Author: mor
Date: Tue Feb 12 05:34:13 2008 New Revision: 620794 URL: http://svn.apache.org/viewvc?rev=620794&view=rev Log: Applied patch from Jira OFBIZ-1496 (https://issues.apache.org/jira/browse/OFBIZ-1496) With few enhancements : 1) Added Apache License to TransactionTotals.bsh 2) Improved the bsh code. 3) Added style element to the Forms and Screen. Many thanks to Rishi Solanki, Sumit Pandit & Ratnesh Upadhyay for posting and testing this patch. Special thanks to Jacopo for his help on this issue. Added: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.bsh Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml ofbiz/trunk/applications/accounting/entitydef/entitygroup.xml ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml ofbiz/trunk/applications/accounting/widget/CommonScreens.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=620794&r1=620793&r2=620794&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original) +++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Tue Feb 12 05:34:13 2008 @@ -4245,6 +4245,9 @@ <value xml:lang="th">ยà¸à¹à¸¥à¸´à¸à¸£à¸²à¸¢à¹à¸à¹à¸à¸±à¸à¸à¸µà¹à¸¢à¸à¸à¸£à¸°à¹à¸ à¸à¸à¸±à¹à¸§à¹à¸</value> <value xml:lang="zh">è¦çæ¶å ¥æ»è´¦è´¦æ·æ è¯</value> </property> + <property key="AccountingPostedTransactionTotals"> + <value xml:lang="en">Posted Totals</value> + </property> <property key="AccountingPSInvalidStatusChange"> <value xml:lang="ar">اÙÙضعÙØ© اÙجدÙدة تغÙÙر غÙر صØÙØ</value> <value xml:lang="en">The new status is not a valid change</value> @@ -5619,6 +5622,9 @@ <value xml:lang="en">Total excl. tax</value> <value xml:lang="th">Total excl. tax</value> </property> + <property key="AccountingTransactionTotals"> + <value xml:lang="en">Transaction Totals</value> + </property> <property key="AccountingTransactionType"> <value xml:lang="ar">ÙÙع اÙع٠ÙÙØ©</value> <value xml:lang="en">Transaction Type</value> @@ -5770,6 +5776,9 @@ <value xml:lang="th">ราà¸à¸²</value> <value xml:lang="zh">åä»·</value> </property> + <property key="AccountingUnPostedTransactionTotals"> + <value xml:lang="en">UnPosted Totals</value> + </property> <property key="AccountingUpdateAvailability"> <value xml:lang="ar">تØدÙØ« اÙتÙÙÙر</value> <value xml:lang="en">Update the availability</value> Modified: ofbiz/trunk/applications/accounting/entitydef/entitygroup.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/entitydef/entitygroup.xml?rev=620794&r1=620793&r2=620794&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/entitydef/entitygroup.xml (original) +++ ofbiz/trunk/applications/accounting/entitydef/entitygroup.xml Tue Feb 12 05:34:13 2008 @@ -116,6 +116,7 @@ <entity-group group="org.ofbiz" entity="AcctgTransEntryType" /> <entity-group group="org.ofbiz" entity="AcctgTransType" /> <entity-group group="org.ofbiz" entity="AcctgTransTypeAttr" /> + <entity-group group="org.ofbiz" entity="GlAccOrgAndAcctgTransAndEntry" /> <entity-group group="org.ofbiz" entity="GlAccount" /> <entity-group group="org.ofbiz" entity="GlAccountClass" /> <entity-group group="org.ofbiz" entity="GlAccountGroup" /> Modified: ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml?rev=620794&r1=620793&r2=620794&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml (original) +++ ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml Tue Feb 12 05:34:13 2008 @@ -3148,4 +3148,28 @@ <key-map field-name="glAccountId"/> </relation> </entity> + + <view-entity entity-name="GlAccOrgAndAcctgTransAndEntry" + package-name="org.ofbiz.accounting.ledger" + title="GlAccountOrganization, AcctgTransEntry, and AccTrans View Entity Group-By organizationPartyId, glAccountId, debitCreditFlag"> + <member-entity entity-alias="GAO" entity-name="GlAccountOrganization"/> + <member-entity entity-alias="ATE" entity-name="AcctgTransEntry"/> + <member-entity entity-alias="AT" entity-name="AcctgTrans"/> + <alias entity-alias="GAO" name="glAccountId" group-by="true"/> + <alias entity-alias="ATE" name="debitCreditFlag" group-by="true"/> + <alias entity-alias="AT" name="isPosted" group-by="true"/> + <alias entity-alias="AT" name="transactionDate" group-by="true"/> + <alias entity-alias="ATE" name="acctgTransId" group-by="true"/> + <alias entity-alias="ATE" name="organizationPartyId" group-by="true"/> + <alias entity-alias="ATE" name="totalAmount" field="amount" function="sum"/> + <alias entity-alias="GAO" name="fromDate" group-by="true"/> + <alias entity-alias="GAO" name="thruDate" group-by="true" /> + <view-link entity-alias="GAO" rel-entity-alias="ATE"> + <key-map field-name="glAccountId"/> + <key-map field-name="organizationPartyId"/> + </view-link> + <view-link entity-alias="ATE" rel-entity-alias="AT"> + <key-map field-name="acctgTransId"/> + </view-link> + </view-entity> </entitymodel> Added: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.bsh URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.bsh?rev=620794&view=auto ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.bsh (added) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.bsh Tue Feb 12 05:34:13 2008 @@ -0,0 +1,87 @@ +/* + * 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.UtilValidate; +import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.entity.condition.EntityCondition; +import org.ofbiz.entity.condition.EntityConditionList; +import org.ofbiz.entity.condition.EntityExpr; +import org.ofbiz.entity.condition.EntityOperator; +import org.ofbiz.entity.GenericDelegator; + +import javolution.util.FastList; +import javolution.util.FastMap; + +exprs = UtilMisc.toList(new EntityExpr("organizationPartyId", EntityOperator.EQUALS, organizationPartyId)); +if (UtilValidate.isNotEmpty(fromDate)) { + exprs.add(new EntityExpr("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate)); +} +if (UtilValidate.isNotEmpty(thruDate)) { + exprs.add(new EntityExpr("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate)); +} + +List postedExprs = FastList.newInstance(); +postedExprs.add(new EntityExpr("isPosted", EntityOperator.EQUALS, "Y")); +postedExprs.addAll(exprs); +fieldsToSelect = UtilMisc.toList("glAccountId", "debitCreditFlag", "totalAmount"); +orderBy = UtilMisc.toList("glAccountId"); + +List postedTransTotalList = FastList.newInstance(); +List postedTrans = delegator.findByCondition("GlAccOrgAndAcctgTransAndEntry", new EntityConditionList(postedExprs, EntityOperator.AND), fieldsToSelect, orderBy); +if (UtilValidate.isNotEmpty(postedTrans)) { + iter = postedTrans.iterator(); + while (iter.hasNext()) { + Map postedMap = FastMap.newInstance(); + GenericValue value = iter.next(); + postedMap.put("glAccountId", value.getString("glAccountId")); + if ("C".equals(value.getString("debitCreditFlag"))) { + postedMap.put("credit", value.getDouble("totalAmount")); + postedMap.put("debit", new Double(0.0)); + } else { + postedMap.put("credit", new Double(0.0)); + postedMap.put("debit", value.getDouble("totalAmount")); + } + postedTransTotalList.add(postedMap); + } +} +context.put("postedTransTotalList", postedTransTotalList); + +List unpostedExprs = FastList.newInstance(); +unpostedExprs.add(new EntityExpr("isPosted", EntityOperator.EQUALS, "N")); +unpostedExprs.addAll(exprs); + +List unpostedTransTotalList = FastList.newInstance(); +List unpostedTrans = delegator.findByCondition("GlAccOrgAndAcctgTransAndEntry", new EntityConditionList(unpostedExprs, EntityOperator.AND), fieldsToSelect, orderBy); +if (UtilValidate.isNotEmpty(unpostedTrans)) { + iter = unpostedTrans.iterator(); + while (iter.hasNext()) { + Map unpostedMap = FastMap.newInstance(); + GenericValue value = iter.next(); + unpostedMap.put("glAccountId", value.getString("glAccountId")); + if ("C".equals(value.getString("debitCreditFlag"))) { + unpostedMap.put("credit", value.getDouble("totalAmount")); + unpostedMap.put("debit", new Double(0.0)); + } else { + unpostedMap.put("credit", new Double(0.0)); + unpostedMap.put("debit", value.getDouble("totalAmount")); + } + unpostedTransTotalList.add(unpostedMap); + } +} +context.put("unpostedTransTotalList", unpostedTransTotalList); \ No newline at end of file Modified: ofbiz/trunk/applications/accounting/widget/CommonScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/CommonScreens.xml?rev=620794&r1=620793&r2=620794&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/CommonScreens.xml (original) +++ ofbiz/trunk/applications/accounting/widget/CommonScreens.xml Tue Feb 12 05:34:13 2008 @@ -243,7 +243,7 @@ <include-menu name="OrganizationAccountingTabBar" location="component://accounting/widget/Menus.xml"/> <include-menu name="OrganizationAccountingReportsTabBar" location="component://accounting/widget/Menus.xml"/> <container> - <label style="head1">${uiLabelMap.CommonFor}: ${currentOrganization.groupName} [${organizationPartyId}]</label> + <label style="head1">${uiLabelMap.${labelTitleProperty}} ${uiLabelMap.CommonFor}: ${currentOrganization.groupName} [${organizationPartyId}]</label> </container> <decorator-section-include name="body"/> </decorator-section> Modified: ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml?rev=620794&r1=620793&r2=620794&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml (original) +++ ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml Tue Feb 12 05:34:13 2008 @@ -199,4 +199,25 @@ </field> <field name="totalAmount"><display type="currency" currency="${currencyUomId}"/></field> </form> + + <form name="FindTransactionTotals" type="single" target="TransactionTotals" title="Find list of transaction totals" + header-row-style="header-row" default-table-style="basic-table"> + <field name="organizationPartyId"><hidden/></field> + <field name="fromDate"><date-time/></field> + <field name="thruDate"><date-time/></field> + <field name="submitButton" widget-style="smallSubmit"><submit button-type="button"/></field> + </form> + <form name="PostedTransactionTotalList" type="list" list-name="postedTransTotalList" + odd-row-style="alternate-row" default-table-style="basic-table hover-bar"> + <field name="glAccountId"><display/></field> + <field name="debit"><display/></field> + <field name="credit"><display/></field> + </form> + + <form name="UnpostedTransactionTotalList" type="list" list-name="unpostedTransTotalList" + odd-row-style="alternate-row" default-table-style="basic-table hover-bar"> + <field name="glAccountId"><display/></field> + <field name="debit"><display/></field> + <field name="credit"><display/></field> + </form> </forms> Modified: ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml?rev=620794&r1=620793&r2=620794&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml (original) +++ ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryScreens.xml Tue Feb 12 05:34:13 2008 @@ -527,9 +527,13 @@ <section> <actions> <set field="titleProperty" value="AccountingTransactionTotals"/> + <set field="labelTitleProperty" value="AccountingTransactionTotals"/> <set field="tabButtonItem" value="OrganizationAccountingReports"/> <set field="tabButtonItem2" value="TransactionTotals"/> <set field="organizationPartyId" from-field="parameters.organizationPartyId"/> + <set field="fromDate" from-field="parameters.fromDate"/> + <set field="thruDate" from-field="parameters.thruDate"/> + <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.bsh"/> </actions> <widgets> <decorator-screen name="CommonOrganizationAccountingReportsDecorator" location="${parameters.mainDecoratorLocation}"> @@ -539,7 +543,30 @@ <container style="head3"> <label text="${uiLabelMap.AccountingTransactionTotals}"/> </container> + <container style="screenlet-body"> + <include-form name="FindTransactionTotals" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/> + </container> </container> + </container> + <container style="screenlet"> + <container style="screenlet-title-bar"> + <container style="head3"> + <label text="${uiLabelMap.AccountingPostedTransactionTotals}"/> + </container> + <container style="screenlet-body"> + <include-form name="PostedTransactionTotalList" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/> + </container> + </container> + </container> + <container style="screenlet"> + <container style="screenlet-title-bar"> + <container style="head3"> + <label text="${uiLabelMap.AccountingUnPostedTransactionTotals}"/> + </container> + <container style="screenlet-body"> + <include-form name="UnpostedTransactionTotalList" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/> + </container> + </container> </container> </decorator-section> </decorator-screen> |
Free forum by Nabble | Edit this page |