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

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

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

jacopoc
Author: jacopoc
Date: Thu Dec  3 15:27:10 2009
New Revision: 886815

URL: http://svn.apache.org/viewvc?rev=886815&view=rev
Log:
Completely reimplemented Income Statement: improved data preparation code, added more subtotals, cleaned up code, improved layout (especially of PDF version); still some work needs to be done (labels, layout).


Added:
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/IncomeStatement.groovy   (with props)
Modified:
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/MonthlyTrialBalance.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

Added: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/IncomeStatement.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/IncomeStatement.groovy?rev=886815&view=auto
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/IncomeStatement.groovy (added)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/IncomeStatement.groovy Thu Dec  3 15:27:10 2009
@@ -0,0 +1,282 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.ofbiz.base.util.UtilDateTime;
+import org.ofbiz.base.util.UtilMisc;
+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 javolution.util.FastList;
+
+if (!fromDate) {
+    return;
+}
+if (!thruDate) {
+    thruDate = UtilDateTime.nowTimestamp();
+}
+if (!parameters.glFiscalTypeId) {
+    parameters.glFiscalTypeId = "ACTUAL";
+}
+
+// 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 revenueGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "REVENUE"), true);
+List revenueAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(revenueGlAccountClass);
+GenericValue incomeGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "INCOME"), true);
+List incomeAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(incomeGlAccountClass);
+GenericValue expenseGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "EXPENSE"), true);
+List expenseAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(expenseGlAccountClass);
+GenericValue cogsExpenseGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "COGS_EXPENSE"), true);
+List cogsExpenseAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(cogsExpenseGlAccountClass);
+GenericValue sgaExpenseGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "SGA_EXPENSE"), true);
+List sgaExpenseAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(sgaExpenseGlAccountClass);
+
+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));
+
+// REVENUE
+// account balances
+accountBalanceList = [];
+transactionTotals = [];
+balanceTotal = BigDecimal.ZERO;
+List revenueAndExprs = FastList.newInstance(mainAndExprs);
+revenueAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, revenueAccountClassIds));
+transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(revenueAndExprs, 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.put("D", BigDecimal.ZERO);
+            accountMap.put("C", BigDecimal.ZERO);
+            accountMap.put("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.get("D");
+        BigDecimal creditAmount = (BigDecimal)accountMap.get("C");
+        // revenues are accounts of class CREDIT: the balance is given by credits minus debits
+        BigDecimal balance = creditAmount.subtract(debitAmount);
+        accountMap.put("balance", balance);
+        transactionTotalsMap.put(transactionTotal.glAccountId, accountMap);
+    }
+    accountBalanceList = transactionTotalsMap.values().asList();
+    // revenues are accounts of class CREDIT: the balance is given by credits minus debits
+    balanceTotal = balanceTotalCredit.subtract(balanceTotalDebit);
+}
+context.revenueAccountBalanceList = accountBalanceList;
+context.revenueAccountBalanceList.add(UtilMisc.toMap("accountName", "TOTAL REVENUES", "balance", balanceTotal));
+context.revenueBalanceTotal = balanceTotal;
+
+// EXPENSE
+// account balances
+accountBalanceList = [];
+transactionTotals = [];
+balanceTotal = BigDecimal.ZERO;
+List expenseAndExprs = FastList.newInstance(mainAndExprs);
+expenseAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, expenseAccountClassIds));
+transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(expenseAndExprs, 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.put("D", BigDecimal.ZERO);
+            accountMap.put("C", BigDecimal.ZERO);
+            accountMap.put("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.get("D");
+        BigDecimal creditAmount = (BigDecimal)accountMap.get("C");
+        // expenses are accounts of class DEBIT: the balance is given by debits minus credits
+        BigDecimal balance = debitAmount.subtract(creditAmount);
+        accountMap.put("balance", balance);
+        transactionTotalsMap.put(transactionTotal.glAccountId, accountMap);
+    }
+    accountBalanceList = transactionTotalsMap.values().asList();
+    // revenues are accounts of class DEBIT: the balance is given by debits minus credits
+    balanceTotal = balanceTotalDebit.subtract(balanceTotalCredit);
+}
+context.expenseAccountBalanceList = accountBalanceList;
+context.expenseAccountBalanceList.add(UtilMisc.toMap("accountName", "TOTAL EXPENSES", "balance", balanceTotal));
+context.expenseBalanceTotal = balanceTotal;
+
+// COST OF GOODS SOLD (COGS_EXPENSE)
+// account balances
+accountBalanceList = [];
+transactionTotals = [];
+balanceTotal = BigDecimal.ZERO;
+List cogsExpenseAndExprs = FastList.newInstance(mainAndExprs);
+cogsExpenseAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, cogsExpenseAccountClassIds));
+transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(cogsExpenseAndExprs, 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.put("D", BigDecimal.ZERO);
+            accountMap.put("C", BigDecimal.ZERO);
+            accountMap.put("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.get("D");
+        BigDecimal creditAmount = (BigDecimal)accountMap.get("C");
+        // expenses are accounts of class DEBIT: the balance is given by debits minus credits
+        BigDecimal balance = debitAmount.subtract(creditAmount);
+        accountMap.put("balance", balance);
+        transactionTotalsMap.put(transactionTotal.glAccountId, accountMap);
+    }
+    accountBalanceList = transactionTotalsMap.values().asList();
+    // revenues are accounts of class DEBIT: the balance is given by debits minus credits
+    balanceTotal = balanceTotalDebit.subtract(balanceTotalCredit);
+}
+context.cogsExpense = balanceTotal;
+
+// OPERATING EXPENSES (SGA_EXPENSE)
+// account balances
+accountBalanceList = [];
+transactionTotals = [];
+balanceTotal = BigDecimal.ZERO;
+List sgaExpenseAndExprs = FastList.newInstance(mainAndExprs);
+sgaExpenseAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, sgaExpenseAccountClassIds));
+transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(sgaExpenseAndExprs, 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.put("D", BigDecimal.ZERO);
+            accountMap.put("C", BigDecimal.ZERO);
+            accountMap.put("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.get("D");
+        BigDecimal creditAmount = (BigDecimal)accountMap.get("C");
+        // expenses are accounts of class DEBIT: the balance is given by debits minus credits
+        BigDecimal balance = debitAmount.subtract(creditAmount);
+        accountMap.put("balance", balance);
+        transactionTotalsMap.put(transactionTotal.glAccountId, accountMap);
+    }
+    accountBalanceList = transactionTotalsMap.values().asList();
+    // revenues are accounts of class DEBIT: the balance is given by debits minus credits
+    balanceTotal = balanceTotalDebit.subtract(balanceTotalCredit);
+}
+sgaExpense = balanceTotal;
+
+// INCOME
+// account balances
+accountBalanceList = [];
+transactionTotals = [];
+balanceTotal = BigDecimal.ZERO;
+List incomeAndExprs = FastList.newInstance(mainAndExprs);
+incomeAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, incomeAccountClassIds));
+transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(incomeAndExprs, 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.put("D", BigDecimal.ZERO);
+            accountMap.put("C", BigDecimal.ZERO);
+            accountMap.put("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.get("D");
+        BigDecimal creditAmount = (BigDecimal)accountMap.get("C");
+        // income are accounts of class CREDIT: the balance is given by credits minus debits
+        BigDecimal balance = creditAmount.subtract(debitAmount);
+        accountMap.put("balance", balance);
+        transactionTotalsMap.put(transactionTotal.glAccountId, accountMap);
+    }
+    accountBalanceList = transactionTotalsMap.values().asList();
+    // incomes are accounts of class CREDIT: the balance is given by credits minus debits
+    balanceTotal = balanceTotalCredit.subtract(balanceTotalDebit);
+}
+context.incomeAccountBalanceList = accountBalanceList;
+context.incomeAccountBalanceList.add(UtilMisc.toMap("accountName", "TOTAL INCOME", "balance", balanceTotal));
+context.incomeBalanceTotal = balanceTotal;
+
+// GROSS MARGIN = NET SALES - COSTS OF GOODS SOLD
+context.grossMargin = (context.revenueBalanceTotal).subtract(context.cogsExpense);
+// OPERATING EXPENSES
+context.sgaExpense = sgaExpense;
+// INCOME FROM OPERATIONS = GROSS MARGIN - OPERATING EXPENSES
+context.incomeFromOperations = (context.grossMargin).subtract(context.sgaExpense);
+// NET INCOME
+context.netIncome = (context.revenueBalanceTotal).add(context.incomeBalanceTotal).subtract(context.expenseBalanceTotal);

Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/IncomeStatement.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/IncomeStatement.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/IncomeStatement.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/MonthlyTrialBalance.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/MonthlyTrialBalance.groovy?rev=886815&r1=886814&r2=886815&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/MonthlyTrialBalance.groovy (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/MonthlyTrialBalance.groovy Thu Dec  3 15:27:10 2009
@@ -62,18 +62,6 @@
           context.financialYearFromDate = customTimePeriodFromDate;
       }
   }
