You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by as...@apache.org on 2009/12/11 13:54:19 UTC

svn commit: r889598 - in /ofbiz/trunk/applications/accounting: config/ webapp/accounting/WEB-INF/ webapp/accounting/WEB-INF/actions/reports/ widget/

Author: ashish
Date: Fri Dec 11 12:54:18 2009
New Revision: 889598

URL: http://svn.apache.org/viewvc?rev=889598&view=rev
Log:
Applied patch from jira issue OFBIZ-3326 - Imporve Cash Flow Statement.

Currently Cash flow statement showing many sections like asset, liability ..... that are not required. Sections contains account payable, receivable and these should no part of cash flow.
So doing improvements in Cash Flow Statement by showing only Cash_Equivalent transactions.

New implementation contains three parts -

    * Opening Cash flow
          o It will contain sum of transactions form last closing period to current from date.
    * Period Cash Flow
          o It will contain sum of transaction during date range.
    * Closing Cash flow
          o It will contain sum of amounts of opening cash flows and closing cash flow.

There is a last section of totals, which will in same format of other reports. 

Also PDF and CSV feature added in this work.

Thanks Sumit & Jacopo for the contribution.

Modified:
    ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/CashFlowStatement.groovy
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml
    ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml
    ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml

Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=889598&r1=889597&r2=889598&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original)
+++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Fri Dec 11 12:54:18 2009
@@ -1900,6 +1900,10 @@
         <value xml:lang="th">ปิดช่วงเวลา</value>
         <value xml:lang="zh">已结束时段</value>
     </property>
+    <property key="AccountingClosingCashBalance">
+        <value xml:lang="en">Closing Cash Balance</value>
+        <value xml:lang="hi_IN">बंद नकदी शेष</value>
+    </property>
     <property key="AccountingComments">
         <value xml:lang="ar">تعاليق</value>
         <value xml:lang="de">Kommentare</value>
@@ -3005,6 +3009,10 @@
         <value xml:lang="en">Ending Balance</value>
         <value xml:lang="hi_IN">अंतिम शेष</value>
     </property>
+    <property key="AccountingEndingCashBalance">
+        <value xml:lang="en">Ending Cash Balance</value>
+        <value xml:lang="hi_IN">अंतिम नकदी शेष</value>
+    </property>
     <property key="AccountingEnterGiftCardLink">
         <value xml:lang="de">Geben Sie Ihre Kartennummer (Physikalische und virtuelle) und den Pin-Code an um Sie mit Ihrem Konto zu verknüpfen</value>
         <value xml:lang="en">Enter your physical and virtual card and pin number to link your account</value>
@@ -6482,6 +6490,10 @@
         <value xml:lang="en">Opening Balance</value>
         <value xml:lang="hi_IN">प्रारंभिक शेष</value>
     </property>
+    <property key="AccountingOpeningCashBalance">
+        <value xml:lang="en">Opening Cash Balance</value>
+        <value xml:lang="hi_IN">प्रारंभिक नकदी शेष</value>
+    </property>
     <property key="AccountingOpenPayments">
         <value xml:lang="ar">مفتوح</value>
         <value xml:lang="de">Offen</value>
@@ -7808,6 +7820,10 @@
         <value xml:lang="en">Period2 Total Amount</value>
         <value xml:lang="hi_IN">अवधि 2 कुल राशि</value>
     </property>
+    <property key="AccountingPeriodCashBalance">
+        <value xml:lang="en">Period Cash Balance</value>
+        <value xml:lang="hi_IN">अवधि नकदी शेष</value>
+    </property>
     <property key="AccountingPeriodName">
         <value xml:lang="de">Name des Zeitraums</value>
         <value xml:lang="en">Period Name</value>
@@ -8788,7 +8804,15 @@
     </property>
     <property key="AccountingTotalCashBalance">
         <value xml:lang="en">Total Cash Balance</value>
-        <value xml:lang="hi_IN">कुल रोकड़ शेष</value>
+        <value xml:lang="hi_IN">कुल नकदी शेष</value>
+    </property>
+    <property key="AccountingTotalClosingCashBalance">
+        <value xml:lang="en">Total Closing Cash Balance</value>
+        <value xml:lang="hi_IN">कुल बंद नकदी शेष</value>
+    </property>
+    <property key="AccountingTotalPeriodCashBalance">
+        <value xml:lang="en">Total Period Cash Balance</value>
+        <value xml:lang="hi_IN">कुल अवधि नकदी शेष</value>
     </property>
     <property key="AccountingTotalCostCenterAmount">
         <value xml:lang="en">Cost center amount percentage saved successfully</value>
@@ -8797,10 +8821,22 @@
         <value xml:lang="en">Total Commission Amount</value>
         <value xml:lang="hi_IN">कुल दलाली राशी</value>
     </property>
+    <property key="AccountingTotalCredit_Disbursement">
+        <value xml:lang="en">Total Credit(Disbursement)</value>
+        <value xml:lang="hi_IN">कुल जमा</value>
+    </property>
     <property key="AccountingTotalCurrentAssetBalance">
         <value xml:lang="en">Total Current Asset Balance</value>
         <value xml:lang="hi_IN">कुल चालू सम्पत्ति राशी</value>
     </property>
+    <property key="AccountingTotalDebit_Receipts">
+        <value xml:lang="en">Total Debit(Receipts)</value>
+        <value xml:lang="hi_IN">कुल नामे</value>
+    </property>
+    <property key="AccountingTotalEndingCashBalance">
+        <value xml:lang="en">Total Ending Cash Balance</value>
+        <value xml:lang="hi_IN">कुल अंतिम नकदी शेष</value>
+    </property>
     <property key="AccountingTotalOfTheCurrentMonth">
         <value xml:lang="en">Total of the current month</value>
         <value xml:lang="hi_IN">चालू माह के कुल</value>
