svn commit: r885256 - in /ofbiz/trunk: applications/accounting/ applications/accounting/data/ applications/accounting/entitydef/ applications/accounting/script/org/ofbiz/accounting/ledger/ applications/accounting/servicedef/ applications/accounting/src...

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

svn commit: r885256 - in /ofbiz/trunk: applications/accounting/ applications/accounting/data/ applications/accounting/entitydef/ applications/accounting/script/org/ofbiz/accounting/ledger/ applications/accounting/servicedef/ applications/accounting/src...

jacopoc
Author: jacopoc
Date: Sun Nov 29 18:32:31 2009
New Revision: 885256

URL: http://svn.apache.org/viewvc?rev=885256&view=rev
Log:
Pretty big enhancements for the accounting processes and demo data:
1) completely refactored the trial balance report: now it is based on GLAccountHistory and no more on GlAccountOrganization records; the main advantage is that now it it possible to run the report per different financial time periods
2) big enhancements to the demo data: data was incomplete or wrong and this was affecting reports and the financial time period closing process
3) several fixes for the financial time period process
More fixes and enhancements will come, but now the closing process works fine and the financial reports make sense.


Modified:
    ofbiz/trunk/applications/accounting/data/DemoAcctgTransactionData.xml
    ofbiz/trunk/applications/accounting/data/DemoGeneralChartOfAccounts.xml
    ofbiz/trunk/applications/accounting/data/DemoGlSetupData.xml
    ofbiz/trunk/applications/accounting/data/DemoPaymentsInvoices.xml
    ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml
    ofbiz/trunk/applications/accounting/ofbiz-component.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/period/PeriodServices.java
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy
    ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml
    ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml
    ofbiz/trunk/specialpurpose/ecommerce/data/DemoOrderTestData.xml

Modified: ofbiz/trunk/applications/accounting/data/DemoAcctgTransactionData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/data/DemoAcctgTransactionData.xml?rev=885256&r1=885255&r2=885256&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/data/DemoAcctgTransactionData.xml (original)
+++ ofbiz/trunk/applications/accounting/data/DemoAcctgTransactionData.xml Sun Nov 29 18:32:31 2009
@@ -41,12 +41,103 @@
     <AcctgTransEntry acctgTransId="6004" acctgTransEntrySeqId="00002" acctgTransEntryTypeId="_NA_" description="Initial raw materials inventory value" glAccountId="141000" organizationPartyId="Company" amount="320.00" currencyUomId="USD" origAmount="320.00" origCurrencyUomId="USD" debitCreditFlag="D" reconcileStatusId="AES_NOT_RECONCILED"/>
 
     <!--
-    <AcctgTrans acctgTransId="9000" acctgTransTypeId="AMORTIZATION" description="Posted accounting transaction" transactionDate="2009-06-19 00:00:00.0" isPosted="Y" postedDate="2009-06-19 00:00:00.0" glFiscalTypeId="ACTUAL" voucherRef="Z000"/>
-    <AcctgTransEntry acctgTransId="9000" acctgTransEntrySeqId="00001" acctgTransEntryTypeId="_NA_" description="Posted accounting transaction entries" voucherRef="Z000" glAccountId="100000" organizationPartyId="Company" amount="1786.43" currencyUomId="USD" origAmount="1786.43" origCurrencyUomId="USD" debitCreditFlag="D" reconcileStatusId="AES_NOT_RECONCILED"/>
-    <AcctgTransEntry acctgTransId="9000" acctgTransEntrySeqId="00002" acctgTransEntryTypeId="_NA_" description="Posted accounting transaction entries" voucherRef="Z000" glAccountId="210000" organizationPartyId="Company" amount="1786.43" currencyUomId="USD" origAmount="1786.43" origCurrencyUomId="USD" debitCreditFlag="C" reconcileStatusId="AES_NOT_RECONCILED"/>
-
-    <AcctgTrans acctgTransId="9001" acctgTransTypeId="AMORTIZATION" description="Unposted accounting transaction" transactionDate="2009-06-19 00:00:00.0" isPosted="N" glFiscalTypeId="ACTUAL" voucherRef="Z0001"/>
-    <AcctgTransEntry acctgTransId="9001" acctgTransEntrySeqId="00001" acctgTransEntryTypeId="_NA_" description="Unposted accounting transaction entries" voucherRef="Z0001" glAccountId="120000" organizationPartyId="Company" amount="500.00" currencyUomId="USD" origAmount="500.00" origCurrencyUomId="USD" debitCreditFlag="D" reconcileStatusId="AES_NOT_RECONCILED"/>
-    <AcctgTransEntry acctgTransId="9001" 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"/>
+    <AcctgTrans acctgTransId="6005" acctgTransTypeId="AMORTIZATION" description="Posted accounting transaction" transactionDate="2009-06-19 00:00:00.0" isPosted="Y" postedDate="2009-06-19 00:00:00.0" glFiscalTypeId="ACTUAL" voucherRef="Z000"/>
+    <AcctgTransEntry acctgTransId="6005" acctgTransEntrySeqId="00001" acctgTransEntryTypeId="_NA_" description="Posted accounting transaction entries" voucherRef="Z000" glAccountId="100000" organizationPartyId="Company" amount="1786.43" currencyUomId="USD" origAmount="1786.43" origCurrencyUomId="USD" debitCreditFlag="D" reconcileStatusId="AES_NOT_RECONCILED"/>
+    <AcctgTransEntry acctgTransId="6005" acctgTransEntrySeqId="00002" acctgTransEntryTypeId="_NA_" description="Posted accounting transaction entries" voucherRef="Z000" glAccountId="210000" organizationPartyId="Company" amount="1786.43" currencyUomId="USD" origAmount="1786.43" origCurrencyUomId="USD" debitCreditFlag="C" reconcileStatusId="AES_NOT_RECONCILED"/>
+
+    <AcctgTrans acctgTransId="6006" acctgTransTypeId="AMORTIZATION" description="Unposted accounting transaction" transactionDate="2009-06-19 00:00:00.0" isPosted="N" glFiscalTypeId="ACTUAL" voucherRef="Z0001"/>
+    <AcctgTransEntry acctgTransId="6006" acctgTransEntrySeqId="00001" acctgTransEntryTypeId="_NA_" description="Unposted accounting transaction entries" voucherRef="Z0001" glAccountId="120000" organizationPartyId="Company" amount="500.00" currencyUomId="USD" origAmount="500.00" origCurrencyUomId="USD" debitCreditFlag="D" reconcileStatusId="AES_NOT_RECONCILED"/>
+    <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="51380.07"/>
+    <GlAccountOrganization glAccountId="310000" organizationPartyId="Company" fromDate="2001-01-01 00:00:00.0" postedBalance="200000.00"/> <!-- Negative -->
+    <GlAccountOrganization glAccountId="140000" organizationPartyId="Company" fromDate="2001-01-01 00:00:00.0" postedBalance="1799.93"/>
+    <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="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="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="649000" organizationPartyId="Company" fromDate="2001-01-01 00:00:00.0" postedBalance="360.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"/>
+
+    <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"/>
+    <GlAccountHistory glAccountId="120000" organizationPartyId="Company" customTimePeriodId="6010" postedDebits="159.96" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="122300" organizationPartyId="Company" customTimePeriodId="6010" postedDebits="127.09" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="140000" organizationPartyId="Company" customTimePeriodId="6010" postedDebits="1936.40" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="141000" organizationPartyId="Company" customTimePeriodId="6010" postedDebits="320.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="171000" organizationPartyId="Company" customTimePeriodId="6010" postedDebits="76500.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="174000" organizationPartyId="Company" customTimePeriodId="6010" postedDebits="70000.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="210000" organizationPartyId="Company" customTimePeriodId="6010" postedDebits="0.00" postedCredits="348.00"/>
+    <GlAccountHistory glAccountId="213000" organizationPartyId="Company" customTimePeriodId="6010" postedDebits="0.00" postedCredits="70.00"/>
+    <GlAccountHistory glAccountId="214000" organizationPartyId="Company" customTimePeriodId="6010" postedDebits="0.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="224000" organizationPartyId="Company" customTimePeriodId="6010" postedDebits="0.00" postedCredits="1.20"/>
+    <GlAccountHistory glAccountId="224153" organizationPartyId="Company" customTimePeriodId="6010" postedDebits="0.00" postedCredits="5.80"/>
+    <GlAccountHistory glAccountId="310000" organizationPartyId="Company" customTimePeriodId="6010" postedDebits="0.00" postedCredits="200000.00"/>
+    <GlAccountHistory glAccountId="400000" organizationPartyId="Company" customTimePeriodId="6010" postedDebits="0.00" postedCredits="299.95"/>
+    <GlAccountHistory glAccountId="409000" organizationPartyId="Company" customTimePeriodId="6010" postedDebits="0.00" postedCredits="12.10"/>
+    <GlAccountHistory glAccountId="410000" organizationPartyId="Company" customTimePeriodId="6010" postedDebits="12.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="649000" organizationPartyId="Company" customTimePeriodId="6010" postedDebits="360.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="500000" organizationPartyId="Company" customTimePeriodId="6010" postedDebits="13.50" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="516100" organizationPartyId="Company" customTimePeriodId="6010" postedDebits="24.88" postedCredits="0.00"/>
+
+    <GlAccountHistory glAccountId="111100" organizationPartyId="Company" customTimePeriodId="6011" postedDebits="51380.07" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="112000" organizationPartyId="Company" customTimePeriodId="6011" postedDebits="0.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="120000" organizationPartyId="Company" customTimePeriodId="6011" postedDebits="0.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="122300" organizationPartyId="Company" customTimePeriodId="6011" postedDebits="0.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="140000" organizationPartyId="Company" customTimePeriodId="6011" postedDebits="1799.93" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="141000" organizationPartyId="Company" customTimePeriodId="6011" postedDebits="320.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="171000" organizationPartyId="Company" customTimePeriodId="6011" postedDebits="76500.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="174000" organizationPartyId="Company" customTimePeriodId="6011" postedDebits="70000.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="210000" organizationPartyId="Company" customTimePeriodId="6011" postedDebits="0.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="213000" organizationPartyId="Company" customTimePeriodId="6011" postedDebits="0.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="214000" organizationPartyId="Company" customTimePeriodId="6011" postedDebits="0.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="224000" organizationPartyId="Company" customTimePeriodId="6011" postedDebits="0.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="224153" organizationPartyId="Company" customTimePeriodId="6011" postedDebits="0.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="310000" organizationPartyId="Company" customTimePeriodId="6011" postedDebits="0.00" postedCredits="200000.00"/>
+    <GlAccountHistory glAccountId="400000" organizationPartyId="Company" customTimePeriodId="6011" postedDebits="0.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="409000" organizationPartyId="Company" customTimePeriodId="6011" postedDebits="0.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="410000" organizationPartyId="Company" customTimePeriodId="6011" postedDebits="0.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="649000" organizationPartyId="Company" customTimePeriodId="6011" postedDebits="0.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="500000" organizationPartyId="Company" customTimePeriodId="6011" postedDebits="0.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="516100" organizationPartyId="Company" customTimePeriodId="6011" postedDebits="0.00" postedCredits="0.00"/>
+
+    <GlAccountHistory glAccountId="111100" organizationPartyId="Company" customTimePeriodId="6013" postedDebits="0.00" postedCredits="116.85"/>
+    <GlAccountHistory glAccountId="112000" organizationPartyId="Company" customTimePeriodId="6013" postedDebits="20.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="120000" organizationPartyId="Company" customTimePeriodId="6013" postedDebits="159.96" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="122300" organizationPartyId="Company" customTimePeriodId="6013" postedDebits="127.09" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="140000" organizationPartyId="Company" customTimePeriodId="6013" postedDebits="136.47" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="141000" organizationPartyId="Company" customTimePeriodId="6013" postedDebits="0.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="171000" organizationPartyId="Company" customTimePeriodId="6013" postedDebits="0.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="174000" organizationPartyId="Company" customTimePeriodId="6013" postedDebits="0.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="210000" organizationPartyId="Company" customTimePeriodId="6013" postedDebits="0.00" postedCredits="348.00"/>
+    <GlAccountHistory glAccountId="213000" organizationPartyId="Company" customTimePeriodId="6013" postedDebits="0.00" postedCredits="70.00"/>
+    <GlAccountHistory glAccountId="214000" organizationPartyId="Company" customTimePeriodId="6013" postedDebits="0.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="224000" organizationPartyId="Company" customTimePeriodId="6013" postedDebits="0.00" postedCredits="1.20"/>
+    <GlAccountHistory glAccountId="224153" organizationPartyId="Company" customTimePeriodId="6013" postedDebits="0.00" postedCredits="5.80"/>
+    <GlAccountHistory glAccountId="310000" organizationPartyId="Company" customTimePeriodId="6013" postedDebits="0.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="400000" organizationPartyId="Company" customTimePeriodId="6013" postedDebits="0.00" postedCredits="299.95"/>
+    <GlAccountHistory glAccountId="409000" organizationPartyId="Company" customTimePeriodId="6013" postedDebits="0.00" postedCredits="12.10"/>
+    <GlAccountHistory glAccountId="410000" organizationPartyId="Company" customTimePeriodId="6013" postedDebits="12.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="649000" organizationPartyId="Company" customTimePeriodId="6013" postedDebits="360.00" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="500000" organizationPartyId="Company" customTimePeriodId="6013" postedDebits="13.50" postedCredits="0.00"/>
+    <GlAccountHistory glAccountId="516100" organizationPartyId="Company" customTimePeriodId="6013" postedDebits="24.88" postedCredits="0.00"/>
+
 </entity-engine-xml>
