Thank you Jacopo for this contribution, this will surely help us in our large Accounting module
implementation which we are doing currently,

Regards,
Hans

On 10/08/2013 08:49 PM, [email protected] wrote:
Author: jacopoc
Date: Tue Oct  8 13:49:19 2013
New Revision: 1530273

URL: http://svn.apache.org/r1530273
Log:
A pretty important refactoring of some GL data and code that fixes a series of 
long standing gaps, errors and design issues affecting account balances and the 
closure of fiscal periods (some of them introduced by me when I initially wrote 
the first version of these business logics; at that time I didn't have a clear 
and deep enough understanding of these accounting rules sigh…).
This new version is cleaner (less code, less redundancy of information), 
correct and it also resolves some pretty relevant issues (including some db 
deadlock errors) affecting performance in instances with medium/high number of 
GL postings.
Here is a list of changes introduced in this commit:
* removed the postedBalance field from GlAccount and GlAccountOrganization: 
this was a wrong design; the field in GlAccount was not used by the 
applications; the field in GlAccountOrganization was used but not consistently
* added openingBalance field to GlAccountHistory: now this entity has full 
information about an account in a financial period after the period closed 
(opening and ending balance, posted debits and credits); now the endingBalance 
is computed correctly both for Debits and Credits accounts
* updated demo data for the data model changes mentioned above
* the business logic to compute the account balances is now implemented in a 
service (computeGlAccountBalanceForTimePeriod) and reused consistently
* removed several FIXME/TODO comments now that the new code addresses the 
related gaps and issues
* removed some old, incorrect or no more used artifacts: 
getGlAcctgOrgWithPostedBalanceSplit (service), getNetBalance (utily methods)
* refactored the TrialBalanceReport and GlAccountTrialBalance reports and 
related pdf versions: the new versions have cleaner code and show the correct 
balances both for debits and credits
* fixed a series of Groovy compilation issues due to missing imports

Modified:
     ofbiz/trunk/applications/accounting/data/DemoAcctgTransactionData.xml
     ofbiz/trunk/applications/accounting/data/DemoGeneralChartOfAccounts.xml
     ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml
     
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/AcctgTransServices.xml
     
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
     ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml
     
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/util/UtilAccounting.java
     
ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/GlAccountTrialBalance.groovy
     
ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy
     
ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy
     
ofbiz/trunk/applications/accounting/webapp/accounting/reports/GlAccountTrialBalanceReport.fo.ftl
     
ofbiz/trunk/applications/accounting/webapp/accounting/reports/GlAccountTrialBalanceReport.ftl
     ofbiz/trunk/applications/accounting/widget/AccountingTrees.xml
     ofbiz/trunk/applications/accounting/widget/GlSetupForms.xml
     ofbiz/trunk/applications/accounting/widget/GlobalGlAccountsForms.xml
     ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml
     
ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml

Modified: ofbiz/trunk/applications/accounting/data/DemoAcctgTransactionData.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/data/DemoAcctgTransactionData.xml?rev=1530273&r1=1530272&r2=1530273&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/data/DemoAcctgTransactionData.xml 
(original)
+++ ofbiz/trunk/applications/accounting/data/DemoAcctgTransactionData.xml Tue 
Oct  8 13:49:19 2013
@@ -49,28 +49,28 @@ under the License.
      <AcctgTransEntry acctgTransId="6006" acctgTransEntrySeqId="00002" acctgTransEntryTypeId="_NA_" description="Unposted transaction entries" voucherRef="Z0001" 
glAccountId="400000" organizationPartyId="Company" amount="500.00" currencyUomId="USD" origAmount="500.00" origCurrencyUomId="USD" 
debitCreditFlag="C" reconcileStatusId="AES_NOT_RECONCILED"/>
      -->
