Author: sichen
Date: Tue Sep 26 16:32:06 2006
New Revision: 450254
URL:
http://svn.apache.org/viewvc?view=rev&rev=450254Log:
Based on error report by Erik Dobelis, fixed bug where UtilAccounting.getNetBalance was not recursively looking up the GL account tree to figure out if an account is debit or credit. OFBIZ-214
Modified:
incubator/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/util/UtilAccounting.java
Modified: incubator/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/util/UtilAccounting.java
URL:
http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/util/UtilAccounting.java?view=diff&rev=450254&r1=450253&r2=450254==============================================================================
--- incubator/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/util/UtilAccounting.java (original)
+++ incubator/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/util/UtilAccounting.java Tue Sep 26 16:32:06 2006
@@ -95,11 +95,11 @@
*/
public static Double getNetBalance(GenericValue account, String debugModule) {
try {
- String parentClassId = account.getRelatedOne("GlAccount").getRelatedOne("GlAccountClass").getRelatedOne("ParentGlAccountClass").getString("glAccountClassId");
+ GenericValue glAccount = account.getRelatedOne("GlAccount");
double balance = 0.0;
- if (parentClassId.equals("DEBIT")) {
+ if (isDebitAccount(glAccount)) {
balance = account.getDouble("postedDebits").doubleValue() - account.getDouble("postedCredits").doubleValue();
- } else if (parentClassId.equals("CREDIT")) {
+ } else if (isCreditAccount(glAccount)) {
balance = account.getDouble("postedCredits").doubleValue() - account.getDouble("postedDebits").doubleValue();
}
return new Double(balance);