-
-
-  if (parameters.isIncomeStatement) {
-      prepareIncomeStatement = dispatcher.runSync("prepareIncomeStatement",
-              [fromDate : fromDate, thruDate : thruDate, organizationPartyId : organizationPartyId, glFiscalTypeId : parameters.glFiscalTypeId, userLogin : userLogin]);
-      glAccountTotalsMap = prepareIncomeStatement.glAccountTotalsMap;
-      if (glAccountTotalsMap) {
-          context.glAccountIncomeList = glAccountTotalsMap.income;
-          context.glAccountExpenseList = glAccountTotalsMap.expenses;
-          context.totalNetIncome = prepareIncomeStatement.totalNetIncome;
-      }
-  }
 }
 
 context.monthList = ExpressionUiHelper.getMonthValueList(locale);

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=886815&r1=886814&r2=886815&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml Thu Dec  3 15:27:10 2009
@@ -2219,12 +2219,6 @@
         <response name="success" type="view" value="ComparativeIncomeStatement"/>
         <response name="error" type="view" value="ComparativeIncomeStatement"/>
     </request-map>
-    <request-map uri="prepareIncomeStatement">
-        <security https="true" auth="true"/>
-        <event type="service" invoke="prepareIncomeStatement"/>
-        <response name="success" type="view" value="IncomeStatement"/>
-        <response name="error" type="view" value="IncomeStatement"/>
-    </request-map>
     <request-map uri="BalanceSheet"><security https="true" auth="true"/><response name="success" type="view" value="BalanceSheet"/></request-map>
     <request-map uri="prepareBalanceSheet">
         <security https="true" auth="true"/>

