Author: ashish
Date: Mon Jul 6 11:37:40 2009
New Revision: 791446
URL: http://svn.apache.org/viewvc?rev=791446&view=rev
Log:
Applied fix from trunk revision: 791445
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/branches/release09.04/applications/accounting/src/org/ofbiz/accounting/agreement/AgreementServices.java
ofbiz/branches/release09.04/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
Modified:
ofbiz/branches/release09.04/applications/accounting/src/org/ofbiz/accounting/agreement/AgreementServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release09.04/applications/accounting/src/org/ofbiz/accounting/agreement/AgreementServices.java?rev=791446&r1=791445&r2=791446&view=diff
==============================================================================
---
ofbiz/branches/release09.04/applications/accounting/src/org/ofbiz/accounting/agreement/AgreementServices.java
(original)
+++
ofbiz/branches/release09.04/applications/accounting/src/org/ofbiz/accounting/agreement/AgreementServices.java
Mon Jul 6 11:37:40 2009
@@ -134,14 +134,14 @@
BigDecimal termValue = elem.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
}
@@ -169,6 +169,7 @@
"partyIdFrom",
agreementItem.getString("partyIdFrom"),
"partyIdTo", agreementItem.getString("partyIdTo"),
"commission", commission,
+ "quantity", quantity,
"currencyUomId",
agreementItem.getString("currencyUomId"),
"productId", productId);
if (days >= 0) {
Modified:
ofbiz/branches/release09.04/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release09.04/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?rev=791446&r1=791445&r2=791446&view=diff
==============================================================================
---
ofbiz/branches/release09.04/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
(original)
+++
ofbiz/branches/release09.04/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
Mon Jul 6 11:37:40 2009
@@ -979,11 +979,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)) {