Author: apatel
Date: Wed Jul 15 10:23:45 2009 New Revision: 794217 URL: http://svn.apache.org/viewvc?rev=794217&view=rev Log: Adding service and UI components to link payments deposits and withdrawal with financial account. Patch from Jira#2717 with minor modifications. Thanks Awdesh and Rishi. Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml ofbiz/trunk/applications/accounting/webapp/accounting/payment/depositWithdrawPayments.ftl 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=794217&r1=794216&r2=794217&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original) +++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Wed Jul 15 10:23:45 2009 @@ -1503,6 +1503,9 @@ <value xml:lang="th">à¹à¸¡à¹à¸ªà¸²à¸¡à¸²à¸£à¸à¸à¸³à¸£à¸°à¹à¸à¸´à¸à¸ªà¸³à¸«à¸£à¸±à¸à¹à¸à¸à¸à¸¥à¸´à¹à¸à¸à¸±à¸ [${payAppl}] à¹à¸à¸·à¹à¸à¸à¸à¸²à¸ ${msg}</value> <value xml:lang="zh">æ æ³ä¸ºåºç¨[${payAppl}]è·å¾æ¯ä»ï¼ç±äº${msg}</value> </property> + <property key="AccountingCannotIncludeApPaymentError"> + <value xml:lang="en">Cannot include AP payment in a deposit batch</value> + </property> <property key="AccountingCapture"> <value xml:lang="ar">خطÙØ©</value> <value xml:lang="de">erfassen</value> @@ -5800,6 +5803,9 @@ <value xml:lang="th">à¸à¸²à¸£à¸à¸³à¸£à¸°à¹à¸à¸´à¸ [${paymentId}] à¸à¸³à¹à¸à¹à¸à¹à¹à¸à¹à¹à¸à¹à¸¡à¸à¸µà¹</value> <value xml:lang="zh">æ¯ä»[${paymentId}]å·²å®æ´åºç¨</value> </property> + <property key="AccountingPaymentAlreadyAssociatedToFinAccountError"> + <value xml:lang="en">Payment [${paymentId}] is already associated with other financial account.</value> + </property> <property key="AccountingPaymentAlreadyReceived"> <value xml:lang="ar">تسدÙد ٠ستÙ٠٠سبÙا</value> <value xml:lang="de">Bezahlung bereits erhalten</value> @@ -6425,6 +6431,9 @@ <value xml:lang="th">สà¹à¸à¸à¸²à¸£à¸à¸³à¸£à¸°à¹à¸à¸´à¸</value> <value xml:lang="zh">å·²åéçæ¯ä»</value> </property> + <property key="AccountingPaymentStatusIsNotReceivedOrSentError"> + <value xml:lang="en">Payment status must be received or sent</value> + </property> <property key="AccountingPermissionError"> <value xml:lang="ar">Ùا رخصة ÙدÙÙÙ ÙÙذ٠اÙع٠ÙÙØ©</value> <value xml:lang="en">You do not have permission for this function.</value> 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=794217&r1=794216&r2=794217&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 Wed Jul 15 10:23:45 2009 @@ -374,4 +374,81 @@ </if-empty> </iterate> </simple-method> + + <simple-method method-name="depositWithdrawPayments" short-description="Deposit withdraw payments"> + <set field="paymentIds" from-field="parameters.paymentIds"/> + <set field="finAccountId" from-field="parameters.finAccountId"/> + <entity-one entity-name="FinAccount" value-field="finAccount"/> + <set field="paymentRunningTotal" type="BigDecimal" value="0"/> + <entity-condition entity-name="Payment" list="payments"> + <condition-expr field-name="paymentId" operator="in" from-field="paymentIds"/> + </entity-condition> + <iterate list="payments" entry="payment"> + <set field="paymentRunningTotal" value="${paymentRunningTotal + payment.amount}" type="BigDecimal"/> + <if-not-empty field="payment.finAccountTransId"> + <add-error><fail-property resource="AccountingUiLabels" property="AccountingPaymentAlreadyAssociatedToFinAccountError"/></add-error> + </if-not-empty> + <check-errors/> + <if> + <condition> + <not> + <or> + <if-compare field="payment.statusId" operator="equals" value="PMNT_SENT"/> + <if-compare field="payment.statusId" operator="equals" value="PMNT_RECEIVED"/> + </or> + </not> + </condition> + <then> + <add-error><fail-property resource="AccountingUiLabels" property="AccountingPaymentStatusIsNotReceivedOrSentError"/></add-error> + </then> + </if> + <check-errors/> + </iterate> + <if-compare field="parameters.groupInOneTransaction" operator="equals" value="Y"> + <set field="createFinAccountTransMap.finAccountId" from-field="finAccountId"/> + <set field="createFinAccountTransMap.finAccountTransTypeId" value="DEPOSIT"/> + <set field="createFinAccountTransMap.partyId" from-field="finAccount.ownerPartyId"/> + <set field="createFinAccountTransMap.amount" from-field="paymentRunningTotal"/> + <set field="createFinAccountTransMap.statusId" value="FINACT_TRNS_CREATED"/> + <call-service service-name="createFinAccountTrans" in-map-name="createFinAccountTransMap"> + <result-to-field result-name="finAccountTransId"/> + <result-to-result result-name="finAccountTransId"/> + </call-service> + <iterate list="payments" entry="payment"> + <if-compare-field field="payment.partyIdTo" operator="not-equals" to-field="finAccount.ownerPartyId"> + <add-error><fail-property resource="AccountingUiLabels" property="AccountingCannotIncludeApPaymentError"/></add-error> + </if-compare-field> + <check-errors/> + <set field="updatePaymentCtx.paymentId" from-field="payment.paymentId"/> + <set field="updatePaymentCtx.finAccountTransId" from-field="finAccountTransId"/> + <call-service service-name="updatePayment" in-map-name="updatePaymentCtx"/> + <clear-field field="updatePaymentCtx"/> + </iterate> + <else> + <iterate list="payments" entry="payment"> + <if-compare-field field="payment.partyIdTo" operator="equals" to-field="finAccount.ownerPartyId"> + <set field="createFinAccountTransMap.finAccountTransTypeId" value="DEPOSIT"/> + <else> + <if-compare-field field="payment.partyIdFrom" operator="equals" to-field="finAccount.ownerPartyId"> + <set field="createFinAccountTransMap.finAccountTransTypeId" value="WITHDRAWAL"/> + </if-compare-field> + </else> + </if-compare-field> + <set field="createFinAccountTransMap.finAccountId" from-field="finAccountId"/> + <set field="createFinAccountTransMap.partyId" from-field="finAccount.ownerPartyId"/> + <set field="createFinAccountTransMap.paymentId" from-field="payment.paymentId"/> + <set field="createFinAccountTransMap.amount" from-field="payment.amount"/> + <set field="createFinAccountTransMap.statusId" value="FINACT_TRNS_CREATED"/> + <call-service service-name="createFinAccountTrans" in-map-name="createFinAccountTransMap"> + <result-to-field result-name="finAccountTransId"/> + </call-service> + <set field="updatePaymentCtx.paymentId" from-field="payment.paymentId"/> + <set field="updatePaymentCtx.finAccountTransId" from-field="finAccountTransId"/> + <call-service service-name="updatePayment" in-map-name="updatePaymentCtx"/> + <clear-field field="updatePaymentCtx"/> + <clear-field field="createFinAccountTransMap"/> + </iterate> + </else> + </if-compare> + </simple-method> </simple-methods> Modified: ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml?rev=794217&r1=794216&r2=794217&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml (original) +++ ofbiz/trunk/applications/accounting/servicedef/services_finaccount.xml Wed Jul 15 10:23:45 2009 @@ -385,4 +385,13 @@ accounting/data/AccountingTypeData.xml </description> </service> + + <service name="depositWithdrawPayments" engine="simple" + location="component://accounting/script/org/ofbiz/accounting/finaccount/FinAccountServices.xml" invoke="depositWithdrawPayments"> + <description>Deposit withdraw payments</description> + <attribute name="paymentIds" type="List" mode="IN" optional="false"/> + <attribute name="finAccountId" type="String" mode="IN" optional="false"/> + <attribute name="groupInOneTransaction" type="String" mode="IN" optional="true"/> + <attribute name="finAccountTransId" type="String" mode="OUT" optional="true"/> + </service> </services> 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=794217&r1=794216&r2=794217&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml Wed Jul 15 10:23:45 2009 @@ -2072,10 +2072,6 @@ <request-map uri="FindPaymentsForDepositOrWithdraw"> <security https="true" auth="true"/> <response name="success" type="view" value="PaymentsDepositWithdraw"/> - </request-map> - <request-map uri="ListPaymentsForDepositOrWithdraw"> - <security https="true" auth="true"/> - <response name="success" type="view" value="PaymentsDepositWithdraw"/> <response name="error" type="view" value="PaymentsDepositWithdraw"/> </request-map> <request-map uri="getPaymentRunningTotal"> @@ -2087,6 +2083,12 @@ <security auth="true" https="true"/> <response name="success" type="view" value="LookupCustomerName"/> </request-map> + <request-map uri="depositWithdrawPayments"> + <security auth="true" https="true"/> + <event type="service" invoke="depositWithdrawPayments"/> + <response name="success" type="view" value="PaymentsDepositWithdraw"/> + <response name="error" type="view" value="PaymentsDepositWithdraw"/> + </request-map> <!-- ================ Depreciation Calculation Report requests ================ --> Modified: ofbiz/trunk/applications/accounting/webapp/accounting/payment/depositWithdrawPayments.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/payment/depositWithdrawPayments.ftl?rev=794217&r1=794216&r2=794217&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/payment/depositWithdrawPayments.ftl (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/payment/depositWithdrawPayments.ftl Wed Jul 15 10:23:45 2009 @@ -67,9 +67,10 @@ </script> <div class="screenlet"> <div class="screenlet-body"> - <form id="depositWithdrawPaymentsForm" name="depositWithdrawPaymentsForm" method="post" action="<@ofbizUrl></@ofbizUrl>"> + <form id="depositWithdrawPaymentsForm" name="depositWithdrawPaymentsForm" method="post" action="<@ofbizUrl>depositWithdrawPayments</@ofbizUrl>"> <#if paymentList?has_content> <input type="hidden" name='organizationPartyId' value="${organizationPartyId?if_exists}"> + <input type="hidden" name='finAccountId' value="${finAccountId?if_exists}"> <div> <span class="label">${uiLabelMap.AccountingRunningTotal} :</span> <span class="label" id="showPaymentRunningTotal"></span> @@ -111,12 +112,14 @@ </td> </tr> </#list> + <div align="right"> + ${uiLabelMap.AccountingGroupInOneTransaction} + <input type="checkbox" name="groupInOneTransaction" value="Y"/> + <a href="javascript:document.depositWithdrawPaymentsForm.submit();" class="buttontext">${uiLabelMap.AccountingDepositWithdraw}</a> + </div> </table> - <div align="right"> - ${uiLabelMap.AccountingGroupInOneTransaction} - <input type="checkbox" name="groupInOneTransaction" value="Y"/> - <a href="javascript:document.depositWithdrawPaymentsForm.submit();" class="buttontext">${uiLabelMap.AccountingDepositWithdraw}</a> - </div> + <#else> + <span class="label">${uiLabelMap.AccountingNoRecordFound}</span> </#if> </form> </div> Modified: ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml?rev=794217&r1=794216&r2=794217&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml (original) +++ ofbiz/trunk/applications/accounting/widget/FinAccountForms.xml Wed Jul 15 10:23:45 2009 @@ -227,7 +227,7 @@ <field name="thruDate"><date-time/></field> <field name="submitButton" title="${uiLabelMap.CommonAdd}" widget-style="smallSubmit"><submit button-type="button"/></field> </form> - <form name="PaymentsDepositWithdraw" type="single" target="ListPaymentsForDepositOrWithdraw" extends="FindBatchPayments" extends-resource="component://accounting/widget/ar/forms/ArPaymentForms.xml"> + <form name="PaymentsDepositWithdraw" type="single" target="FindPaymentsForDepositOrWithdraw" extends="FindBatchPayments" extends-resource="component://accounting/widget/ar/forms/ArPaymentForms.xml"> <field name="finAccountId"><hidden/></field> <field name="submitButton" title="${uiLabelMap.CommonFind}" widget-style="smallSubmit"><submit button-type="button"/></field> </form> |
Free forum by Nabble | Edit this page |