\ No newline at end of file

Modified: ofbiz/trunk/applications/accounting/data/DemoGeneralChartOfAccounts.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/data/DemoGeneralChartOfAccounts.xml?rev=885256&r1=885255&r2=885256&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/data/DemoGeneralChartOfAccounts.xml (original)
+++ ofbiz/trunk/applications/accounting/data/DemoGeneralChartOfAccounts.xml Sun Nov 29 18:32:31 2009
@@ -1464,6 +1464,10 @@
     glAccountClassId="CASH_EXPENSE" glAccountTypeId="" glResourceTypeId="MONEY"
     accountName="OTHER EXPENSES" description="" postedBalance="0.0"/>
 
+  <GlAccount parentGlAccountId="" glAccountId="850000" accountCode="850000"
+    glAccountClassId="DEBIT" glAccountTypeId="PROFIT_LOSS_ACCOUNT" glResourceTypeId="MONEY"
+    accountName="NET INCOME" description="" postedBalance="0.0"/>
+
   <GlAccount parentGlAccountId="" glAccountId="900000" accountCode="900000"
     glAccountClassId="NON_POSTING" glAccountTypeId="" glResourceTypeId="MONEY"
     accountName="INCOME TAX" description="" postedBalance="0.0"/>

Modified: ofbiz/trunk/applications/accounting/data/DemoGlSetupData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/data/DemoGlSetupData.xml?rev=885256&r1=885255&r2=885256&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/data/DemoGlSetupData.xml (original)
+++ ofbiz/trunk/applications/accounting/data/DemoGlSetupData.xml Sun Nov 29 18:32:31 2009
@@ -280,6 +280,7 @@
     <GlAccountOrganization organizationPartyId="Company" glAccountId="650000" fromDate="2001-01-01 00:00:00.0"/>
     <GlAccountOrganization organizationPartyId="Company" glAccountId="804000" fromDate="2001-01-01 00:00:00.0"/>
     <GlAccountOrganization organizationPartyId="Company" glAccountId="810000" fromDate="2001-01-01 00:00:00.0"/>
+    <GlAccountOrganization organizationPartyId="Company" glAccountId="850000" fromDate="2001-01-01 00:00:00.0"/>
     <GlAccountOrganization organizationPartyId="Company" glAccountId="900000" fromDate="2001-01-01 00:00:00.0"/>
 
     <!-- Default mapping between account types and account ids -->
@@ -301,8 +302,9 @@
     <GlAccountTypeDefault organizationPartyId="Company" glAccountTypeId="COGS_ACCOUNT" glAccountId="500000"/>
     <GlAccountTypeDefault organizationPartyId="Company" glAccountTypeId="INV_ADJ_VAL" glAccountId="515000"/>
     <GlAccountTypeDefault organizationPartyId="Company" glAccountTypeId="OPERATING_EXPENSE" glAccountId="600000"/>
+    <GlAccountTypeDefault organizationPartyId="Company" glAccountTypeId="PROFIT_LOSS_ACCOUNT" glAccountId="850000"/>
     <GlAccountTypeDefault organizationPartyId="Company" glAccountTypeId="TAX_ACCOUNT" glAccountId="900000"/>
-    
+
     <!-- Demo Cost center  -->
     <GlAccountCategory glAccountCategoryId="9301" glAccountCategoryTypeId="COST_CENTER" description="Cost Center 1"/>
     <GlAccountCategory glAccountCategoryId="9302" glAccountCategoryTypeId="COST_CENTER" description="Cost Center 2"/>
@@ -382,21 +384,16 @@
     <VarianceReasonGlAccount organizationPartyId="Company" varianceReasonId="VAR_SAMPLE" glAccountId="625000"/>
 
     <!-- Some Sample Time Periods, two Years with Quarters -->
