コード例 #1
0
 /**
  * Perform process.
  *
  * @return Message (clear text)
  * @throws Exception if not successful
  */
 protected String doIt() throws Exception {
   if (m_C_ProjectLine_ID == 0) throw new IllegalArgumentException("No Project Line");
   MProjectLine projectLine = new MProjectLine(getCtx(), m_C_ProjectLine_ID, get_TrxName());
   log.info("doIt - " + projectLine);
   if (projectLine.getM_Product_ID() == 0) throw new IllegalArgumentException("No Product");
   //
   MProject project = new MProject(getCtx(), projectLine.getC_Project_ID(), get_TrxName());
   if (project.getM_PriceList_ID() == 0) throw new IllegalArgumentException("No PriceList");
   //
   boolean isSOTrx = true;
   MProductPricing pp =
       new MProductPricing(
           projectLine.getM_Product_ID(),
           project.getC_BPartner_ID(),
           projectLine.getPlannedQty(),
           isSOTrx);
   pp.setM_PriceList_ID(project.getM_PriceList_ID());
   pp.setPriceDate(project.getDateContract());
   //
   projectLine.setPlannedPrice(pp.getPriceStd());
   projectLine.setPlannedMarginAmt(pp.getPriceStd().subtract(pp.getPriceLimit()));
   projectLine.saveEx();
   //
   String retValue =
       Msg.getElement(getCtx(), "PriceList")
           + pp.getPriceList()
           + " - "
           + Msg.getElement(getCtx(), "PriceStd")
           + pp.getPriceStd()
           + " - "
           + Msg.getElement(getCtx(), "PriceLimit")
           + pp.getPriceLimit();
   return retValue;
 } //	doIt