@@ -8809,6 +8845,10 @@
         <value xml:lang="en">Total of Year To Date</value>
         <value xml:lang="hi_IN">वर्ष से दिनांक का कुल</value>
     </property>
+    <property key="AccountingTotalOpeningCashBalance">
+        <value xml:lang="en">Total Opening Cash Balance</value>
+        <value xml:lang="hi_IN">कुल अथ नकदी शेष</value>
+    </property>
     <property key="AccountingTotalOperationalCashBalance">
         <value xml:lang="en">Total Operational Cash Balance</value>
         <value xml:lang="hi_IN">कुल क्रियाशील नकदी</value>

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/CashFlowStatement.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/CashFlowStatement.groovy?rev=889598&r1=889597&r2=889598&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/CashFlowStatement.groovy (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/CashFlowStatement.groovy Fri Dec 11 12:54:18 2009
@@ -17,15 +17,18 @@
  * under the License.
  */
 
+import org.ofbiz.accounting.util.UtilAccounting;
 import org.ofbiz.base.util.UtilDateTime;
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.condition.EntityCondition;
 import org.ofbiz.entity.condition.EntityOperator;
-import org.ofbiz.accounting.util.UtilAccounting;
 import org.ofbiz.party.party.PartyWorker;
 
+import java.sql.Date;
+import java.sql.Timestamp;
+
 import javolution.util.FastList;
 import javolution.util.FastMap;
 
@@ -40,221 +43,99 @@
 }
 
 uiLabelMap = UtilProperties.getResourceBundleMap("AccountingUiLabels", locale);
+parametersFromDate = fromDate;
 
 // Setup the divisions for which the report is executed
 List partyIds = PartyWorker.getAssociatedPartyIdsByRelationshipType(delegator, organizationPartyId, 'GROUP_ROLLUP');
 partyIds.add(organizationPartyId);
 
-// Get the group of account classes that will be used to position accounts in the proper section of the financial statement
-GenericValue cashEquivalentGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "CASH_EQUIVALENT"), true);
-List cashEquivalentAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(cashEquivalentGlAccountClass);
-GenericValue nonCashExpanseGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "NON_CASH_EXPENSE"), true);
-List nonCashExpanseAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(nonCashExpanseGlAccountClass);
-GenericValue inventoryAdjustGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "INVENTORY_ADJUST"), true);
-List inventoryAdjustAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(inventoryAdjustGlAccountClass);
-GenericValue currentAssetGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "CURRENT_ASSET"), true);
-List currentAssetAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(currentAssetGlAccountClass);
-GenericValue currentLiabilityGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "CURRENT_LIABILITY"), true);
-List currentLiabilityAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(currentLiabilityGlAccountClass);
-GenericValue longTermAssetGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "LONGTERM_ASSET"), true);
-List longTermAssetAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(longTermAssetGlAccountClass);
-GenericValue accumDepreciationGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "ACCUM_DEPRECIATION"), true);
-List accumDepreciationAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(accumDepreciationGlAccountClass);
-GenericValue accumAmoritizationGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "ACCUM_AMORTIZATION"), true);
-List accumAmoritizationAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(accumAmoritizationGlAccountClass);
-GenericValue longTermLiabilityGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "LONGTERM_LIABILITY"), true);
-List longTermLiabilityAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(longTermLiabilityGlAccountClass);
-GenericValue ownersEquityGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "OWNERS_EQUITY"), true);
-List ownersEquityAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(ownersEquityGlAccountClass);
-
-List mainAndExprs = FastList.newInstance();
-mainAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
-mainAndExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "Y"));
-mainAndExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, parameters.glFiscalTypeId));
-mainAndExprs.add(EntityCondition.makeCondition("acctgTransTypeId", EntityOperator.NOT_EQUAL, "PERIOD_CLOSING"));
-mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
-mainAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, thruDate));
+// Get the group of account classes that will be used to position accounts in the proper section of the  Cash Flow statement
+GenericValue glAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "CASH_EQUIVALENT"), true);
+List glAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(glAccountClass);
 
 List cashFlowBalanceTotalList = [];
 
-// CASH BALANCE 
-accountBalanceList = [];
-transactionTotals = [];
-balanceTotal = BigDecimal.ZERO;
-List cashEquivalentAndExprs = FastList.newInstance(mainAndExprs);
-cashEquivalentAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, cashEquivalentAccountClassIds));
-transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(cashEquivalentAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
-if (transactionTotals) {
-    Map transactionTotalsMap = [:];
-    balanceTotalCredit = BigDecimal.ZERO;
-    balanceTotalDebit = BigDecimal.ZERO;
-    transactionTotals.each { transactionTotal ->
-        Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId);
-        if (!accountMap) {
-            accountMap = UtilMisc.makeMapWritable(transactionTotal);
-            accountMap.remove("debitCreditFlag");
-            accountMap.remove("amount");
-            accountMap.D = BigDecimal.ZERO;
-            accountMap.C = BigDecimal.ZERO;
-            accountMap.balance = BigDecimal.ZERO;
-        }
-        UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount);
-        if ("D".equals(transactionTotal.debitCreditFlag)) {
-            balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount);
-        } else {
-            balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount);
-        }
-        BigDecimal debitAmount = (BigDecimal)accountMap.D;
-        BigDecimal creditAmount = (BigDecimal)accountMap.C;
-        BigDecimal balance = debitAmount.subtract(creditAmount);
-        accountMap.balance = balance;
-        transactionTotalsMap.(transactionTotal.glAccountId) = accountMap;
-    }
-    accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"));
-    balanceTotal = balanceTotalDebit.subtract(balanceTotalCredit);
+// Find the last closed time period to get the fromDate for the transactions in the current period and the ending balances of the last closed period 
+Map lastClosedTimePeriodResult = dispatcher.runSync("findLastClosedDate", ["organizationPartyId":organizationPartyId, "findDate":new Date(parametersFromDate.getTime()),"userLogin":userLogin]);
+Timestamp periodClosingFromDate = (Timestamp)lastClosedTimePeriodResult.lastClosedDate;
+if (!periodClosingFromDate) {
+    return;
 }
