Author: jaz
Date: Fri Sep  7 10:40:07 2007
New Revision: 573640

URL: http://svn.apache.org/viewvc?rev=573640&view=rev
Log:
added code to support new replenish method

Modified:
    
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java

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?rev=573640&r1=573639&r2=573640&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java
 (original)
+++ 
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/finaccount/FinAccountPaymentServices.java
 Fri Sep  7 10:40:07 2007
@@ -760,8 +760,17 @@
             }
         }
 
-        // the deposit is level - balance (500 - (-10) = 510 || 500 - (10) = 
490)
-        BigDecimal depositAmount = replenishLevel.subtract(balance);
+        String replenishMethod = 
finAccountSettings.getString("replenishMethodEnumId");
+        BigDecimal depositAmount;
+        if (replenishMethod == null || "FARP_TOP_OFF".equals(replenishMethod)) 
{
+            //the deposit is level - balance (500 - (-10) = 510 || 500 - (10) 
= 490)
+            depositAmount = replenishLevel.subtract(balance);
+        } else if ("FARP_REPLENISH_LEVEL".equals(replenishMethod)) {
+            //the deposit is replenish-level itself
+            depositAmount = replenishLevel;
+        } else {
+            return ServiceUtil.returnError("Unknown replenish method found");
+        }
 
         // get the owner party
         String ownerPartyId = finAccount.getString("ownerPartyId");


Reply via email to