Author: apatel
Date: Sat Jul 18 09:36:14 2009 New Revision: 795331 URL: http://svn.apache.org/viewvc?rev=795331&view=rev Log: Enhanced Monthly trial balance report, added BigDecimal rounding and Internationalization. Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/AcctgTransServices.xml ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/GlAccountTrialBalance.groovy ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=795331&r1=795330&r2=795331&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original) +++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Sat Jul 18 09:36:14 2009 @@ -1655,6 +1655,12 @@ <value xml:lang="nl">Afgesloten perioden</value> <value xml:lang="th">à¸à¸´à¸à¸à¹à¸§à¸à¹à¸§à¸¥à¸²</value> </property> + <property key="AccountingClosingBalanceCredit"> + <value xml:lang="en">Closing Balance Credit</value> + </property> + <property key="AccountingClosingBalanceDebit"> + <value xml:lang="en">Closing Balance Debit</value> + </property> <property key="AccountingComments"> <value xml:lang="ar">تعاÙÙÙ</value> <value xml:lang="de">Kommentare</value> @@ -4835,6 +4841,12 @@ <value xml:lang="th">à¸à¸·à¹à¸à¸à¸¥à¸²à¸ (à¸à¸±à¸à¸£)</value> <value xml:lang="zh">å¡ä¸å§åçä¸é´ä¸ç»åæ¯</value> </property> + <property key="AccountingMonthlyBalanceCredit"> + <value xml:lang="en">Monthly Balance Credit</value> + </property> + <property key="AccountingMonthlyBalanceDebit"> + <value xml:lang="en">Monthly Balance Debit</value> + </property> <property key="AccountingMonthlyTrialBalance"> <value xml:lang="en">Monthly Trial Balance</value> </property> @@ -5433,6 +5445,12 @@ <value xml:lang="nl">Open perioden</value> <value xml:lang="th">à¹à¸à¸´à¸à¸à¹à¸§à¸à¹à¸§à¸¥à¸²</value> </property> + <property key="AccountingOpeningBalanceCredit"> + <value xml:lang="en">Opening Balance Credit</value> + </property> + <property key="AccountingOpeningBalanceDebit"> + <value xml:lang="en">Opening Balance Debit</value> + </property> <property key="AccountingOrderItemWithIdNotFound"> <value xml:lang="en">Order Item with id ${orderItemSeqId} not found.</value> <value xml:lang="fr">La ligne de commande avec identifiant ${orderItemSeqId} n'a pas été trouvée</value> @@ -7783,6 +7801,12 @@ <value xml:lang="en">Delivery Address Editable</value> <value xml:lang="it">Indirizzo di spedizione editabile</value> </property> + <property key="AccountingYearToDateBalanceCredit"> + <value xml:lang="en">Year To Date Balance Credit</value> + </property> + <property key="AccountingYearToDateBalanceDebit"> + <value xml:lang="en">Year To Date Balance Debit</value> + </property> <property key="AcctgAssignGlAccount"> <value xml:lang="ar">تعÙÙ٠اÙØساب اÙÙ ØاسبÙ</value> <value xml:lang="de">zuweisen Hauptbuchkonto</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=795331&r1=795330&r2=795331&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 Sat Jul 18 09:36:14 2009 @@ -441,7 +441,8 @@ </simple-method> <simple-method method-name="getAcctgTransEntriesAndTransTotal" short-description="Calculate total of credit and debit and difference between both"> - + <property-to-field resource="arithmetic" property="ledger.decimals" field="ledgerDecimals"/> + <property-to-field resource="arithmetic" property="ledger.rounding" field="roundingMode"/> <entity-condition entity-name="AcctgTransAndEntries" list="acctgTransAndEntries" distinct="true"> <condition-list combine="and"> <condition-expr field-name="organizationPartyId" operator="equals" from-field="parameters.organizationPartyId"/> @@ -466,7 +467,12 @@ </else> </if-compare> </iterate> - + <calculate field="debitTotal" decimal-scale="${ledgerDecimals}" rounding-mode="${roundingMode}"> + <calcop operator="get" field="debitTotal"/> + </calculate> + <calculate field="creditTotal" decimal-scale="${ledgerDecimals}" rounding-mode="${roundingMode}"> + <calcop operator="get" field="creditTotal"/> + </calculate> <set field="debitCreditDifference" value="${debitTotal - creditTotal}" type="BigDecimal"/> <field-to-result field="acctgTransAndEntries"/> <field-to-result field="debitTotal"/> @@ -477,8 +483,10 @@ <!-- GlAccount Trial Balance based on isPosted flag --> <simple-method method-name="calculateGlAccountTrialBalance" short-description="Calculate Trial Balance for a GlAccount"> - <set field="openingDebitTotal" type="BigDecimal" value="0"/> - <set field="openingCreditTotal" type="BigDecimal" value="0"/> + <property-to-field resource="arithmetic" property="ledger.decimals" field="ledgerDecimals"/> + <property-to-field resource="arithmetic" property="ledger.rounding" field="roundingMode"/> + <set field="openingBalanceDebit" type="BigDecimal" value="0"/> + <set field="openingBalanceCredit" type="BigDecimal" value="0"/> <set field="debitCreditDifference" type="BigDecimal" value="0"/> <!-- iterate through all GlAccOrgAndAcctgTransAndEntry in this account and that are filter based on posted and unposted, and get totals of all debits and of all credits --> @@ -494,16 +502,22 @@ <iterate entry="glAccOrgAndAcctgTransAndEntry" list="glAccOrgAndAcctgTransAndEntries"> <if-compare field="glAccOrgAndAcctgTransAndEntry.debitCreditFlag" operator="equals" value="D"> - <set field="openingDebitTotal" value="${openingDebitTotal + glAccOrgAndAcctgTransAndEntry.totalAmount}" type="BigDecimal" default-value="0"/> + <set field="openingBalanceDebit" value="${openingBalanceDebit + glAccOrgAndAcctgTransAndEntry.totalAmount}" type="BigDecimal" default-value="0"/> <else> - <set field="openingCreditTotal" value="${openingCreditTotal + glAccOrgAndAcctgTransAndEntry.totalAmount}" type="BigDecimal" default-value="0"/> + <set field="openingBalanceCredit" value="${openingBalanceCredit + glAccOrgAndAcctgTransAndEntry.totalAmount}" type="BigDecimal" default-value="0"/> </else> </if-compare> </iterate> - <set field="debitCreditDifference" value="${openingDebitTotal - openingCreditTotal}" type="BigDecimal"/> + <calculate field="openingBalanceDebit" decimal-scale="${ledgerDecimals}" rounding-mode="${roundingMode}"> + <calcop operator="get" field="openingBalanceDebit"/> + </calculate> + <calculate field="openingBalanceCredit" decimal-scale="${ledgerDecimals}" rounding-mode="${roundingMode}"> + <calcop operator="get" field="openingBalanceCredit"/> + </calculate> + <set field="debitCreditDifference" value="${openingBalanceDebit - openingBalanceCredit}" type="BigDecimal"/> - <field-to-result field="openingDebitTotal"/> - <field-to-result field="openingCreditTotal"/> + <field-to-result field="openingBalanceDebit"/> + <field-to-result field="openingBalanceCredit"/> <field-to-result field="debitCreditDifference"/> </simple-method> </simple-methods> \ No newline at end of file Modified: ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml?rev=795331&r1=795330&r2=795331&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml (original) +++ ofbiz/trunk/applications/accounting/servicedef/services_ledger.xml Sat Jul 18 09:36:14 2009 @@ -594,8 +594,8 @@ <attribute name="isPosted" mode="IN" type="String" optional="true"/> <attribute name="fromDate" mode="IN" type="Timestamp"/> <attribute name="thruDate" mode="IN" type="Timestamp"/> - <attribute name="openingDebitTotal" type="BigDecimal" mode="OUT"/> - <attribute name="openingCreditTotal" type="BigDecimal" mode="OUT"/> + <attribute name="openingBalanceDebit" type="BigDecimal" mode="OUT"/> + <attribute name="openingBalanceCredit" type="BigDecimal" mode="OUT"/> <attribute name="debitCreditDifference" type="BigDecimal" mode="OUT"/> </service> </services> Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/GlAccountTrialBalance.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/GlAccountTrialBalance.groovy?rev=795331&r1=795330&r2=795331&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/GlAccountTrialBalance.groovy (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/GlAccountTrialBalance.groovy Sat Jul 18 09:36:14 2009 @@ -21,11 +21,14 @@ import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.base.util.UtilNumber; import org.ofbiz.accounting.util.UtilAccounting; import java.math.BigDecimal; import com.ibm.icu.util.Calendar; if (organizationPartyId) { + decimals = UtilNumber.getBigDecimalScale("ledger.decimals"); + rounding = UtilNumber.getBigDecimalRoundingMode("ledger.rounding"); context.currentOrganization = delegator.findOne("PartyNameView", [partyId : organizationPartyId], false); if (parameters.glAccountId) { glAccount = delegator.findOne("GlAccount", [glAccountId : parameters.glAccountId], false); @@ -71,16 +74,16 @@ acctgTransEntriesAndTransTotal = dispatcher.runSync("getAcctgTransEntriesAndTransTotal", [customTimePeriodStartDate : customTimePeriodStartDate, customTimePeriodEndDate : customTimePeriodEndDate, organizationPartyId : organizationPartyId, glAccountId : parameters.glAccountId, isPosted : isPosted, userLogin : userLogin]); totalOfYearToDateDebit = totalOfYearToDateDebit + acctgTransEntriesAndTransTotal.debitTotal; - acctgTransEntriesAndTransTotal.totalOfYearToDateDebit = totalOfYearToDateDebit; + acctgTransEntriesAndTransTotal.totalOfYearToDateDebit = totalOfYearToDateDebit.setScale(decimals, rounding); totalOfYearToDateCredit = totalOfYearToDateCredit + acctgTransEntriesAndTransTotal.creditTotal; - acctgTransEntriesAndTransTotal.totalOfYearToDateCredit = totalOfYearToDateCredit; + acctgTransEntriesAndTransTotal.totalOfYearToDateCredit = totalOfYearToDateCredit.setScale(decimals, rounding); if (isDebitAccount) { balanceOfTheAcctgForYear = balanceOfTheAcctgForYear + acctgTransEntriesAndTransTotal.debitCreditDifference; - acctgTransEntriesAndTransTotal.balanceOfTheAcctgForYear = balanceOfTheAcctgForYear; + acctgTransEntriesAndTransTotal.balanceOfTheAcctgForYear = balanceOfTheAcctgForYear.setScale(decimals, rounding); } else { balanceOfTheAcctgForYear = balanceOfTheAcctgForYear + acctgTransEntriesAndTransTotal.debitCreditDifference; - acctgTransEntriesAndTransTotal.balanceOfTheAcctgForYear = balanceOfTheAcctgForYear; + acctgTransEntriesAndTransTotal.balanceOfTheAcctgForYear = balanceOfTheAcctgForYear.setScale(decimals, rounding); } glAcctgTrialBalanceList.add(acctgTransEntriesAndTransTotal); Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy?rev=795331&r1=795330&r2=795331&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy Sat Jul 18 09:36:14 2009 @@ -18,6 +18,7 @@ */ import org.ofbiz.base.util.UtilDateTime; +import org.ofbiz.base.util.UtilNumber; import org.ofbiz.entity.condition.EntityCondition; import org.ofbiz.entity.condition.EntityConditionList; import org.ofbiz.entity.condition.EntityOperator; @@ -29,9 +30,11 @@ debitTotal = BigDecimal.ZERO; creditTotal = BigDecimal.ZERO; -openingCreditBalance = BigDecimal.ZERO; -openingDebitBalance = BigDecimal.ZERO; +openingBalanceCredit = BigDecimal.ZERO; +openingBalanceDebit = BigDecimal.ZERO; +decimals = UtilNumber.getBigDecimalScale("ledger.decimals"); +rounding = UtilNumber.getBigDecimalRoundingMode("ledger.rounding"); exprs = [EntityCondition.makeCondition("organizationPartyId", EntityOperator.EQUALS, organizationPartyId)]; if (fromDate) { exprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate)); @@ -85,15 +88,15 @@ resultMap = dispatcher.runSync("calculateGlAccountTrialBalance", [fromDate : financialYearFromDate, thruDate : fromDate , glAccountId : prevGlAccountId, isPosted : value.isPosted, userLogin : userLogin]); - openingCreditBalance = resultMap.openingCreditTotal; - openingDebitBalance = resultMap.openingDebitTotal; + openingBalanceCredit = resultMap.openingBalanceCredit; + openingBalanceDebit = resultMap.openingBalanceDebit; } postedAndUnpostedMap = FastMap.newInstance(); postedAndUnpostedMap.glAccountId = prevGlAccountId; - postedAndUnpostedMap.credit = creditTotal; - postedAndUnpostedMap.debit = debitTotal; - postedAndUnpostedMap.openingCreditBalance = openingCreditBalance; - postedAndUnpostedMap.openingDebitBalance = openingDebitBalance; + postedAndUnpostedMap.credit = creditTotal.setScale(decimals, rounding); + postedAndUnpostedMap.debit = debitTotal.setScale(decimals, rounding); + postedAndUnpostedMap.openingBalanceCredit = openingBalanceCredit.setScale(decimals, rounding); + postedAndUnpostedMap.openingBalanceDebit = openingBalanceDebit.setScale(decimals, rounding); transectionList.add(postedAndUnpostedMap); debitTotal = BigDecimal.ZERO; creditTotal = BigDecimal.ZERO; Modified: ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml?rev=795331&r1=795330&r2=795331&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml (original) +++ ofbiz/trunk/applications/accounting/widget/ReportFinancialSummaryForms.xml Sat Jul 18 09:36:14 2009 @@ -462,16 +462,36 @@ odd-row-style="alternate-row" default-table-style="basic-table hover-bar"> <field name="isPosted" field-name="parameters.isPosted"><hidden/></field> - <field name="accountCode" entry-name="glAccountId"><display-entity entity-name="GlAccount" key-field-name="glAccountId" description="${accountCode}"/></field> - <field name="accountName" entry-name="glAccountId"><display-entity entity-name="GlAccount" key-field-name="glAccountId" description="${accountName}"/></field> - <field name="openingCreditBalance"><display description="${openingCreditBalance}"/></field> - <field name="openingDebitBalance"><display description="${openingDebitBalance}"/></field> - <field name="monthlyCreditTotal"><display description="${credit}"/></field> - <field name="monthlyDebitTotal"><display description="${debit}"/></field> - <field name="closingBalanceCredit"><display description="${openingCreditBalance + credit}"/></field> - <field name="closingBalanceDebit"><display description="${openingDebitBalance + debit}"/></field> - <field name="yearToDateBalanceCredit"><display description="${openingCreditBalance + credit}"/></field> - <field name="yearToDateBalanceDebit"><display description="${openingDebitBalance + debit}"/></field> + <field name="accountCode" title="${uiLabelMap.FormFieldTitle_accountCode}" entry-name="glAccountId"> + <display-entity entity-name="GlAccount" key-field-name="glAccountId" description="${accountCode}"/> + </field> + <field name="accountName" title="${uiLabelMap.FormFieldTitle_accountName}" entry-name="glAccountId"> + <display-entity entity-name="GlAccount" key-field-name="glAccountId" description="${accountName}"/> + </field> + <field name="openingBalanceCredit" title="${uiLabelMap.AccountingOpeningBalanceCredit}"> + <display description="${openingBalanceCredit}" type="currency" currency="${currencyUomId}"/> + </field> + <field name="openingBalanceDebit" title="${uiLabelMap.AccountingOpeningBalanceDebit}"> + <display description="${openingBalanceDebit}" type="currency" currency="${currencyUomId}"/> + </field> + <field name="monthlyBalanceCredit" title="${uiLabelMap.AccountingMonthlyBalanceCredit}"> + <display description="${credit}" type="currency" currency="${currencyUomId}"/> + </field> + <field name="monthlyBalanceDebit" title="${uiLabelMap.AccountingMonthlyBalanceDebit}"> + <display description="${debit}" type="currency" currency="${currencyUomId}"/> + </field> + <field name="closingBalanceCredit" title="${uiLabelMap.AccountingClosingBalanceCredit}"> + <display description="${openingBalanceCredit + credit}" type="currency" currency="${currencyUomId}"/> + </field> + <field name="closingBalanceDebit" title="${uiLabelMap.AccountingClosingBalanceDebit}"> + <display description="${openingBalanceDebit + debit}" type="currency" currency="${currencyUomId}"/> + </field> + <field name="yearToDateBalanceCredit" title="${uiLabelMap.AccountingYearToDateBalanceCredit}"> + <display description="${openingBalanceCredit + credit}" type="currency" currency="${currencyUomId}"/> + </field> + <field name="yearToDateBalanceDebit" title="${uiLabelMap.AccountingYearToDateBalanceDebit}"> + <display description="${openingBalanceDebit + debit}" type="currency" currency="${currencyUomId}"/> + </field> </form> <form name="MonthlyUnpostedTransactionList" type="list" list-name="unpostedTransTotalList" paginate-target="MonthlyTrialBalance" |
Free forum by Nabble | Edit this page |