-cashEquivalentBalanceTotal = balanceTotal;
-context.cashEquivalentBalanceList = accountBalanceList;
-context.cashEquivalentBalanceList.add("accountName":uiLabelMap.AccountingTotalCashBalance, "balance":balanceTotal);
-cashFlowBalanceTotalList.add("totalName":"AccountingCashBalance", "balance":balanceTotal);
-
-// OPERATING CASH FLOW BALANCE
-// NON_CASH_EXPENSE excluding INVENTORY_ADJUST
-accountBalanceList = [];
-transactionTotals = [];
-balanceTotal = BigDecimal.ZERO;
-List nonCashExpenseAndExprs = FastList.newInstance(mainAndExprs);
-nonCashExpenseAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, nonCashExpanseAccountClassIds));
-nonCashExpenseAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.NOT_IN, inventoryAdjustAccountClassIds));
-transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(nonCashExpenseAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
-if (transactionTotals) {
-    Map transactionTotalsMap = [:];
-    balanceTotalCredit = BigDecimal.ZERO;
-    balanceTotalDebit = BigDecimal.ZERO;
-    transactionTotals.each { transactionTotal ->
-        Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId);
-        if (!accountMap) {
-            accountMap = UtilMisc.makeMapWritable(transactionTotal);
-            accountMap.remove("debitCreditFlag");
-            accountMap.remove("amount");
-            accountMap.D = BigDecimal.ZERO;
-            accountMap.C = BigDecimal.ZERO;
-            accountMap.balance = BigDecimal.ZERO;
-        }
-        UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount);
-        if ("D".equals(transactionTotal.debitCreditFlag)) {
-            balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount);
-        } else {
-            balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount);
-        }
-        BigDecimal debitAmount = (BigDecimal)accountMap.D;
-        BigDecimal creditAmount = (BigDecimal)accountMap.C;
-        BigDecimal balance = debitAmount.subtract(creditAmount);
-        accountMap.balance = balance;
-        transactionTotalsMap.(transactionTotal.glAccountId) = accountMap;
+GenericValue lastClosedTimePeriod = (GenericValue)lastClosedTimePeriodResult.lastClosedTimePeriod;
+// Get the opening balances of Cash Account
+Map openingCashBalances = [:];
+if (lastClosedTimePeriod) {
+    List timePeriodAndExprs = FastList.newInstance();
+    timePeriodAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
+    timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, glAccountClassIds));
+    timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO));
+    timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
+    List lastTimePeriodHistories = delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false);
+    lastTimePeriodHistories.each { lastTimePeriodHistory ->
+        Map accountMap = ["glAccountId":lastTimePeriodHistory.glAccountId, "accountCode":lastTimePeriodHistory.accountCode, "accountName":lastTimePeriodHistory.accountName, "balance":lastTimePeriodHistory.getBigDecimal("endingBalance"), "D":lastTimePeriodHistory.getBigDecimal("postedDebits"), "C":lastTimePeriodHistory.getBigDecimal("postedCredits")];
+        openingCashBalances.(lastTimePeriodHistory.glAccountId) = accountMap;
     }
-    accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"));
-    balanceTotal = balanceTotalDebit.subtract(balanceTotalCredit);
 }
-context.nonCashExpenseBalanceList = accountBalanceList;
-context.nonCashExpenseBalanceList.add("accountName":uiLabelMap.AccountingTotalOperationalCashBalance, "balance":balanceTotal);
-nonCashExpenseBalanceTotal = balanceTotal;
+List mainAndExprs = FastList.newInstance();
+mainAndExprs.add(EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds));
+mainAndExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "Y"));
+mainAndExprs.add(EntityCondition.makeCondition("glFiscalTypeId", EntityOperator.EQUALS, parameters.glFiscalTypeId));
+//mainAndExprs.add(EntityCondition.makeCondition("acctgTransTypeId", EntityOperator.NOT_EQUAL, "PERIOD_CLOSING"));
+mainAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, glAccountClassIds));
 
-// CURRENT_ASSET excluding CASH_EQUIVALENT
+// All GlAccount's transactions (from last closing period to parameter's fromDate) 
 accountBalanceList = [];
 transactionTotals = [];
 balanceTotal = BigDecimal.ZERO;
-List currentAssetAndExprs = FastList.newInstance(mainAndExprs);
-currentAssetAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, currentAssetAccountClassIds));
-currentAssetAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.NOT_IN, cashEquivalentAccountClassIds));
-transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(currentAssetAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
-if (transactionTotals) {
-    Map transactionTotalsMap = [:];
-    balanceTotalCredit = BigDecimal.ZERO;
-    balanceTotalDebit = BigDecimal.ZERO;
-    transactionTotals.each { transactionTotal ->
-        Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId);
-        if (!accountMap) {
-            accountMap = UtilMisc.makeMapWritable(transactionTotal);
+List openingCashBalanceAndExprs = FastList.newInstance(mainAndExprs);
+openingCashBalanceAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, periodClosingFromDate));
+openingCashBalanceAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, parametersFromDate));
+transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(openingCashBalanceAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+transactionTotalsMap = [:];
+transactionTotalsMap.putAll(openingCashBalances);
+transactionTotals.each { transactionTotal ->
+    Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId);
+    if (!accountMap) {
+        accountMap = UtilMisc.makeMapWritable(transactionTotal);
+        accountMap.remove("debitCreditFlag");
+        accountMap.remove("amount");
+        accountMap.D = BigDecimal.ZERO;
+        accountMap.C = BigDecimal.ZERO;
+        accountMap.balance = BigDecimal.ZERO;
+    } else {
+        if (accountMap.debitCreditFlag && accountMap.amount) {
             accountMap.remove("debitCreditFlag");
             accountMap.remove("amount");
-            accountMap.D = BigDecimal.ZERO;
-            accountMap.C = BigDecimal.ZERO;
-            accountMap.balance = BigDecimal.ZERO;
         }
-        UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount);
-        if ("D".equals(transactionTotal.debitCreditFlag)) {
-            balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount);
+        if (transactionTotal.debitCreditFlag == "C") {
+            accountMap.C = ((BigDecimal)accountMap.get("C")).add(transactionTotal.amount);
+            accountMap.balance = (accountMap.balance).subtract(transactionTotal.amount);
         } else {
-            balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount);
+            accountMap.D = ((BigDecimal)accountMap.get("D")).add(transactionTotal.amount);
+            accountMap.balance = (accountMap.balance).add(transactionTotal.amount);
         }