Modified: ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml?rev=886815&r1=886814&r2=886815&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml Thu Dec  3 15:27:10 2009
@@ -80,7 +80,6 @@
     </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}">
             <drop-down>
                 <list-options list-name="monthList" key-name="value" description="${description}"/>
@@ -98,30 +97,38 @@
         <field name="submitButton" title="${uiLabelMap.CommonSubmit}" widget-style="smallSubmit" tooltip="Please enter From and Thru date in fields above"><submit button-type="button"/></field>
     </form>
 
-    <form name="IncomeStatementList" type="list" list-name="glAccountIncomeList"
+    <form name="IncomeStatementRevenues" type="list" list-name="revenueAccountBalanceList"
         odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
-        <field name="glAccountId">
-            <hyperlink target="FindAcctgTransEntries" description="${glAccountId}">
+        <field name="accountCode">
+            <hyperlink target="FindAcctgTransEntries" description="${accountCode}">
                 <parameter param-name="glAccountId"/>
                 <parameter param-name="organizationPartyId"/>
             </hyperlink>
         </field>
-        <field name="accountName" entry-name="glAccountId"><display-entity entity-name="GlAccount" key-field-name="glAccountId" description="${accountName}"/></field>
-        <field name="totalAmount"><display type="currency" currency="${currencyUomId}"/></field>
-        <field name="totalOfCurrentFiscalPeriod"><display type="currency" currency="${currencyUomId}"/></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="ExpenseStatementList" type="list" list-name="glAccountExpenseList"
+    <form name="IncomeStatementExpenses" type="list" list-name="expenseAccountBalanceList"
         odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
-        <field name="glAccountId">
-            <hyperlink target="FindAcctgTransEntries" description="${glAccountId}">
+        <field name="accountCode">
+            <hyperlink target="FindAcctgTransEntries" description="${accountCode}">
                 <parameter param-name="glAccountId"/>
                 <parameter param-name="organizationPartyId"/>
             </hyperlink>
         </field>
