svn commit: r793971 - in /ofbiz/trunk/applications/accounting: script/org/ofbiz/accounting/payment/PaymentServices.xml servicedef/secas_payment.xml servicedef/services_payment.xml webapp/ap/invoices/PurchaseInvoices.ftl

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r793971 - in /ofbiz/trunk/applications/accounting: script/org/ofbiz/accounting/payment/PaymentServices.xml servicedef/secas_payment.xml servicedef/services_payment.xml webapp/ap/invoices/PurchaseInvoices.ftl

apatel-2
Author: apatel
Date: Tue Jul 14 16:48:42 2009
New Revision: 793971

URL: http://svn.apache.org/viewvc?rev=793971&view=rev
Log:
Updates to create finaccount transaction when a payment is associated with finaccount. Thanks Sumit for implementation.

Modified:
    ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml
    ofbiz/trunk/applications/accounting/servicedef/secas_payment.xml
    ofbiz/trunk/applications/accounting/servicedef/services_payment.xml
    ofbiz/trunk/applications/accounting/webapp/ap/invoices/PurchaseInvoices.ftl

Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml?rev=793971&r1=793970&r2=793971&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml Tue Jul 14 16:48:42 2009
@@ -479,7 +479,7 @@
         <if-not-empty field="paymentIds">
             <set field="createPaymentGroupAndMemberMap.paymentIds" from-field="paymentIds"/>
             <set field="createPaymentGroupAndMemberMap.paymentGroupTypeId" value="CHECK_RUN"/>
-            <set field="createPaymentGroupAndMemberMap.paymentGroupName" value="Check Run for ${nowTimestamp}"/>
+            <set field="createPaymentGroupAndMemberMap.paymentGroupName" value="Payment group for Check Run(InvoiceIds-${parameters.invoiceIds})"/>
             <call-service service-name="createPaymentGroupAndMember" in-map-name="createPaymentGroupAndMemberMap">
                 <result-to-field result-name="paymentGroupId"/>
                 <result-to-result result-name="paymentGroupId"/>
@@ -534,9 +534,29 @@
                         <call-service service-name="createPaymentApplication" in-map-name="createPaymentApplicationMap"/>
                     </if-compare>
                 </if-compare>
+                <field-to-list field="invoice.invoiceId" list="invoiceIds"/>
                 <clear-field field="createPaymentApplicationMap"/>
             </iterate>
         </if-compare>
+        <field-to-result field="invoiceIds"/>
+        <set field="amount" type="BigDecimal" from-field="paymentAmount"/>
+        <field-to-result field="amount"/>
+    </simple-method>
+    
+    <simple-method method-name="createFinAccoutnTransFromPayment" short-description="Creates a record for FinAccountTrans on creation of payment.">
+        <set-service-fields service-name="createFinAccountTrans" map="parameters" to-map="createFinAccountTransMap"/>
+        <set field="createFinAccountTransMap.finAccountTransTypeId" value="WITHDRAWAL"/>
+        <set field="createFinAccountTransMap.partyId" from-field="parameters.organizationPartyId"/>
+        <now-timestamp field="createFinAccountTransMap.transactionDate"/>
+        <now-timestamp field="createFinAccountTransMap.entryDate"/>
+        <!-- set field="createFinAccountTransMap.statusId" value="CREATE"/>  --> <!-- TODO: It will uncomment when status Id field will add in FinAccountTrans Entity. -->
+        <set field="createFinAccountTransMap.comments" value="Pay to ${parameters.partyId} for invoice Ids - ${parameters.invoiceIds}"/>
+        <call-service service-name="createFinAccountTrans" in-map-name="createFinAccountTransMap">
+            <result-to-field result-name="finAccountTransId"/>
+        </call-service>
+        <set field="updatePaymentMap.finAccountTransId" from-field="finAccountTransId"/>
+        <set field="updatePaymentMap.paymentId" from-field="parameters.paymentId"/>
+        <call-service service-name="updatePayment" in-map-name="updatePaymentMap"/>
     </simple-method>
 
     <simple-method method-name="createPaymentGroupAndMember" short-description="creates PaymentGroup and PaymentGroupMembers">