-        BigDecimal debitAmount = (BigDecimal)accountMap.D;
-        BigDecimal creditAmount = (BigDecimal)accountMap.C;
-        BigDecimal balance = debitAmount.subtract(creditAmount);
-        accountMap.balance = balance;
-        transactionTotalsMap.(transactionTotal.glAccountId) = accountMap;
     }
-    accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"));
-    balanceTotal = balanceTotalDebit.subtract(balanceTotalCredit);
+    transactionTotalsMap.put(transactionTotal.glAccountId, accountMap);
 }
-context.currentAssetBalanceList = accountBalanceList;
-context.currentAssetBalanceList.add("accountName":uiLabelMap.AccountingTotalCurrentAssetBalance, "balance":balanceTotal);
-currentAssetBalanceTotal = balanceTotal;
-
-// CURRENT_LIABILITY
-accountBalanceList = [];
-transactionTotals = [];
-balanceTotal = BigDecimal.ZERO;
-List currentLiabilityAndExprs = FastList.newInstance(mainAndExprs);
-currentLiabilityAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, currentLiabilityAccountClassIds));
-transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(currentLiabilityAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
-if (transactionTotals) {
-    Map transactionTotalsMap = [:];
-    balanceTotalCredit = BigDecimal.ZERO;
-    balanceTotalDebit = BigDecimal.ZERO;
-    transactionTotals.each { transactionTotal ->
-        Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId);
-        if (!accountMap) {
-            accountMap = UtilMisc.makeMapWritable(transactionTotal);
-            accountMap.remove("debitCreditFlag");
-            accountMap.remove("amount");
-            accountMap.D = BigDecimal.ZERO;
-            accountMap.C = BigDecimal.ZERO;
-            accountMap.balance = BigDecimal.ZERO;
-        }
-        UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount);
-        if ("D".equals(transactionTotal.debitCreditFlag)) {
-            balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount);
-        } else {
-            balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount);
-        }
-        BigDecimal debitAmount = (BigDecimal)accountMap.D;
-        BigDecimal creditAmount = (BigDecimal)accountMap.C;
-        BigDecimal balance = debitAmount.subtract(creditAmount);
-        accountMap.balance = balance;
-        transactionTotalsMap.(transactionTotal.glAccountId) = accountMap;
-    }
-    accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"));
-    balanceTotal = balanceTotalDebit.subtract(balanceTotalCredit);
+glAccountIdList = [];
+accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"));
+accountBalanceList.each { accountBalance ->
+    balanceTotal = balanceTotal.add(accountBalance.balance);
 }
-context.currentLiabilityBalanceList = accountBalanceList;
-context.currentLiabilityBalanceList.add("accountName":uiLabelMap.AccountingTotalCurrentLiabilityBalance, "balance": balanceTotal);
-currentLiabilityBalanceTotal = balanceTotal;
-
-// TOTAL OPERATION CASH FLOW = NET INCOME + CURRENT_LIABILITY - NON_CASH_EXPENSE escluding INVENTORY_ADJUST - CURRENT_ASSET excluding CASH_EQUIVALENT
-context.totalOperationsCashBalance = ((context.netIncome.add(currentLiabilityBalanceTotal)).subtract(nonCashExpenseBalanceTotal)).subtract(currentAssetBalanceTotal);
-cashFlowBalanceTotalList.add("totalName":"AccountingOperationsCashBalance", "balance":context.totalOperationsCashBalance);
+openingCashBalanceTotal = balanceTotal;
+context.openingCashBalanceList = accountBalanceList;
+cashFlowBalanceTotalList.add("totalName":"AccountingOpeningCashBalance", "balance":balanceTotal);
+openingTransactionKeySet = transactionTotalsMap.keySet();
 
-// INVESTING CASH FLOW AMOUNT
-// LONGTERM_ASSET && ! ACCUM_DEPRECIATION && ! ACCUM_AMORTIZATION
+// PERIOD CASH BALANCE 
+// GlAccounts from parameter's fromDate to parameter's thruDate.
 accountBalanceList = [];
 transactionTotals = [];
 balanceTotal = BigDecimal.ZERO;