-    <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6005" periodTypeId="FISCAL_YEAR" fromDate="2008-01-01" thruDate="2008-12-31" isClosed="Y" periodNum="1" periodName="2008"/>
-    <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6006" periodTypeId="FISCAL_QUARTER" fromDate="2008-01-01" thruDate="2008-04-01" isClosed="Y" periodNum="1" periodName="2008/Q1" parentPeriodId="6005"/>
-    <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6007" periodTypeId="FISCAL_QUARTER" fromDate="2008-04-01" thruDate="2008-07-01" isClosed="Y" periodNum="2" periodName="2008/Q2" parentPeriodId="6005"/>
-    <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6008" periodTypeId="FISCAL_QUARTER" fromDate="2008-07-01" thruDate="2008-10-01" isClosed="Y" periodNum="3" periodName="2008/Q3" parentPeriodId="6005"/>
-    <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6009" periodTypeId="FISCAL_QUARTER" fromDate="2008-10-01" thruDate="2009-01-01" isClosed="Y" periodNum="4" periodName="2008/Q4" parentPeriodId="6005"/>
-    <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6010" periodTypeId="FISCAL_YEAR" fromDate="2009-01-01" thruDate="2009-12-31" isClosed="N" periodNum="2" periodName="2009"/>
-    <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6011" periodTypeId="FISCAL_QUARTER" fromDate="2009-01-01" thruDate="2009-04-01" isClosed="N" periodNum="1" periodName="2009/Q1" parentPeriodId="6010"/>
-    <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6012" periodTypeId="FISCAL_QUARTER" fromDate="2009-04-01" thruDate="2009-07-01" isClosed="N" periodNum="2" periodName="2009/Q2" parentPeriodId="6010"/>
-    <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6013" periodTypeId="FISCAL_QUARTER" fromDate="2009-07-01" thruDate="2009-10-01" isClosed="N" periodNum="3" periodName="2009/Q3" parentPeriodId="6010"/>
-    <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6014" periodTypeId="FISCAL_QUARTER" fromDate="2009-10-01" thruDate="2010-01-01" isClosed="N" periodNum="4" periodName="2009/Q4" parentPeriodId="6010"/>
-    <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6015" periodTypeId="FISCAL_YEAR" fromDate="2010-01-01" thruDate="2010-12-31" isClosed="N" periodNum="3" periodName="2010"/>
-    <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6016" periodTypeId="FISCAL_QUARTER" fromDate="2010-01-01" thruDate="2010-04-01" isClosed="N" periodNum="1" periodName="2010/Q1" parentPeriodId="6015"/>
-    <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6017" periodTypeId="FISCAL_QUARTER" fromDate="2010-04-01" thruDate="2010-07-01" isClosed="N" periodNum="2" periodName="2010/Q2" parentPeriodId="6015"/>
-    <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6018" periodTypeId="FISCAL_QUARTER" fromDate="2010-07-01" thruDate="2010-10-01" isClosed="N" periodNum="3" periodName="2010/Q3" parentPeriodId="6015"/>
-    <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6019" periodTypeId="FISCAL_QUARTER" fromDate="2010-10-01" thruDate="2011-01-01" isClosed="N" periodNum="4" periodName="2010/Q4" parentPeriodId="6015"/>
+    <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6010" periodTypeId="FISCAL_YEAR" fromDate="2009-01-01" thruDate="2009-12-31" isClosed="N" periodNum="1" periodName="2009"/>
+    <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6011" periodTypeId="FISCAL_QUARTER" fromDate="2009-01-01" thruDate="2009-04-01" isClosed="N" periodNum="2" periodName="2009/Q1" parentPeriodId="6010"/>
+    <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6012" periodTypeId="FISCAL_QUARTER" fromDate="2009-04-01" thruDate="2009-07-01" isClosed="N" periodNum="3" periodName="2009/Q2" parentPeriodId="6010"/>
+    <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6013" periodTypeId="FISCAL_QUARTER" fromDate="2009-07-01" thruDate="2009-10-01" isClosed="N" periodNum="4" periodName="2009/Q3" parentPeriodId="6010"/>
+    <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6014" periodTypeId="FISCAL_QUARTER" fromDate="2009-10-01" thruDate="2010-01-01" isClosed="N" periodNum="5" periodName="2009/Q4" parentPeriodId="6010"/>
+    <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6015" periodTypeId="FISCAL_YEAR" fromDate="2010-01-01" thruDate="2010-12-31" isClosed="N" periodNum="1" periodName="2010"/>
+    <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6016" periodTypeId="FISCAL_QUARTER" fromDate="2010-01-01" thruDate="2010-04-01" isClosed="N" periodNum="2" periodName="2010/Q1" parentPeriodId="6015"/>
+    <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6017" periodTypeId="FISCAL_QUARTER" fromDate="2010-04-01" thruDate="2010-07-01" isClosed="N" periodNum="3" periodName="2010/Q2" parentPeriodId="6015"/>
+    <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6018" periodTypeId="FISCAL_QUARTER" fromDate="2010-07-01" thruDate="2010-10-01" isClosed="N" periodNum="4" periodName="2010/Q3" parentPeriodId="6015"/>
+    <CustomTimePeriod organizationPartyId="Company" customTimePeriodId="6019" periodTypeId="FISCAL_QUARTER" fromDate="2010-10-01" thruDate="2011-01-01" isClosed="N" periodNum="5" periodName="2010/Q4" parentPeriodId="6015"/>
 
     <!-- to convert demo invoice -->
     <UomConversionDated uomId="USD" uomIdTo="EUR" fromDate="2001-01-01 00:00:00.0" conversionFactor="0.7"/>

Modified: ofbiz/trunk/applications/accounting/data/DemoPaymentsInvoices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/data/DemoPaymentsInvoices.xml?rev=885256&r1=885255&r2=885256&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/data/DemoPaymentsInvoices.xml (original)
+++ ofbiz/trunk/applications/accounting/data/DemoPaymentsInvoices.xml Sun Nov 29 18:32:31 2009
@@ -154,20 +154,6 @@
     <AcctgTransEntry acctgTransId="8009" acctgTransEntrySeqId="00002" acctgTransEntryTypeId="_NA_" glAccountTypeId="ACCOUNTS_PAYABLE" glAccountId="210000" organizationPartyId="Company" amount="33.99" currencyUomId="USD" origAmount="33.99" origCurrencyUomId="USD" debitCreditFlag="D" reconcileStatusId="AES_NOT_RECONCILED"/>
     <AcctgTransEntry acctgTransId="8010" acctgTransEntrySeqId="00001" acctgTransEntryTypeId="_NA_" partyId="DemoSupplier" roleTypeId="BILL_FROM_VENDOR" glAccountTypeId="ACCOUNTS_PAYABLE" glAccountId="210000" organizationPartyId="Company" amount="33.99" currencyUomId="USD" origAmount="33.99" origCurrencyUomId="USD" debitCreditFlag="D" reconcileStatusId="AES_NOT_RECONCILED"/>
     <AcctgTransEntry acctgTransId="8010" acctgTransEntrySeqId="00002" acctgTransEntryTypeId="_NA_" partyId="DemoSupplier" roleTypeId="BILL_FROM_VENDOR" glAccountTypeId="ACCOUNTS_PAYABLE" glAccountId="210000" organizationPartyId="Company" amount="33.99" currencyUomId="USD" origAmount="33.99" origCurrencyUomId="USD" debitCreditFlag="C" reconcileStatusId="AES_NOT_RECONCILED"/>
-
-    <GlAccountHistory glAccountId="112000" organizationPartyId="Company" customTimePeriodId="6010" postedDebits="0.00" postedCredits="116.85"/>
-    <GlAccountHistory glAccountId="112000" organizationPartyId="Company" customTimePeriodId="6013" postedDebits="0.00" postedCredits="116.85"/>
-    <GlAccountHistory glAccountId="140000" organizationPartyId="Company" customTimePeriodId="6010" postedDebits="101.97" postedCredits="0.00"/>
-    <GlAccountHistory glAccountId="140000" organizationPartyId="Company" customTimePeriodId="6013" postedDebits="101.97" postedCredits="0.00"/>
-    <GlAccountHistory glAccountId="210000" organizationPartyId="Company" customTimePeriodId="6010" postedDebits="233.70" postedCredits="233.70"/>
-    <GlAccountHistory glAccountId="210000" organizationPartyId="Company" customTimePeriodId="6013" postedDebits="233.70" postedCredits="233.70"/>
-    <GlAccountHistory glAccountId="516100" organizationPartyId="Company" customTimePeriodId="6010" postedDebits="14.88" postedCredits="0.00"/>
-    <GlAccountHistory glAccountId="516100" organizationPartyId="Company" customTimePeriodId="6013" postedDebits="14.88" postedCredits="0.00"/>
-
-    <GlAccountOrganization glAccountId="112000" organizationPartyId="Company" fromDate="2001-01-01 00:00:00.0" postedBalance="-116.85"/>
-    <GlAccountOrganization glAccountId="140000" organizationPartyId="Company" fromDate="2001-01-01 00:00:00.0" postedBalance="101.97"/>
-    <GlAccountOrganization glAccountId="210000" organizationPartyId="Company" fromDate="2001-01-01 00:00:00.0" postedBalance="0.00"/>
-    <GlAccountOrganization glAccountId="516100" organizationPartyId="Company" fromDate="2001-01-01 00:00:00.0" postedBalance="14.88"/>
     
     <!-- Demo invoice data for sales invoice with INVOICE_PAID status -->
     <Party partyId="DemoCustAgent"/>

