Author: ashish
Date: Mon Jul 6 11:35:20 2009 New Revision: 791445 URL: http://svn.apache.org/viewvc?rev=791445&view=rev Log: Applied patch from jira issue OFBIZ-2705 (Commission Invoice doesn't show correct price and quantity) Thanks Amit for your contribution on this. I have extensively reviewed this work and it seems to be working fine. Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/agreement/AgreementServices.java ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/agreement/AgreementServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/agreement/AgreementServices.java?rev=791445&r1=791444&r2=791445&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/agreement/AgreementServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/agreement/AgreementServices.java Mon Jul 6 11:35:20 2009 @@ -131,14 +131,14 @@ BigDecimal termValue = term.getBigDecimal("termValue"); if (termValue != null) { if (termTypeId.equals("FIN_COMM_FIXED")) { - commission = commission.add(termValue.multiply(quantity)); + commission = commission.add(termValue); } else if (termTypeId.equals("FIN_COMM_VARIABLE")) { // if variable percentage commission, need to divide by 100, because 5% is stored as termValue of 5.0 commission = commission.add(termValue.multiply(amount).divide(new BigDecimal("100"), 12, rounding)); } else if (termTypeId.equals("FIN_COMM_MIN")) { - min = termValue.multiply(quantity); + min = termValue; } else if (termTypeId.equals("FIN_COMM_MAX")) { - max = termValue.multiply(quantity); + max = termValue; } // TODO: Add other type of terms and handling here } @@ -166,6 +166,7 @@ "partyIdFrom", agreementItem.getString("partyIdFrom"), "partyIdTo", agreementItem.getString("partyIdTo"), "commission", commission, + "quantity", quantity, "currencyUomId", agreementItem.getString("currencyUomId"), "productId", productId); if (days >= 0) { Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?rev=791445&r1=791444&r2=791445&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java Mon Jul 6 11:35:20 2009 @@ -993,11 +993,13 @@ while (itt.hasNext()) { Map elem = (Map) itt.next(); BigDecimal elemAmount = ((BigDecimal)elem.get("commission")).multiply(appliedFraction); + BigDecimal quantity = (BigDecimal)elem.get("quantity"); elemAmount = elemAmount.setScale(decimals, rounding); Map resMap = dispatcher.runSync("createInvoiceItem", UtilMisc.toMap( "invoiceId", invoiceId, "productId", elem.get("productId"), "invoiceItemTypeId", "COMM_INV_ITEM", + "quantity",quantity, "amount", elemAmount, "userLogin", userLogin)); if (ServiceUtil.isError(resMap)) { |
Free forum by Nabble | Edit this page |