Search in sources :

Example 1 with MLandedCost

use of org.compiere.model.MLandedCost in project adempiere by adempiere.

the class LandedCostDistribute method doIt.

//	prepare
/**
	 * 	Process
	 *	@return info
	 *	@throws Exception
	 */
protected String doIt() throws Exception {
    m_lc = new MLandedCost(getCtx(), p_C_LandedCost_ID, get_TrxName());
    log.info(m_lc.toString());
    if (m_lc.get_ID() == 0)
        throw new AdempiereUserError("@NotFound@: @C_LandedCost_ID@ - " + p_C_LandedCost_ID);
    String error = m_lc.allocateCosts();
    generateCostDetail();
    if (error == null || error.length() == 0)
        return "@OK@";
    return error;
}
Also used : AdempiereUserError(org.compiere.util.AdempiereUserError) MLandedCost(org.compiere.model.MLandedCost)

Example 2 with MLandedCost

use of org.compiere.model.MLandedCost in project adempiere by adempiere.

the class GenerateLandedCost method createLandedCost.

public void createLandedCost(MInOut inOut, MInOutLine inOutLine) {
    MInOut document = inOut;
    if (document == null)
        document = inOutLine.getParent();
    MLandedCost landedCost = new MLandedCost(getCtx(), 0, get_TrxName());
    landedCost.setAD_Org_ID(document.getAD_Org_ID());
    landedCost.setC_InvoiceLine_ID(getRecord_ID());
    landedCost.setM_InOut_ID(document.getM_InOut_ID());
    landedCost.setDescription(document.getPOReference());
    landedCost.setLandedCostDistribution(getCostDistribution());
    landedCost.setM_CostElement_ID(getCostElementId());
    if (inOut == null) {
        landedCost.setM_InOutLine_ID(inOutLine.getM_InOutLine_ID());
        landedCost.setM_Product_ID(inOutLine.getM_Product_ID());
    }
    landedCost.saveEx();
}
Also used : MInOut(org.compiere.model.MInOut) MLandedCost(org.compiere.model.MLandedCost)

Aggregations

MLandedCost (org.compiere.model.MLandedCost)2 MInOut (org.compiere.model.MInOut)1 AdempiereUserError (org.compiere.util.AdempiereUserError)1