Modified: ofbiz/branches/release13.07/applications/accounting/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/accounting/entitydef/entitymodel.xml?rev=1530274&r1=1530273&r2=1530274&view=diff ============================================================================== --- ofbiz/branches/release13.07/applications/accounting/entitydef/entitymodel.xml (original) +++ ofbiz/branches/release13.07/applications/accounting/entitydef/entitymodel.xml Tue Oct 8 13:57:54 2013 @@ -2035,7 +2035,6 @@ under the License. <field name="description" type="description"></field> <field name="productId" type="id"></field> <field name="externalId" type="id"><description>id of the account in an external system where the accounts are imported/exported</description></field> - <field name="postedBalance" type="currency-amount"></field> <prim-key field="glAccountId"/> <relation type="one" fk-name="GLACCT_TYPE" rel-entity-name="GlAccountType"> <key-map field-name="glAccountTypeId"/> @@ -2111,6 +2110,7 @@ under the License. <field name="glAccountId" type="id-ne"></field> <field name="organizationPartyId" type="id-ne"></field> <field name="customTimePeriodId" type="id-ne"></field> + <field name="openingBalance" type="currency-amount"></field> <field name="postedDebits" type="currency-amount"></field> <field name="postedCredits" type="currency-amount"></field> <field name="endingBalance" type="currency-amount"></field> @@ -2184,7 +2184,6 @@ under the License. <field name="roleTypeId" type="id-ne"></field> <field name="fromDate" type="date-time"></field> <field name="thruDate" type="date-time"></field> - <field name="postedBalance" type="currency-amount"></field> <prim-key field="glAccountId"/> <prim-key field="organizationPartyId"/> <relation type="one" fk-name="GLACCT_ORG_GLA" rel-entity-name="GlAccount"> @@ -2207,10 +2206,7 @@ under the License. <member-entity entity-alias="GLAO" entity-name="GlAccountOrganization"/> <member-entity entity-alias="GLA" entity-name="GlAccount"/> <alias-all entity-alias="GLAO"/> - <alias-all entity-alias="GLA"> - <exclude field="postedBalance"/> - </alias-all> - <alias entity-alias="GLA" name="accountPostedBalance" field="postedBalance"/> + <alias-all entity-alias="GLA"/> <view-link entity-alias="GLAO" rel-entity-alias="GLA"> <key-map field-name="glAccountId"/> </view-link> Modified: ofbiz/branches/release13.07/applications/accounting/script/org/ofbiz/accounting/ledger/AcctgTransServices.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/accounting/script/org/ofbiz/accounting/ledger/AcctgTransServices.xml?rev=1530274&r1=1530273&r2=1530274&view=diff ============================================================================== --- ofbiz/branches/release13.07/applications/accounting/script/org/ofbiz/accounting/ledger/AcctgTransServices.xml (original) +++ ofbiz/branches/release13.07/applications/accounting/script/org/ofbiz/accounting/ledger/AcctgTransServices.xml Tue Oct 8 13:57:54 2013 @@ -361,122 +361,6 @@ under the License. </if-empty> </iterate> </if-not-empty> - <!-- TODO: for each entry: lookup GlAccount, update posted balance --> - <iterate entry="acctgTransEntry" list="acctgTransEntryList"> - <!-- Get all data to operate on: GlAccount, GlAccountOrganization, GlAccountHistory --> - <clear-field field="glAccount"/> - <clear-field field="glAccountOrganization"/> - <clear-field field="glAccountHistoryList"/> - - <entity-one entity-name="GlAccount" value-field="glAccount"> - <field-map field-name="glAccountId" from-field="acctgTransEntry.glAccountId"/> - </entity-one> - <entity-one entity-name="GlAccountOrganization" value-field="glAccountOrganization"> - <field-map field-name="glAccountId" from-field="acctgTransEntry.glAccountId"/> - <field-map field-name="organizationPartyId" from-field="acctgTransEntry.organizationPartyId"/> - </entity-one> - - <!-- update the GlAccount's posted balance. This depends on whether the GlAccount is a debit or credit account and the - debitCreditFlag of the acctgTransEntry. Debits add to debit accounts and subtract from credit accounts. Credits add to - credit accounts and subtract from debit accounts --> - <!-- we do this by first calculating a postingAmount (positive or negative) then adding to the postingBalance --> - <clear-field field="postingAmount"/> - <!-- use the parent of the GlAccountClass, which should either be DEBIT or CREDIT --> - <get-related-one relation-name="GlAccountClass" value-field="glAccount" to-value-field="glAccountClass"/> - <get-related-one relation-name="ParentGlAccountClass" value-field="glAccountClass" to-value-field="parentGlAccountClass"/> - <!-- test if the account is a DEBIT account --> - <set field="isDebit" value="${groovy:org.ofbiz.accounting.util.UtilAccounting.isDebitAccount(glAccount)}"/> - <if-compare field="isDebit" operator="equals" value="true"> - <if-compare field="acctgTransEntry.debitCreditFlag" operator="equals" value="D"> - <set from-field="acctgTransEntry.amount" field="postingAmount"/> - <else> - <if-compare field="acctgTransEntry.debitCreditFlag" operator="equals" value="C"> - <calculate field="postingAmount" type="BigDecimal"> - <calcop field="acctgTransEntry.amount" operator="negative"/> - </calculate> - </if-compare> - </else> - </if-compare> - <else> - <!-- otherwise, test if the account is credit --> - <set field="isCredit" value="${groovy:org.ofbiz.accounting.util.UtilAccounting.isCreditAccount(glAccount)}"/> - <if-compare field="isCredit" operator="equals" value="true"> - <if-compare field="acctgTransEntry.debitCreditFlag" operator="equals" value="C"> - <set from-field="acctgTransEntry.amount" field="postingAmount"/> - <else> - <if-compare field="acctgTransEntry.debitCreditFlag" operator="equals" value="D"> - <calculate field="postingAmount" type="BigDecimal"> - <calcop field="acctgTransEntry.amount" operator="negative"/> - </calculate> - </if-compare> - </else> - </if-compare> - <else> - <log level="warning" message="GL account ${glAccount.glAccountId} is of class ${glAccount.glAccountClassId} which is neither debit nor credit - cannot update posted balance"/> - </else> - </if-compare> - </else> - </if-compare> - <log level="verbose" message="GL account: [${acctgTransEntry.glAccountId}] initial balance: [${glAccountOrganization.postedBalance}] ${acctgTransEntry.debitCreditFlag} [${acctgTransEntry.amount}]"/> - <!-- calculate the new posted balance for this gl account --> - <calculate field="postedBalance" type="BigDecimal"> - <calcop operator="get" field="glAccountOrganization.postedBalance"/> - <calcop operator="get" field="postingAmount"/> - </calculate> - <log level="verbose" message="GL account: [${acctgTransEntry.glAccountId}] final balance: [${postedBalance}]"/> - - <!-- update the gl account's posted balance for this organization --> - <set from-field="glAccount.glAccountId" field="updateGlAccountParams.glAccountId"/> - <set from-field="postedBalance" field="updateGlAccountParams.postedBalance" type="BigDecimal"/> - <set from-field="acctgTransEntry.organizationPartyId" field="updateGlAccountParams.organizationPartyId"/> - <call-service service-name="updateGlAccountOrganization" in-map-name="updateGlAccountParams"/> - - <!-- assemble the glAccountHistoryList, we will update all of these --> - <set from-field="customTimePeriodListByOrganizationPartyIdMap[acctgTransEntry.organizationPartyId]" field="customTimePeriodList"/> - <iterate entry="customTimePeriod" list="customTimePeriodList"> - <entity-one entity-name="GlAccountHistory" value-field="glAccountHistory"> - <field-map field-name="glAccountId" from-field="acctgTransEntry.glAccountId"/> - <field-map field-name="organizationPartyId" from-field="acctgTransEntry.organizationPartyId"/> - <field-map field-name="customTimePeriodId" from-field="customTimePeriod.customTimePeriodId"/> - </entity-one> - <!-- if no glAccountHistory create a new empty one --> - <if-empty field="glAccountHistory"> - <make-value value-field="glAccountHistory" entity-name="GlAccountHistory"/> - <set from-field="acctgTransEntry.glAccountId" field="glAccountHistory.glAccountId"/> - <set from-field="acctgTransEntry.organizationPartyId" field="glAccountHistory.organizationPartyId"/> - <set from-field="customTimePeriod.customTimePeriodId" field="glAccountHistory.customTimePeriodId"/> - <set field="glAccountHistory.postedDebits" value="0.0" type="BigDecimal"/> - <set field="glAccountHistory.postedCredits" value="0.0" type="BigDecimal"/> - <create-value value-field="glAccountHistory"/> - </if-empty> - - <!-- update GlAccountHistory's debit and credit totals --> - <if-compare field="acctgTransEntry.debitCreditFlag" operator="equals" value="D"> - <calculate field="glAccountHistory.postedDebits" type="BigDecimal"> - <calcop operator="add"> - <calcop operator="get" field="acctgTransEntry.amount"/> - <calcop operator="get" field="glAccountHistory.postedDebits"/> - </calcop> - </calculate> - <else> - <if-compare field="acctgTransEntry.debitCreditFlag" operator="equals" value="C"> - <calculate field="glAccountHistory.postedCredits" type="BigDecimal"> - <calcop operator="add"> - <calcop operator="get" field="acctgTransEntry.amount"/> - <calcop operator="get" field="glAccountHistory.postedCredits"/> - </calcop> - </calculate> - <else> - <add-error> - <fail-property resource="AccountingUiLabels" property="AccountingNotPostingGlAccountTransactionBadDebitCreditFlag"/> - </add-error> - </else> - </if-compare> - </else> - </if-compare> - <store-value value-field="glAccountHistory"/> - </iterate> - </iterate> <!-- check-errors just in case we had some bad debitCreditFlags --> <check-errors/> Modified: ofbiz/branches/release13.07/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml?rev=1530274&r1=1530273&r2=1530274&view=diff ============================================================================== --- ofbiz/branches/release13.07/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml (original) +++ ofbiz/branches/release13.07/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml Tue Oct 8 13:57:54 2013 @@ -787,10 +787,7 @@ under the License. </entity-one> <if-not-empty field="profitLossAccountHistory"> <!-- already posted: verify if numbers match --> - <call-class-method class-name="org.ofbiz.accounting.util.UtilAccounting" method-name="getNetBalance" ret-field="postedBalance"> - <field field="profitLossAccountHistory" type="GenericValue"/> - </call-class-method> - <if-compare-field field="postedBalance" to-field="totalAmount" operator="not-equals" type="BigDecimal"> + <if-compare-field field="profitLossAccountHistory.endingBalance" to-field="totalAmount" operator="not-equals" type="BigDecimal"> <add-error> <fail-property resource="AccountingUiLabels" property="AccountingPostedBalanceAlreadyPresent"/> </add-error> @@ -823,131 +820,25 @@ under the License. </else> </if-not-empty> - <!-- The history records in the current time period are updated with the endingBalance field --> - <entity-and entity-name="GlAccountHistory" list="glAccountHistories"> - <field-map field-name="organizationPartyId" from-field="customTimePeriod.organizationPartyId"/> - <field-map field-name="customTimePeriodId" from-field="customTimePeriod.customTimePeriodId"/> - </entity-and> - <iterate list="glAccountHistories" entry="glAccountHistory"> - <call-class-method class-name="org.ofbiz.accounting.util.UtilAccounting" method-name="getNetBalance" ret-field="endingBalance"> - <field field="glAccountHistory" type="GenericValue"/> - </call-class-method> - <set field="glAccountHistory.endingBalance" from-field="endingBalance"/> - <store-value value-field="glAccountHistory"/> - </iterate> - - <!-- For all the accounts of class asset/contra-asset/liability/equity the endingBalance of the last time period's history is added to the one of the history of the period being closed --> - <if-not-empty field="lastClosedTimePeriod"> - <entity-condition entity-name="GlAccountAndHistory" list="lastPeriodGlAccountAndHistories"> - <condition-list combine="and"> - <condition-expr field-name="organizationPartyId" operator="equals" from-field="customTimePeriod.organizationPartyId"/> - <condition-expr field-name="customTimePeriodId" operator="equals" from-field="lastClosedTimePeriod.customTimePeriodId"/> - <condition-list combine="or"> - <condition-expr field-name="glAccountClassId" operator="in" from-field="assetAccountClassIds"/> - <condition-expr field-name="glAccountClassId" operator="in" from-field="contraAssetAccountClassIds"/> - <condition-expr field-name="glAccountClassId" operator="in" from-field="liabilityAccountClassIds"/> - <condition-expr field-name="glAccountClassId" operator="in" from-field="equityAccountClassIds"/> - </condition-list> - </condition-list> - <order-by field-name="glAccountId"/> - </entity-condition> - <iterate list="lastPeriodGlAccountAndHistories" entry="lastPeriodGlAccountAndHistory"> - <get-related-one value-field="lastPeriodGlAccountAndHistory" relation-name="GlAccountHistory" to-value-field="lastPeriodGlAccountHistory"/> - <entity-one entity-name="GlAccountHistory" value-field="thisPeriodGlAccountHistory" auto-field-map="false"> - <field-map field-name="organizationPartyId" from-field="customTimePeriod.organizationPartyId"/> - <field-map field-name="customTimePeriodId" from-field="customTimePeriod.customTimePeriodId"/> - <field-map field-name="glAccountId" from-field="lastPeriodGlAccountHistory.glAccountId"/> - </entity-one> - <if-empty field="thisPeriodGlAccountHistory"> - <make-value entity-name="GlAccountHistory" value-field="thisPeriodGlAccountHistory"/> - <set field="thisPeriodGlAccountHistory.customTimePeriodId" from-field="customTimePeriod.customTimePeriodId"/> - <set field="thisPeriodGlAccountHistory.organizationPartyId" from-field="customTimePeriod.organizationPartyId"/> - <set field="thisPeriodGlAccountHistory.glAccountId" from-field="lastPeriodGlAccountHistory.glAccountId"/> - <set field="thisPeriodGlAccountHistory.postedDebits" value="0.0" type="BigDecimal"/> - <set field="thisPeriodGlAccountHistory.postedCredits" value="0.0" type="BigDecimal"/> - <set field="thisPeriodGlAccountHistory.endingBalance" from-field="lastPeriodGlAccountHistory.endingBalance"/> - <create-value value-field="thisPeriodGlAccountHistory"/> - <else> - <calculate field="thisPeriodGlAccountHistory.endingBalance"> - <calcop field="thisPeriodGlAccountHistory.endingBalance" operator="add"><calcop field="lastPeriodGlAccountHistory.endingBalance" operator="get"/></calcop> - </calculate> - <store-value value-field="thisPeriodGlAccountHistory"/> - </else> - </if-empty> - </iterate> - </if-not-empty> - - <!-- TODO: the usage of GlAccountOrganization.postedAmount is deprecated in place of GlAccountHistory; the next section will then be removed--> - <!-- Initialize the GlAccountOrganization.postedAmount for expense/revenue/income accounts for the new fiscal period --> - <entity-condition entity-name="GlAccountOrganizationAndClass" list="glAccountOrganizationAndClassList"> + <!-- One balance history record for each account is created for the time period being closed --> + <entity-condition entity-name="GlAccountOrganization" list="organizationGlAccounts"> <condition-list combine="and"> <condition-expr field-name="organizationPartyId" operator="equals" from-field="customTimePeriod.organizationPartyId"/> - <condition-expr field-name="postedBalance" operator="not-equals" value="0.0"/> + <condition-expr field-name="fromDate" operator="less" from-field="customTimePeriod.thruDate"/> <condition-list combine="or"> - <condition-expr field-name="glAccountClassId" operator="in" from-field="expenseAccountClassIds"/> - <condition-expr field-name="glAccountClassId" operator="in" from-field="revenueAccountClassIds"/> - <condition-expr field-name="glAccountClassId" operator="in" from-field="incomeAccountClassIds"/> - <condition-expr field-name="glAccountId" operator="equals" from-field="profitLossAccount.glAccountId"/> + <condition-expr field-name="thruDate" operator="greater-equals" from-field="customTimePeriod.fromDate"/> + <condition-expr field-name="thruDate" operator="equals" from-field="nullField"/> </condition-list> </condition-list> + <select-field field-name="glAccountId"/> </entity-condition> - <now-timestamp field="nowTimestamp"/> - <iterate list="glAccountOrganizationAndClassList" entry="glAccountOrganizationAndClass"> - <entity-condition entity-name="AcctgTransAndEntries" list="acctgTransAndEntries"> - <condition-list combine="and"> - <condition-expr field-name="organizationPartyId" operator="equals" from-field="customTimePeriod.organizationPartyId"/> - <condition-expr field-name="glAccountId" operator="equals" from-field="glAccountOrganizationAndClass.glAccountId"/> - <condition-expr field-name="isPosted" operator="equals" value="Y"/> - <condition-expr field-name="glFiscalTypeId" operator="equals" value="ACTUAL"/> - <condition-expr field-name="transactionDate" operator="greater-equals" from-field="customTimePeriod.thruDate"/> <!-- FIXME: Date to Timestamp --> - <condition-expr field-name="transactionDate" operator="less" from-field="nowTimestamp"/> - <condition-expr field-name="acctgTransTypeId" operator="not-equals" value="PERIOD_CLOSING"/> - </condition-list> - <order-by field-name="acctgTransId"/> - <order-by field-name="acctgTransEntrySeqId"/> - </entity-condition> - - <set field="newPostedBalance" value="0.0" type="BigDecimal"/> - <iterate list="acctgTransAndEntries" entry="acctgTransAndEntry"> - <get-related-one value-field="acctgTransAndEntry" relation-name="GlAccount" to-value-field="glAccount"/> - <call-class-method class-name="org.ofbiz.accounting.util.UtilAccounting" method-name="isCreditAccount" ret-field="isCreditAccount"> - <field field="glAccount" type="GenericValue"/> - </call-class-method> - <call-class-method class-name="org.ofbiz.accounting.util.UtilAccounting" method-name="isDebitAccount" ret-field="isDebitAccount"> - <field field="glAccount" type="GenericValue"/> - </call-class-method> - <call-class-method class-name="org.ofbiz.accounting.util.UtilAccounting" method-name="isExpenseAccount" ret-field="isExpenseAccount"> - <field field="glAccount" type="GenericValue"/> - </call-class-method> - <set field="amount" from-field="acctgTransAndEntry.amount"/> - <if> - <condition> - <or> - <and> - <if-compare field="acctgTransAndEntry.debitCreditFlag" operator="equals" value="D"/> - <if-compare field="isCreditAccount" operator="equals" value="true" type="Boolean"/> - </and> - <and> - <if-compare field="acctgTransAndEntry.debitCreditFlag" operator="equals" value="C"/> - <if-compare field="isDebitAccount" operator="equals" value="true" type="Boolean"/> - </and> - </or> - </condition> - <then> - <calculate field="amount"> - <calcop field="amount" operator="negative"/> - </calculate> - </then> - </if> - <calculate field="newPostedBalance"> - <calcop field="newPostedBalance" operator="add"><calcop field="amount" operator="get"/></calcop> - </calculate> - </iterate> - - <set field="updateGlAccountOrganizationInMap.organizationPartyId" from-field="customTimePeriod.organizationPartyId"/> - <set field="updateGlAccountOrganizationInMap.glAccountId" from-field="glAccountOrganizationAndClass.glAccountId"/> - <set field="updateGlAccountOrganizationInMap.postedBalance" from-field="newPostedBalance"/> - <call-service service-name="updateGlAccountOrganization" in-map-name="updateGlAccountOrganizationInMap"/> + <iterate list="organizationGlAccounts" entry="organizationGlAccount"> + <make-value entity-name="GlAccountHistory" value-field="glAccountHistory"/> + <set field="glAccountHistory.customTimePeriodId" from-field="customTimePeriod.customTimePeriodId"/> + <set field="glAccountHistory.organizationPartyId" from-field="customTimePeriod.organizationPartyId"/> + <set field="glAccountHistory.glAccountId" from-field="organizationGlAccount.glAccountId"/> + <create-value value-field="glAccountHistory"/> + <call-service service-name="computeAndStoreGlAccountHistoryBalance" in-map-name="glAccountHistory"/> </iterate> <set field="updateCustomTimePeriodInMap.customTimePeriodId" from-field="customTimePeriod.customTimePeriodId"/> @@ -956,6 +847,105 @@ under the License. <call-service service-name="updateCustomTimePeriod" in-map-name="updateCustomTimePeriodInMap"/> </simple-method> + <simple-method method-name="computeGlAccountBalanceForTimePeriod" short-description="Compute the total debits, total credits, opening, ending balances of an account in a financial period"> + <entity-one entity-name="CustomTimePeriod" auto-field-map="true" value-field="customTimePeriod"/> + <entity-one entity-name="GlAccount" auto-field-map="true" value-field="glAccount"/> + + <!-- compute totalDebitsToOpeningDate, totalDebitsToEndingDate, totalCreditsToOpeningDate, totalCreditsToEndingDate --> + <entity-condition entity-name="AcctgTransEntrySums" list="totalDebitsToOpeningDates"> + <condition-list combine="and"> + <condition-expr field-name="organizationPartyId" operator="equals" from-field="parameters.organizationPartyId"/> + <condition-expr field-name="glAccountId" operator="equals" from-field="parameters.glAccountId"/> + <condition-expr field-name="isPosted" operator="equals" value="Y"/> + <condition-expr field-name="debitCreditFlag" operator="equals" value="D"/> + <condition-expr field-name="glFiscalTypeId" operator="equals" value="ACTUAL"/> + <condition-expr field-name="transactionDate" operator="less" from-field="customTimePeriod.fromDate"/> + </condition-list> + <select-field field-name="amount"/> + </entity-condition> + <set field="totalDebitsToOpeningDate" from-field="totalDebitsToOpeningDates[0]"/> + + <entity-condition entity-name="AcctgTransEntrySums" list="totalDebitsToEndingDates"> + <condition-list combine="and"> + <condition-expr field-name="organizationPartyId" operator="equals" from-field="parameters.organizationPartyId"/> + <condition-expr field-name="glAccountId" operator="equals" from-field="parameters.glAccountId"/> + <condition-expr field-name="isPosted" operator="equals" value="Y"/> + <condition-expr field-name="debitCreditFlag" operator="equals" value="D"/> + <condition-expr field-name="glFiscalTypeId" operator="equals" value="ACTUAL"/> + <condition-expr field-name="transactionDate" operator="less" from-field="customTimePeriod.thruDate"/> + </condition-list> + <select-field field-name="amount"/> + </entity-condition> + <set field="totalDebitsToEndingDate" from-field="totalDebitsToEndingDates[0]"/> + + <entity-condition entity-name="AcctgTransEntrySums" list="totalCreditsToOpeningDates"> + <condition-list combine="and"> + <condition-expr field-name="organizationPartyId" operator="equals" from-field="parameters.organizationPartyId"/> + <condition-expr field-name="glAccountId" operator="equals" from-field="parameters.glAccountId"/> + <condition-expr field-name="isPosted" operator="equals" value="Y"/> + <condition-expr field-name="debitCreditFlag" operator="equals" value="C"/> + <condition-expr field-name="glFiscalTypeId" operator="equals" value="ACTUAL"/> + <condition-expr field-name="transactionDate" operator="less" from-field="customTimePeriod.fromDate"/> + </condition-list> + <select-field field-name="amount"/> + </entity-condition> + <set field="totalCreditsToOpeningDate" from-field="totalCreditsToOpeningDates[0]"/> + + <entity-condition entity-name="AcctgTransEntrySums" list="totalCreditsToEndingDates"> + <condition-list combine="and"> + <condition-expr field-name="organizationPartyId" operator="equals" from-field="parameters.organizationPartyId"/> + <condition-expr field-name="glAccountId" operator="equals" from-field="parameters.glAccountId"/> + <condition-expr field-name="isPosted" operator="equals" value="Y"/> + <condition-expr field-name="debitCreditFlag" operator="equals" value="C"/> + <condition-expr field-name="glFiscalTypeId" operator="equals" value="ACTUAL"/> + <condition-expr field-name="transactionDate" operator="less" from-field="customTimePeriod.thruDate"/> + </condition-list> + <select-field field-name="amount"/> + </entity-condition> + <set field="totalCreditsToEndingDate" from-field="totalCreditsToEndingDates[0]"/> + + <!-- compute totalDebitsInTimePeriod, totalCreditsInTimePeriod and store them --> + <set field="totalDebitsInTimePeriod" value="${totalDebitsToEndingDate.amount - totalDebitsToOpeningDate.amount}" type="BigDecimal"/> + <set field="totalCreditsInTimePeriod" value="${totalCreditsToEndingDate.amount - totalCreditsToOpeningDate.amount}" type="BigDecimal"/> + + <!-- compute opening and ending balance and store them --> + <set field="isDebit" value="${groovy:org.ofbiz.accounting.util.UtilAccounting.isDebitAccount(glAccount)}"/> + <if-compare field="isDebit" operator="equals" value="true"> + <!-- "Debit balance" account --> + <set field="openingBalance" value="${totalDebitsToOpeningDate.amount - totalCreditsToOpeningDate.amount}" type="BigDecimal"/> + <set field="endingBalance" value="${totalDebitsToEndingDate.amount - totalCreditsToEndingDate.amount}" type="BigDecimal"/> + <else> + <!-- "Credit balance" account --> + <set field="openingBalance" value="${totalCreditsToOpeningDate.amount - totalDebitsToOpeningDate.amount}" type="BigDecimal"/> + <set field="endingBalance" value="${totalCreditsToEndingDate.amount - totalDebitsToEndingDate.amount}" type="BigDecimal"/> + </else> + </if-compare> + + <field-to-result field="openingBalance" result-name="openingBalance"/> + <field-to-result field="endingBalance" result-name="endingBalance"/> + <field-to-result field="totalDebitsInTimePeriod" result-name="postedDebits"/> + <field-to-result field="totalCreditsInTimePeriod" result-name="postedCredits"/> + </simple-method> + + <simple-method method-name="computeAndStoreGlAccountHistoryBalance" short-description="Compute and store the total debits, total credits, opening, ending balances of an account in a financial period"> + <entity-one entity-name="GlAccountHistory" auto-field-map="true" value-field="glAccountHistory"/> + <set field="inMap.organizationPartyId" from-field="parameters.organizationPartyId"/> + <set field="inMap.customTimePeriodId" from-field="parameters.customTimePeriodId"/> + <set field="inMap.glAccountId" from-field="parameters.glAccountId"/> + <call-service service-name="computeGlAccountBalanceForTimePeriod" in-map-name="inMap"> + <result-to-field field="openingBalance"/> + <result-to-field field="endingBalance"/> + <result-to-field field="postedDebits"/> + <result-to-field field="postedCredits"/> + </call-service> + <!-- persist the balances --> + <set field="glAccountHistory.openingBalance" from-field="openingBalance"/> + <set field="glAccountHistory.endingBalance" from-field="endingBalance"/> + <set field="glAccountHistory.postedDebits" from-field="postedDebits"/> + <set field="glAccountHistory.postedCredits" from-field="postedCredits"/> + <store-value value-field="glAccountHistory"/> + </simple-method> + <simple-method method-name="prepareIncomeStatement" short-description="Prepare data for the Income Statement"> <call-simple-method method-name="getGlArithmeticSettingsInline"/> <entity-one entity-name="GlAccountClass" value-field="expenseGlAccountClass"> @@ -2782,71 +2772,6 @@ under the License. </if-not-empty> </simple-method> - <simple-method method-name="getGlAcctgOrgWithPostedBalanceSplit" short-description="Posted amounts split by cost center from GlAccountOrganization"> - <!-- retrieve ledger rounding properties --> - <call-simple-method method-name="getGlArithmeticSettingsInline"/> - <now-timestamp field="nowTimestamp"/> - <set field="fromDate" from-field="parameters.fromDate" type="Timestamp"/> - <set field="thruDate" from-field="parameters.thruDate" type="Timestamp" default-value="${nowTimestamp}"/> - <if-empty field="fromDate"> - <entity-one entity-name="CustomTimePeriod" value-field="customTimePeriod" auto-field-map="false"> - <field-map field-name="customTimePeriodId" from-field="parameters.timePeriod"/> - </entity-one> - <set field="fromDate" from-field="customTimePeriod.fromDate" type="Timestamp"/> - <set field="thruDate" from-field="customTimePeriod.thruDate" type="Timestamp"/> - </if-empty> - <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="GlAccountOrganization" list="glAccountOrganizations" use-cache="true"> - <condition-list> - <condition-expr field-name="organizationPartyId" operator="in" from-field="partyIds"/> - <condition-expr field-name="postedBalance" operator="not-equals" value=""/> - <condition-expr field-name="fromDate" operator="greater-equals" from-field="fromDate"/> - <condition-expr field-name="fromDate" operator="less" from-field="thruDate"/> - </condition-list> - <order-by field-name="glAccountId"/> - </entity-condition> - <if-not-empty field="glAccountOrganizations"> - <entity-and entity-name="GlAccountCategory" list="glAccountCategories" use-cache="true"> - <field-map field-name="glAccountCategoryTypeId" value="COST_CENTER"/> - <order-by field-name="glAccountCategoryId"/> - </entity-and> - <if-not-empty field="glAccountCategories"> - <iterate list="glAccountOrganizations" entry="glAccountOrganization"> - <clear-field field="glAcctgOrgAndCostCenterMap"/> - <set field="postedBalance" from-field="glAccountOrganization.postedBalance" type="BigDecimal"/> - <if-compare field="postedBalance" operator="less" value="0" type="BigDecimal"> - <set field="postedBalance" value="${groovy:postedBalance.negate()}" type="BigDecimal"/> - </if-compare> - <set field="glAcctgOrgAndCostCenterMap.postedBalance" from-field="postedBalance"/> - <entity-one entity-name="GlAccount" value-field="glAccount" auto-field-map="false"> - <field-map field-name="glAccountId" from-field="glAccountOrganization.glAccountId"/> - </entity-one> - <set field="glAcctgOrgAndCostCenterMap.glAccountId" from-field="glAccount.glAccountId"/> - <set field="glAcctgOrgAndCostCenterMap.accountCode" from-field="glAccount.accountCode"/> - <set field="glAcctgOrgAndCostCenterMap.accountName" from-field="glAccount.accountName"/> - <iterate list="glAccountCategories" entry="glAccountCategory"> - <entity-and entity-name="GlAccountCategoryMember" list="glAccountCategoryMembers" filter-by-date="true"> - <field-map field-name="glAccountId" from-field="glAccountOrganization.glAccountId"/> - <field-map field-name="glAccountCategoryId" from-field="glAccountCategory.glAccountCategoryId"/> - </entity-and> - <if-not-empty field="glAccountCategoryMembers"> - <first-from-list list="glAccountCategoryMembers" entry="glAccountCategoryMember"/> - <if-not-empty field="glAccountCategoryMember"> - <set field="divisor" value="100" type="BigDecimal"/> - <set field="splitAmount" value="${groovy:postedBalance.multiply(glAccountCategoryMember.amountPercentage).divide(divisor, Integer.valueOf(ledgerDecimals), BigDecimal.ROUND_HALF_UP)}" type="BigDecimal"/> - <set field="glAcctgOrgAndCostCenterMap[glAccountCategory.glAccountCategoryId]" from-field="splitAmount" type="BigDecimal"/> - </if-not-empty> - </if-not-empty> - </iterate> - <field-to-list field="glAcctgOrgAndCostCenterMap" list="glAcctgOrgAndCostCenterList"/> - </iterate> - </if-not-empty> - <field-to-result field="glAcctgOrgAndCostCenterList"/> - </if-not-empty> - </simple-method> - <simple-method method-name="getGlAcctgAndAmountPercentage" short-description="Get amount percentage and glAccount for cost center"> <set field="glAcctgAndAmountPercentageList" type="List" from-field="nullfield"/> <set field="organizationPartyId" from-field="parameters.organizationPartyId"/> Modified: ofbiz/branches/release13.07/applications/accounting/servicedef/services_ledger.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/accounting/servicedef/services_ledger.xml?rev=1530274&r1=1530273&r2=1530274&view=diff ============================================================================== --- ofbiz/branches/release13.07/applications/accounting/servicedef/services_ledger.xml (original) +++ ofbiz/branches/release13.07/applications/accounting/servicedef/services_ledger.xml Tue Oct 8 13:57:54 2013 @@ -295,6 +295,23 @@ under the License. <auto-attributes include="pk" mode="IN" optional="false"/> </service> + <service name="computeGlAccountBalanceForTimePeriod" engine="simple" + location="component://accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="computeGlAccountBalanceForTimePeriod" auth="true"> + <description>Compute the total debits, total credits, opening, ending balances of an account in a financial period</description> + <attribute name="organizationPartyId" type="String" mode="IN" optional="false"/> + <attribute name="customTimePeriodId" type="String" mode="IN" optional="false"/> + <attribute name="glAccountId" type="String" mode="IN" optional="false"/> + <attribute name="openingBalance" type="BigDecimal" mode="OUT" optional="false"/> + <attribute name="postedDebits" type="BigDecimal" mode="OUT" optional="false"/> + <attribute name="postedCredits" type="BigDecimal" mode="OUT" optional="false"/> + <attribute name="endingBalance" type="BigDecimal" mode="OUT" optional="false"/> + </service> + <service name="computeAndStoreGlAccountHistoryBalance" engine="simple" + location="component://accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="computeAndStoreGlAccountHistoryBalance" auth="true"> + <description>Compute and store in a GlAccountHistory record the total debits, total credits, opening, ending balances of an account in a financial period</description> + <auto-attributes entity-name="GlAccountHistory" include="pk" mode="IN" optional="false"/> + </service> + <!-- Financial Reports --> <service name="prepareIncomeStatement" engine="simple" location="component://accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="prepareIncomeStatement" auth="true"> @@ -630,16 +647,6 @@ under the License. <attribute name="totalAmountPercentage" mode="IN" type="BigDecimal" optional="true"/> </service> - <service name="getGlAcctgOrgWithPostedBalanceSplit" engine="simple" - location="component://accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="getGlAcctgOrgWithPostedBalanceSplit" auth="true"> - <description>Posted amounts split by cost center from GlAccountOrganization</description> - <attribute name="organizationPartyId" type="String" mode="IN"/> - <attribute name="fromDate" type="Timestamp" mode="IN" optional="true"/> - <attribute name="thruDate" type="Timestamp" mode="IN" optional="true"/> - <attribute name="timePeriod" type="String" mode="IN" optional="true"/> - <attribute name="glAcctgOrgAndCostCenterList" mode="OUT" type="List" optional="true"/> - </service> - <service name="getGlAcctgAndAmountPercentage" engine="simple" location="component://accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="getGlAcctgAndAmountPercentage" auth="false"> <description>Get amount percentage and glAccount for cost center</description> Modified: ofbiz/branches/release13.07/applications/accounting/src/org/ofbiz/accounting/util/UtilAccounting.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/accounting/src/org/ofbiz/accounting/util/UtilAccounting.java?rev=1530274&r1=1530273&r2=1530274&view=diff ============================================================================== --- ofbiz/branches/release13.07/applications/accounting/src/org/ofbiz/accounting/util/UtilAccounting.java (original) +++ ofbiz/branches/release13.07/applications/accounting/src/org/ofbiz/accounting/util/UtilAccounting.java Tue Oct 8 13:57:54 2013 @@ -91,31 +91,6 @@ public class UtilAccounting { return getProductOrgGlAccountId(null, glAccountTypeId, organizationPartyId, delegator); } - /** - * Little method to figure out the net or ending balance of a GlAccountHistory or GlAccountAndHistory value, based on what kind - * of account (DEBIT or CREDIT) it is - * @param account - GlAccountHistory or GlAccountAndHistory value - * @return balance - a BigDecimal - */ - public static BigDecimal getNetBalance(GenericValue account, String debugModule) { - try { - return getNetBalance(account); - } catch (GenericEntityException ex) { - Debug.logError(ex.getMessage(), debugModule); - return null; - } - } - public static BigDecimal getNetBalance(GenericValue account) throws GenericEntityException { - GenericValue glAccount = account.getRelatedOne("GlAccount", false); - BigDecimal balance = BigDecimal.ZERO; - if (isDebitAccount(glAccount)) { - balance = account.getBigDecimal("postedDebits").subtract(account.getBigDecimal("postedCredits")); - } else if (isCreditAccount(glAccount)) { - balance = account.getBigDecimal("postedCredits").subtract(account.getBigDecimal("postedDebits")); - } - return balance; - } - public static List<String> getDescendantGlAccountClassIds(GenericValue glAccountClass) throws GenericEntityException { List<String> glAccountClassIds = FastList.newInstance(); getGlAccountClassChildren(glAccountClass, glAccountClassIds); Modified: ofbiz/branches/release13.07/applications/accounting/webapp/accounting/WEB-INF/actions/reports/GlAccountTrialBalance.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/accounting/webapp/accounting/WEB-INF/actions/reports/GlAccountTrialBalance.groovy?rev=1530274&r1=1530273&r2=1530274&view=diff ============================================================================== --- ofbiz/branches/release13.07/applications/accounting/webapp/accounting/WEB-INF/actions/reports/GlAccountTrialBalance.groovy (original) +++ ofbiz/branches/release13.07/applications/accounting/webapp/accounting/WEB-INF/actions/reports/GlAccountTrialBalance.groovy Tue Oct 8 13:57:54 2013 @@ -16,14 +16,11 @@ * specific language governing permissions and limitations * under the License. */ -import org.ofbiz.entity.condition.EntityCondition; -import org.ofbiz.entity.condition.EntityOperator; -import org.ofbiz.entity.util.EntityUtil; +import java.sql.Timestamp; 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) { @@ -87,12 +84,12 @@ if (organizationPartyId) { acctgTransEntriesAndTransTotal.totalOfYearToDateCredit = totalOfYearToDateCredit.setScale(decimals, rounding); if (isDebitAccount) { - balanceOfTheAcctgForYear = balanceOfTheAcctgForYear + acctgTransEntriesAndTransTotal.debitCreditDifference; - acctgTransEntriesAndTransTotal.balanceOfTheAcctgForYear = balanceOfTheAcctgForYear.setScale(decimals, rounding); + acctgTransEntriesAndTransTotal.balance = acctgTransEntriesAndTransTotal.debitCreditDifference; } else { - balanceOfTheAcctgForYear = balanceOfTheAcctgForYear + acctgTransEntriesAndTransTotal.debitCreditDifference; - acctgTransEntriesAndTransTotal.balanceOfTheAcctgForYear = balanceOfTheAcctgForYear.setScale(decimals, rounding); + acctgTransEntriesAndTransTotal.balance = -1 * acctgTransEntriesAndTransTotal.debitCreditDifference; } + balanceOfTheAcctgForYear = balanceOfTheAcctgForYear + acctgTransEntriesAndTransTotal.balance; + acctgTransEntriesAndTransTotal.balanceOfTheAcctgForYear = balanceOfTheAcctgForYear.setScale(decimals, rounding); glAcctgTrialBalanceList.add(acctgTransEntriesAndTransTotal); Modified: ofbiz/branches/release13.07/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy?rev=1530274&r1=1530273&r2=1530274&view=diff ============================================================================== --- ofbiz/branches/release13.07/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy (original) +++ ofbiz/branches/release13.07/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy Tue Oct 8 13:57:54 2013 @@ -17,6 +17,8 @@ * under the License. */ +import java.sql.Timestamp; + import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.entity.GenericValue; Modified: ofbiz/branches/release13.07/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy?rev=1530274&r1=1530273&r2=1530274&view=diff ============================================================================== --- ofbiz/branches/release13.07/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy (original) +++ ofbiz/branches/release13.07/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy Tue Oct 8 13:57:54 2013 @@ -17,6 +17,8 @@ * under the License. */ +import org.ofbiz.entity.condition.EntityCondition +import org.ofbiz.entity.condition.EntityOperator import org.ofbiz.party.party.PartyHelper; partyNameList = []; @@ -25,3 +27,31 @@ parties.each { party -> partyNameList.add(partyName); } context.partyNameList = partyNameList; + +if (parameters.customTimePeriodId) { + customTimePeriod = delegator.findOne('CustomTimePeriod', [customTimePeriodId:parameters.customTimePeriodId], true) + exprList = []; + exprList.add(EntityCondition.makeCondition('organizationPartyId', EntityOperator.IN, partyIds)) + exprList.add(EntityCondition.makeCondition('fromDate', EntityOperator.LESS_THAN, customTimePeriod.getDate('thruDate').toTimestamp())) + exprList.add(EntityCondition.makeCondition(EntityCondition.makeCondition('thruDate', EntityOperator.GREATER_THAN_EQUAL_TO, customTimePeriod.getDate('fromDate').toTimestamp()), EntityOperator.OR, EntityCondition.makeCondition('thruDate', EntityOperator.EQUALS, null))) + List organizationGlAccounts = delegator.findList('GlAccountOrganizationAndClass', EntityCondition.makeCondition(exprList, EntityOperator.AND), null, ['accountCode'], null, false) + + accountBalances = [] + postedDebitsTotal = 0 + postedCreditsTotal = 0 + organizationGlAccounts.each { organizationGlAccount -> + accountBalance = [:] + accountBalance = dispatcher.runSync('computeGlAccountBalanceForTimePeriod', [organizationPartyId: organizationGlAccount.organizationPartyId, customTimePeriodId: customTimePeriod.customTimePeriodId, glAccountId: organizationGlAccount.glAccountId, userLogin: userLogin]); + if (accountBalance.postedDebits != 0 || accountBalance.postedCredits != 0) { + accountBalance.glAccountId = organizationGlAccount.glAccountId + accountBalance.accountCode = organizationGlAccount.accountCode + accountBalance.accountName = organizationGlAccount.accountName + postedDebitsTotal = postedDebitsTotal + accountBalance.postedDebits + postedCreditsTotal = postedCreditsTotal + accountBalance.postedCredits + accountBalances.add(accountBalance) + } + } + context.postedDebitsTotal = postedDebitsTotal + context.postedCreditsTotal = postedCreditsTotal + context.accountBalances = accountBalances +} Modified: ofbiz/branches/release13.07/applications/accounting/webapp/accounting/reports/GlAccountTrialBalanceReport.fo.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/accounting/webapp/accounting/reports/GlAccountTrialBalanceReport.fo.ftl?rev=1530274&r1=1530273&r2=1530274&view=diff ============================================================================== --- ofbiz/branches/release13.07/applications/accounting/webapp/accounting/reports/GlAccountTrialBalanceReport.fo.ftl (original) +++ ofbiz/branches/release13.07/applications/accounting/webapp/accounting/reports/GlAccountTrialBalanceReport.fo.ftl Tue Oct 8 13:57:54 2013 @@ -84,7 +84,7 @@ under the License. </fo:table-cell> </fo:table-header> <fo:table-body> - <fo:table-row border="1pt solid" border-width=".1mm"><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="3" text-align="center" ><fo:block text-align="center">${uiLabelMap.AccountingTheBalanceOfLastYear}</fo:block></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"><fo:block text-align="center"><#if (isDebitAccount)??>${uiLabelMap.AccountingDebitFlag}<#else>${uiLabelMap.AccountingCreditFlag}</#if></fo:block></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"><fo:bloc k text-align="center">${(openingBalance)!}</fo:block></fo:table-cell></fo:table-row> + <fo:table-row border="1pt solid" border-width=".1mm"><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="3" text-align="center" ><fo:block text-align="center">${uiLabelMap.AccountingTheBalanceOfLastYear}</fo:block></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"><fo:block text-align="center"><#if (isDebitAccount)>${uiLabelMap.AccountingDebitFlag}<#else>${uiLabelMap.AccountingCreditFlag}</#if></fo:block></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"><fo:block text-align="center">${(openingBalance)!}</fo:block></fo:table-cell></fo:table-row> <#list glAcctgTrialBalanceList as glAcctgTrialBalance> <#assign acctgTransAndEntries = glAcctgTrialBalance.acctgTransAndEntries/> <#if (acctgTransAndEntries)?has_content> @@ -125,8 +125,8 @@ under the License. </fo:table-cell> </fo:table-row> </#list> - <fo:table-row border="1pt solid" border-width=".1mm"><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="3" text-align="center" ><fo:block text-align="center">${uiLabelMap.AccountingTotalOfTheCurrentMonth}</fo:block></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"><fo:block text-align="center">${(glAcctgTrialBalance.debitTotal)!}</fo:block></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"><fo:block text-align="center">${(glAcctgTrialBalance.creditTotal)!}</fo:block></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"><fo:block text-align="center"><#if (isDebitAccount)??>${uiLabelMap.AccountingDebitFla g}<#else>${uiLabelMap.AccountingCreditFlag}</#if></fo:block></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"><fo:block text-align="center">${(glAcctgTrialBalance.debitCreditDifference)!}</fo:block></fo:table-cell></fo:table-row> - <fo:table-row border="1pt solid" border-width=".1mm"><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="3" text-align="center" ><fo:block text-align="center">${uiLabelMap.AccountingTotalOfYearToDate}</fo:block></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"><fo:block text-align="center">${glAcctgTrialBalance.totalOfYearToDateDebit}</fo:block></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"><fo:block text-align="center">${glAcctgTrialBalance.totalOfYearToDateCredit}</fo:block></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"><fo:block text-align="center"><#if (isDebitAccount)??>${uiLabelMap.Accou ntingDebitFlag}<#else>${uiLabelMap.AccountingCreditFlag}</#if></fo:block></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"><fo:block text-align="center">${(glAcctgTrialBalance.balanceOfTheAcctgForYear)!}</fo:block></fo:table-cell></fo:table-row> + <fo:table-row border="1pt solid" border-width=".1mm"><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="3" text-align="center" ><fo:block text-align="center">${uiLabelMap.AccountingTotalOfTheCurrentMonth}</fo:block></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"><fo:block text-align="center">${(glAcctgTrialBalance.debitTotal)!}</fo:block></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"><fo:block text-align="center">${(glAcctgTrialBalance.creditTotal)!}</fo:block></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"><fo:block text-align="center"><#if (isDebitAccount)>${uiLabelMap.AccountingDebitFlag} <#else>${uiLabelMap.AccountingCreditFlag}</#if></fo:block></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"><fo:block text-align="center">${(glAcctgTrialBalance.balance)!}</fo:block></fo:table-cell></fo:table-row> + <fo:table-row border="1pt solid" border-width=".1mm"><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="3" text-align="center" ><fo:block text-align="center">${uiLabelMap.AccountingTotalOfYearToDate}</fo:block></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"><fo:block text-align="center">${glAcctgTrialBalance.totalOfYearToDateDebit}</fo:block></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"><fo:block text-align="center">${glAcctgTrialBalance.totalOfYearToDateCredit}</fo:block></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"><fo:block text-align="center"><#if (isDebitAccount)>${uiLabelMap.Account ingDebitFlag}<#else>${uiLabelMap.AccountingCreditFlag}</#if></fo:block></fo:table-cell><fo:table-cell border="1pt solid" border-width=".1mm" number-columns-spanned="1"><fo:block text-align="center">${(glAcctgTrialBalance.balanceOfTheAcctgForYear)!}</fo:block></fo:table-cell></fo:table-row> </#if> </#list> </fo:table-body> Modified: ofbiz/branches/release13.07/applications/accounting/webapp/accounting/reports/GlAccountTrialBalanceReport.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/accounting/webapp/accounting/reports/GlAccountTrialBalanceReport.ftl?rev=1530274&r1=1530273&r2=1530274&view=diff ============================================================================== --- ofbiz/branches/release13.07/applications/accounting/webapp/accounting/reports/GlAccountTrialBalanceReport.ftl (original) +++ ofbiz/branches/release13.07/applications/accounting/webapp/accounting/reports/GlAccountTrialBalanceReport.ftl Tue Oct 8 13:57:54 2013 @@ -44,7 +44,7 @@ under the License. <td colspan=2></td> <td colspan=3 align="center"><b>${uiLabelMap.AccountingTheBalanceOfLastYear}</b></td> <td colspan=2></td> - <td ALIGN="right"><b><#if (isDebitAccount)??>${uiLabelMap.AccountingDebitFlag}<#else>${uiLabelMap.AccountingCreditFlag}</#if></b></td> + <td ALIGN="right"><b><#if (isDebitAccount)>${uiLabelMap.AccountingDebitFlag}<#else>${uiLabelMap.AccountingCreditFlag}</#if></b></td> <td ALIGN="right">${(openingBalance)!}</td> </tr> <#list glAcctgTrialBalanceList as glAcctgTrialBalance> @@ -69,15 +69,15 @@ under the License. <td colspan=3 ALIGN="center"><b>${uiLabelMap.AccountingTotalOfTheCurrentMonth}</b></td> <td ALIGN="right" colspan=1><b>${(glAcctgTrialBalance.debitTotal)!}</b></td> <td ALIGN="right" colspan=1><b>${(glAcctgTrialBalance.creditTotal)!}</b></td> - <td ALIGN="right" colspan=1><b><#if (isDebitAccount)??>${uiLabelMap.AccountingDebitFlag}<#else>${uiLabelMap.AccountingCreditFlag}</#if></b></td> - <td ALIGN="right" colspan=1><b>${(glAcctgTrialBalance.debitCreditDifference)!}</b></td> + <td ALIGN="right" colspan=1><b><#if (isDebitAccount)>${uiLabelMap.AccountingDebitFlag}<#else>${uiLabelMap.AccountingCreditFlag}</#if></b></td> + <td ALIGN="right" colspan=1><b>${(glAcctgTrialBalance.balance)!}</b></td> </tr> <tr class="header-row"> <td colspan=2></td> <td ALIGN="center" colspan=3><b>${uiLabelMap.AccountingTotalOfYearToDate}</b></td> <td ALIGN="right"><b>${glAcctgTrialBalance.totalOfYearToDateDebit}</b></td> <td ALIGN="right"><b>${glAcctgTrialBalance.totalOfYearToDateCredit}</b></td> - <td ALIGN="right"><b><#if (isDebitAccount)??>${uiLabelMap.AccountingDebitFlag}<#else>${uiLabelMap.AccountingCreditFlag}</#if></b></td> + <td ALIGN="right"><b><#if (isDebitAccount)>${uiLabelMap.AccountingDebitFlag}<#else>${uiLabelMap.AccountingCreditFlag}</#if></b></td> <td ALIGN="right"><b>${(glAcctgTrialBalance.balanceOfTheAcctgForYear)!}</b></td> </tr> </#if> Modified: ofbiz/branches/release13.07/applications/accounting/widget/AccountingTrees.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/accounting/widget/AccountingTrees.xml?rev=1530274&r1=1530273&r2=1530274&view=diff ============================================================================== --- ofbiz/branches/release13.07/applications/accounting/widget/AccountingTrees.xml (original) +++ ofbiz/branches/release13.07/applications/accounting/widget/AccountingTrees.xml Tue Oct 8 13:57:54 2013 @@ -31,7 +31,7 @@ under the License. </node> <node name="node-body"> <entity-one entity-name="GlAccount" value-field="glAccount"></entity-one> - <link target="GlAccountNavigate" text="${glAccountId} ${glAccount.accountName} ${postedBalance}"> + <link target="GlAccountNavigate" text="${glAccountId} ${glAccount.accountName}"> <parameter param-name="glAccountId"/> <parameter param-name="trail"/> </link> @@ -54,7 +54,7 @@ under the License. </node> <node name="node-body"> <entity-one entity-name="GlAccount" value-field="glAccount"></entity-one> - <link target="GlAccountNavigate" text="${glAccountId} ${glAccount.accountName} ${postedBalance}"> + <link target="GlAccountNavigate" text="${glAccountId} ${glAccount.accountName}"> <parameter param-name="glAccountId"/> <parameter param-name="trail"/> </link> Modified: ofbiz/branches/release13.07/applications/accounting/widget/GlSetupForms.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/accounting/widget/GlSetupForms.xml?rev=1530274&r1=1530273&r2=1530274&view=diff ============================================================================== --- ofbiz/branches/release13.07/applications/accounting/widget/GlSetupForms.xml (original) +++ ofbiz/branches/release13.07/applications/accounting/widget/GlSetupForms.xml Tue Oct 8 13:57:54 2013 @@ -1098,7 +1098,6 @@ under the License. <field name="accountName" ><display-entity entity-name="GlAccount" key-field-name="glAccountId" description="${accountName}"/></field> <field name="description"><display description="${description}"/></field> <field name="productId"><display description="${productId}"/></field> - <field name="postedBalance"><display description="${postedBalance}"/></field> </form> <form name="FindGlAccountCategory" type="single" target="FindGlAccountCategory" default-entity-name="GlAccountCategory"> Modified: ofbiz/branches/release13.07/applications/accounting/widget/GlobalGlAccountsForms.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/accounting/widget/GlobalGlAccountsForms.xml?rev=1530274&r1=1530273&r2=1530274&view=diff ============================================================================== --- ofbiz/branches/release13.07/applications/accounting/widget/GlobalGlAccountsForms.xml (original) +++ ofbiz/branches/release13.07/applications/accounting/widget/GlobalGlAccountsForms.xml Tue Oct 8 13:57:54 2013 @@ -97,7 +97,6 @@ under the License. </display-entity> </field> <field name="accountCode"><hidden/></field> - <field name="postedBalance" widget-area-style="align-text" title-area-style="align-text"><display type="currency" currency="${defaultOrganizationPartyCurrencyUomId}"/></field> </form> <form name="EditGlAccount" type="single" target="updateGlAccount" title="" default-map-name="glAccount" @@ -145,7 +144,6 @@ under the License. </entity-options> </drop-down> </field> - <field name="postedBalance"><display/></field> <field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field> <field name="submitButton" title="${uiLabelMap.CommonAdd}" use-when="glAccount==null" widget-style="smallSubmit"><submit button-type="button"/></field> Modified: ofbiz/branches/release13.07/applications/accounting/widget/ReportFinancialSummaryForms.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/accounting/widget/ReportFinancialSummaryForms.xml?rev=1530274&r1=1530273&r2=1530274&view=diff ============================================================================== --- ofbiz/branches/release13.07/applications/accounting/widget/ReportFinancialSummaryForms.xml (original) +++ ofbiz/branches/release13.07/applications/accounting/widget/ReportFinancialSummaryForms.xml Tue Oct 8 13:57:54 2013 @@ -540,26 +540,8 @@ under the License. <field name="submitButton" title="${uiLabelMap.CommonSubmit}" widget-style="smallSubmit"><submit button-type="button"/></field> </form> - <form name="TrialBalanceReport" type="list" list-name="glAccountAndHistories" - odd-row-style="alternate-row" default-table-style="basic-table hover-bar"> - <actions> - <entity-condition entity-name="GlAccountAndHistoryTotals" filter-by-date="false" list="glAccountAndHistories"> - <condition-list> - <condition-expr field-name="organizationPartyId" operator="in" from-field="partyIds"/> - <condition-expr field-name="customTimePeriodId" operator="equals" from-field="parameters.customTimePeriodId"/> - </condition-list> - <select-field field-name="glAccountId"/> - <select-field field-name="accountCode"/> - <select-field field-name="accountName"/> - <select-field field-name="totalPostedDebits"/> - <select-field field-name="totalPostedCredits"/> - <select-field field-name="totalEndingBalance"/> - <order-by field-name="accountCode"/> - </entity-condition> - </actions> - <row-actions> - <set field="totalEndingBalance" from-field="totalEndingBalance" default-value="${totalPostedDebits - totalPostedCredits}" type="BigDecimal"/> - </row-actions> + <form name="TrialBalanceReport" type="list" list-name="accountBalances" + odd-row-style="alternate-row" default-table-style="basic-table hover-bar"> <field name="accountCode"> <hyperlink target="FindAcctgTransEntries" description="${accountCode}"> <parameter param-name="glAccountId"/> @@ -567,9 +549,10 @@ under the License. </hyperlink> </field> <field name="accountName" title-area-style="tableheadwide"><display description="${accountName}"/></field> - <field name="totalPostedDebits" title="${uiLabelMap.AccountingDebitFlag}" widget-style="tabletextright"><display description="${totalPostedDebits}" type="currency" currency="${currencyUomId}"/></field> - <field name="totalPostedCredits" title="${uiLabelMap.AccountingCreditFlag}" widget-style="tabletextright"><display description="${totalPostedCredits}" type="currency" currency="${currencyUomId}"/></field> - <field name="totalEndingBalance" title="${uiLabelMap.AccountingEndingBalance}" widget-style="tabletextright"><display description="${totalEndingBalance}" type="currency" currency="${currencyUomId}"/></field> + <field name="openingBalance" title="${uiLabelMap.AccountingOpeningBalance}" widget-style="tabletextright"><display description="${openingBalance}" type="currency" currency="${currencyUomId}"/></field> + <field name="postedDebits" title="${uiLabelMap.AccountingDebitFlag}" widget-style="tabletextright"><display description="${postedDebits}" type="currency" currency="${currencyUomId}"/></field> + <field name="postedCredits" title="${uiLabelMap.AccountingCreditFlag}" widget-style="tabletextright"><display description="${postedCredits}" type="currency" currency="${currencyUomId}"/></field> + <field name="endingBalance" title="${uiLabelMap.AccountingEndingBalance}" widget-style="tabletextright"><display description="${endingBalance}" type="currency" currency="${currencyUomId}"/></field> </form> <form name="CashFlowStatementParameters" type="single" header-row-style="header-row" default-table-style="basic-table"> Modified: ofbiz/branches/release13.07/applications/accounting/widget/ReportFinancialSummaryScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/accounting/widget/ReportFinancialSummaryScreens.xml?rev=1530274&r1=1530273&r2=1530274&view=diff ============================================================================== --- ofbiz/branches/release13.07/applications/accounting/widget/ReportFinancialSummaryScreens.xml (original) +++ ofbiz/branches/release13.07/applications/accounting/widget/ReportFinancialSummaryScreens.xml Tue Oct 8 13:57:54 2013 @@ -227,15 +227,6 @@ under the License. </entity-condition> <set field="partyIds[]" from-field="organizationPartyId"/> <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy"/> - <entity-condition entity-name="GlAccountAndHistoryTotals" filter-by-date="false" list="grandTotalPosted"> - <condition-list> - <condition-expr field-name="organizationPartyId" operator="in" from-field="partyIds"/> - <condition-expr field-name="customTimePeriodId" operator="equals" from-field="parameters.customTimePeriodId"/> - </condition-list> - <select-field field-name="totalPostedDebits"/> - <select-field field-name="totalPostedCredits"/> - </entity-condition> - <set field="grandTotalPostedRecord" from-field="grandTotalPosted[0]"/> </actions> <widgets> <decorator-screen name="CommonOrganizationAccountingReportsDecorator" location="${parameters.mainDecoratorLocation}"> @@ -260,10 +251,10 @@ under the License. </link> <include-form name="TrialBalanceReport" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/> <container style="h3"> - <label text="${uiLabelMap.AccountingDebitFlag}: ${grandTotalPostedRecord.totalPostedDebits}"/> + <label text="${uiLabelMap.AccountingDebitFlag}: ${postedDebitsTotal}"/> </container> <container style="h3"> - <label text="${uiLabelMap.AccountingCreditFlag}: ${grandTotalPostedRecord.totalPostedCredits}"/> + <label text="${uiLabelMap.AccountingCreditFlag}: ${postedCreditsTotal}"/> </container> </screenlet> </widgets> @@ -291,15 +282,6 @@ under the License. </entity-condition> <set field="partyIds[]" from-field="organizationPartyId"/> <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy"/> - <entity-condition entity-name="GlAccountAndHistoryTotals" filter-by-date="false" list="grandTotalPosted"> - <condition-list> - <condition-expr field-name="organizationPartyId" operator="in" from-field="partyIds"/> - <condition-expr field-name="customTimePeriodId" operator="equals" from-field="parameters.customTimePeriodId"/> - </condition-list> - <select-field field-name="totalPostedDebits"/> - <select-field field-name="totalPostedCredits"/> - </entity-condition> - <set field="grandTotalPostedRecord" from-field="grandTotalPosted[0]"/> </actions> <widgets> <container> @@ -326,15 +308,6 @@ under the License. </entity-condition> <set field="partyIds[]" from-field="organizationPartyId"/> <script location="component://accounting/webapp/accounting/WEB-INF/actions/reports/TrialBalance.groovy"/> - <entity-condition entity-name="GlAccountAndHistoryTotals" filter-by-date="false" list="grandTotalPosted"> - <condition-list> - <condition-expr field-name="organizationPartyId" operator="in" from-field="partyIds"/> - <condition-expr field-name="customTimePeriodId" operator="equals" from-field="parameters.customTimePeriodId"/> - </condition-list> - <select-field field-name="totalPostedDebits"/> - <select-field field-name="totalPostedCredits"/> - </entity-condition> - <set field="grandTotalPostedRecord" from-field="grandTotalPosted[0]"/> </actions> <widgets> <decorator-screen name="SimpleDecorator" location="component://common/widget/CommonScreens.xml"> @@ -348,10 +321,10 @@ under the License. <include-form name="TrialBalanceFinancialTimePeriodSelection" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/> <include-form name="TrialBalanceReport" location="component://accounting/widget/ReportFinancialSummaryForms.xml"/> <container style="h3"> - <label text="${uiLabelMap.AccountingDebitFlag}: ${grandTotalPostedRecord.totalPostedDebits}"/> + <label text="${uiLabelMap.AccountingDebitFlag}: ${postedDebitsTotal}"/> </container> <container style="h3"> - <label text="${uiLabelMap.AccountingCreditFlag}: ${grandTotalPostedRecord.totalPostedCredits}"/> + <label text="${uiLabelMap.AccountingCreditFlag}: ${postedCreditsTotal}"/> </container> </decorator-section> </decorator-screen> |
Free forum by Nabble | Edit this page |