svn commit: r806484 - /ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r806484 - /ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml

apatel-2
Author: apatel
Date: Fri Aug 21 10:25:08 2009
New Revision: 806484

URL: http://svn.apache.org/viewvc?rev=806484&view=rev
Log:
fix calculation of running total on list of financial account transactions. Patch from OFBIZ-2852. Thanks Surya and Sumit for fix.

Modified:
    ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml

Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml?rev=806484&r1=806483&r2=806484&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml Fri Aug 21 10:25:08 2009
@@ -622,7 +622,12 @@
     <simple-method method-name="getFinAccountTransRunningTotalAndBalances" short-description="Calculate running total and Balances of Financial Account Transactions">
         <set field="runningTotal" type="BigDecimal" from-field="parameters.runningTotal" default-value="0"/>
         <entity-one entity-name="FinAccountTrans" value-field="finAccountTrans" auto-field-map="true"/>
-        <set field="runningTotal" value="${runningTotal + finAccountTrans.amount}" type="BigDecimal"/>
+        <if-compare field="finAccountTrans.finAccountTransTypeId"  operator="equals" value="WITHDRAWAL">
+            <set field="runningTotal" value="${runningTotal - finAccountTrans.amount}" type="BigDecimal"/>
+        <else>
+            <set field="runningTotal" value="${runningTotal + finAccountTrans.amount}" type="BigDecimal"/>
+        </else>
+        </if-compare>
         <field-to-result field="runningTotal"/>
         <set field="numberOfTransactions" type="Long" from-field="parameters.numberOfTransactions" default-value="0"/>
         <set field="numberOfTransactions" type="Long" value="${numberOfTransactions + 1}"/>