You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ap...@apache.org on 2009/08/09 08:57:03 UTC
svn commit: r802495 - in /ofbiz/trunk/applications: accounting/config/
accounting/script/org/ofbiz/accounting/ledger/
accounting/webapp/accounting/WEB-INF/actions/reports/
accounting/webapp/accounting/reports/ accounting/widget/
party/src/org/ofbiz/par...
Author: apatel
Date: Sun Aug 9 06:57:02 2009
New Revision: 802495
URL: http://svn.apache.org/viewvc?rev=802495&view=rev
Log:
Accounting reports should display consolidated data from divisions. Patch from OFBIZ-2818. Thanks Rishi, Sumit and Awdesh for contribution. Also Thanks for Vince and Eva for help in designing tools.
Added:
ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy
Modified:
ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/AcctgTransServices.xml
ofbiz/trunk/applications/accounting/webapp/accounting/reports/GlAccountTrialBalanceReport.fo.ftl
ofbiz/trunk/applications/accounting/webapp/accounting/reports/GlAccountTrialBalanceReport.ftl
ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml
ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyWorker.java
Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=802495&r1=802494&r2=802495&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original)
+++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Sun Aug 9 06:57:02 2009
@@ -1999,6 +1999,10 @@
<value xml:lang="nl">Complete transactievelden</value>
<value xml:lang="zh">å®æ交ææ°æ®é¡¹</value>
</property>
+ <property key="AccountingConsolidatedDataFromDivisions">
+ <value xml:lang="en">Consolidated data from divisions ${partyNameList}</value>
+ <value xml:lang="hi_IN">डिवà¥à¤à¤¨à¥à¤ ${partyNameList} सॠसमà¥à¤à¤¿à¤¤ डà¥à¤à¤¾</value>
+ </property>
<property key="AccountingCopyAgreement">
<value xml:lang="ar">Ùسخ اÙإتÙاÙÙØ©</value>
<value xml:lang="de">Vereinbarung kopieren</value>
Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/AcctgTransServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/AcctgTransServices.xml?rev=802495&r1=802494&r2=802495&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/AcctgTransServices.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/AcctgTransServices.xml Sun Aug 9 06:57:02 2009
@@ -440,19 +440,21 @@
</if-compare>
</simple-method>
- <simple-method method-name="getAcctgTransEntriesAndTransTotal" short-description="Calculate total of credit and debit and difference between both">
+ <simple-method method-name="getAcctgTransEntriesAndTransTotal" short-description="Calculate total of credit and debit and difference between both for passed party and group rollup parties">
<property-to-field resource="arithmetic" property="ledger.decimals" field="ledgerDecimals"/>
<property-to-field resource="arithmetic" property="ledger.rounding" field="roundingMode"/>
+ <set field="organizationPartyId" from-field="parameters.organizationPartyId"/>
+ <set field="partyIds" value="${groovy:org.ofbiz.party.party.PartyWorker.getAssociatedPartyIdsByRelationshipType(delegator, organizationPartyId, 'GROUP_ROLLUP')}" type="List"/>
+ <set field="partyIds[]" from-field="organizationPartyId"/>
<entity-condition entity-name="AcctgTransAndEntries" list="acctgTransAndEntries" distinct="true">
<condition-list combine="and">
- <condition-expr field-name="organizationPartyId" operator="equals" from-field="parameters.organizationPartyId"/>
+ <condition-expr field-name="organizationPartyId" operator="in" from-field="partyIds"/>
<condition-expr field-name="glAccountId" operator="equals" from-field="parameters.glAccountId"/>
<condition-expr field-name="isPosted" operator="equals" from-field="parameters.isPosted" ignore-if-empty="true"/>
<condition-expr field-name="transactionDate" operator="greater-equals" from-field="parameters.customTimePeriodStartDate"/>
<condition-expr field-name="transactionDate" operator="less" from-field="parameters.customTimePeriodEndDate"/>
</condition-list>
</entity-condition>
-
<set field="debitTotal" type="BigDecimal" value="0"/>
<set field="creditTotal" type="BigDecimal" value="0"/>
<set field="debitCreditDifference" type="BigDecimal" value="0"/>
@@ -552,4 +554,4 @@
</iterate>
</simple-method>
-</simple-methods>
\ No newline at end of file
+</simple-methods>
Added: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy?rev=802495&view=auto
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy (added)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy Sun Aug 9 06:57:02 2009
@@ -0,0 +1,46 @@
+/*
+ * 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 org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.condition.EntityCondition;
+import org.ofbiz.entity.condition.EntityOperator;
+import org.ofbiz.party.party.PartyHelper;
+
+glAccountOrganizationCond = EntityCondition.makeCondition([EntityCondition.makeCondition("organizationPartyId", EntityOperator.IN, partyIds),
+ EntityCondition.makeCondition("postedBalance", EntityOperator.NOT_EQUAL, null)], EntityOperator.AND);
+trialBalances = [];
+glAccountOrganizations = delegator.findList("GlAccountOrganization", glAccountOrganizationCond, null, null, null, false);
+glAccountIds = EntityUtil.getFieldListFromEntityList(glAccountOrganizations, "glAccountId", true);
+glAccountIds.each { glAccountId ->
+ BigDecimal postedBalance = 0;
+ glAccountOrganizations.each { glAccountOrganization ->
+ if (glAccountOrganization.glAccountId.equals(glAccountId)) {
+ postedBalance += glAccountOrganization.getBigDecimal("postedBalance");
+ }
+ }
+ trialBalances.add([glAccountId : glAccountId , postedBalance : postedBalance]);
+}
+partyNameList = [];
+parties.each { party ->
+ partyName = PartyHelper.getPartyName(party);
+ partyNameList.add(partyName);
+}
+context.trialBalances = trialBalances;
+context.partyNameList = partyNameList;
Modified: ofbiz/trunk/applications/accounting/webapp/accounting/reports/GlAccountTrialBalanceReport.fo.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/reports/GlAccountTrialBalanceReport.fo.ftl?rev=802495&r1=802494&r2=802495&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/reports/GlAccountTrialBalanceReport.fo.ftl (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/reports/GlAccountTrialBalanceReport.fo.ftl Sun Aug 9 06:57:02 2009
@@ -54,8 +54,12 @@
<fo:table-column/>
<fo:table-column/>
<fo:table-column/>
+ <fo:table-column/>
<fo:table-header>
<fo:table-cell border="1pt solid" border-width=".1mm">
+ <fo:block text-align="center">${uiLabelMap.Party}</fo:block>
+ </fo:table-cell>
+ <fo:table-cell border="1pt solid" border-width=".1mm">
<fo:block text-align="center">${uiLabelMap.FormFieldTitle_transactionDate}</fo:block>
</fo:table-cell>
<fo:table-cell border="1pt solid" border-width=".1mm">
@@ -92,6 +96,12 @@
<fo:table-row border="1pt solid" border-width=".1mm">
<fo:table-cell border="1pt solid" border-width=".1mm">
<fo:block text-align="center">
+ <#assign partyNameFrom = (delegator.findOne("PartyNameView", {"partyId" : acctgTransAndEntry.organizationPartyId}, true))!>
+ ${(partyNameFrom.firstName)!} ${(partyNameFrom.lastName)!} ${(partyNameFrom.groupName)!}
+ </fo:block>
+ </fo:table-cell>
+ <fo:table-cell border="1pt solid" border-width=".1mm">
+ <fo:block text-align="center">
<#if acctgTransAndEntry.transactionDate?has_content>
<#assign dateFormat = Static["java.text.DateFormat"].LONG/>
<#assign transactionDate = Static["java.text.DateFormat"].getDateInstance(dateFormat, locale).format((acctgTransAndEntry.transactionDate)!)/>
@@ -134,4 +144,4 @@
<#else>
${uiLabelMap.AccountingNoRecordFound}
</#if>
-</#escape>
\ No newline at end of file
+</#escape>
Modified: ofbiz/trunk/applications/accounting/webapp/accounting/reports/GlAccountTrialBalanceReport.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/reports/GlAccountTrialBalanceReport.ftl?rev=802495&r1=802494&r2=802495&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/reports/GlAccountTrialBalanceReport.ftl (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/reports/GlAccountTrialBalanceReport.ftl Sun Aug 9 06:57:02 2009
@@ -31,6 +31,7 @@
<tr><th colspan=9 style="height: 30px;" ALIGN="left">${uiLabelMap.AccountingTimePeriod} : <#if currentTimePeriod?has_content>${(currentTimePeriod.fromDate)!} ${uiLabelMap.CommonTo} ${(currentTimePeriod.thruDate)!}</#if></th></tr>
<tr><th colspan=9 style="height: 30px;" ALIGN="left">${uiLabelMap.AccountingGlAccountNameAndGlAccountCode} : ${(glAccount.accountCode)!} - ${(glAccount.accountName)!}</th></tr>
<tr>
+ <th>${uiLabelMap.Party}</th>
<th>${uiLabelMap.FormFieldTitle_transactionDate}</th>
<th>${uiLabelMap.AccountingAccountTransactionId}</th>
<th>${uiLabelMap.CommonDescription}</th>
@@ -48,6 +49,10 @@
<#if acctgTransAndEntries?has_content>
<#list acctgTransAndEntries as acctgTransAndEntry>
<tr>
+ <td>
+ <#assign partyNameFrom = (delegator.findOne("PartyNameView", {"partyId" : acctgTransAndEntry.organizationPartyId}, true))!>
+ <a href="/partymgr/control/viewprofile?partyId=${(partyNameFrom.partyId)!}&organizationPartyId=${(partyNameFrom.partyId)!}">${(partyNameFrom.firstName)!} ${(partyNameFrom.lastName)!} ${(partyNameFrom.groupName)!}</a>
+ </td>
<td ALIGN="center">${(acctgTransAndEntry.transactionDate)!}</td>
<td ALIGN="center">${(acctgTransAndEntry.acctgTransId)!}</td>
<td ALIGN="center">${(acctgTransAndEntry.transDescription)!}</td>
@@ -70,4 +75,4 @@
<#else>
${uiLabelMap.AccountingNoRecordFound}
</#if>
-</div>
\ No newline at end of file
+</div>
Modified: ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml?rev=802495&r1=802494&r2=802495&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml Sun Aug 9 06:57:02 2009
@@ -285,13 +285,12 @@
</service>
<set field="partyAcctgPreference" from-field="result.partyAccountingPreference"/>
<set field="currencyUomId" from-field="partyAcctgPreference.baseCurrencyUomId"/>
- <entity-condition entity-name="GlAccountOrganization" list="trialBalances" filter-by-date="true">
- <condition-list>
- <condition-expr field-name="organizationPartyId" operator="equals" from-field="organizationPartyId"/>
- <condition-expr field-name="postedBalance" operator="not-equals" from-field="null"/>
- </condition-list>
- <order-by field-name="glAccountId"/>
+ <set field="partyIds" value="${groovy:org.ofbiz.party.party.PartyWorker.getAssociatedPartyIdsByRelationshipType(delegator, organizationPartyId, 'GROUP_ROLLUP')}" type="List"/>
+ <entity-condition entity-name="Party" list="parties">
+ <condition-expr field-name="partyId" operator="in" from-field="partyIds"/>
</entity-condition>
+ <set field="partyIds[]" from-field="organizationPartyId"/>
+ <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy"/>
<set field="totalsRow.isLastRow" value="true" type="Boolean"/>
<set field="totalsRow.postedBalance" value="0" type="BigDecimal"/>
<set field="trialBalances[]" from-field="totalsRow" type="Object"/>
@@ -301,22 +300,18 @@
<widgets>
<decorator-screen name="CommonOrganizationAccountingReportsDecorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
- <container style="screenlet">
- <container style="screenlet-title-bar">
- <container style="h3">
- <label text="${uiLabelMap.AccountingTrialBalance}"/>
- </container>
- </container>
- <container style="screenlet-body">
- <link text="${uiLabelMap.AccountingExportAsCsv}" style="buttontext" target="TrialBalanceSearchResultsCsv.csv">
- <parameter param-name="organizationPartyId"/>
- </link>
- <link text="${uiLabelMap.AccountingExportAsPdf}" style="buttontext" target="TrialBalanceSearchResultsPdf.pdf">
- <parameter param-name="organizationPartyId"/>
- </link>
- <include-form name="TrialBalanceList" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
- </container>
+ <container style="h3">
+ <label text="${uiLabelMap.AccountingConsolidatedDataFromDivisions}"/>
</container>
+ <screenlet title="${uiLabelMap.AccountingTrialBalance}">
+ <link text="${uiLabelMap.AccountingExportAsCsv}" style="buttontext" target="TrialBalanceSearchResultsCsv.csv">
+ <parameter param-name="organizationPartyId"/>
+ </link>
+ <link text="${uiLabelMap.AccountingExportAsPdf}" style="buttontext" target="TrialBalanceSearchResultsPdf.pdf">
+ <parameter param-name="organizationPartyId"/>
+ </link>
+ <include-form name="TrialBalanceList" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/>
+ </screenlet>
</decorator-section>
</decorator-screen>
</widgets>
@@ -788,13 +783,13 @@
<set field="partyAcctgPreference" from-field="result.partyAccountingPreference"/>
<set field="currencyUomId" from-field="partyAcctgPreference.baseCurrencyUomId"/>
- <entity-condition entity-name="GlAccountOrganization" list="trialBalances" filter-by-date="true">
- <condition-list>
- <condition-expr field-name="organizationPartyId" operator="equals" from-field="organizationPartyId"/>
- <condition-expr field-name="postedBalance" operator="not-equals" from-field="null"/>
- </condition-list>
- <order-by field-name="glAccountId"/>
+ <set field="organizationPartyId" from-field="parameters.organizationPartyId"/>
+ <set field="partyIds" value="${groovy:org.ofbiz.party.party.PartyWorker.getAssociatedPartyIdsByRelationshipType(delegator, organizationPartyId, 'GROUP_ROLLUP')}" type="List"/>
+ <entity-condition entity-name="Party" list="parties">
+ <condition-expr field-name="partyId" operator="in" from-field="partyIds"/>
</entity-condition>
+ <set field="partyIds[]" from-field="organizationPartyId"/>
+ <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy"/>
<set field="totalsRow.isLastRow" value="true" type="Boolean"/>
<set field="totalsRow.postedBalance" value="0" type="BigDecimal"/>
<set field="trialBalances[]" from-field="totalsRow" type="Object"/>
@@ -819,13 +814,13 @@
<set field="partyAcctgPreference" from-field="result.partyAccountingPreference"/>
<set field="currencyUomId" from-field="partyAcctgPreference.baseCurrencyUomId"/>
- <entity-condition entity-name="GlAccountOrganization" list="trialBalances" filter-by-date="true">
- <condition-list>
- <condition-expr field-name="organizationPartyId" operator="equals" from-field="organizationPartyId"/>
- <condition-expr field-name="postedBalance" operator="not-equals" from-field="null"/>
- </condition-list>
- <order-by field-name="glAccountId"/>
+ <set field="organizationPartyId" from-field="parameters.organizationPartyId"/>
+ <set field="partyIds" value="${groovy:org.ofbiz.party.party.PartyWorker.getAssociatedPartyIdsByRelationshipType(delegator, organizationPartyId, 'GROUP_ROLLUP')}" type="List"/>
+ <entity-condition entity-name="Party" list="parties">
+ <condition-expr field-name="partyId" operator="in" from-field="partyIds"/>
</entity-condition>
+ <set field="partyIds[]" from-field="organizationPartyId"/>
+ <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy"/>
<set field="totalsRow.isLastRow" value="true" type="Boolean"/>
<set field="totalsRow.postedBalance" value="0" type="BigDecimal"/>
<set field="trialBalances[]" from-field="totalsRow" type="Object"/>
Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyWorker.java?rev=802495&r1=802494&r2=802495&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyWorker.java (original)
+++ ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyWorker.java Sun Aug 9 06:57:02 2009
@@ -39,6 +39,7 @@
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.condition.EntityCondition;
+import org.ofbiz.entity.condition.EntityConditionList;
import org.ofbiz.entity.condition.EntityFunction;
import org.ofbiz.entity.condition.EntityOperator;
import org.ofbiz.entity.model.ModelEntity;
@@ -377,4 +378,33 @@
return str.replaceAll("\\W", "");
}
+ public static List<String> getAssociatedPartyIdsByRelationshipType(GenericDelegator delegator, String partyIdFrom, String partyRelationshipTypeId) {
+ List<GenericValue> partyList = FastList.newInstance();
+ List<String> partyIds = null;
+ try {
+ EntityConditionList baseExprs = EntityCondition.makeCondition(UtilMisc.toList(
+ EntityCondition.makeCondition("partyIdFrom", partyIdFrom),
+ EntityCondition.makeCondition("partyRelationshipTypeId", partyRelationshipTypeId)), EntityOperator.AND);
+ List<GenericValue> associatedParties = delegator.findList("PartyRelationship", baseExprs, null, null, null, true);
+ partyList.addAll(associatedParties);
+ while (UtilValidate.isNotEmpty(associatedParties)) {
+ List<GenericValue> currentAssociatedParties = FastList.newInstance();
+ for (GenericValue associatedParty : associatedParties ) {
+ EntityConditionList innerExprs = EntityCondition.makeCondition(UtilMisc.toList(
+ EntityCondition.makeCondition("partyIdFrom", associatedParty.get("partyIdTo")),
+ EntityCondition.makeCondition("partyRelationshipTypeId", partyRelationshipTypeId)), EntityOperator.AND);
+ List<GenericValue> associatedPartiesChilds = delegator.findList("PartyRelationship", innerExprs, null, null, null, true);
+ if (UtilValidate.isNotEmpty(associatedPartiesChilds)) {
+ currentAssociatedParties.addAll(associatedPartiesChilds);
+ }
+ partyList.add(associatedParty);
+ }
+ associatedParties = currentAssociatedParties;
+ }
+ partyIds = EntityUtil.getFieldListFromEntityList(partyList, "partyIdTo", true);
+ } catch (GenericEntityException e) {
+ Debug.logWarning(e, module);
+ }
+ return partyIds;
+ }
}