Author: ashish
Date: Mon Aug 17 06:19:34 2009 New Revision: 804869 URL: http://svn.apache.org/viewvc?rev=804869&view=rev Log: Applied patch from jira issue OFBIZ-2835 (Under Accounting - Report tab create a new screen for showing comparative income statements.) Following points are covered in this patch: 1) Added New tab under Accounting -> Organization Gl Setting (Company) -> Reports with name Comparative Income Statment . 2) Used groovy for preparing list of compared income/expenses statements. 3) Added list form to show compared Income/expenses statements. Thanks Awdesh and Sumit for the contribution. Added: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/ComparativeIncomeStatement.groovy (with props) Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml ofbiz/trunk/applications/accounting/widget/Menus.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=804869&r1=804868&r2=804869&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original) +++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Mon Aug 17 06:19:34 2009 @@ -2003,6 +2003,10 @@ <value xml:lang="th">à¹à¸à¸£à¸µà¸¢à¸à¹à¸à¸µà¸¢à¸à¸à¸à¸à¸¸à¸¥</value> <value xml:lang="zh">æ¯è¾èµäº§è´åºè¡¨</value> </property> + <property key="AccountingComparativeIncomeStatement"> + <value xml:lang="en">Comparative Income Statement</value> + <value xml:lang="hi_IN">तà¥à¤²à¤¨à¤¾à¤¤à¥à¤®à¤ à¤à¤¯ विवरण</value> + </property> <property key="AccountingCompleteAcctgTransFields"> <value xml:lang="en">Complete transaction fields</value> <value xml:lang="fr">Remplissez les champs de la transaction</value> @@ -7575,6 +7579,14 @@ <value xml:lang="th">à¸à¹à¸§à¸à¹à¸§à¸¥à¸²à¸ªà¸±à¹à¸ à¹</value> <value xml:lang="zh">åæ¶é´æ®µ</value> </property> + <property key="AccountingPeriod1TotalAmount"> + <value xml:lang="en">Period1 Total Amount</value> + <value xml:lang="hi_IN">ठवधि 1 à¤à¥à¤² राशि</value> + </property> + <property key="AccountingPeriod2TotalAmount"> + <value xml:lang="en">Period2 Total Amount</value> + <value xml:lang="hi_IN">ठवधि 2 à¤à¥à¤² राशि</value> + </property> <property key="AccountingPeriodName"> <value xml:lang="en">Period Name</value> <value xml:lang="fr">Nom de période</value> @@ -11278,6 +11290,14 @@ <value xml:lang="th">à¹à¸ªà¸à¸à¹à¸à¸¢à¸£à¸«à¸±à¸ªà¸à¸¥à¸¸à¹à¸¡à¸à¸¹à¹à¹à¸à¹</value> <value xml:lang="zh">æ§è¡è çä¼åæ è¯</value> </property> + <property key="FormFieldTitle_period1FromDate"> + <value xml:lang="en">Period1 From Date</value> + <value xml:lang="hi_IN">ठवधि 1 दिनाà¤à¤ सà¥</value> + </property> + <property key="FormFieldTitle_period2FromDate"> + <value xml:lang="en">Period2 From Date</value> + <value xml:lang="hi_IN">ठवधि 2 दिनाà¤à¤ सà¥</value> + </property> <property key="FormFieldTitle_period1GlFiscalTypeId"> <value xml:lang="en">Period1 Gl Fiscal Type Id</value> <value xml:lang="fr">Réf. de type d'exercice 1</value> Added: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/ComparativeIncomeStatement.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/ComparativeIncomeStatement.groovy?rev=804869&view=auto ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/ComparativeIncomeStatement.groovy (added) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/ComparativeIncomeStatement.groovy Mon Aug 17 06:19:34 2009 @@ -0,0 +1,112 @@ +/* + * 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 java.math.BigDecimal; +import java.sql.Timestamp; +import org.ofbiz.entity.util.EntityUtil; + +if (period1FromDate && period1ThruDate && organizationPartyId && period2FromDate && period2ThruDate) { + onlyIncludePeriodTypeIdList = []; + onlyIncludePeriodTypeIdList.add("FISCAL_YEAR"); + glAccountIncomeList = []; + glAccountExpenseList = []; + periodExpenses = []; + periodIncomes = []; + glAccountTotalsMapForPeriod1 = getGlAccountTotals(onlyIncludePeriodTypeIdList, period1FromDate, period1ThruDate, organizationPartyId, parameters.glFiscalTypeId); + period1Expenses = []; + period1Incomes = []; + if (glAccountTotalsMapForPeriod1) { + period1Expenses = glAccountTotalsMapForPeriod1.expenses; + period1Incomes = glAccountTotalsMapForPeriod1.income; + if (period1Incomes) + periodIncomes.addAll(period1Incomes); + if (period1Expenses) + periodExpenses.addAll(period1Expenses); + } + glAccountTotalsMapForPeriod2 = getGlAccountTotals(onlyIncludePeriodTypeIdList ,period2FromDate ,period2ThruDate ,organizationPartyId , parameters.glFiscalTypeId); + period2Expenses = []; + period2Incomes = []; + if (glAccountTotalsMapForPeriod2) { + period2Expenses = glAccountTotalsMapForPeriod2.expenses; + period2Incomes = glAccountTotalsMapForPeriod2.income; + period2Expenses.each { period2Expense -> + if (!((periodExpenses.glAccountId).contains(period2Expense.glAccountId))) + periodExpenses.add(period2Expense); + } + period2Incomes.each { period2Income -> + if (!((periodIncomes.glAccountId).contains(period2Income.glAccountId))) + periodIncomes.add(period2Income); + } + } + periodExpenses.each { periodExpense -> + period1TotalAmount = BigDecimal.ZERO; + period2TotalAmount = BigDecimal.ZERO; + if ((period1Expenses.glAccountId).contains(periodExpense.glAccountId)) { + period1Expenses.each { period1Expense -> + if(periodExpense.glAccountId.equals(period1Expense.glAccountId)) + period1TotalAmount = period1Expense.totalAmount; + } + } + if ((period2Expenses.glAccountId).contains(periodExpense.glAccountId)) { + period2Expenses.each { period2Expense -> + if(periodExpense.glAccountId.equals(period2Expense.glAccountId)) + period2TotalAmount = period2Expense.totalAmount; + } + } + glAccountExpenseList.add([glAccountId : periodExpense.glAccountId , period1TotalAmount : period1TotalAmount , period2TotalAmount : period2TotalAmount]); + context.glAccountExpenseList = glAccountExpenseList; + } + periodIncomes.each { periodIncome -> + period1TotalAmount = BigDecimal.ZERO; + period2TotalAmount = BigDecimal.ZERO; + if ((period1Incomes.glAccountId).contains(periodIncome.glAccountId)) { + period1Incomes.each { period1Income -> + if(periodIncome.glAccountId.equals(period1Income.glAccountId)) + period1TotalAmount = period1Income.totalAmount; + } + } + if ((period2Incomes.glAccountId).contains(periodIncome.glAccountId)) { + period2Incomes.each { period2Income -> + if(periodIncome.glAccountId.equals(period2Income.glAccountId)) + period2TotalAmount = period2Income.totalAmount; + } + } + glAccountIncomeList.add([glAccountId : periodIncome.glAccountId , period1TotalAmount : period1TotalAmount , period2TotalAmount : period2TotalAmount]); + context.glAccountIncomeList = glAccountIncomeList; + } +} + +private Map getGlAccountTotals(List onlyIncludePeriodTypeIdList, Timestamp fromDate, Timestamp thruDate, String organizationPartyId, String glFiscalTypeId) { + customTimePeriodResult = dispatcher.runSync("findCustomTimePeriods", [findDate : thruDate, organizationPartyId : organizationPartyId, onlyIncludePeriodTypeIdList : onlyIncludePeriodTypeIdList, userLogin : userLogin]); + if (customTimePeriodResult) { + customTimePeriod = EntityUtil.getFirst(customTimePeriodResult.customTimePeriodList); + if (customTimePeriod) { + customTimePeriodFromDate = new Timestamp((customTimePeriod.fromDate).getTime()); + customTimePeriodThruDate = new Timestamp((customTimePeriod.thruDate).getTime()); + if (customTimePeriodFromDate.compareTo(fromDate) > 0) + fromDate = customTimePeriodFromDate; + if (customTimePeriodThruDate.compareTo(thruDate) < 0) + thruDate = customTimePeriodThruDate; + context.financialYearFromDate = customTimePeriodFromDate; + } + prepareIncomeStatement = dispatcher.runSync("prepareIncomeStatement", + [fromDate : fromDate, thruDate : thruDate, organizationPartyId : organizationPartyId, glFiscalTypeId : glFiscalTypeId, userLogin : userLogin]); + return glAccountTotalsMap = prepareIncomeStatement.glAccountTotalsMap; + } +} \ No newline at end of file Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/ComparativeIncomeStatement.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/ComparativeIncomeStatement.groovy ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/ComparativeIncomeStatement.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain 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=804869&r1=804868&r2=804869&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml Mon Aug 17 06:19:34 2009 @@ -2170,6 +2170,11 @@ <request-map uri="SalesInvoiceByProductCategorySummary"><security https="true" auth="true"/><response name="success" type="view" value="SalesInvoiceByProductCategorySummary"/></request-map> <request-map uri="TrialBalance"><security https="true" auth="true"/><response name="success" type="view" value="TrialBalance"/></request-map> <request-map uri="IncomeStatement"><security https="true" auth="true"/><response name="success" type="view" value="IncomeStatement"/></request-map> + <request-map uri="ComparativeIncomeStatement"> + <security https="true" auth="true"/> + <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"/> @@ -2666,6 +2671,7 @@ <view-map name="SalesInvoiceByProductCategorySummary" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#SalesInvoiceByProductCategorySummary"/> <view-map name="TrialBalance" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#TrialBalance"/> <view-map name="IncomeStatement" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#IncomeStatement"/> + <view-map name="ComparativeIncomeStatement" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#ComparativeIncomeStatement"/> <view-map name="BalanceSheet" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#BalanceSheet"/> <view-map name="ComparativeBalanceSheet" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#ComparativeBalanceSheet"/> <view-map name="TransactionTotals" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#TransactionTotals"/> Modified: ofbiz/trunk/applications/accounting/widget/Menus.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/Menus.xml?rev=804869&r1=804868&r2=804869&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/Menus.xml (original) +++ ofbiz/trunk/applications/accounting/widget/Menus.xml Mon Aug 17 06:19:34 2009 @@ -756,6 +756,11 @@ <parameter param-name="organizationPartyId"/> </link> </menu-item> + <menu-item name="ComparativeIncomeStatement" title="${uiLabelMap.AccountingComparativeIncomeStatement}"> + <link target="ComparativeIncomeStatement"> + <parameter param-name="organizationPartyId"/> + </link> + </menu-item> <menu-item name="BalanceSheet" title="${uiLabelMap.AccountingBalanceSheet}"> <link target="BalanceSheet"> <parameter param-name="organizationPartyId"/> Modified: ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml?rev=804869&r1=804868&r2=804869&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml (original) +++ ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml Mon Aug 17 06:19:34 2009 @@ -541,4 +541,36 @@ <field name="totalInventoryCost" use-when="currencyUomId==null" title="${uiLabelMap.CommonTotalValue}"><display description="${uiLabelMap.ProductDifferentCurrencies}"/></field> </form> + <form name="ComparativeIncomeStatementParameters" type="single" header-row-style="header-row" default-table-style="basic-table"> + <field name="period1FromDate" title="${uiLabelMap.FormFieldTitle_period1FromDate}" required-field="true" position="1"><date-time type="timestamp"/></field> + <field name="period1ThruDate" title="${uiLabelMap.FormFieldTitle_period1ThruDate}" required-field="true" position="2"><date-time type="timestamp"/></field> + <field name="period2FromDate" title="${uiLabelMap.FormFieldTitle_period2FromDate}" required-field="true" position="1"><date-time type="timestamp"/></field> + <field name="period2ThruDate" title="${uiLabelMap.FormFieldTitle_period2ThruDate}" required-field="true" position="2"><date-time type="timestamp"/></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" title="${uiLabelMap.CommonSubmit}" widget-style="smallSubmit" tooltip="Please enter From and Thru date in fields above"><submit button-type="button"/></field> + </form> + + <form name="ComparativeIncomeStatementList" type="list" list-name="glAccountIncomeList" + odd-row-style="alternate-row" default-table-style="basic-table hover-bar"> + <row-actions> + <entity-one entity-name="GlAccount" value-field="glAccount"/> + </row-actions> + <field name="glAccountId" title="${uiLabelMap.AccountingGlAccountId}"> + <hyperlink target="FindAcctgTransEntries" description="${glAccountId}"> + <parameter param-name="glAccountId"/> + <parameter param-name="organizationPartyId"/> + </hyperlink> + </field> + <field name="accountName" title="${uiLabelMap.FormFieldTitle_accountName}"><display description="${glAccount.accountName}"/></field> + <field name="period1TotalAmount" title="${uiLabelMap.AccountingPeriod1TotalAmount}"><display type="currency" currency="${currencyUomId}"/></field> + <field name="period2TotalAmount" title="${uiLabelMap.AccountingPeriod1TotalAmount}"><display type="currency" currency="${currencyUomId}"/></field> + </form> + + <form name="ComparativeExpenseStatementList" type="list" list-name="glAccountExpenseList" extends="ComparativeIncomeStatementList"/> </forms> Modified: ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml?rev=804869&r1=804868&r2=804869&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml (original) +++ ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml Mon Aug 17 06:19:34 2009 @@ -1217,4 +1217,37 @@ </section> </screen> + <screen name="ComparativeIncomeStatement"> + <section> + <actions> + <set field="titleProperty" value="AccountingComparativeIncomeStatement"/> + <set field="tabButtonItem" value="OrganizationAccountingReports"/> + <set field="tabButtonItem2" value="ComparativeIncomeStatement"/> + <set field="organizationPartyId" from-field="parameters.organizationPartyId"/> + <service service-name="getPartyAccountingPreferences" result-map="result" auto-field-map="true"/> + <set field="partyAcctgPreference" from-field="result.partyAccountingPreference"/> + <set field="currencyUomId" from-field="partyAcctgPreference.baseCurrencyUomId"/> + <set field="period1FromDate" from-field="parameters.period1FromDate" type="Timestamp"/> + <set field="period1ThruDate" from-field="parameters.period1ThruDate" type="Timestamp"/> + <set field="period2FromDate" from-field="parameters.period2FromDate" type="Timestamp"/> + <set field="period2ThruDate" from-field="parameters.period2ThruDate" type="Timestamp"/> + <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/ComparativeIncomeStatement.groovy"/> + </actions> + <widgets> + <decorator-screen name="CommonOrganizationAccountingReportsDecorator" location="${parameters.mainDecoratorLocation}"> + <decorator-section name="body"> + <screenlet title="${uiLabelMap.AccountingComparativeIncomeStatement}"> + <include-form name="ComparativeIncomeStatementParameters" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/> + </screenlet> + <screenlet title="${uiLabelMap.AccountingComparativeIncomeStatement}"> + <container style="h3"><label text="${uiLabelMap.AccountingIncome}"/></container> + <include-form name="ComparativeIncomeStatementList" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/> + <container style="h3"><label text="${uiLabelMap.AccountingExpences}"/></container> + <include-form name="ComparativeExpenseStatementList" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/> + </screenlet> + </decorator-section> + </decorator-screen> + </widgets> + </section> + </screen> </screens> |
Free forum by Nabble | Edit this page |