1 14 package org.compiere.process; 15 16 import java.math.*; 17 import java.util.*; 18 import java.sql.*; 19 20 import org.compiere.model.*; 21 import org.compiere.util.*; 22 23 29 public class ProjectLinePricing extends SvrProcess 30 { 31 32 private int m_C_ProjectLine_ID = 0; 33 34 37 protected void prepare() 38 { 39 ProcessInfoParameter[] para = getParameter(); 40 for (int i = 0; i < para.length; i++) 41 { 42 String name = para[i].getParameterName(); 43 if (para[i].getParameter() == null) 44 ; 45 else 46 log.error("prepare - Unknown Parameter: " + name); 47 } 48 m_C_ProjectLine_ID = getRecord_ID(); 49 } 51 56 protected String doIt() throws Exception 57 { 58 if (m_C_ProjectLine_ID == 0) 59 throw new IllegalArgumentException ("No Project Line"); 60 MProjectLine projectLine = new MProjectLine (getCtx(), m_C_ProjectLine_ID); 61 log.info("doIt - " + projectLine); 62 if (projectLine.getM_Product_ID() == 0) 63 throw new IllegalArgumentException ("No Product"); 64 MProject project = new MProject (getCtx(), projectLine.getC_Project_ID()); 66 if (project.getM_PriceList_ID() == 0) 67 throw new IllegalArgumentException ("No PriceList"); 68 MProductPriceVO pp = MProductPriceVO.getBOMPricesPL 70 (projectLine.getM_Product_ID(), project.getM_PriceList_ID(), project.getDateContract()); 71 if (pp == null) 72 throw new Exception ("No Price found"); 73 projectLine.setPlannedPrice(pp.PriceStd); 75 projectLine.setPlannedMarginAmt(pp.PriceStd.subtract(pp.PriceLimit)); 76 projectLine.save(); 77 String retValue = Msg.getElement(getCtx(), "PriceList") + pp.PriceList + " - " 79 + Msg.getElement(getCtx(), "PriceStd") + pp.PriceStd + " - " 80 + Msg.getElement(getCtx(), "PriceLimit") + pp.PriceLimit; 81 return retValue; 82 } 84 } | Popular Tags |