Implement an automatic GL posting service for payment applications
------------------------------------------------------------------
Key: OFBIZ-1492
URL: https://issues.apache.org/jira/browse/OFBIZ-1492
Project: OFBiz
Issue Type: Sub-task
Components: accounting
Affects Versions: SVN trunk
Reporter: Jacopo Cappellato
Name of the service: "createAcctgTransAndEntriesForPaymentApplication" or
similar
Service definition:
<service name="createAcctgTransAndEntriesForPaymentApplication"
engine="simple" auth="true"
location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml"
invoke="createAcctgTransAndEntriesForPaymentApplication">
<description>Create an accounting transaction for a payment
application</description>
<attribute name="paymentApplicationId" type="String" mode="IN"
optional="false"/>
<attribute name="acctgTransId" type="String" mode="OUT"
optional="true"/>
</service>
1) get the PaymentApplication and Payment records
if (UtilAccounting.isReceipt(payment)) then {
2) prepare the debit AcctgTransEntry entry:
debitCreditFlag=D
organizationPartyId=payment.partyIdTo
partyId=payment.partyIdFrom
roleTypeId=BILL_TO_CUSTOMER
origAmount=paymentApplication.amountApplied
origCurrencyUomId=payment.currencyUomId
glAccountId=payment.overrideGlAccountId
glAccountTypeId=get the PaymentGlAccountTypeMap for the given
Payment.paymentTypeId and organizationPartyId
and use the PaymentGlAccountTypeMap.glAccountTypeId
3) prepare the credit AcctgTransEntry entry:
debitCreditFlag=C
organizationPartyId=payment.partyIdTo
partyId=payment.partyIdFrom
roleTypeId=BILL_TO_CUSTOMER
origAmount=paymentApplication.amountApplied
origCurrencyUomId=payment.currencyUomId
glAccountTypeId=ACCOUNTS_RECEIVABLE
}
else {
4) prepare the credit AcctgTransEntry entry:
debitCreditFlag=C
organizationPartyId=payment.partyIdFrom
partyId=payment.partyIdTo
roleTypeId=BILL_FROM_VENDOR
origAmount=paymentApplication.amountApplied
origCurrencyUomId=payment.currencyUomId
glAccountId=payment.overrideGlAccountId
glAccountTypeId=get the PaymentGlAccountTypeMap for the given
Payment.paymentTypeId and organizationPartyId
and use the PaymentGlAccountTypeMap.glAccountTypeId
5) prepare the debit AcctgTransEntry entry:
debitCreditFlag=D
organizationPartyId=payment.partyIdFrom
partyId=payment.partyIdTo
roleTypeId=BILL_FROM_VENDOR
origAmount=paymentApplication.amountApplied
origCurrencyUomId=payment.currencyUomId
glAccountTypeId=ACCOUNTS_PAYABLE
}
6) call the createAcctgTransAndEntries with the following fields
acctgTransEntries= entries prepared at points 2 and 3 or 4 and 5
acctgTransTypeId="PAYMENT_APPL"
paymentId=paymentApplication.paymentId
invoiceId=paymentApplication.invoiceId
if (UtilAccounting.isReceipt(payment)) then {
partyId=payment.partyIdFrom
roleTypeId=BILL_TO_CUSTOMER
} else{
partyId=payment.partyIdTo
roleTypeId=BILL_FROM_VENDOR
}
The service is triggered by the following seca:
<eca service="createPaymentApplication" event="commit">
<condition field-name="invoiceId" operator="is-not-empty" />
<action service="createAcctgTransAndEntriesForPaymentApplication"
mode="sync"/>
</eca>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.