Author: hansbak
Date: Tue Jul 21 10:26:24 2009 New Revision: 796243 URL: http://svn.apache.org/viewvc?rev=796243&view=rev Log: extended accounting demo data for payrol, payments are now generated at approved or ready status and accounting transactions are now generated for payrol as wel as for returns and commission invoices, as reported in the mailing list Modified: ofbiz/trunk/applications/accounting/data/DemoGlSetupData.xml ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml Modified: ofbiz/trunk/applications/accounting/data/DemoGlSetupData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/data/DemoGlSetupData.xml?rev=796243&r1=796242&r2=796243&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/data/DemoGlSetupData.xml (original) +++ ofbiz/trunk/applications/accounting/data/DemoGlSetupData.xml Tue Jul 21 10:26:24 2009 @@ -310,6 +310,7 @@ <PaymentGlAccountTypeMap organizationPartyId="Company" paymentTypeId="PAY_CHECK" glAccountTypeId="CUSTOMER_CREDIT"/> <PaymentGlAccountTypeMap organizationPartyId="Company" paymentTypeId="GC_WITHDRAWAL" glAccountTypeId="CUSTOMER_CREDIT"/> <PaymentGlAccountTypeMap organizationPartyId="Company" paymentTypeId="SALES_TAX_PAYMENT" glAccountTypeId="TAX_ACCOUNT"/> + <PaymentGlAccountTypeMap organizationPartyId="Company" paymentTypeId="PAYROL_PAYMENT" glAccountTypeId="OPERATING_EXPENSE"/> <PaymentGlAccountTypeMap organizationPartyId="Company" paymentTypeId="PAYROLL_TAX_PAYMENT" glAccountTypeId="TAX_ACCOUNT"/> <PaymentGlAccountTypeMap organizationPartyId="Company" paymentTypeId="INCOME_TAX_PAYMENT" glAccountTypeId="TAX_ACCOUNT"/> 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=796243&r1=796242&r2=796243&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 Tue Jul 21 10:26:24 2009 @@ -478,25 +478,39 @@ <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 field="invoice.invoiceTypeId" operator="equals" value="PAYROL_INVOICE"> + <if> + <condition> + <or> + <if-compare field="parameters.statusId" operator="equals" value="INVOICE_APPROVED"/> + <if-compare field="parameters.statusId" operator="equals" value="INVOICE_READY"/> + </or> + </condition> + <then> + <!-- only generate payment if no application exist yet --> + <entity-and entity-name="PaymentApplication" list="paymentApplications"> + <field-map field-name="invoiceId" from-field="parameters.invoiceId"/> + </entity-and> + <if-empty field="paymentApplications"> + <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-empty> + </then> + </if> </if-compare> </else> </if-empty> Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml?rev=796243&r1=796242&r2=796243&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml (original) +++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/ledger/GeneralLedgerServices.xml Tue Jul 21 10:26:24 2009 @@ -1960,7 +1960,8 @@ <set field="totalAmountFromInvoice" type="BigDecimal" value="0"/> <entity-one entity-name="Invoice" value-field="invoice"/> - <if-compare field="invoice.invoiceTypeId" operator="equals" value="PURCHASE_INVOICE"> + <get-related-one value-field="invoice" relation-name="InvoiceType" to-value-field="invoiceType"/> + <if-compare field="invoiceType.parentTypeId" operator="equals" value="PURCHASE_INVOICE"> <get-related value-field="invoice" relation-name="InvoiceItem" list="invoiceItems"/> <iterate list="invoiceItems" entry="invoiceItem"> <set field="amountFromOrder" type="BigDecimal" value="0"/> |
Free forum by Nabble | Edit this page |