Modified: ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml?rev=885256&r1=885255&r2=885256&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml Sun Nov 29 18:32:31 2009
@@ -2031,6 +2031,28 @@
         <key-map field-name="customTimePeriodId"/>
       </relation>
     </view-entity>
+    <view-entity entity-name="GlAccountAndHistoryTotals"
+            package-name="org.ofbiz.accounting.ledger"
+            title="View of GL Account and its History totals">
+      <member-entity entity-alias="GLA" entity-name="GlAccount"/>
+      <member-entity entity-alias="GLAH" entity-name="GlAccountHistory"/>
+      <alias-all entity-alias="GLA" group-by="true"/>
+      <alias-all entity-alias="GLAH" group-by="true"/>
+      <alias entity-alias="GLAH" name="totalPostedDebits" field="postedDebits" function="sum"/>
+      <alias entity-alias="GLAH" name="totalPostedCredits" field="postedCredits" function="sum"/>
+      <alias entity-alias="GLAH" name="totalEndingBalance" field="endingBalance" function="sum"/>
+      <view-link entity-alias="GLA" rel-entity-alias="GLAH">
+        <key-map field-name="glAccountId"/>
+      </view-link>
+      <relation type="one" fk-name="GLAAH_GLACT" rel-entity-name="GlAccount">
+        <key-map field-name="glAccountId"/>
+      </relation>
+      <relation type="one" fk-name="GLAAH_GLAH" rel-entity-name="GlAccountHistory">
+        <key-map field-name="glAccountId"/>
+        <key-map field-name="organizationPartyId"/>
+        <key-map field-name="customTimePeriodId"/>
+      </relation>
+    </view-entity>
     <entity entity-name="GlAccountOrganization"
             package-name="org.ofbiz.accounting.ledger"
             title="GL Account Organization Entity">

Modified: ofbiz/trunk/applications/accounting/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/ofbiz-component.xml?rev=885256&r1=885255&r2=885256&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/ofbiz-component.xml (original)
+++ ofbiz/trunk/applications/accounting/ofbiz-component.xml Sun Nov 29 18:32:31 2009
@@ -46,9 +46,9 @@
     <entity-resource type="data" reader-name="demo" loader="main" location="data/DemoGlSetupData.xml"/>
     <entity-resource type="data" reader-name="demo" loader="main" location="data/DemoFinAccountData.xml"/>
     <entity-resource type="data" reader-name="demo" loader="main" location="data/DemoTaxAuthority.xml"/>
-    <entity-resource type="data" reader-name="demo" loader="main" location="data/DemoPaymentsInvoices.xml"/>
     <entity-resource type="data" reader-name="demo" loader="main" location="data/DemoAcctgTransactionData.xml"/>
-    
+    <entity-resource type="data" reader-name="demo" loader="main" location="data/DemoPaymentsInvoices.xml"/>
+
     <entity-resource type="data" reader-name="demo" loader="main" location="data/DemoAccountingUserData.xml"/>
 
     <!-- General Payment Service Definitions -->

Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml?rev=885256&r1=885255&r2=885256&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml Sun Nov 29 18:32:31 2009
@@ -645,7 +645,7 @@
             <field field="equityGlAccountClass" type="GenericValue"/>
         </call-class-method>
 
-        <!-- Compute the total posted amount of the period -->
+        <!-- Compute the total posted amount of the period for expense/revenue/income accounts -->
         <entity-condition entity-name="AcctgTransAndEntries" list="acctgTransAndEntries">
             <condition-list combine="and">
                 <condition-expr field-name="organizationPartyId" operator="equals" from-field="customTimePeriod.organizationPartyId"/>
@@ -664,6 +664,8 @@
             <order-by field-name="acctgTransEntrySeqId"/>
         </entity-condition>
         <set field="totalAmount" value="0.0" type="BigDecimal"/>
+        <set field="totalCreditAmount" value="0.0" type="BigDecimal"/>
+        <set field="totalDebitAmount" value="0.0" type="BigDecimal"/>
         <iterate list="acctgTransAndEntries" entry="acctgTransAndEntry">
             <get-related-one value-field="acctgTransAndEntry" relation-name="GlAccount" to-value-field="glAccount"/>
             <call-class-method class-name="org.ofbiz.accounting.util.UtilAccounting" method-name="isCreditAccount" ret-field="isCreditAccount">
@@ -678,32 +680,23 @@
             <set field="amount" from-field="acctgTransAndEntry.amount"/>
             <if>
                 <condition>
-                    <or>
-                        <and>
-                            <if-compare field="acctgTransAndEntry.debitCreditFlag" operator="equals" value="D"/>
-                            <if-compare field="isCreditAccount" operator="equals" value="true" type="Boolean"/>
-                        </and>
-                        <and>
-                            <if-compare field="acctgTransAndEntry.debitCreditFlag" operator="equals" value="C"/>
-                            <if-compare field="isDebitAccount" operator="equals" value="true" type="Boolean"/>
-                        </and>
-                    </or>
+                    <if-compare field="acctgTransAndEntry.debitCreditFlag" operator="equals" value="D"/>
                 </condition>
                 <then>
-                    <calculate field="amount">
-                        <calcop field="amount" operator="negative"/>
+                    <calculate field="totalDebitAmount">
+                        <calcop field="totalDebitAmount" operator="add"><calcop field="amount" operator="get"/></calcop>
                     </calculate>
                 </then>
+                <else>
+                    <calculate field="totalCreditAmount">
+                        <calcop field="totalCreditAmount" operator="add"><calcop field="amount" operator="get"/></calcop>
+                    </calculate>
+                </else>
             </if>
-            <if-compare field="isExpenseAccount" operator="equals" value="true" type="Boolean">
-                <calculate field="amount">
-                    <calcop field="amount" operator="negative"/>
-                </calculate>
-            </if-compare>
-            <calculate field="totalAmount">
-                <calcop field="totalAmount" operator="add"><calcop field="amount" operator="get"/></calcop>
-            </calculate>
         </iterate>
+        <calculate field="totalAmount">
+            <calcop field="totalCreditAmount" operator="subtract"><calcop field="totalDebitAmount" operator="get"/></calcop>
+        </calculate>
         <set field="partyAccountingPreferencesCallMap.organizationPartyId" from-field="customTimePeriod.organizationPartyId"/>
         <call-service service-name="getPartyAccountingPreferences" in-map-name="partyAccountingPreferencesCallMap">
              <result-to-field result-name="partyAccountingPreference" field="partyAcctgPreference"/>
@@ -753,6 +746,8 @@
             </call-service>
         </else>
         </if-not-empty>
+
+        <!-- The history records in the current time period are updated with the endingBalance field -->
         <entity-and entity-name="GlAccountHistory" list="glAccountHistories">
             <field-map field-name="organizationPartyId" from-field="customTimePeriod.organizationPartyId"/>
             <field-map field-name="customTimePeriodId" from-field="customTimePeriod.customTimePeriodId"/>
@@ -764,6 +759,8 @@
             <set field="glAccountHistory.endingBalance" from-field="endingBalance"/>
             <store-value value-field="glAccountHistory"/>
         </iterate>
+
+        <!-- For all the accounts of class assets/liability/equity the endingBalance of the last time period's history is added to the one of the history of the period being closed -->
         <if-not-empty field="lastClosedTimePeriod">
             <entity-condition entity-name="GlAccountAndHistory" list="lastPeriodGlAccountAndHistories">
                 <condition-list combine="and">
@@ -803,7 +800,8 @@
             </iterate>
         </if-not-empty>
 