-        <field name="accountName" entry-name="glAccountId"><display-entity entity-name="GlAccount" key-field-name="glAccountId" description="${accountName}"/></field>
-        <field name="totalAmount"><display type="currency" currency="${currencyUomId}"/></field>
-        <field name="totalOfCurrentFiscalPeriod"><display type="currency" currency="${currencyUomId}"/></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="IncomeStatementIncome" type="list" list-name="incomeAccountBalanceList"
+        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="BalanceSheetParameters" type="single" target="prepareBalanceSheet"

Modified: ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml?rev=886815&r1=886814&r2=886815&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml Thu Dec  3 15:27:10 2009
@@ -288,14 +288,13 @@
                 <set field="partyAcctgPreference" from-field="result.partyAccountingPreference"/>
                 <set field="currencyUomId" from-field="partyAcctgPreference.baseCurrencyUomId"/>
                 <!-- Get a default fromDate -->
-                <set field="findLastClosedDateInMap.organizationPartyId" from-field="organizationPartyId"/>
-                <service service-name="findLastClosedDate" in-map-name="findLastClosedDateInMap">
-                    <result-to-field result-name="lastClosedDate"/>
-                    <result-to-field result-name="lastClosedTimePeriod"/>
+                <service service-name="findLastClosedDate" result-map="findLastClosedDateOutMap">
+                    <field-map field-name="organizationPartyId" from-field="organizationPartyId"/>
                 </service>
-                <set field="fromDate" from-field="parameters.fromDate" type="Timestamp" default-value="${lastClosedDate}"/>
+                <set field="fromDate" from-field="parameters.fromDate" type="Timestamp" default-value="${findLastClosedDateOutMap.lastClosedDate}"/>
                 <set field="thruDate" from-field="parameters.thruDate" type="Timestamp" default-value="${nowTimestamp}"/>
                 <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/MonthlyTrialBalance.groovy"/>
+                <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/IncomeStatement.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="CommonOrganizationAccountingReportsDecorator" location="${parameters.mainDecoratorLocation}">
@@ -312,27 +311,46 @@
                                     <link text="${uiLabelMap.AccountingExportAsCsv}" style="button" target="IncomeStatementListCsv.csv">
                                         <parameter param-name="fromDate" from-field="parameters.fromDate"/>
                                         <parameter param-name="thruDate" from-field="parameters.thruDate"/>
-                                        <parameter param-name="isIncomeStatement" value="true"/>
-                                        <parameter param-name="selectedMonth" from-field="parameters.selectedMonth"/>
                                         <parameter param-name="organizationPartyId" from-field="parameters.organizationPartyId"/>
                                         <parameter param-name="glFiscalTypeId" from-field="parameters.glFiscalTypeId"/>
                                     </link>
                                     <link text="${uiLabelMap.AccountingExportAsPdf}" style="button" target="IncomeStatementListPdf.pdf">
                                         <parameter param-name="fromDate" from-field="parameters.fromDate"/>
                                         <parameter param-name="thruDate" from-field="parameters.thruDate"/>
-                                        <parameter param-name="isIncomeStatement" value="true"/>
-                                        <parameter param-name="selectedMonth" from-field="parameters.selectedMonth"/>
                                         <parameter param-name="organizationPartyId" from-field="parameters.organizationPartyId"/>
                                         <parameter param-name="glFiscalTypeId" from-field="parameters.glFiscalTypeId"/>
                                     </link>
-                                    <container style="h3"><label text="${uiLabelMap.AccountingIncome}"/></container>
-                                    <include-form name="IncomeStatementList" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
-                                    <container style="h3"><label text="${uiLabelMap.AccountingExpenses}"/></container>
-                                    <include-form name="ExpenseStatementList" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                                    <container>
+                                        <label style="h3" text="${uiLabelMap.AccountingRevenues}"/>
+                                    </container>
+                                    <include-form name="IncomeStatementRevenues" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                                    <container>
+                                        <label style="h3" text="${uiLabelMap.AccountingExpenses}"/>
+                                    </container>
+                                    <include-form name="IncomeStatementExpenses" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                                    <container>
+                                        <label style="h3" text="${uiLabelMap.AccountingIncome}"/>
+                                    </container>
+                                    <include-form name="IncomeStatementIncome" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                                    <container>
+                                        <label style="h3" text="${uiLabelMap.AccountingNetSales}: ${revenueBalanceTotal}"/>
+                                    </container>
+                                    <container>
+                                        <label style="h3" text="${uiLabelMap.AccountingCostOfGoodsSold}: ${cogsExpense}"/>
+                                    </container>
+                                    <container>
+                                        <label style="h3" text="${uiLabelMap.AccountingGrossMargin}: ${grossMargin}"/>
+                                    </container>
+                                    <container>
+                                        <label style="h3" text="${uiLabelMap.AccountingOperatingExpenses}: ${sgaExpense}"/>
+                                    </container>
+                                    <container>
+                                        <label style="h3" text="${uiLabelMap.AccountingIncomeFromOperations}: ${incomeFromOperations}"/>
+                                    </container>
+                                    <container>
+                                        <label style="h3" text="${uiLabelMap.AccountingNetIncome}: ${netIncome}"/>
+                                    </container>
                                 </screenlet>
