Author: apatel
Date: Fri Jul 17 13:11:15 2009 New Revision: 795074 URL: http://svn.apache.org/viewvc?rev=795074&view=rev Log: Setting financial account transaction status and Control firing seca based on status of financial account transaction.Thanks Sumit and Arpit. Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml ofbiz/trunk/applications/accounting/data/DemoFinAccountData.xml ofbiz/trunk/applications/accounting/entitydef/eecas.xml ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml ofbiz/trunk/applications/accounting/servicedef/secas_payment.xml ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=795074&r1=795073&r2=795074&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original) +++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Fri Jul 17 13:11:15 2009 @@ -1491,6 +1491,9 @@ <property key="AccountingCancelCheckRun"> <value xml:lang="en">Cancel Check Run</value> </property> + <property key="AccountingCancelTransactionStatus"> + <value xml:lang="en">Cancel Transaction Status</value> + </property> <property key="AccountingCannotGetPaymentForApplication"> <value xml:lang="ar">Ùا ÙÙ Ù٠اÙØصÙ٠عÙ٠اÙتسدÙد ÙÙتطبÙÙ [${payAppl}] ٠٠أج٠${msg}</value> <value xml:lang="en">Cannot get payment for application [${payAppl}] due to ${msg}</value> Modified: ofbiz/trunk/applications/accounting/data/DemoFinAccountData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/data/DemoFinAccountData.xml?rev=795074&r1=795073&r2=795074&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/data/DemoFinAccountData.xml (original) +++ ofbiz/trunk/applications/accounting/data/DemoFinAccountData.xml Fri Jul 17 13:11:15 2009 @@ -23,12 +23,12 @@ currencyUomId="USD" organizationPartyId="Company" ownerPartyId="Company" postToGlAccountId="111000" isRefundable="Y" replenishLevel="0.00" actualBalance="0.00" availableBalance="0.00"/> <FinAccountStatus finAccountId="9000" statusId="FNACT_ACTIVE" statusDate="2009-04-01 00:00:01.000"/> <FinAccountTrans finAccountTransId="9100" finAccountTransTypeId="DEPOSIT" finAccountId="9000" amount="50000.00" - partyId="Company" transactionDate="2009-04-01 00:00:01.000" entryDate="2009-04-01 00:00:01.000" performedByPartyId="admin"/> + partyId="Company" transactionDate="2009-04-01 00:00:01.000" entryDate="2009-04-01 00:00:01.000" performedByPartyId="admin" statusId="FINACT_TRNS_APPROVED"/> <FinAccount finAccountId="9001" finAccountTypeId="BANK_ACCOUNT" statusId="FNACT_ACTIVE" finAccountName="ABN AMRO" finAccountCode="6577852521447" finAccountPin="1234" currencyUomId="USD" organizationPartyId="Company" ownerPartyId="Company" postToGlAccountId="111000" isRefundable="Y" replenishLevel="0.00" actualBalance="0.00" availableBalance="0.00"/> <FinAccountStatus finAccountId="9001" statusId="FNACT_ACTIVE" statusDate="2009-04-01 00:00:01.000"/> <FinAccountTrans finAccountTransId="9101" finAccountTransTypeId="DEPOSIT" finAccountId="9001" amount="75000.00" - partyId="Company" transactionDate="2009-04-01 00:00:01.000" entryDate="2009-04-01 00:00:01.000" performedByPartyId="admin"/> + partyId="Company" transactionDate="2009-04-01 00:00:01.000" entryDate="2009-04-01 00:00:01.000" performedByPartyId="admin" statusId="FINACT_TRNS_APPROVED"/> </entity-engine-xml> \ No newline at end of file Modified: ofbiz/trunk/applications/accounting/entitydef/eecas.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/entitydef/eecas.xml?rev=795074&r1=795073&r2=795074&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/entitydef/eecas.xml (original) +++ ofbiz/trunk/applications/accounting/entitydef/eecas.xml Fri Jul 17 13:11:15 2009 @@ -23,6 +23,7 @@ <!-- To maintain FinAccount.actualBalance and FinAccount.availableBalance --> <eca entity="FinAccountTrans" operation="create-store" event="return"> + <condition field-name="statusId" operator="equals" value="FINACT_TRNS_APPROVED"/> <action service="updateFinAccountBalancesFromTrans" mode="sync"/> </eca> <!-- To maintain FinAccount.availableBalance --> Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml?rev=795074&r1=795073&r2=795074&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml (original) +++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml Fri Jul 17 13:11:15 2009 @@ -288,8 +288,13 @@ <set field="actualBalanceSum" value="0" type="BigDecimal"/> <iterate entry="finAccountTrans" list="finAccountTransList"> <if> - <condition><if-compare field="finAccountTrans.finAccountTransTypeId" operator="equals" value="DEPOSIT"/></condition> - <then><set field="amountForCalc" from-field="finAccountTrans.amount"/></then> + <condition> + <if-compare field="finAccountTrans.statusId" operator="equals" value="FINACT_TRNS_APPROVED"/> + </condition> + <then> + <if> + <condition><if-compare field="finAccountTrans.finAccountTransTypeId" operator="equals" value="DEPOSIT"/></condition> + <then><set field="amountForCalc" from-field="finAccountTrans.amount"/></then> <else-if> <condition><if-compare field="finAccountTrans.finAccountTransTypeId" operator="equals" value="WITHDRAWAL"/></condition> <then><calculate field="amountForCalc"><calcop operator="negative" field="finAccountTrans.amount"/></calculate></then> @@ -298,13 +303,14 @@ <condition><if-compare field="finAccountTrans.finAccountTransTypeId" operator="equals" value="ADJUSTMENT"/></condition> <then><set field="amountForCalc" from-field="finAccountTrans.amount"/></then> </else-if> + </if> + <set field="actualBalanceSum" value="${actualBalanceSum + amountForCalc}" type="BigDecimal"/> + </then> </if> - <calculate field="actualBalanceSum" decimal-scale="${roundingDecimals}" rounding-mode="${roundingMode}"> - <calcop operator="add" field="actualBalanceSum"> - <calcop operator="get" field="amountForCalc"/> - </calcop> - </calculate> </iterate> + <calculate field="actualBalanceSum" decimal-scale="${roundingDecimals}" rounding-mode="${roundingMode}"> + <calcop operator="get" field="actualBalanceSum"/> + </calculate> <!-- start with the actual balance, and subtract off FinAccountAuth.amount --> <set field="availableBalanceSum" from-field="actualBalanceSum"/> @@ -444,4 +450,34 @@ </else> </if-compare> </simple-method> + + <simple-method method-name="setFinAccountTransStatus" short-description="set the financial account transaction status"> + <entity-one entity-name="FinAccountTrans" value-field="finAccountTrans"/> + <field-to-result field="finAccountTrans.statusId" result-name="oldStatusId"/> + <if-compare-field field="finAccountTrans.statusId" operator="not-equals" to-field="parameters.statusId"> + <entity-one entity-name="StatusValidChange" value-field="statusChange" auto-field-map="false"> + <field-map field-name="statusId" from-field="finAccountTrans.statusId"/> + <field-map field-name="statusIdTo" from-field="parameters.statusId"/> + </entity-one> + <if-empty field="statusChange"> + <add-error><fail-message message="${uiLabelMap.AccountingPSInvalidStatusChange}"/></add-error> + <log level="error" message="Cannot change from ${finAccountTrans.statusId} to ${parameters.statusId}"/> + <check-errors/> + <else> + <set field="finAccountTrans.statusId" from-field="parameters.statusId"/> + <store-value value-field="finAccountTrans"/> + </else> + </if-empty> + </if-compare-field> + </simple-method> + + <simple-method method-name="updatePaymentOnFinAccTransStatusSetToCancel" short-description="remove field finAccountTransId from Payment entity."> + <entity-one entity-name="FinAccountTrans" value-field="finAccountTrans"/> + <get-related-one relation-name="Payment" value-field="finAccountTrans" to-value-field="payment"/> + <if-not-empty field="payment"> + <set field="updatePaymentMap.paymentId" from-field="payment.paymentId"/> + <clear-field field="updatePaymentMap.finAccountTransId"/> + <call-service service-name="updatePayment" in-map-name="updatePaymentMap"/> + </if-not-empty> + </simple-method> </simple-methods> Modified: ofbiz/trunk/applications/accounting/servicedef/secas_payment.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/secas_payment.xml?rev=795074&r1=795073&r2=795074&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/servicedef/secas_payment.xml (original) +++ ofbiz/trunk/applications/accounting/servicedef/secas_payment.xml Fri Jul 17 13:11:15 2009 @@ -46,4 +46,11 @@ <condition field-name="finAccountId" operator="is-not-empty"/> <action service="createFinAccoutnTransFromPayment" mode="sync"/> </eca> + + <!-- Update payment when FinAccountTrans status is set to Cancle, remove finAccountTransId form Payment entity. --> + <eca service="setFinAccountTransStatus" event="commit"> + <condition field-name="finAccountTransId" operator="is-not-empty"/> + <condition field-name="statusId" operator="equals" value="FINACT_TRNS_CANCELED"/> + <action service="updatePaymentOnFinAccTransStatusSetToCancel" mode="sync"/> + </eca> </service-eca> Modified: ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml?rev=795074&r1=795073&r2=795074&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml (original) +++ ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml Fri Jul 17 13:11:15 2009 @@ -120,6 +120,18 @@ <attribute name="expireDateTime" type="Timestamp" mode="IN" optional="true"/> </service> + <service name="setFinAccountTransStatus" engine="simple" + location="component://accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml" invoke="setFinAccountTransStatus"> + <description>Set financial account transaction status</description> + <attribute name="finAccountTransId" type="String" mode="IN" optional="true"/> + <attribute name="statusId" type="String" mode="IN" optional="true"/> + <attribute name="oldStatusId" type="String" mode="OUT" optional="true"/> + </service> + + <service name="updatePaymentOnFinAccTransStatusSetToCancel" engine="simple" location="component://accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml" invoke="updatePaymentOnFinAccTransStatusSetToCancel"> + <description>Update payment when FinAccountTrans status is set to Cancle, remove finAccountTransId form Payment entity.</description> + <attribute name="finAccountTransId" type="String" mode="IN" optional="true"/> + </service> <!-- these services use the product store's fin account settings --> <service name="createFinAccountForStore" engine="java" default-entity-name="FinAccount" location="org.ofbiz.accounting.finaccount.FinAccountServices" invoke="createFinAccountForStore"> Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml?rev=795074&r1=795073&r2=795074&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml Fri Jul 17 13:11:15 2009 @@ -1860,6 +1860,14 @@ <response name="success" type="view" value="EditFinAccountTrans"/> <response name="error" type="view" value="EditFinAccountTrans"/> </request-map> + + <request-map uri="setFinAccountTransStatus"> + <security https="true" auth="true"/> + <event type="service" path="" invoke="setFinAccountTransStatus"/> + <response name="success" type="view" value="EditFinAccountTrans"/> + <response name="error" type="view" value="EditFinAccountTrans"/> + </request-map> + <!-- Fin Account Authority--> <request-map uri="EditFinAccountAuths"> <security https="true" auth="true"/> Modified: ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml?rev=795074&r1=795073&r2=795074&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml (original) +++ ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml Fri Jul 17 13:11:15 2009 @@ -170,6 +170,13 @@ <field name="finAccountId"><hidden/></field> <field name="finAccountTransId"><display/></field> <field name="finAccountTransTypeId"><display-entity entity-name="FinAccountTransType" description="${description}"/></field> + <field name="cancelLink" title="${uiLabelMap.AccountingCancelTransactionStatus}" use-when="${statusId=='FINACT_TRNS_CREATED'}" widget-style="buttontext"> + <hyperlink target="setFinAccountTransStatus" description="${uiLabelMap.CommonCancel}" also-hidden="false"> + <parameter param-name="finAccountTransId"/> + <parameter param-name="finAccountId"/> + <parameter param-name="statusId" value="FINACT_TRNS_CANCELED"/> + </hyperlink> + </field> </form> <form name="AddFinAccountTrans" type="single" target="createFinAccountTrans" header-row-style="header-row" default-table-style="basic-table"> |
Free forum by Nabble | Edit this page |