-        <!-- Initialize the accounts for the new fiscal period -->
+        <!-- TODO: the usage of GlAccountOrganization.postedAmount is deprecated in place of GlAccountHistory; the next section will then be removed-->
+        <!-- Initialize the GlAccountOrganization.postedAmount for expense/revenue/income accounts for the new fiscal period -->
         <entity-condition entity-name="GlAccountOrganizationAndClass" list="glAccountOrganizationAndClassList">
             <condition-list combine="and">
                 <condition-expr field-name="organizationPartyId" operator="equals" from-field="customTimePeriod.organizationPartyId"/>
@@ -812,6 +810,7 @@
                     <condition-expr field-name="glAccountClassId" operator="in" from-field="expenseAccountClassIds"/>
                     <condition-expr field-name="glAccountClassId" operator="in" from-field="revenueAccountClassIds"/>
                     <condition-expr field-name="glAccountClassId" operator="in" from-field="incomeAccountClassIds"/>
+                    <condition-expr field-name="glAccountId" operator="equals" from-field="profitLossAccount.glAccountId"/>
                 </condition-list>
             </condition-list>
         </entity-condition>
@@ -863,11 +862,6 @@
                         </calculate>
                     </then>
                 </if>
-                <if-compare field="isExpenseAccount" operator="equals" value="true" type="Boolean">
-                    <calculate field="amount">
-                        <calcop field="amount" operator="negative"/>
-                    </calculate>
-                </if-compare>
                 <calculate field="newPostedBalance">
                     <calcop field="newPostedBalance" operator="add"><calcop field="amount" operator="get"/></calcop>
                 </calculate>
@@ -1058,7 +1052,7 @@
         <set field="partyIds" value="${groovy:org.ofbiz.party.party.PartyWorker.getAssociatedPartyIdsByRelationshipType(delegator, organizationPartyId, 'GROUP_ROLLUP')}" type="List"/>
         <set field="partyIds[]" from-field="organizationPartyId"/>
         <set field="findLastClosedDateInMap.organizationPartyId" from-field="organizationPartyId"/>
-        <set field="findLastClosedDateInMap.findDate" from-field="parameters.thruDate"/>
+        <set field="findLastClosedDateInMap.findDate" from-field="parameters.thruDate" type="Date"/>
         <call-service service-name="findLastClosedDate" in-map-name="findLastClosedDateInMap">
             <result-to-field result-name="lastClosedDate"/>
             <result-to-field result-name="lastClosedTimePeriod"/>
@@ -1186,7 +1180,6 @@
             </calculate>
         </iterate>
 
-        <!-- retrieve the last closed date for the same type of time period -->
         <set field="prepareIncomeStatementInMap.organizationPartyId" from-field="organizationPartyId"/>
         <set field="prepareIncomeStatementInMap.glFiscalTypeId" from-field="parameters.glFiscalTypeId"/>
         <set field="prepareIncomeStatementInMap.fromDate" from-field="lastClosedDate"/>

Modified: ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml?rev=885256&r1=885255&r2=885256&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml Sun Nov 29 18:32:31 2009
@@ -564,7 +564,7 @@
             If no findDate is given, then use the current moment (nowTimestamp).
         </description>
         <attribute name="organizationPartyId" type="String" mode="IN" optional="true"/>
-        <attribute name="findDate" type="Timestamp" mode="IN" optional="true"/>
+        <attribute name="findDate" type="java.sql.Date" mode="IN" optional="true"/>
         <attribute name="periodTypeId" type="String" mode="IN" optional="true"/>
         <attribute name="lastClosedDate" type="Timestamp" mode="OUT" optional="true"/>
         <attribute name="lastClosedTimePeriod" type="org.ofbiz.entity.GenericValue" mode="OUT" optional="true"/>

Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/period/PeriodServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/period/PeriodServices.java?rev=885256&r1=885255&r2=885256&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/period/PeriodServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/period/PeriodServices.java Sun Nov 29 18:32:31 2009
@@ -19,6 +19,7 @@
 
 package org.ofbiz.accounting.period;
 
+import java.sql.Date;
 import java.sql.Timestamp;
 import java.util.List;
 import java.util.Map;
@@ -44,11 +45,11 @@
         Delegator delegator = dctx.getDelegator();
         String organizationPartyId = (String) context.get("organizationPartyId"); // input parameters
         String periodTypeId = (String) context.get("periodTypeId");
-        Timestamp findDate = (Timestamp) context.get("findDate");
+        Date findDate = (Date) context.get("findDate");
 
         // default findDate to now
         if (findDate == null) {
-            findDate = UtilDateTime.nowTimestamp();
+            findDate = new Date(UtilDateTime.nowTimestamp().getTime());
         }
 
         Timestamp lastClosedDate = null;          // return parameters

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy?rev=885256&r1=885255&r2=885256&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy Sun Nov 29 18:32:31 2009
@@ -17,30 +17,11 @@
  * under the License.
  */
 
-import java.math.BigDecimal;
-import org.ofbiz.entity.util.EntityUtil;
-import org.ofbiz.entity.condition.EntityCondition;
-import org.ofbiz.entity.condition.EntityOperator;
 import org.ofbiz.party.party.PartyHelper;
 
-glAccountOrganizationCond = EntityCondition.makeCondition([EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds),
-                                    EntityCondition.makeCondition("postedBalance", EntityOperator.NOT_EQUAL, null)], EntityOperator.AND);
-trialBalances = [];
-glAccountOrganizations = delegator.findList("GlAccountOrganization", glAccountOrganizationCond, null, null, null, false);
-glAccountIds = EntityUtil.getFieldListFromEntityList(glAccountOrganizations, "glAccountId", true);
-glAccountIds.each { glAccountId ->
-    BigDecimal postedBalance = 0;
-    glAccountOrganizations.each { glAccountOrganization ->
-        if (glAccountOrganization.glAccountId.equals(glAccountId)) {
-            postedBalance += glAccountOrganization.getBigDecimal("postedBalance");
-        }
-    }
-    trialBalances.add([glAccountId : glAccountId , postedBalance : postedBalance]);
-}
 partyNameList = [];
 parties.each { party ->
     partyName = PartyHelper.getPartyName(party);
     partyNameList.add(partyName);
 }
-context.trialBalances = trialBalances;
 context.partyNameList = partyNameList;

Modified: ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml?rev=885256&r1=885255&r2=885256&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml Sun Nov 29 18:32:31 2009
@@ -79,37 +79,6 @@
         <field name="submitButton" widget-style="smallSubmit"><submit button-type="button"/></field>
     </form>
 
-    <form name="TrialBalanceList" type="list" list-name="trialBalances"
-        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
-        <row-actions>
-            <entity-one entity-name="GlAccount" value-field="glAccount">
-                <field-map field-name="glAccountId"/>
-            </entity-one>
-            <set field="showDebit" value="${bsh:(postedBalance.compareTo(java.math.BigDecimal.ZERO) &gt;= 0 &amp;&amp; org.ofbiz.accounting.util.UtilAccounting.isDebitAccount(glAccount)) || (postedBalance.compareTo(java.math.BigDecimal.ZERO) &lt; 0 &amp;&amp; org.ofbiz.accounting.util.UtilAccounting.isCreditAccount(glAccount))}" type="Boolean"/>
-            <set field="showCredit" value="${bsh:(postedBalance.compareTo(java.math.BigDecimal.ZERO) &gt;= 0 &amp;&amp; org.ofbiz.accounting.util.UtilAccounting.isCreditAccount(glAccount)) || (postedBalance.compareTo(java.math.BigDecimal.ZERO) &lt; 0 &amp;&amp; org.ofbiz.accounting.util.UtilAccounting.isDebitAccount(glAccount))}" type="Boolean"/>
-            <set field="absolutePostedBalance" value="${bsh:(postedBalance.abs())}" type="BigDecimal"/>
-            <set field="showTotals" value="${bsh:(isLastRow != null &amp;&amp; isLastRow==true)}" type="Boolean"/>
-            <set field="debitTotal" from-field="parameters.debitTotal" type="BigDecimal"/>
-            <set field="creditTotal" from-field="parameters.creditTotal" type="BigDecimal"/>
-            <set field="parameters.debitTotal" value="${bsh:(showDebit ? (debitTotal.add(absolutePostedBalance)) : (debitTotal))}" type="BigDecimal"/>
-            <set field="parameters.creditTotal" value="${bsh:(showCredit ? (creditTotal.add(absolutePostedBalance)) : (creditTotal))}" type="BigDecimal"/>
-        </row-actions>
-        <field name="glAccountId" use-when="!showTotals || isPdf != true">
-            <hyperlink target="FindAcctgTransEntries" description="[${glAccountId}] [${glAccount.accountCode}] ${glAccount.accountName}">
-                <parameter param-name="glAccountId"/>
-                <parameter param-name="organizationPartyId"/>
-            </hyperlink>
-        </field>
-        <field name="glAccountId" use-when="isPdf == true" title-area-style="tableheadhuge"><display description="[${glAccountId}] [${glAccount.accountCode}] ${glAccount.accountName}"/></field>
-        <field name="debit" use-when="showDebit" widget-style="tabletextright"><display description="${absolutePostedBalance}" type="currency" currency="${currencyUomId}"/></field>
-        <field name="debit" use-when="showCredit" widget-style="tabletextright"><display/></field>
-        <field name="credit" use-when="showCredit" widget-style="tabletextright"><display description="${absolutePostedBalance}" type="currency" currency="${currencyUomId}"/></field>
-        <field name="credit" use-when="showDebit" widget-style="tabletextright"><display/></field>
-        <field name="glAccountId" use-when="showTotals"><display description="${uiLabelMap.CommonTotal}"/></field>
-        <field name="debit" use-when="showTotals" widget-style="tabletextright"><display description="${parameters.debitTotal}" type="currency" currency="${currencyUomId}"/></field>
-        <field name="credit" use-when="showTotals" widget-style="tabletextright"><display description="${parameters.creditTotal}" type="currency" currency="${currencyUomId}"/></field>
-    </form>
-
     <form name="IncomeStatementParameters" type="single" header-row-style="header-row" default-table-style="basic-table">
         <field name="isIncomeStatement"><hidden value="true"/></field>
         <field name="selectedMonth" title="${uiLabelMap.CommonMonth}">