-List investingCashAndExprs = FastList.newInstance(mainAndExprs);
-investingCashAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, longTermAssetAccountClassIds));
-investingCashAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.NOT_IN, accumDepreciationAccountClassIds));
-investingCashAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.NOT_IN, accumAmoritizationAccountClassIds));
-transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(investingCashAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+List periodCashBalanceAndExprs = FastList.newInstance(mainAndExprs);
+periodCashBalanceAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, parametersFromDate));
+periodCashBalanceAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, thruDate));
+transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(periodCashBalanceAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
 if (transactionTotals) {
     Map transactionTotalsMap = [:];
     balanceTotalCredit = BigDecimal.ZERO;
@@ -284,96 +165,63 @@
     accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"));
     balanceTotal = balanceTotalDebit.subtract(balanceTotalCredit);
 }
-investingBalanceTotal = balanceTotal;
-context.investingCashBalanceList = accountBalanceList;
-context.investingCashBalanceList.add("accountName":uiLabelMap.AccountingTotalInvestingCashBalance, "balance":balanceTotal);
-cashFlowBalanceTotalList.add("totalName":"AccountingInvestmentsBalance", "balance":((BigDecimal.ZERO).subtract(balanceTotal)));
+periodCashBalanceTotal = balanceTotal;
+context.periodCashBalanceList = accountBalanceList;
+context.periodCashBalanceList.add("accountName":uiLabelMap.AccountingTotalPeriodCashBalance, "balance":balanceTotal);
+cashFlowBalanceTotalList.add("totalName":"AccountingPeriodCashBalance", "balance":balanceTotal);
 
-// FINANCING CASH FLOW AMOUNT
-// LONGTERM_LIABILITY
+// CLOSING BALANCE 
+// GlAccounts from parameter's fromDate to parameter's thruDate.
 accountBalanceList = [];
-transactionTotals = [];
 balanceTotal = BigDecimal.ZERO;
-List longTermLiabilityAndExprs = FastList.newInstance(mainAndExprs);
-longTermLiabilityAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, longTermLiabilityAccountClassIds));
-transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(longTermLiabilityAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+List transactionTotals = FastList.newInstance();
+transactionTotals.addAll(FastList.newInstance(context.openingCashBalanceList));
+transactionTotals.addAll(FastList.newInstance(context.periodCashBalanceList));
+transactionTotals = UtilMisc.sortMaps(transactionTotals, UtilMisc.toList("accountCode"));
+closingTransactionKeySet = [];
 if (transactionTotals) {
     Map transactionTotalsMap = [:];
     balanceTotalCredit = BigDecimal.ZERO;
     balanceTotalDebit = BigDecimal.ZERO;
     transactionTotals.each { transactionTotal ->
-        Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId);
-        if (!accountMap) {
-            accountMap = UtilMisc.makeMapWritable(transactionTotal);
-            accountMap.remove("debitCreditFlag");
-            accountMap.remove("amount");
-            accountMap.D = BigDecimal.ZERO;
-            accountMap.C = BigDecimal.ZERO;
-            accountMap.balance = BigDecimal.ZERO;
-        }
-        UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount);
-        if ("D".equals(transactionTotal.debitCreditFlag)) {
-            balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount);
-        } else {
-            balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount);
+        if (transactionTotal.D != null) {
+            if (transactionTotalsMap.(transactionTotal.glAccountId)) {
+                totalDebitBalance = (transactionTotal.D).add(transactionTotalsMap.(transactionTotal.glAccountId).D);
+                totalCreditBalance = (transactionTotal.C).add(transactionTotalsMap.(transactionTotal.glAccountId).C);
+                if (transactionTotalsMap.(transactionTotal.glAccountId).D == 0 && transactionTotalsMap.(transactionTotal.glAccountId).C == 0) {
+                    transactionTotalsMap.(transactionTotal.glAccountId).balance = (transactionTotal.balance).add(transactionTotalsMap.(transactionTotal.glAccountId).balance);
+                } else {
+                    transactionTotalsMap.(transactionTotal.glAccountId).D = totalDebitBalance;
+                    transactionTotalsMap.(transactionTotal.glAccountId).C = totalCreditBalance;
+                    transactionTotalsMap.(transactionTotal.glAccountId).balance = totalDebitBalance.subtract(totalCreditBalance);
+                }
+            } else {
+                transactionTotalsMap.(transactionTotal.glAccountId) = FastMap.newInstance(transactionTotal);
+            }
+            accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"));
         }
-        BigDecimal debitAmount = (BigDecimal)accountMap.D;
-        BigDecimal creditAmount = (BigDecimal)accountMap.C;
-        BigDecimal balance = debitAmount.subtract(creditAmount);
-        accountMap.balance = balance;
-        transactionTotalsMap.(transactionTotal.glAccountId) = accountMap;
     }
-    accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"));
-    balanceTotal = balanceTotalDebit.subtract(balanceTotalCredit);
+    closingTransactionKeySet = transactionTotalsMap.keySet();
 }
-longTermLiabillityBalanceTotal = balanceTotal; 
-context.longTermLiabilityBalanceList = accountBalanceList;
-context.longTermLiabilityBalanceList.add("accountName":uiLabelMap.AccountingTotalLongTermLiabilityBalance, "balance":balanceTotal);
-cashFlowBalanceTotalList.add("totalName":"AccountingLongTermLiabilityBalance", "balance":balanceTotal);
+accountBalanceList.each { accountBalance ->
+    balanceTotal = balanceTotal.add(accountBalance.balance);
+}
+//closingCashBalanceTotal = balanceTotal;
+context.closingCashBalanceList = accountBalanceList;
+context.closingCashBalanceList.add("accountName":uiLabelMap.AccountingTotalClosingCashBalance, "balance":balanceTotal);
 
