Author: ashish
Date: Mon Aug 17 14:22:29 2009 New Revision: 804993 URL: http://svn.apache.org/viewvc?rev=804993&view=rev Log: Applied patch from jira issue OFBIZ-2835 - Under Accounting - Report tab create a new screen for showing comparative income statements. Following point is covered in this patch: – Added option and functionality for generating CSV and PDF on same screen. Thanks Awdesh & Sumit for the contribution. Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/ComparativeIncomeStatement.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=804993&r1=804992&r2=804993&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original) +++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Mon Aug 17 14:22:29 2009 @@ -3115,8 +3115,8 @@ <value xml:lang="th">Error: à¸à¸§à¸²à¸¡à¸à¸´à¸à¸à¸¥à¸²à¸! à¹à¸à¸à¸²à¸£à¸ªà¸£à¹à¸²à¸à¹à¸à¹à¸ªà¸£à¹à¸à¸£à¸²à¸¢à¸à¸²à¸£à¸ªà¸±à¹à¸à¸à¸·à¹à¸à¸ªà¸´à¸à¸à¹à¸²à¸à¸²à¸à¸£à¸²à¸¢à¸à¸²à¸£à¸ªà¸±à¹à¸à¸à¸·à¹à¸</value> <value xml:lang="zh">ä»å®åå建å®åæç»è´¦åæ¶åºé</value> </property> - <property key="AccountingExpences"> - <value xml:lagn="en">Expences</value> + <property key="AccountingExpenses"> + <value xml:lagn="en">Expenses</value> <value xml:lagn="hi_IN">वà¥à¤¯à¤¯</value> </property> <property key="AccountingExpEndOfLifeIsEmpty"> @@ -7579,6 +7579,14 @@ <value xml:lang="th">à¸à¹à¸§à¸à¹à¸§à¸¥à¸²à¸ªà¸±à¹à¸ à¹</value> <value xml:lang="zh">åæ¶é´æ®µ</value> </property> + <property key="AccountingPeriod1NetIncome"> + <value xml:lang="en">Period1 Net Income</value> + <value xml:lang="hi_IN">ठवधि 1 शà¥à¤¦à¥à¤§ à¤à¤¯</value> + </property> + <property key="AccountingPeriod2NetIncome"> + <value xml:lang="en">Period2 Net Income</value> + <value xml:lang="hi_IN">ठवधि 2 शà¥à¤¦à¥à¤§ à¤à¤¯</value> + </property> <property key="AccountingPeriod1TotalAmount"> <value xml:lang="en">Period1 Total Amount</value> <value xml:lang="hi_IN">ठवधि 1 à¤à¥à¤² राशि</value> Modified: 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=804993&r1=804992&r2=804993&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/ComparativeIncomeStatement.groovy (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/ComparativeIncomeStatement.groovy Mon Aug 17 14:22:29 2009 @@ -21,6 +21,11 @@ import java.sql.Timestamp; import org.ofbiz.entity.util.EntityUtil; +period1FromDate = parameters.period1FromDate; +period1ThruDate = parameters.period1ThruDate; +period2FromDate = parameters.period2FromDate; +period2ThruDate = parameters.period2ThruDate; + if (period1FromDate && period1ThruDate && organizationPartyId && period2FromDate && period2ThruDate) { onlyIncludePeriodTypeIdList = []; onlyIncludePeriodTypeIdList.add("FISCAL_YEAR"); @@ -28,31 +33,39 @@ glAccountExpenseList = []; periodExpenses = []; periodIncomes = []; - glAccountTotalsMapForPeriod1 = getGlAccountTotals(onlyIncludePeriodTypeIdList, period1FromDate, period1ThruDate, organizationPartyId, parameters.glFiscalTypeId); + period1IncomeStatement = getGlAccountTotals(onlyIncludePeriodTypeIdList, Timestamp.valueOf(period1FromDate), Timestamp.valueOf(period1ThruDate), organizationPartyId, parameters.glFiscalTypeId); period1Expenses = []; period1Incomes = []; - if (glAccountTotalsMapForPeriod1) { - period1Expenses = glAccountTotalsMapForPeriod1.expenses; - period1Incomes = glAccountTotalsMapForPeriod1.income; - if (period1Incomes) - periodIncomes.addAll(period1Incomes); - if (period1Expenses) - periodExpenses.addAll(period1Expenses); + if (period1IncomeStatement) { + context.period1TotalNetIncome = period1IncomeStatement.totalNetIncome; + glAccountTotalsMapForPeriod1 = period1IncomeStatement.glAccountTotalsMap; + 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); + period2IncomeStatement = getGlAccountTotals(onlyIncludePeriodTypeIdList ,Timestamp.valueOf(period2FromDate) ,Timestamp.valueOf(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); - } + if (period2IncomeStatement) { + context.period2TotalNetIncome = period2IncomeStatement.totalNetIncome; + glAccountTotalsMapForPeriod2 = period2IncomeStatement.glAccountTotalsMap; + 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; @@ -107,6 +120,6 @@ } prepareIncomeStatement = dispatcher.runSync("prepareIncomeStatement", [fromDate : fromDate, thruDate : thruDate, organizationPartyId : organizationPartyId, glFiscalTypeId : glFiscalTypeId, userLogin : userLogin]); - return glAccountTotalsMap = prepareIncomeStatement.glAccountTotalsMap; + return prepareIncomeStatement; } } \ 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=804993&r1=804992&r2=804993&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 14:22:29 2009 @@ -2321,6 +2321,17 @@ <response name="success" type="view" value="TrialBalanceSearchResultsCsv"/> </request-map> + <request-map uri="ComparativeIncomeStatements.csv"> + <security https="true" auth="true"/> + <response name="success" type="view" value="ComparativeIncomeStatementsCsv"/> + <response name="error" type="view" value="ComparativeIncomeStatement"/> + </request-map> + <request-map uri="ComparativeIncomeStatements.pdf"> + <security https="true" auth="true"/> + <response name="success" type="view" value="ComparativeIncomeStatementsPdf"/> + <response name="error" type="view" value="ComparativeIncomeStatement"/> + </request-map> + <!--Global GL Settings --> <request-map uri="acctgTransDetailReportPdf.pdf"> <security https="true" auth="true"/> @@ -2724,6 +2735,7 @@ <view-map name="CostCenters" type="screen" page="component://accounting/widget/GlobalGlAccountsScreens.xml#CostCenters"/> <view-map name="CostCenterReport" type="screen" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#CostCenterReport"/> <view-map name="CostCentersReportPdf" type="screenfop" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#CostCentersReportPdf" content-type="application/pdf" encoding="none"/> - + <view-map name="ComparativeIncomeStatementsPdf" type="screenfop" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#ComparativeIncomeStatementsPdf" content-type="application/pdf" encoding="none"/> + <view-map name="ComparativeIncomeStatementsCsv" type="screencsv" page="component://accounting/widget/ReportFinancialSummaryScreens.xml#ComparativeIncomeStatementsCsv" content-type="text/csv" encoding="none"/> <!-- end of view mappings --> </site-conf> Modified: ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml?rev=804993&r1=804992&r2=804993&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml (original) +++ ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml Mon Aug 17 14:22:29 2009 @@ -567,10 +567,23 @@ <parameter param-name="organizationPartyId"/> </hyperlink> </field> + <field name="glAccountId" use-when="isPdf == true"><display description="${glAccountId}"/></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"/> + + <form name="ComparativeIncomeStatementsCsv" type="list" list-name="glAccountIncomeList" view-size="99999"> + <row-actions> + <entity-one entity-name="GlAccount" value-field="glAccount"/> + </row-actions> + <field name="glAccountId"><display description="${glAccountId}"/></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="ComparativeExpenseStatementsCsv" type="list" list-name="glAccountExpenseList" view-size="99999" extends="ComparativeIncomeStatementsCsv"/> </forms> Modified: ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml?rev=804993&r1=804992&r2=804993&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml (original) +++ ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml Mon Aug 17 14:22:29 2009 @@ -375,7 +375,7 @@ </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.AccountingExpences}"/></container> + <container style="h3"><label text="${uiLabelMap.AccountingExpenses}"/></container> <include-form name="ExpenseStatementList" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/> </container> </container> @@ -697,7 +697,7 @@ <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.AccountingExpences}"/></container> + <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> </decorator-section> @@ -716,7 +716,7 @@ <widgets> <container><label text="${uiLabelMap.AccountingIncome}"/></container> <include-form name="IncomeStatementListCsv" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/> - <container><label text="${uiLabelMap.AccountingExpences}"/></container> + <container><label text="${uiLabelMap.AccountingExpenses}"/></container> <include-form name="ExpenseStatementListCsv" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/> <container><label text="${uiLabelMap.AccountingNetIncome}: ${totalNetIncome}"/></container> </widgets> @@ -1227,11 +1227,8 @@ <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"/> + <set field="displaySearchResult" value="${period1TotalNetIncome != 0 || period2TotalNetIncome != 0}" type="Boolean"/> </actions> <widgets> <decorator-screen name="CommonOrganizationAccountingReportsDecorator" location="${parameters.mainDecoratorLocation}"> @@ -1239,15 +1236,85 @@ <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> + <section> + <condition> + <if-compare field="displaySearchResult" operator="equals" value="true" type="Boolean"/> + </condition> + <widgets> + <screenlet title="${uiLabelMap.AccountingComparativeIncomeStatement}"> + <link text="${uiLabelMap.AccountingExportAsCsv}" style="button" target="ComparativeIncomeStatements.csv"> + <parameter param-name="period1FromDate" from-field="parameters.period1FromDate"/> + <parameter param-name="period1ThruDate" from-field="parameters.period1ThruDate"/> + <parameter param-name="period2FromDate" from-field="parameters.period2FromDate"/> + <parameter param-name="period2ThruDate" from-field="parameters.period2ThruDate"/> + <parameter param-name="organizationPartyId"/> + <parameter param-name="currencyUomId"/> + <parameter param-name="glFiscalTypeId" from-field="parameters.glFiscalTypeId"/> + </link> + <link text="${uiLabelMap.AccountingExportAsPdf}" style="button" target="ComparativeIncomeStatements.pdf"> + <parameter param-name="period1FromDate" from-field="parameters.period1FromDate"/> + <parameter param-name="period1ThruDate" from-field="parameters.period1ThruDate"/> + <parameter param-name="period2FromDate" from-field="parameters.period2FromDate"/> + <parameter param-name="period2ThruDate" from-field="parameters.period2ThruDate"/> + <parameter param-name="organizationPartyId"/> + <parameter param-name="currencyUomId"/> + <parameter param-name="glFiscalTypeId" from-field="parameters.glFiscalTypeId"/> + </link> + <container style="h3"><label text="${uiLabelMap.AccountingIncome}"/></container> + <include-form name="ComparativeIncomeStatementList" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/> + <container style="h3"><label text="${uiLabelMap.AccountingExpenses}"/></container> + <include-form name="ComparativeExpenseStatementList" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/> + </screenlet> + <container><label style="h3" text="${uiLabelMap.AccountingPeriod1NetIncome}: ${period1TotalNetIncome}"/></container> + <container><label style="h3" text="${uiLabelMap.AccountingPeriod2NetIncome}: ${period2TotalNetIncome}"/></container> + </widgets> + </section> + </decorator-section> + </decorator-screen> + </widgets> + </section> + </screen> + + <screen name="ComparativeIncomeStatementsPdf"> + <section> + <actions> + <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/> + <set field="isPdf" value="true" type="Boolean"/> + <set field="organizationPartyId" from-field="parameters.organizationPartyId"/> + <set field="currencyUomId" from-field="parameters.currencyUomId"/> + <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/ComparativeIncomeStatement.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="ComparativeIncomeStatementList" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/> + <container style="h3"><label text="${uiLabelMap.AccountingExpenses}"/></container> + <include-form name="ComparativeExpenseStatementList" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/> + <container><label style="h3" text="${uiLabelMap.AccountingPeriod1NetIncome}: ${period1TotalNetIncome}"/></container> + <container><label style="h3" text="${uiLabelMap.AccountingPeriod2NetIncome}: ${period2TotalNetIncome}"/></container> </decorator-section> </decorator-screen> </widgets> </section> </screen> + + <screen name="ComparativeIncomeStatementsCsv"> + <section> + <actions> + <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/> + <set field="organizationPartyId" from-field="parameters.organizationPartyId"/> + <set field="currencyUomId" from-field="parameters.currencyUomId"/> + <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/ComparativeIncomeStatement.groovy"/> + </actions> + <widgets> + <container><label text="${uiLabelMap.AccountingIncome}"/></container> + <include-form name="ComparativeIncomeStatementsCsv" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/> + <container><label text="${uiLabelMap.AccountingExpenses}"/></container> + <include-form name="ComparativeExpenseStatementsCsv" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/> + <container><label text="${uiLabelMap.AccountingPeriod1NetIncome}: ${period1TotalNetIncome}"/></container> + <container><label text="${uiLabelMap.AccountingPeriod2NetIncome}: ${period2TotalNetIncome}"/></container> + </widgets> + </section> + </screen> </screens> |
Free forum by Nabble | Edit this page |