@@ -361,32 +330,6 @@
         <field name="glAccountId"><display description="[${glAccountId}] [${glAccount.accountCode}] ${glAccount.accountName}"/></field>
         <field name="totalAmount"><display type="currency" currency="${currencyUomId}"/></field>
     </form>
-
-    <form name="TrialBalanceSearchResultsCsv" type="list" list-name="trialBalances"
-        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
-        <row-actions>
-            <entity-one entity-name="GlAccount" value-field="glAccount">
-                <field-map field-name="glAccountId"/>
-            </entity-one>
-            <set field="showDebit" value="${bsh:(postedBalance.compareTo(java.math.BigDecimal.ZERO) &gt;= 0 &amp;&amp; org.ofbiz.accounting.util.UtilAccounting.isDebitAccount(glAccount)) || (postedBalance.compareTo(java.math.BigDecimal.ZERO) &lt; 0 &amp;&amp; org.ofbiz.accounting.util.UtilAccounting.isCreditAccount(glAccount))}" type="Boolean"/>
-            <set field="showCredit" value="${bsh:(postedBalance.compareTo(java.math.BigDecimal.ZERO) &gt;= 0 &amp;&amp; org.ofbiz.accounting.util.UtilAccounting.isCreditAccount(glAccount)) || (postedBalance.compareTo(java.math.BigDecimal.ZERO) &lt; 0 &amp;&amp; org.ofbiz.accounting.util.UtilAccounting.isDebitAccount(glAccount))}" type="Boolean"/>
-            <set field="absolutePostedBalance" value="${bsh:(postedBalance.abs())}" type="BigDecimal"/>
-            <set field="showTotals" value="${bsh:(isLastRow != null &amp;&amp; isLastRow==true)}" type="Boolean"/>
-            <set field="debitTotal" from-field="parameters.debitTotal" type="BigDecimal"/>
-            <set field="creditTotal" from-field="parameters.creditTotal" type="BigDecimal"/>
-            <set field="noValue" value="0" type="BigDecimal"/>
-            <set field="parameters.debitTotal" value="${bsh:(showDebit ? (debitTotal.add(absolutePostedBalance)) : (debitTotal))}" type="BigDecimal"/>
-            <set field="parameters.creditTotal" value="${bsh:(showCredit ? (creditTotal.add(absolutePostedBalance)) : (creditTotal))}" type="BigDecimal"/>
-        </row-actions>
-        <field name="glAccountId" use-when="!showTotals"><display description="[${glAccountId}] [${glAccount.accountCode}] ${glAccount.accountName}"/></field>
-        <field name="debit" use-when="showDebit"><display description="${absolutePostedBalance}" type="currency" currency="${currencyUomId}"/></field>
-        <field name="debit" use-when="showCredit"><display description="${noValue}"/></field>
-        <field name="credit" use-when="showCredit"><display description="${absolutePostedBalance}" type="currency" currency="${currencyUomId}"/></field>
-        <field name="credit" use-when="showDebit"><display description="${noValue}"/></field>
-        <field name="glAccountId" use-when="showTotals"><display description="${uiLabelMap.Total}"/></field>
-        <field name="debit" use-when="showTotals"><display description="${parameters.debitTotal}" type="currency" currency="${currencyUomId}"/></field>
-        <field name="credit" use-when="showTotals"><display description="${parameters.creditTotal}" type="currency" currency="${currencyUomId}"/></field>
-    </form>
     <form name="GlAccountTrialBalance" type="single" target="GlAccountTrialBalance">
         <actions>
             <entity-and entity-name="CustomTimePeriod" list="customTimePeriods">
@@ -586,4 +529,48 @@
     </form>
 
     <form name="ComparativeExpenseStatementsCsv" type="list" list-name="glAccountExpenseList" view-size="99999" extends="ComparativeIncomeStatementsCsv"/>
+
+    <form name="TrialBalanceFinancialTimePeriodSelection" type="single" header-row-style="header-row" target="TrialBalance" default-table-style="basic-table">
+        <field name="organizationPartyId"><hidden/></field>
+        <field name="customTimePeriodId" required-field="true">
+            <drop-down>
+                <entity-options entity-name="CustomTimePeriod" key-field-name="customTimePeriodId" description="${periodName}: ${fromDate} - ${thruDate}" filter-by-date="false">
+                    <entity-constraint name="periodTypeId" operator="like" value="FISCAL_%"/>
+                    <entity-order-by field-name="-thruDate"/>
+                    <entity-order-by field-name="periodNum"/>
+                </entity-options>
+            </drop-down>
+        </field>
+        <field name="submitButton" title="${uiLabelMap.CommonSubmit}" widget-style="smallSubmit"><submit button-type="button"/></field>
+    </form>
+    <form name="TrialBalanceReport" type="list" list-name="glAccountAndHistories"
+        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
+        <actions>
+            <entity-condition entity-name="GlAccountAndHistoryTotals" filter-by-date="false" list="glAccountAndHistories">
+                <condition-list>
+                    <condition-expr field-name="organizationPartyId" operator="in" from-field="partyIds"/>
+                    <condition-expr field-name="customTimePeriodId" operator="equals" from-field="parameters.customTimePeriodId"/>
+                </condition-list>
+                <select-field field-name="glAccountId"/>
+                <select-field field-name="accountCode"/>
+                <select-field field-name="accountName"/>
+                <select-field field-name="totalPostedDebits"/>
+                <select-field field-name="totalPostedCredits"/>
+                <select-field field-name="totalEndingBalance"/>
+                <order-by field-name="accountCode"/>
+            </entity-condition>
+        </actions>
+        <field name="glAccountId">
+            <hyperlink target="FindAcctgTransEntries" description="${glAccountId}">
+                <parameter param-name="glAccountId"/>
+                <parameter param-name="organizationPartyId"/>
+            </hyperlink>
+        </field>
+        <field name="accountCode"><display description="${accountCode}"/></field>
+        <field name="accountName" title-area-style="tableheadwide"><display description="${accountName}"/></field>
+        <field name="totalPostedDebits" title="${uiLabelMap.AccountingDebitFlag}" widget-style="tabletextright"><display description="${totalPostedDebits}" type="currency" currency="${currencyUomId}"/></field>
+        <field name="totalPostedCredits" title="${uiLabelMap.AccountingCreditFlag}" widget-style="tabletextright"><display description="${totalPostedCredits}" type="currency" currency="${currencyUomId}"/></field>
+        <field name="totalEndingBalance" title="${uiLabelMap.AccountingEndingBalance}" widget-style="tabletextright"><display description="${totalEndingBalance}" type="currency" currency="${currencyUomId}"/></field>
+    </form>
+
 </forms>

Modified: ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml?rev=885256&r1=885255&r2=885256&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml Sun Nov 29 18:32:31 2009
@@ -226,11 +226,15 @@
                 </entity-condition>
                 <set field="partyIds[]" from-field="organizationPartyId"/>
                 <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy"/>