- <GlAccountOrganization glAccountId="111100" organizationPartyId="Company" fromDate="2001-01-01 00:00:00.0" postedBalance="51263.22"/>
-    <GlAccountOrganization glAccountId="112000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0" postedBalance="20.00"/>
-    <GlAccountOrganization glAccountId="120000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0" postedBalance="159.96"/>
-    <GlAccountOrganization glAccountId="122300" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0" postedBalance="127.09"/>
-    <GlAccountOrganization glAccountId="140000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0" postedBalance="1936.40"/>
-    <GlAccountOrganization glAccountId="141000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0" postedBalance="320.00"/>
-    <GlAccountOrganization glAccountId="171000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0" postedBalance="76500.00"/>
-    <GlAccountOrganization glAccountId="174000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0" postedBalance="70000.00"/>
-    <GlAccountOrganization glAccountId="188000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0" postedBalance="2500.00"/>
-    <GlAccountOrganization glAccountId="210000" organizationPartyId="Company" fromDate="2001-01-01 
00:00:00.0" postedBalance="348.00"/> <!-- Negative -->
-    <GlAccountOrganization glAccountId="213000" organizationPartyId="Company" fromDate="2001-01-01 
00:00:00.0" postedBalance="70.00"/> <!-- Negative -->
-    <GlAccountOrganization glAccountId="214000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0" postedBalance="0.00"/>
-    <GlAccountOrganization glAccountId="224000" organizationPartyId="Company" fromDate="2001-01-01 
00:00:00.0" postedBalance="1.20"/> <!-- Negative -->
-    <GlAccountOrganization glAccountId="224153" organizationPartyId="Company" fromDate="2001-01-01 
00:00:00.0" postedBalance="5.80"/> <!-- Negative -->
-    <GlAccountOrganization glAccountId="310000" organizationPartyId="Company" fromDate="2001-01-01 
00:00:00.0" postedBalance="200000.00"/> <!-- Negative -->
-    <GlAccountOrganization glAccountId="400000" organizationPartyId="Company" fromDate="2001-01-01 
00:00:00.0" postedBalance="299.95"/> <!-- Negative -->
-    <GlAccountOrganization glAccountId="409000" organizationPartyId="Company" fromDate="2001-01-01 
00:00:00.0" postedBalance="12.10"/> <!-- Negative -->
-    <GlAccountOrganization glAccountId="410000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0" postedBalance="12.00"/>
-    <GlAccountOrganization glAccountId="500000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0" postedBalance="13.50"/>
-    <GlAccountOrganization glAccountId="516100" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0" postedBalance="24.88"/>
-    <GlAccountOrganization glAccountId="649000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0" postedBalance="360.00"/>
-    <GlAccountOrganization glAccountId="675400" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0" postedBalance="2500.00"/>
+    <GlAccountOrganization glAccountId="111100" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0"/>
+    <GlAccountOrganization glAccountId="112000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0"/>
+    <GlAccountOrganization glAccountId="120000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0"/>
+    <GlAccountOrganization glAccountId="122300" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0"/>
+    <GlAccountOrganization glAccountId="140000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0"/>
+    <GlAccountOrganization glAccountId="141000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0"/>
+    <GlAccountOrganization glAccountId="171000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0"/>
+    <GlAccountOrganization glAccountId="174000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0"/>
+    <GlAccountOrganization glAccountId="188000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0"/>
+    <GlAccountOrganization glAccountId="210000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0"/>
+    <GlAccountOrganization glAccountId="213000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0"/>
+    <GlAccountOrganization glAccountId="214000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0"/>
+    <GlAccountOrganization glAccountId="224000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0"/>
+    <GlAccountOrganization glAccountId="224153" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0"/>
+    <GlAccountOrganization glAccountId="310000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0"/>
+    <GlAccountOrganization glAccountId="400000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0"/>
+    <GlAccountOrganization glAccountId="409000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0"/>
+    <GlAccountOrganization glAccountId="410000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0"/>
+    <GlAccountOrganization glAccountId="500000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0"/>
+    <GlAccountOrganization glAccountId="516100" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0"/>
+    <GlAccountOrganization glAccountId="649000" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0"/>
+    <GlAccountOrganization glAccountId="675400" organizationPartyId="Company" 
fromDate="2001-01-01 00:00:00.0"/>
<GlAccountHistory glAccountId="111100" organizationPartyId="Company" customTimePeriodId="6010" postedDebits="51263.22" postedCredits="0.00"/>
      <GlAccountHistory glAccountId="112000" organizationPartyId="Company" customTimePeriodId="6010" 
postedDebits="20.00" postedCredits="0.00"/>



Reply via email to