svn commit: r736590 - in /ofbiz/trunk/applications/accounting: data/AccountingTypeData.xml script/org/ofbiz/accounting/invoice/InvoiceServices.xml

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

svn commit: r736590 - in /ofbiz/trunk/applications/accounting: data/AccountingTypeData.xml script/org/ofbiz/accounting/invoice/InvoiceServices.xml

hansbak-2
Author: hansbak
Date: Thu Jan 22 00:44:25 2009
New Revision: 736590

URL: http://svn.apache.org/viewvc?rev=736590&view=rev
Log:
first phase of payrol completed. to test: create payrol invoice, add items under the 'items' tab, set to 'approved', go to accounting -> general ledger -> accounting -> checks and your check should appear there and you are able to print it

Modified:
    ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml
    ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml

Modified: ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml?rev=736590&r1=736589&r2=736590&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml (original)
+++ ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml Thu Jan 22 00:44:25 2009
@@ -647,6 +647,7 @@
     <PaymentType description="Vendor Payment" hasTable="N" parentTypeId="DISBURSEMENT" paymentTypeId="VENDOR_PAYMENT"/>
     <PaymentType description="Vendor Prepayment" hasTable="N" parentTypeId="DISBURSEMENT" paymentTypeId="VENDOR_PREPAY"/>
     <PaymentType description="Commission Payment" hasTable="N" parentTypeId="DISBURSEMENT" paymentTypeId="COMMISSION_PAYMENT"/>
+    <PaymentType description="Payrol Payment" hasTable="N" parentTypeId="DISBURSEMENT" paymentTypeId="PAYROL_PAYMENT"/>
     <PaymentType description="Pay Check" hasTable="N" parentTypeId="DISBURSEMENT" paymentTypeId="PAY_CHECK"/>
     <PaymentType description="Tax Payment" hasTable="N" parentTypeId="DISBURSEMENT" paymentTypeId="TAX_PAYMENT"/>
     <PaymentType description="Sales Tax Payment" hasTable="N" parentTypeId="TAX_PAYMENT" paymentTypeId="SALES_TAX_PAYMENT"/>

Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml?rev=736590&r1=736589&r2=736590&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml Thu Jan 22 00:44:25 2009
@@ -482,6 +482,28 @@
                 </if-empty>
                 <create-value value-field="newEntity"/>
 
+                <!-- if the invoice is a payrol invoice, create the payment in the not-paid status -->
+                <if-compare field="parameters.statusId" operator="equals" value="INVOICE_APPROVED">
+                    <if-compare field="invoice.invoiceTypeId" operator="equals" value="PAYROL_INVOICE">
+                        <set field="newp.partyIdFrom" from-field="invoice.partyId"/>
+                        <set field="newp.partyIdTo" from-field="invoice.partyIdFrom"/>
+                        <set field="newp.paymentMethodTypeId" value="COMPANY_CHECK"/>
+                        <set field="newp.paymentTypeId" value="PAYROL_PAYMENT"/>
+                        <set field="newp.statusId" value="PMNT_NOT_PAID"/>
+                        <set field="newp.currencyUomId" from-field="invoice.currencyUomId"/>
+                        <call-class-method class-name="org.ofbiz.accounting.invoice.InvoiceWorker" method-name="getInvoiceTotal" ret-field="newp.amount">
+                            <field field="invoice" type="GenericValue"/>
+                        </call-class-method>
+                        <call-service service-name="createPayment" in-map-name="newp">
+                            <result-to-field result-name="paymentId" field="payment.paymentId"/>
+                        </call-service>
+                        <set field="payAppl.invoiceId" from-field="invoice.invoiceId"/>
+                        <set field="payAppl.paymentId" from-field="payment.paymentId"/>
+                        <set field="payAppl.amountApplied" from-field="newp.amount"/>
+                        <call-service service-name="createPaymentApplication" in-map-name="payAppl"/>
+                    </if-compare>
+                </if-compare>
+
                 <!-- if new status is cancelled remove existing payment applications and time entries. -->
                 <if-compare field="parameters.statusId" operator="equals" value="INVOICE_CANCELLED">
                     <set field="removePaymentApplicationMap.invoiceId" from-field="parameters.invoiceId"/>