Modified: ofbiz/trunk/applications/accounting/servicedef/secas_payment.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/secas_payment.xml?rev=793971&r1=793970&r2=793971&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/secas_payment.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/secas_payment.xml Tue Jul 14 16:48:42 2009
@@ -41,4 +41,9 @@
         <action service="checkPaymentInvoices" mode="sync"/>
      </eca>
 
+     <!-- Create finAccountTrans record for payment. -->
+     <eca service="createPaymentAndApplicationForParty" event="commit">
+        <condition field-name="finAccountId" operator="is-not-empty"/>
+        <action service="createFinAccoutnTransFromPayment" mode="sync"/>
+     </eca>
 </service-eca>

Modified: ofbiz/trunk/applications/accounting/servicedef/services_payment.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_payment.xml?rev=793971&r1=793970&r2=793971&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_payment.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_payment.xml Tue Jul 14 16:48:42 2009
@@ -166,18 +166,22 @@
         <attribute name="checkStartNumber" type="Long" mode="IN" optional="true"/>
         <attribute name="invoiceIds" type="List" mode="IN" optional="false"/>
         <attribute name="paymentMethodTypeId" type="String" mode="IN" optional="false"/>
+        <attribute name="finAccountId" type="String" mode="IN" optional="true"/>
         <attribute name="paymentGroupId" type="String" mode="OUT" optional="true"/>
         <attribute name="errorMessage" type="String" optional="true" mode="OUT"/>
     </service>
     <service name="createPaymentAndApplicationForParty" engine="simple"
             location="component://accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml" invoke="createPaymentAndApplicationForParty" auth="true">
         <description>create Payment and PaymentApplications for multiple invoices for one party</description>
-        <attribute name="organizationPartyId" type="String" mode="IN" optional="true"/>
+        <attribute name="organizationPartyId" type="String" mode="INOUT" optional="true"/>
         <attribute name="partyId" type="String" mode="IN" optional="false"/>
         <attribute name="invoices" type="List" mode="IN" optional="false"/>
         <attribute name="paymentMethodTypeId" type="String" mode="IN" optional="false"/>
+        <attribute name="finAccountId" type="String" mode="INOUT" optional="true"/>
         <attribute name="checkStartNumber" type="Long" mode="IN" optional="true"/>
         <attribute name="paymentId" type="String" mode="OUT" optional="true"/>
+        <attribute name="invoiceIds" type="List" mode="OUT" optional="true"/>
+        <attribute name="amount" type="BigDecimal" mode="OUT" optional="true"/>
     </service>
     <service name="createPaymentGroupAndMember" engine="simple"
             location="component://accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml" invoke="createPaymentGroupAndMember" auth="true">
@@ -192,4 +196,11 @@
         <description>Cancel all payments for payment group</description>
         <attribute name="paymentGroupId" type="String" mode="IN" optional="false"/>
     </service>
+    <service name="createFinAccoutnTransFromPayment" engine="simple"
+            location="component://accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml" invoke="createFinAccoutnTransFromPayment" auth="true">
+        <auto-attributes entity-name="FinAccountTrans" include="nonpk" mode="IN" optional="true"/>
+        <auto-attributes entity-name="FinAccountTrans" include="pk" mode="INOUT" optional="true"/>
+        <attribute name="invoiceIds" type="List" mode="IN" optional="true"/>
+    </service>
+    
 </services>

Modified: ofbiz/trunk/applications/accounting/webapp/ap/invoices/PurchaseInvoices.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/ap/invoices/PurchaseInvoices.ftl?rev=793971&r1=793970&r2=793971&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/ap/invoices/PurchaseInvoices.ftl (original)
+++ ofbiz/trunk/applications/accounting/webapp/ap/invoices/PurchaseInvoices.ftl Tue Jul 14 16:48:42 2009
@@ -114,7 +114,7 @@
         </#if>
       </select>
       <span class="label">${uiLabelMap.AccountingBankAccount}</span>
-      <select name="bankAccount">
+      <select name="finAccountId">
         <option value=""></option>
         <#if finAccounts?has_content>
           <#list finAccounts as finAccount>