-                                <container>
-                                    <label style="h3" text="${uiLabelMap.AccountingNetIncome}: ${totalNetIncome}"/>
-                                </container>
                             </widgets>
                         </section>
                     </decorator-section>
@@ -463,12 +481,10 @@
                 <set field="partyAcctgPreference" from-field="result.partyAccountingPreference"/>
                 <set field="currencyUomId" from-field="partyAcctgPreference.baseCurrencyUomId"/>
                 <!-- Get a default fromDate -->
-                <set field="findLastClosedDateInMap.organizationPartyId" from-field="organizationPartyId"/>
-                <service service-name="findLastClosedDate" in-map-name="findLastClosedDateInMap">
-                    <result-to-field result-name="lastClosedDate"/>
-                    <result-to-field result-name="lastClosedTimePeriod"/>
+                <service service-name="findLastClosedDate" result-map="findLastClosedDateOutMap">
+                    <field-map field-name="organizationPartyId" from-field="organizationPartyId"/>
                 </service>
-                <set field="fromDate" from-field="parameters.fromDate" type="Timestamp" default-value="${lastClosedDate}"/>
+                <set field="fromDate" from-field="parameters.fromDate" type="Timestamp" default-value="${findLastClosedDateOutMap.lastClosedDate}"/>
                 <set field="thruDate" from-field="parameters.thruDate" type="Timestamp" default-value="${nowTimestamp}"/>
                 <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy"/>
             </actions>
@@ -587,17 +603,47 @@
                 <set field="viewSize" value="99999"/>
                 <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
                 <set field="organizationPartyId" from-field="parameters.organizationPartyId"/>
-                <set field="isPdf" value="true" type="Boolean"/>
-                <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/MonthlyTrialBalance.groovy"/>
+                <set field="fromDate" from-field="parameters.fromDate" type="Timestamp"/>
+                <set field="thruDate" from-field="parameters.thruDate" type="Timestamp"/>
+                <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/IncomeStatement.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="SimpleDecorator" location="component://common/widget/CommonScreens.xml">
                     <decorator-section name="body">
-                        <container style="h3"><label text="${uiLabelMap.AccountingIncome}"/></container>
-                        <include-form name="IncomeStatementList" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
-                        <container style="h3"><label text="${uiLabelMap.AccountingExpenses}"/></container>
-                        <include-form name="ExpenseStatementList" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
-                        <container><label style="h3" text="${uiLabelMap.AccountingNetIncome}: ${totalNetIncome}"/></container>
+                        <container>
+                            <label style="h1" text="${uiLabelMap.AccountingIncomeStatement}"/>
+                        </container>
+                        <include-form name="FindTransactionTotals" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                        <container>
+                            <label style="h3" text="${uiLabelMap.AccountingRevenues}"/>
+                        </container>
+                        <include-form name="IncomeStatementRevenues" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                        <container>
+                            <label style="h3" text="${uiLabelMap.AccountingExpenses}"/>
+                        </container>
+                        <include-form name="IncomeStatementExpenses" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                        <container>
+                            <label style="h3" text="${uiLabelMap.AccountingIncome}"/>
+                        </container>
+                        <include-form name="IncomeStatementIncome" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                        <container>
+                            <label style="h3" text="${uiLabelMap.AccountingNetSales}: ${revenueBalanceTotal}"/>
+                        </container>
+                        <container>
+                            <label style="h3" text="${uiLabelMap.AccountingCostOfGoodsSold}: ${cogsExpense}"/>
+                        </container>
+                        <container>
+                            <label style="h3" text="${uiLabelMap.AccountingGrossMargin}: ${grossMargin}"/>
+                        </container>
+                        <container>
+                            <label style="h3" text="${uiLabelMap.AccountingOperatingExpenses}: ${sgaExpense}"/>
+                        </container>
+                        <container>
+                            <label style="h3" text="${uiLabelMap.AccountingIncomeFromOperations}: ${incomeFromOperations}"/>
+                        </container>
+                        <container>
+                            <label style="h3" text="${uiLabelMap.AccountingNetIncome}: ${netIncome}"/>
+                        </container>
                     </decorator-section>
                 </decorator-screen>
             </widgets>
