BF #2797257 Landed Cost Detail is not using allocation qty

https://sourceforge.net/tracker/?func=detail&aid=2797257&group_id=176962&atid=879332
This commit is contained in:
armenrz 2009-05-28 02:04:52 +00:00
parent a3950600aa
commit 93a4e0fb80
1 changed files with 6 additions and 11 deletions

View File

@ -44,6 +44,9 @@ import org.compiere.util.Env;
* Document Types: ARI, ARC, ARF, API, APC
* </pre>
* @author Jorg Janke
* @author Armen Rizal, Goodwill Consulting
* <li>BF: 2797257 Landed Cost Detail is not using allocation qty
*
* @version $Id: Doc_Invoice.java,v 1.2 2006/07/30 00:53:33 jjanke Exp $
*/
public class Doc_Invoice extends Doc
@ -859,22 +862,14 @@ public class Doc_Invoice extends Doc
allocationAmt = allocationAmt.setScale(as.getCostingPrecision(), BigDecimal.ROUND_HALF_UP);
if (!dr)
allocationAmt = allocationAmt.negate();
// MZ Goodwill
// set Qty to 1 or -1 instead of 0 and allocation Amt is counted for each product qty
if (lca.getQty().signum() != 0)
allocationAmt = allocationAmt.divide(lca.getQty(), as.getCostingPrecision(), BigDecimal.ROUND_HALF_UP);
// Qty is 1 or -1
BigDecimal qty = Env.ONE;
if (il.getQtyInvoiced().signum() != 0)
qty = il.getQtyInvoiced().divide(il.getQtyInvoiced().abs());
// AZ Goodwill
// use createInvoice to create/update non Material Cost Detail
MCostDetail.createInvoice(as, lca.getAD_Org_ID(),
lca.getM_Product_ID(), lca.getM_AttributeSetInstance_ID(),
C_InvoiceLine_ID, lca.getM_CostElement_ID(),
allocationAmt, qty, // Qty
allocationAmt, lca.getQty(),
desc, getTrxName());
// end MZ
// end AZ
}
log.config("Created #" + lcas.length);