-// OWNERS_EQUITY
-accountBalanceList = [];
-transactionTotals = [];
-balanceTotal = BigDecimal.ZERO;
-List ownersEquityAndExprs = FastList.newInstance(mainAndExprs);
-ownersEquityAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, ownersEquityAccountClassIds));
-transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(ownersEquityAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
-if (transactionTotals) {
-    Map transactionTotalsMap = [:];
-    balanceTotalCredit = BigDecimal.ZERO;
-    balanceTotalDebit = BigDecimal.ZERO;
-    transactionTotals.each { transactionTotal ->
-        Map accountMap = (Map)transactionTotalsMap.get(transactionTotal.glAccountId);
-        if (!accountMap) {
-            accountMap = UtilMisc.makeMapWritable(transactionTotal);
-            accountMap.remove("debitCreditFlag");
-            accountMap.remove("amount");
-            accountMap.D = BigDecimal.ZERO;
-            accountMap.C = BigDecimal.ZERO;
-            accountMap.balance = BigDecimal.ZERO;
-        }
-        UtilMisc.addToBigDecimalInMap(accountMap, transactionTotal.debitCreditFlag, transactionTotal.amount);
-        if ("D".equals(transactionTotal.debitCreditFlag)) {
-            balanceTotalDebit = balanceTotalDebit.add(transactionTotal.amount);
-        } else {
-            balanceTotalCredit = balanceTotalCredit.add(transactionTotal.amount);
-        }
-        BigDecimal debitAmount = (BigDecimal)accountMap.D;
-        BigDecimal creditAmount = (BigDecimal)accountMap.C;
-        BigDecimal balance = debitAmount.subtract(creditAmount);
-        accountMap.balance = balance;
-        transactionTotalsMap.(transactionTotal.glAccountId) = accountMap;
+// Get differences of glAccount in closing and opening list and then add difference to opening list.
+if (closingTransactionKeySet) {
+    closingTransactionKeySet.removeAll(openingTransactionKeySet);
+    closingTransactionKeySet.each { closingTransactionKey ->
+        glAccount = delegator.findOne("GlAccount", UtilMisc.toMap("glAccountId", closingTransactionKey), true);
+        context.openingCashBalanceList.add(["glAccountId":glAccount.glAccountId, "accountName":glAccount.accountName, accountCode:glAccount.accountCode, balance:BigDecimal.ZERO, D:BigDecimal.ZERO, C:BigDecimal.ZERO]);
     }
-    accountBalanceList = UtilMisc.sortMaps(transactionTotalsMap.values().asList(), UtilMisc.toList("accountCode"));
-    balanceTotal = balanceTotalCredit.subtract(balanceTotalDebit);
 }
-ownersEquityBalanceTotal = balanceTotal;
-context.ownersEquityBalanceList = accountBalanceList;
-context.ownersEquityBalanceList.add("accountName":uiLabelMap.AccountingOwnersEquityBalance, "balance":balanceTotal);
-cashFlowBalanceTotalList.add("totalName":"AccountingOwnersEquityBalance", "balance":balanceTotal);
+context.openingCashBalanceList.add(["accountName":uiLabelMap.AccountingTotalOpeningCashBalance, "balance":openingCashBalanceTotal]);
 
 // CASH FLOW STATEMENT ENDING BALANCE
-// ENDING BALANCE = CASH BALANCE + OPERATING CASH BALANCE + LONG TERM LIABILITY BALANCE + OWNERS EQUITY BALANCE - INVESTMENT BALANCE
-cashFlowEndingBalance = cashEquivalentBalanceTotal.add(context.totalOperationsCashBalance).add(longTermLiabillityBalanceTotal).add(ownersEquityBalanceTotal).subtract(investingBalanceTotal)
-cashFlowBalanceTotalList.add("totalName":"AccountingCashFlowEndingBalance", "balance":cashFlowEndingBalance);
-context.cashFlowBalanceTotalList = cashFlowBalanceTotalList;
+// ENDING BALANCE = OPENING CASH BALANCE + PERIOD CASH BALANCE 
+endingCashBalanceTotal = openingCashBalanceTotal.add(periodCashBalanceTotal);
+cashFlowBalanceTotalList.add("totalName":"AccountingEndingCashBalance", "balance":endingCashBalanceTotal);
+context.cashFlowBalanceTotalList = cashFlowBalanceTotalList;
\ No newline at end of file

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml?rev=889598&r1=889597&r2=889598&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml Fri Dec 11 12:54:18 2009
@@ -2269,6 +2269,14 @@
         <response name="error" type="view" value="InventoryValuation"/>
     </request-map>
     <request-map uri="CashFlowStatement"><security https="true" auth="true"/><response name="success" type="view" value="CashFlowStatement"/></request-map>
+    <request-map uri="CashFlowStatementListPdf.pdf">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="CashFlowStatementListPdf"/>
+    </request-map>
+    <request-map uri="CashFlowStatementListCsv.csv">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="CashFlowStatementListCsv"/>
+    </request-map>
     
     <!-- ================ Depreciation Calculation Report requests ================ -->
     <request-map uri="showFixedAssetDepreciation">
@@ -2721,6 +2729,8 @@
     <view-map name="InventoryValuationPdf" type="screenfop" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#InventoryValuationPdf" content-type="application/pdf" encoding="none"/>
     <view-map name="InventoryValuationCsv" type="screencsv" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#InventoryValuationCsv" content-type="text/csv" encoding="none"/>
     <view-map name="CashFlowStatement" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#CashFlowStatement"/>
+    <view-map name="CashFlowStatementListPdf" type="screenfop" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#CashFlowStatementListPdf" content-type="application/pdf" encoding="none"/>
+    <view-map name="CashFlowStatementListCsv" type="screencsv" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#CashFlowStatementListCsv" content-type="text/csv" encoding="none"/>
     <!-- Assignment Mappings -->
     <view-map name="EditPartyFixedAssetAssignments" type="screen" page="component://accounting/widget/FixedAssetScreens.xml#EditPartyFixedAssetAssignments"/>
 

Modified: ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml?rev=889598&r1=889597&r2=889598&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml Fri Dec 11 12:54:18 2009
@@ -595,7 +595,7 @@
     </form>
 
     <!-- Cash Flow Statement -->
-    <form name="CashFlowStatementOperationalCash" type="list" list-name="nonCashExpenseBalanceList"
+    <form name="CashFlowStatementOpeningCashBalance" type="list" list-name="openingCashBalanceList"
         odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
         <field name="accountCode">
             <hyperlink target="FindAcctgTransEntries" description="${accountCode}">
@@ -606,7 +606,7 @@
         <field name="accountName" title-area-style="tableheadwide"><display description="${accountName}"/></field>
         <field name="balance" widget-style="tabletextright"><display type="currency" currency="${currencyUomId}"/></field>
     </form>
-    <form name="CashFlowStatementCurrentAsset" type="list" list-name="currentAssetBalanceList"
+    <form name="CashFlowStatementPeriodCashBalance" type="list" list-name="periodCashBalanceList"
         odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
         <field name="accountCode">
             <hyperlink target="FindAcctgTransEntries" description="${accountCode}">
@@ -615,53 +615,11 @@
             </hyperlink>
         </field>
         <field name="accountName" title-area-style="tableheadwide"><display description="${accountName}"/></field>
+        <field name="D" widget-style="tabletextright" title="${uiLabelMap.AccountingTotalDebit_Receipts}"><display type="currency" currency="${currencyUomId}"/></field>
+        <field name="C" widget-style="tabletextright" title="${uiLabelMap.AccountingTotalCredit_Disbursement}"><display type="currency" currency="${currencyUomId}"/></field>
         <field name="balance" widget-style="tabletextright"><display type="currency" currency="${currencyUomId}"/></field>
     </form>
-    <form name="CashFlowStatementCurrentLiability" type="list" list-name="currentLiabilityBalanceList"
-        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
-        <field name="accountCode">
-            <hyperlink target="FindAcctgTransEntries" description="${accountCode}">
-                <parameter param-name="glAccountId"/>
-                <parameter param-name="organizationPartyId"/>
-            </hyperlink>
-        </field>
-        <field name="accountName" title-area-style="tableheadwide"><display description="${accountName}"/></field>
-        <field name="balance" widget-style="tabletextright"><display type="currency" currency="${currencyUomId}"/></field>
-    </form>
-    <form name="CashFlowStatementInvestment" type="list" list-name="investingCashBalanceList"
-        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
-        <field name="accountCode">
-            <hyperlink target="FindAcctgTransEntries" description="${accountCode}">
-                <parameter param-name="glAccountId"/>
-                <parameter param-name="organizationPartyId"/>
-            </hyperlink>
-        </field>
-        <field name="accountName" title-area-style="tableheadwide"><display description="${accountName}"/></field>
-        <field name="balance" widget-style="tabletextright"><display type="currency" currency="${currencyUomId}"/></field>
-    </form>
-    <form name="CashFlowStatementLongTermLiability" type="list" list-name="longTermLiabilityBalanceList"
-        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
-        <field name="accountCode">
-            <hyperlink target="FindAcctgTransEntries" description="${accountCode}">
-                <parameter param-name="glAccountId"/>
-                <parameter param-name="organizationPartyId"/>
-            </hyperlink>
-        </field>
-        <field name="accountName" title-area-style="tableheadwide"><display description="${accountName}"/></field>
-        <field name="balance" widget-style="tabletextright"><display type="currency" currency="${currencyUomId}"/></field>
-    </form>
-    <form name="CashFlowStatementOwnersEquity" type="list" list-name="ownersEquityBalanceList"
-        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
-        <field name="accountCode">
-            <hyperlink target="FindAcctgTransEntries" description="${accountCode}">
-                <parameter param-name="glAccountId"/>
-                <parameter param-name="organizationPartyId"/>
-            </hyperlink>
-        </field>
-        <field name="accountName" title-area-style="tableheadwide"><display description="${accountName}"/></field>
-        <field name="balance" widget-style="tabletextright"><display type="currency" currency="${currencyUomId}"/></field>
-    </form>
-    <form name="CashFlowStatementCashBalance" type="list" list-name="cashEquivalentBalanceList"
+    <form name="CashFlowStatementClosingCashBalance" type="list" list-name="closingCashBalanceList"
         odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
         <field name="accountCode">
             <hyperlink target="FindAcctgTransEntries" description="${accountCode}">
@@ -680,4 +638,18 @@
         <field name="totalName" title="${uiLabelMap.CommonTotal}" title-area-style="tableheadhuge"><display description="${totalName}"/></field>
         <field name="balance" title="_" widget-style="tabletextright"><display type="currency" currency="${currencyUomId}"/></field>
     </form>
+    <form name="FindCashFlowTotals" type="single" target="TransactionTotals" title="Find list of cash flow totals"
+        header-row-style="header-row" default-table-style="basic-table">
+        <field name="organizationPartyId"><hidden/></field>
+        <field name="fromDate"><date-time/></field>
+        <field name="thruDate"><date-time/></field>
+        <field name="glFiscalTypeId" title="${uiLabelMap.FormFieldTitle_glFiscalType}">
+            <drop-down>
+                <entity-options entity-name="GlFiscalType" description="${description}">
+                    <entity-order-by field-name="glFiscalTypeId"/>
+                </entity-options>
+            </drop-down>
+        </field>
+        <field name="submitButton" widget-style="smallSubmit"><submit button-type="button"/></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=889598&r1=889597&r2=889598&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml Fri Dec 11 12:54:18 2009
@@ -1474,7 +1474,6 @@
                 <set field="thruDate" from-field="parameters.thruDate" type="Timestamp" default-value="${nowTimestamp}"/>
                 <set field="glFiscalTypeId" from-field="parameters.glFiscalTypeId" default-value="ACTUAL"/>                                
                 <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/MonthSelection.groovy"/>
-                <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/IncomeStatement.groovy"/>
                 <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/CashFlowStatement.groovy"/>
             </actions>
             <widgets>
@@ -1484,32 +1483,24 @@
                             <include-form name="CashFlowStatementParameters" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
                         </screenlet>
                         <screenlet title="${uiLabelMap.AccountingCashFlowStatement}">
-                            <link text="${uiLabelMap.AccountingExportAsCsv}" style="button" target="">
+                            <link text="${uiLabelMap.AccountingExportAsCsv}" style="button" target="CashFlowStatementListCsv.csv">
                                 <parameter param-name="fromDate" from-field="fromDate"/>
                                 <parameter param-name="thruDate" from-field="thruDate"/>
                                 <parameter param-name="organizationPartyId" from-field="organizationPartyId"/>
                                 <parameter param-name="glFiscalTypeId" from-field="glFiscalTypeId"/>
                             </link>
-                            <link text="${uiLabelMap.AccountingExportAsPdf}" style="button" target="">
+                            <link text="${uiLabelMap.AccountingExportAsPdf}" style="button" target="CashFlowStatementListPdf.pdf">
                                 <parameter param-name="fromDate" from-field="fromDate"/>
                                 <parameter param-name="thruDate" from-field="thruDate"/>
                                 <parameter param-name="organizationPartyId" from-field="organizationPartyId"/>
                                 <parameter param-name="glFiscalTypeId" from-field="glFiscalTypeId"/>
                             </link>
-                            <label style="h3" text="${uiLabelMap.AccountingCashBalance}"/>
-                            <include-form name="CashFlowStatementCashBalance" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
-                            <label style="h3" text="${uiLabelMap.AccountingOperationalCash}"/>
-                            <include-form name="CashFlowStatementOperationalCash" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
-                            <label style="h3" text="${uiLabelMap.AccountingCurrentAsset}"/>
-                            <include-form name="CashFlowStatementCurrentAsset" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
-                            <label style="h3" text="${uiLabelMap.AccountingCurrentLiability}"/>
-                            <include-form name="CashFlowStatementCurrentLiability" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
-                            <label style="h3" text="${uiLabelMap.AccountingInvestment}"/>
-                            <include-form name="CashFlowStatementInvestment" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
-                            <label style="h3" text="${uiLabelMap.AccountingFinanceAndLongTermLiability}"/>
-                            <include-form name="CashFlowStatementLongTermLiability" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
-                            <label style="h3" text="${uiLabelMap.AccountingOwnersEquity}"/>
-                            <include-form name="CashFlowStatementOwnersEquity" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                            <label style="h3" text="${uiLabelMap.AccountingOpeningCashBalance}"/>
+                            <include-form name="CashFlowStatementOpeningCashBalance" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                            <label style="h3" text="${uiLabelMap.AccountingPeriodCashBalance}"/>
+                            <include-form name="CashFlowStatementPeriodCashBalance" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                            <label style="h3" text="${uiLabelMap.AccountingClosingCashBalance}"/>
+                            <include-form name="CashFlowStatementClosingCashBalance" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
                             <label style="h3" text="${uiLabelMap.CommonTotal}"/>
                             <include-form name="CashFlowBalanceTotals" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
                         </screenlet>
@@ -1518,4 +1509,58 @@
             </widgets>
         </section>
     </screen>
+    <screen name="CashFlowStatementListPdf">
+        <section>
+            <actions>
+                <set field="viewSize" value="99999"/>
+                <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
+                <set field="organizationPartyId" from-field="parameters.organizationPartyId"/>
+                <set field="fromDate" from-field="parameters.fromDate" type="Timestamp"/>
+                <set field="thruDate" from-field="parameters.thruDate" type="Timestamp"/>
+                <set field="glFiscalTypeId" from-field="parameters.glFiscalTypeId" default-value="ACTUAL"/>
+                <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/CashFlowStatement.groovy"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="SimpleDecorator" location="component://common/widget/CommonScreens.xml">
+                    <decorator-section name="body">
+                        <container>
+                            <label style="h1" text="${uiLabelMap.AccountingCashFlowStatement}"/>
+                            <include-form name="FindCashFlowTotals" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                            <label style="h3" text="${uiLabelMap.AccountingOpeningCashBalance}"/>
+                            <include-form name="CashFlowStatementOpeningCashBalance" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                            <label style="h3" text="${uiLabelMap.AccountingPeriodCashBalance}"/>
+                            <include-form name="CashFlowStatementPeriodCashBalance" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                            <label style="h3" text="${uiLabelMap.AccountingClosingCashBalance}"/>
+                            <include-form name="CashFlowStatementClosingCashBalance" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                            <label style="h3" text="${uiLabelMap.CommonTotal}"/>
+                            <include-form name="CashFlowBalanceTotals" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                        </container>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+    <screen name="CashFlowStatementListCsv">
+        <section>
+            <actions>
+                <set field="viewSize" value="99999"/>
+                <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
+                <set field="organizationPartyId" from-field="parameters.organizationPartyId"/>
+                <set field="fromDate" from-field="parameters.fromDate" type="Timestamp"/>
+                <set field="thruDate" from-field="parameters.thruDate" type="Timestamp"/>
+                <set field="glFiscalTypeId" from-field="parameters.glFiscalTypeId" default-value="ACTUAL"/>
+                <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/CashFlowStatement.groovy"/>
+            </actions>
+            <widgets>
+                <label style="h3" text="${uiLabelMap.AccountingOpeningCashBalance}"/>
+                <include-form name="CashFlowStatementOpeningCashBalance" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                <label style="h3" text="${uiLabelMap.AccountingPeriodCashBalance}"/>
+                <include-form name="CashFlowStatementPeriodCashBalance" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                <label style="h3" text="${uiLabelMap.AccountingClosingCashBalance}"/>
+                <include-form name="CashFlowStatementClosingCashBalance" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                <label style="h3" text="${uiLabelMap.CommonTotal}"/>
+                <include-form name="CashFlowBalanceTotals" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+            </widgets>
+        </section>
+    </screen>
 </screens>