-                <set field="totalsRow.isLastRow" value="true" type="Boolean"/>
-                <set field="totalsRow.postedBalance" value="0" type="BigDecimal"/>
-                <set field="trialBalances[]" from-field="totalsRow" type="Object"/>
-                <set field="parameters.debitTotal" value="0" type="BigDecimal"/>
-                <set field="parameters.creditTotal" value="0" type="BigDecimal"/>
+                <entity-condition entity-name="GlAccountAndHistoryTotals" filter-by-date="false" list="grandTotalPosted">
+                    <condition-list>
+                        <condition-expr field-name="organizationPartyId" operator="in" from-field="partyIds"/>
+                        <condition-expr field-name="customTimePeriodId" operator="equals" from-field="parameters.customTimePeriodId"/>
+                    </condition-list>
+                    <select-field field-name="totalPostedDebits"/>
+                    <select-field field-name="totalPostedCredits"/>
+                </entity-condition>
+                <set field="grandTotalPostedRecord" from-field="grandTotalPosted[0]"/>
             </actions>
             <widgets>
                 <decorator-screen name="CommonOrganizationAccountingReportsDecorator" location="${parameters.mainDecoratorLocation}">
@@ -238,15 +242,31 @@
                         <container style="h3">
                             <label text="${uiLabelMap.AccountingConsolidatedDataFromDivisions}"/>
                         </container>
-                        <screenlet title="${uiLabelMap.AccountingTrialBalance}">
-                            <link text="${uiLabelMap.AccountingExportAsCsv}" style="buttontext" target="TrialBalanceSearchResultsCsv.csv">
-                                <parameter param-name="organizationPartyId"/>
-                            </link>
-                            <link text="${uiLabelMap.AccountingExportAsPdf}" style="buttontext" target="TrialBalanceSearchResultsPdf.pdf">
-                                <parameter param-name="organizationPartyId"/>
-                            </link>
-                            <include-form name="TrialBalanceList" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
-                        </screenlet>
+                        <include-form name="TrialBalanceFinancialTimePeriodSelection" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                        <section>
+                            <condition>
+                                <not><if-empty field="parameters.customTimePeriodId"/></not>
+                            </condition>
+                            <widgets>
+                                <screenlet title="${uiLabelMap.AccountingTrialBalance}">
+                                    <link text="${uiLabelMap.AccountingExportAsCsv}" style="buttontext" target="TrialBalanceSearchResultsCsv.csv">
+                                        <parameter param-name="organizationPartyId" from-field="organizationPartyId"/>
+                                        <parameter param-name="customTimePeriodId" from-field="parameters.customTimePeriodId"/>
+                                    </link>
+                                    <link text="${uiLabelMap.AccountingExportAsPdf}" style="buttontext" target="TrialBalanceSearchResultsPdf.pdf">
+                                        <parameter param-name="organizationPartyId" from-field="organizationPartyId"/>
+                                        <parameter param-name="customTimePeriodId" from-field="parameters.customTimePeriodId"/>
+                                    </link>
+                                    <include-form name="TrialBalanceReport" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                                    <container style="h3">
+                                        <label text="${uiLabelMap.AccountingDebitFlag}: ${grandTotalPostedRecord.totalPostedDebits}"/>
+                                    </container>
+                                    <container style="h3">
+                                        <label text="${uiLabelMap.AccountingCreditFlag}: ${grandTotalPostedRecord.totalPostedCredits}"/>
+                                    </container>
+                                </screenlet>
+                            </widgets>
+                        </section>
                     </decorator-section>
                 </decorator-screen>
             </widgets>
@@ -626,27 +646,30 @@
             <actions>
                 <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
                 <set field="organizationPartyId" from-field="parameters.organizationPartyId"/>
-
-                <service service-name="getPartyAccountingPreferences" result-map="result" auto-field-map="true"/>
+                <service service-name="getPartyAccountingPreferences" result-map="result">
+                    <field-map field-name="organizationPartyId"/>
+                </service>
                 <set field="partyAcctgPreference" from-field="result.partyAccountingPreference"/>
                 <set field="currencyUomId" from-field="partyAcctgPreference.baseCurrencyUomId"/>
-
-                <set field="organizationPartyId" from-field="parameters.organizationPartyId"/>
                 <set field="partyIds" value="${groovy:org.ofbiz.party.party.PartyWorker.getAssociatedPartyIdsByRelationshipType(delegator, organizationPartyId, 'GROUP_ROLLUP')}" type="List"/>
                 <entity-condition entity-name="Party" list="parties">
                     <condition-expr field-name="partyId" operator="in" from-field="partyIds"/>
                 </entity-condition>
                 <set field="partyIds[]" from-field="organizationPartyId"/>
                 <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy"/>
-                <set field="totalsRow.isLastRow" value="true" type="Boolean"/>
-                <set field="totalsRow.postedBalance" value="0" type="BigDecimal"/>
-                <set field="trialBalances[]" from-field="totalsRow" type="Object"/>
-                <set field="parameters.debitTotal" value="0" type="BigDecimal"/>
-                <set field="parameters.creditTotal" value="0" type="BigDecimal"/>
+                <entity-condition entity-name="GlAccountAndHistoryTotals" filter-by-date="false" list="grandTotalPosted">
+                    <condition-list>
+                        <condition-expr field-name="organizationPartyId" operator="in" from-field="partyIds"/>
+                        <condition-expr field-name="customTimePeriodId" operator="equals" from-field="parameters.customTimePeriodId"/>
+                    </condition-list>
+                    <select-field field-name="totalPostedDebits"/>
+                    <select-field field-name="totalPostedCredits"/>
+                </entity-condition>
+                <set field="grandTotalPostedRecord" from-field="grandTotalPosted[0]"/>
             </actions>
             <widgets>
                 <container>
-                    <include-form name="TrialBalanceSearchResultsCsv" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                    <include-form name="TrialBalanceReport" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
                 </container>
             </widgets>
         </section>
@@ -657,29 +680,44 @@
             <actions>
                 <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
                 <set field="organizationPartyId" from-field="parameters.organizationPartyId"/>
-
-                <service service-name="getPartyAccountingPreferences" result-map="result" auto-field-map="true"/>
+                <service service-name="getPartyAccountingPreferences" result-map="result">
+                    <field-map field-name="organizationPartyId"/>
+                </service>
                 <set field="partyAcctgPreference" from-field="result.partyAccountingPreference"/>
                 <set field="currencyUomId" from-field="partyAcctgPreference.baseCurrencyUomId"/>
-
-                <set field="organizationPartyId" from-field="parameters.organizationPartyId"/>
                 <set field="partyIds" value="${groovy:org.ofbiz.party.party.PartyWorker.getAssociatedPartyIdsByRelationshipType(delegator, organizationPartyId, 'GROUP_ROLLUP')}" type="List"/>
                 <entity-condition entity-name="Party" list="parties">
                     <condition-expr field-name="partyId" operator="in" from-field="partyIds"/>
                 </entity-condition>
                 <set field="partyIds[]" from-field="organizationPartyId"/>
                 <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy"/>
-                <set field="totalsRow.isLastRow" value="true" type="Boolean"/>
-                <set field="totalsRow.postedBalance" value="0" type="BigDecimal"/>
-                <set field="trialBalances[]" from-field="totalsRow" type="Object"/>
-                <set field="parameters.debitTotal" value="0" type="BigDecimal"/>
-                <set field="parameters.creditTotal" value="0" type="BigDecimal"/>
-                <set field="isPdf" value="true" type="Boolean"/>
+                <entity-condition entity-name="GlAccountAndHistoryTotals" filter-by-date="false" list="grandTotalPosted">
+                    <condition-list>
+                        <condition-expr field-name="organizationPartyId" operator="in" from-field="partyIds"/>
+                        <condition-expr field-name="customTimePeriodId" operator="equals" from-field="parameters.customTimePeriodId"/>
+                    </condition-list>
+                    <select-field field-name="totalPostedDebits"/>
+                    <select-field field-name="totalPostedCredits"/>
+                </entity-condition>
+                <set field="grandTotalPostedRecord" from-field="grandTotalPosted[0]"/>
             </actions>
             <widgets>
                 <decorator-screen name="SimpleDecorator" location="component://common/widget/CommonScreens.xml">
                     <decorator-section name="body">
-                        <include-form name="TrialBalanceList" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                        <container style="h3">
+                            <label text="${uiLabelMap.AccountingTrialBalance}"/>
+                        </container>
+                        <container style="h3">
+                            <label text="${uiLabelMap.AccountingConsolidatedDataFromDivisions}"/>
+                        </container>
+                        <include-form name="TrialBalanceFinancialTimePeriodSelection" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                        <include-form name="TrialBalanceReport" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                        <container style="h3">
+                            <label text="${uiLabelMap.AccountingDebitFlag}: ${grandTotalPostedRecord.totalPostedDebits}"/>
+                        </container>
+                        <container style="h3">
+                            <label text="${uiLabelMap.AccountingCreditFlag}: ${grandTotalPostedRecord.totalPostedCredits}"/>
+                        </container>
                     </decorator-section>
                 </decorator-screen>
             </widgets>

