1003754 Landed cost issue -- related to IDEMPIERE-1285. Fix landed cost posting.

This commit is contained in:
Heng Sin Low 2014-05-05 15:29:23 +08:00
parent 2915294c5c
commit 06ce3aae94
1 changed files with 19 additions and 0 deletions

View File

@ -977,6 +977,25 @@ public class Doc_Invoice extends Doc
fl.setQty(line.getQty());
}
else if (compare < 0)
{
drAmt = dr ? (reversal ? null : allocationAmt) : (reversal ? allocationAmt : null);
crAmt = dr ? (reversal ? allocationAmt : null) : (reversal ? null : allocationAmt);
account = pc.getAccount(ProductCost.ACCTTYPE_P_LandedCostClearing, as);
FactLine fl = fact.createLine (line, account, getC_Currency_ID(), drAmt, crAmt);
fl.setDescription(desc);
fl.setM_Product_ID(lca.getM_Product_ID());
fl.setQty(line.getQty());
BigDecimal underAmt = estimatedAmt.subtract(allocationAmt);
drAmt = dr ? (reversal ? underAmt : null) : (reversal ? null : underAmt);
crAmt = dr ? (reversal ? null : underAmt) : (reversal ? underAmt : null);
account = zeroQty ? pc.getAccount(ProductCost.ACCTTYPE_P_AverageCostVariance, as) : pc.getAccount(ProductCost.ACCTTYPE_P_Asset, as);
fl = fact.createLine (line, account, getC_Currency_ID(), drAmt, crAmt);
fl.setDescription(desc);
fl.setM_Product_ID(lca.getM_Product_ID());
fl.setQty(line.getQty());
}
else
{
drAmt = dr ? (reversal ? null : allocationAmt) : (reversal ? allocationAmt : null);
crAmt = dr ? (reversal ? allocationAmt : null) : (reversal ? null : allocationAmt);