/** * Get Base value for Cost Distribution * * @param CostDistribution cost Distribution * @return base number */ public BigDecimal getBase(String CostDistribution) { if (MLandedCost.LANDEDCOSTDISTRIBUTION_Costs.equals(CostDistribution)) { MInvoiceLine m_il = MInvoiceLine.getOfInOutLine(this); if (m_il == null) { log.severe("No Invoice Line for: " + this.toString()); return Env.ZERO; } return this.getMovementQty().multiply(m_il.getPriceActual()); // Actual delivery } else if (MLandedCost.LANDEDCOSTDISTRIBUTION_Line.equals(CostDistribution)) return Env.ONE; else if (MLandedCost.LANDEDCOSTDISTRIBUTION_Quantity.equals(CostDistribution)) return getMovementQty(); else if (MLandedCost.LANDEDCOSTDISTRIBUTION_Volume.equals(CostDistribution)) { MProduct product = getProduct(); if (product == null) { log.severe("No Product"); return Env.ZERO; } return getMovementQty().multiply(product.getVolume()); } else if (MLandedCost.LANDEDCOSTDISTRIBUTION_Weight.equals(CostDistribution)) { MProduct product = getProduct(); if (product == null) { log.severe("No Product"); return Env.ZERO; } return getMovementQty().multiply(product.getWeight()); } // log.severe("Invalid Criteria: " + CostDistribution); return Env.ZERO; } // getBase
/** * Parent Constructor * * @param parent parent * @param invoice invoice * @param iLine invoice line */ public MTaxDeclarationLine(MTaxDeclaration parent, MInvoice invoice, MInvoiceLine iLine) { this(parent.getCtx(), 0, parent.get_TrxName()); setClientOrg(invoice); setC_TaxDeclaration_ID(parent.getC_TaxDeclaration_ID()); setIsManual(false); // setC_Invoice_ID(invoice.getC_Invoice_ID()); setC_BPartner_ID(invoice.getC_BPartner_ID()); setC_Currency_ID(invoice.getC_Currency_ID()); setDateAcct(invoice.getDateAcct()); // setC_InvoiceLine_ID(iLine.getC_InvoiceLine_ID()); setC_Tax_ID(iLine.getC_Tax_ID()); if (invoice.isTaxIncluded()) { setTaxBaseAmt(iLine.getLineNetAmt()); setTaxAmt(iLine.getTaxAmt()); } else { setTaxBaseAmt(iLine.getLineNetAmt()); setTaxAmt(iLine.getTaxAmt()); } } // MTaxDeclarationLine
/** * Set Invoice Line. Does not set Quantity! * * @param iLine invoice line * @param M_Locator_ID locator * @param Qty qty only fo find suitable locator */ public void setInvoiceLine(MInvoiceLine iLine, int M_Locator_ID, BigDecimal Qty) { setC_OrderLine_ID(iLine.getC_OrderLine_ID()); setLine(iLine.getLine()); setC_UOM_ID(iLine.getC_UOM_ID()); int M_Product_ID = iLine.getM_Product_ID(); if (M_Product_ID == 0) { set_ValueNoCheck("M_Product_ID", null); set_ValueNoCheck("M_Locator_ID", null); set_ValueNoCheck("M_AttributeSetInstance_ID", null); } else { setM_Product_ID(M_Product_ID); setM_AttributeSetInstance_ID(iLine.getM_AttributeSetInstance_ID()); if (M_Locator_ID == 0) setM_Locator_ID(Qty); // requires warehouse, product, asi else setM_Locator_ID(M_Locator_ID); } setC_Charge_ID(iLine.getC_Charge_ID()); setDescription(iLine.getDescription()); setIsDescription(iLine.isDescription()); // setC_Project_ID(iLine.getC_Project_ID()); setC_ProjectPhase_ID(iLine.getC_ProjectPhase_ID()); setC_ProjectTask_ID(iLine.getC_ProjectTask_ID()); setC_Activity_ID(iLine.getC_Activity_ID()); setC_Campaign_ID(iLine.getC_Campaign_ID()); setAD_OrgTrx_ID(iLine.getAD_OrgTrx_ID()); setUser1_ID(iLine.getUser1_ID()); setUser2_ID(iLine.getUser2_ID()); } // setInvoiceLine
/** * Parent Constructor * * @param parent parent * @param M_CostElement_ID cost element */ public MLandedCostAllocation(MInvoiceLine parent, int M_CostElement_ID) { this(parent.getCtx(), 0, parent.get_TrxName()); setClientOrg(parent); setC_InvoiceLine_ID(parent.getC_InvoiceLine_ID()); setM_CostElement_ID(M_CostElement_ID); } // MLandedCostAllocation