You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2007/03/28 02:12:11 UTC
svn commit: r523121 - in /ofbiz/trunk/applications/accounting:
servicedef/services_finaccount.xml
src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java
Author: jaz
Date: Tue Mar 27 17:12:10 2007
New Revision: 523121
URL: http://svn.apache.org/viewvc?view=rev&rev=523121
Log:
updated trans code to include the amount field (as a positive number unless its an adjustment)
Modified:
ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java
Modified: ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml?view=diff&rev=523121&r1=523120&r2=523121
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml Tue Mar 27 17:12:10 2007
@@ -172,7 +172,7 @@
<service name="createPartyFinAccountFromPurchase" engine="java"
location="org.ofbiz.accounting.finaccount.FinAccountProductServices" invoke="createPartyFinAccountFromPurchase" auth="true">
<implements service="itemFulfillmentInterface"/>
- <attribute name="finAccountId" type="String" mode="OUT"/>
+ <attribute name="finAccountId" type="String" mode="OUT" optional="false"/>
</service>
<!-- financial account as payment method services -->
Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java?view=diff&rev=523121&r1=523120&r2=523121
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java Tue Mar 27 17:12:10 2007
@@ -731,24 +731,36 @@
String paymentType;
String partyIdFrom;
String partyIdTo;
+ Double paymentAmount;
// determine the payment type and which direction the parties should go
if ("DEPOSIT".equals(txType)) {
paymentType = "RECEIPT";
partyIdFrom = partyId;
partyIdTo = coParty;
+ paymentAmount = amount;
} else if ("WITHDRAWAL".equals(txType)) {
paymentType = "DISBURSEMENT";
partyIdFrom = coParty;
partyIdTo = partyId;
+ paymentAmount = amount;
} else if ("ADJUSTMENT".equals(txType)) {
- paymentType = "CUSTOMER_REFUND";
- partyIdFrom = coParty;
- partyIdTo = partyId;
+ if (amount.doubleValue() < 0) {
+ paymentType = "DISBURSEMENT";
+ partyIdFrom = coParty;
+ partyIdTo = partyId;
+ paymentAmount = new Double(amount.doubleValue() * -1); // must be positive
+ } else {
+ paymentType = "RECEIPT";
+ partyIdFrom = partyId;
+ partyIdTo = coParty;
+ paymentAmount = amount;
+ }
} else {
throw new GeneralException("Unable to create financial account transaction!");
}
+ // payment amount should always be positive; adjustments may
// create the payment for the transaction
Map paymentCtx = UtilMisc.toMap("paymentTypeId", paymentType);
paymentCtx.put("paymentMethodTypeId", paymentMethodType);
@@ -756,7 +768,7 @@
paymentCtx.put("partyIdFrom", partyIdFrom);
paymentCtx.put("statusId", "PMNT_RECEIVED");
paymentCtx.put("currencyUomId", currencyUom);
- paymentCtx.put("amount", amount);
+ paymentCtx.put("amount", paymentAmount);
paymentCtx.put("userLogin", userLogin);
paymentCtx.put("paymentRefNum", Long.toString(UtilDateTime.nowTimestamp().getTime()));
@@ -780,7 +792,8 @@
Map transCtx = UtilMisc.toMap("finAccountTransTypeId", txType);
transCtx.put("finAccountId", finAccountId);
transCtx.put("partyId", userLogin.getString("partyId"));
- transCtx.put("userLogin", userLogin);
+ transCtx.put("amount", amount);
+ transCtx.put("userLogin", userLogin);
transCtx.put("paymentId", paymentId);
Map transResult;