@@ -610,14 +656,41 @@
                 <set field="viewSize" value="99999"/>
                 <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
                 <set field="organizationPartyId" from-field="parameters.organizationPartyId"/>
-                <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/MonthlyTrialBalance.groovy"/>
+                <set field="fromDate" from-field="parameters.fromDate" type="Timestamp"/>
+                <set field="thruDate" from-field="parameters.thruDate" type="Timestamp"/>
+                <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/IncomeStatement.groovy"/>
             </actions>
             <widgets>
-                <container><label text="${uiLabelMap.AccountingIncome}"/></container>
-                <include-form name="IncomeStatementListCsv" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
-                <container><label text="${uiLabelMap.AccountingExpenses}"/></container>
-                <include-form name="ExpenseStatementListCsv" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
-                <container><label text="${uiLabelMap.AccountingNetIncome}: ${totalNetIncome}"/></container>
+                <container>
+                    <label style="h3" text="${uiLabelMap.AccountingRevenues}"/>
+                </container>
+                <include-form name="IncomeStatementRevenues" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                <container>
+                    <label style="h3" text="${uiLabelMap.AccountingExpenses}"/>
+                </container>
+                <include-form name="IncomeStatementExpenses" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                <container>
+                    <label style="h3" text="${uiLabelMap.AccountingIncome}"/>
+                </container>
+                <include-form name="IncomeStatementIncome" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+                <container>
+                    <label style="h3" text="${uiLabelMap.AccountingNetSales}: ${revenueBalanceTotal}"/>
+                </container>
+                <container>
+                    <label style="h3" text="${uiLabelMap.AccountingCostOfGoodsSold}: ${cogsExpense}"/>
+                </container>
+                <container>
+                    <label style="h3" text="${uiLabelMap.AccountingGrossMargin}: ${grossMargin}"/>
+                </container>
+                <container>
+                    <label style="h3" text="${uiLabelMap.AccountingOperatingExpenses}: ${sgaExpense}"/>
+                </container>
+                <container>
+                    <label style="h3" text="${uiLabelMap.AccountingIncomeFromOperations}: ${incomeFromOperations}"/>
+                </container>
+                <container>
+                    <label style="h3" text="${uiLabelMap.AccountingNetIncome}: ${netIncome}"/>
+                </container>
             </widgets>
         </section>
     </screen>
@@ -976,12 +1049,10 @@
                 <set field="tabButtonItem2" value="CostCenterReport"/>
                 <set field="organizationPartyId" from-field="parameters.organizationPartyId" type="String"/>
                 <!-- Get a default fromDate -->
-                <set field="findLastClosedDateInMap.organizationPartyId" from-field="organizationPartyId"/>
-                <service service-name="findLastClosedDate" in-map-name="findLastClosedDateInMap">
-                    <result-to-field result-name="lastClosedDate"/>
-                    <result-to-field result-name="lastClosedTimePeriod"/>
+                <service service-name="findLastClosedDate" result-map="findLastClosedDateOutMap">
+                    <field-map field-name="organizationPartyId" from-field="organizationPartyId"/>
                 </service>
-                <set field="fromDate" from-field="parameters.fromDate" type="Timestamp" default-value="${lastClosedDate}"/>
+                <set field="fromDate" from-field="parameters.fromDate" type="Timestamp" default-value="${findLastClosedDateOutMap.lastClosedDate}"/>
                 <set field="thruDate" from-field="parameters.thruDate" type="Timestamp" default-value="${nowTimestamp}"/>
 
                 <set field="glAcctgOrgAndCostCenterList" from-field="parameters.glAcctgOrgAndCostCenterList" type="List"/>