Modified: ofbiz/trunk/specialpurpose/ecommerce/data/DemoOrderTestData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/data/DemoOrderTestData.xml?rev=885256&r1=885255&r2=885256&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/data/DemoOrderTestData.xml (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/data/DemoOrderTestData.xml Sun Nov 29 18:32:31 2009
@@ -115,9 +115,9 @@
     <ShipmentStatus statusId="PURCH_SHIP_CREATED" shipmentId="9997" statusDate="2009-08-13 17:46:28.784"/>
     <ShipmentStatus statusId="PURCH_SHIP_RECEIVED" shipmentId="9997" statusDate="2009-08-13 17:47:47.602"/>
     <ShipmentStatus statusId="PURCH_SHIP_SHIPPED" shipmentId="9997" statusDate="2009-08-13 17:46:29.836"/>
-    <AcctgTrans acctgTransId="8015" acctgTransTypeId="SHIPMENT_RECEIPT" transactionDate="2009-08-13 17:47:48.642" isPosted="Y" postedDate="2009-08-13 17:47:49.281" glFiscalTypeId="ACTUAL" partyId="DemoSupplier" shipmentId="9997"/>
-    <AcctgTransEntry acctgTransId="8015" acctgTransEntrySeqId="00001" acctgTransEntryTypeId="_NA_" partyId="DemoSupplier" roleTypeId="BILL_FROM_VENDOR" productId="GZ-2644" glAccountTypeId="UNINVOICED_SHIP_RCPT" glAccountId="214000" organizationPartyId="Company" amount="48.00" currencyUomId="USD" origAmount="48.00" origCurrencyUomId="USD" debitCreditFlag="C" reconcileStatusId="AES_NOT_RECONCILED"/>
-    <AcctgTransEntry acctgTransId="8015" acctgTransEntrySeqId="00002" acctgTransEntryTypeId="_NA_" partyId="DemoSupplier" roleTypeId="BILL_FROM_VENDOR" productId="GZ-2644" glAccountTypeId="INVENTORY_ACCOUNT" glAccountId="140000" organizationPartyId="Company" amount="48.00" currencyUomId="USD" origAmount="48.00" origCurrencyUomId="USD" debitCreditFlag="D" reconcileStatusId="AES_NOT_RECONCILED"/>
+    <AcctgTrans acctgTransId="9000" acctgTransTypeId="SHIPMENT_RECEIPT" transactionDate="2009-08-13 17:47:48.642" isPosted="Y" postedDate="2009-08-13 17:47:49.281" glFiscalTypeId="ACTUAL" partyId="DemoSupplier" shipmentId="9997"/>
+    <AcctgTransEntry acctgTransId="9000" acctgTransEntrySeqId="00001" acctgTransEntryTypeId="_NA_" partyId="DemoSupplier" roleTypeId="BILL_FROM_VENDOR" productId="GZ-2644" glAccountTypeId="UNINVOICED_SHIP_RCPT" glAccountId="214000" organizationPartyId="Company" amount="48.00" currencyUomId="USD" origAmount="48.00" origCurrencyUomId="USD" debitCreditFlag="C" reconcileStatusId="AES_NOT_RECONCILED"/>
+    <AcctgTransEntry acctgTransId="9000" acctgTransEntrySeqId="00002" acctgTransEntryTypeId="_NA_" partyId="DemoSupplier" roleTypeId="BILL_FROM_VENDOR" productId="GZ-2644" glAccountTypeId="INVENTORY_ACCOUNT" glAccountId="140000" organizationPartyId="Company" amount="48.00" currencyUomId="USD" origAmount="48.00" origCurrencyUomId="USD" debitCreditFlag="D" reconcileStatusId="AES_NOT_RECONCILED"/>
     
     <InventoryItem inventoryItemId="9025" inventoryItemTypeId="NON_SERIAL_INV_ITEM" productId="GZ-2644" ownerPartyId="Company" datetimeReceived="2009-08-13 17:47:31.095" facilityId="WebStoreWarehouse" locationSeqId="TLTLTLLL01" quantityOnHandTotal="2.000000" availableToPromiseTotal="2.000000" unitCost="24.000000" currencyUomId="USD"/>
     <ShipmentReceipt receiptId="9000" inventoryItemId="9025" productId="GZ-2644" shipmentId="9997" orderId="Demo1001" orderItemSeqId="00001" datetimeReceived="2009-08-13 17:47:31.095" quantityAccepted="2.000000" quantityRejected="0.000000"/>
@@ -127,9 +127,9 @@
     <Invoice invoiceId="8008" invoiceTypeId="PURCHASE_INVOICE" description="Purchase Order Invoice" partyIdFrom="DemoSupplier" partyId="Company" statusId="INVOICE_READY" invoiceDate="2009-08-13 17:47:47.929" currencyUomId="USD"/>
     <InvoiceItem invoiceId="8008" invoiceItemSeqId="00001" invoiceItemTypeId="PINV_FPROD_ITEM" productId="GZ-2644" quantity="2.000000" amount="24.000" description="GZ-2644-0 Round Gizmo"/>
     <OrderItemBilling orderId="Demo1001" orderItemSeqId="00001" invoiceId="8008" invoiceItemSeqId="00001" shipmentReceiptId="9000" quantity="2.000000" amount="24.00"/>
-    <AcctgTrans acctgTransId="8016" acctgTransTypeId="PURCHASE_INVOICE" transactionDate="2009-08-13 18:58:34.65" isPosted="Y" postedDate="2009-08-13 18:58:35.08" glFiscalTypeId="ACTUAL" partyId="DemoSupplier" roleTypeId="BILL_FROM_VENDOR" invoiceId="8008"/>
-    <AcctgTransEntry acctgTransId="8016" acctgTransEntrySeqId="00001" acctgTransEntryTypeId="_NA_" partyId="DemoSupplier" roleTypeId="BILL_FROM_VENDOR" productId="GZ-2644" glAccountId="214000" organizationPartyId="Company" amount="48.00" currencyUomId="USD" origAmount="48.00" origCurrencyUomId="USD" debitCreditFlag="D" reconcileStatusId="AES_NOT_RECONCILED"/>
-    <AcctgTransEntry acctgTransId="8016" acctgTransEntrySeqId="00002" acctgTransEntryTypeId="_NA_" partyId="DemoSupplier" roleTypeId="BILL_FROM_VENDOR" glAccountTypeId="ACCOUNTS_PAYABLE" glAccountId="210000" organizationPartyId="Company" amount="48.00" currencyUomId="USD" origAmount="48.00" origCurrencyUomId="USD" debitCreditFlag="C" reconcileStatusId="AES_NOT_RECONCILED"/>
+    <AcctgTrans acctgTransId="9001" acctgTransTypeId="PURCHASE_INVOICE" transactionDate="2009-08-13 18:58:34.65" isPosted="Y" postedDate="2009-08-13 18:58:35.08" glFiscalTypeId="ACTUAL" partyId="DemoSupplier" roleTypeId="BILL_FROM_VENDOR" invoiceId="8008"/>
+    <AcctgTransEntry acctgTransId="9001" acctgTransEntrySeqId="00001" acctgTransEntryTypeId="_NA_" partyId="DemoSupplier" roleTypeId="BILL_FROM_VENDOR" productId="GZ-2644" glAccountId="214000" organizationPartyId="Company" amount="48.00" currencyUomId="USD" origAmount="48.00" origCurrencyUomId="USD" debitCreditFlag="D" reconcileStatusId="AES_NOT_RECONCILED"/>
+    <AcctgTransEntry acctgTransId="9001" acctgTransEntrySeqId="00002" acctgTransEntryTypeId="_NA_" partyId="DemoSupplier" roleTypeId="BILL_FROM_VENDOR" glAccountTypeId="ACCOUNTS_PAYABLE" glAccountId="210000" organizationPartyId="Company" amount="48.00" currencyUomId="USD" origAmount="48.00" origCurrencyUomId="USD" debitCreditFlag="C" reconcileStatusId="AES_NOT_RECONCILED"/>
 
     <!--Demo Sales Order for Accounting-->
     <OrderHeader orderId="Demo1002" orderTypeId="SALES_ORDER" orderName="Demo Sales Order" salesChannelEnumId="WEB_SALES_CHANNEL" orderDate="2009-08-17 14:23:49.475" priority="2" entryDate="2009-08-17 14:23:49.475" visitId="10000" statusId="ORDER_COMPLETED" createdBy="admin" currencyUom="USD" webSiteId="OrderEntry" productStoreId="9000" remainingSubTotal="107.98" grandTotal="127.09"/>