You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Mridul Pathak (JIRA)" <ji...@apache.org> on 2007/12/10 13:40:43 UTC

[jira] Commented: (OFBIZ-1490) Implement an automatic GL posting service for incoming payments

    [ https://issues.apache.org/jira/browse/OFBIZ-1490?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12550037 ] 

Mridul Pathak commented on OFBIZ-1490:
--------------------------------------

Brajesh,
    I think the eca condition is correct and it will not be needed to modify it.  Because there may be a case where createPayment service is called and statusId is passed with value PMNT_RECEIVED.
    I reviewed your patch, and I find it correct w.r.t the logic, only with some slight modifications required.  Which are :
1) For requirement 2, Operator "not-equals" should be used used in "if-compare" condition for "isReceipt". 
2) For requirement (7.1) the condition in the patch is not correct.  The condition should be on field-name="paymentApplication.overrideGlAccountId".
3) The service call for createAcctgTransAndEntries and <field-to-result> should be inside the <if-compare field-name="isReceipt" operator="not-equals" type="Boolean" value="false"> condition.
4) The comment for the eca on setPaymentStatus needs to be refactored.

> Implement an automatic GL posting service for incoming payments
> ---------------------------------------------------------------
>
>                 Key: OFBIZ-1490
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1490
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: accounting
>    Affects Versions: SVN trunk
>            Reporter: Jacopo Cappellato
>         Attachments: Jira_issue_1490.patch, Jira_issue_1490.patch
>
>
> Name of the service: "createAcctgTransAndEntriesForIncomingPayment" or similar
> Service definition:
>     <service name="createAcctgTransAndEntriesForIncomingPayment" engine="simple" auth="true"
>         location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransAndEntriesForIncomingPayment">
>         <description>Create an accounting transaction for an outgoing payment</description>
>         <attribute name="paymentId" type="String" mode="IN" optional="false"/>
>         <attribute name="acctgTransId" type="String" mode="OUT" optional="true"/>
>     </service>
> 1) get the Payment by paymentId
> 2) if (!UtilAccounting.isReceipt(payment)) then return; (hint: in Minilang, use the "call-class-method" operation)
> 3) organizationPartyId = payment.partyIdTo
> 4) partyId = payment.partyIdFrom and roleTypeId = "BILL_TO_CUSTOMER"
> 5) create an AcctgTransEntry with:
> 5.1) debitCreditFlag=D, glAccountTypeId: do not set for now (<!--TODO-->), origAmount=payment.amount, origCurrencyUomId=payment.currencyUomId
> 6) get the creditGlAccountTypeId in the following way:
> 6.1) get the PaymentGlAccountTypeMap for the given Payment.paymentTypeId and organizationPartyId
> 6.2) creditGlAccountTypeId = PaymentGlAccountTypeMap.glAccountTypeId
> 7) for the credit entries: select the PaymentApplications associated to the Payment and for each one:
> 7.1) create a AcctgTransEntry with: debitCreditFlag=C, origAmount=paymentApplication.amountApplied, origCurrencyUomId=payment.currencyUomId, glAccountId=paymentApplication.overrideGlAccountId or (if empty) payment.overrideGlAccountId, glAccountTypeId=creditGlAccountTypeId
> 7.2) amountAppliedTotal = amountAppliedTotal + paymentApplication.amountApplied
> 8) if ((payment.amount - amountAppliedTotal) > 0) then create another credit entry with: debitCreditFlag=C, origAmount=(payment.amount - amountAppliedTotal), origCurrencyUomId=payment.currencyUomId, glAccountId=payment.overrideGlAccountId, glAccountTypeId=creditGlAccountTypeId
> 9) call the createAcctgTransAndEntries with the following fields
> 9.1) acctgTransEntries prepared at points 5, 7 and 8
> 9.2) acctgTransTypeId="INCOMING_PAYMENT"
> 9.3) partyId e roleTypeId (point 4), paymentId
> Add the following secas to trigger the service:
> <eca service="createPayment" event="commit">
>     <condition field-name="statusId" operator="equals" value="PMNT_RECEIVED"/>
>     <action service="createAcctgTransAndEntriesForIncomingPayment" mode="sync"/>
> </eca>
> <eca service="setPaymentStatus" event="commit">
>     <condition field-name="statusId" operator="equals" value="PMNT_RECEIVED"/>
>     <condition field-name="oldStatusId" operator="not-equals" value="PMNT_RECEIVED"/>
>     <action service="createAcctgTransAndEntriesForIncomingPayment" mode="sync"/>
> </eca>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.