Implement an automatic GL posting service for outgoing payments
--------------------------------------------------------------- Key: OFBIZ-1491 URL: https://issues.apache.org/jira/browse/OFBIZ-1491 Project: OFBiz Issue Type: Sub-task Components: accounting Reporter: Jacopo Cappellato The service is very similar to the one described in OFBIZ-1490. Name of the service: "createAcctgTransAndEntriesForOutgoingPayment" or similar Service definition: <service name="createAcctgTransAndEntriesForOutgoingPayment" engine="simple" auth="true" location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransAndEntriesForOutgoingPayment"> <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.isDisbursement(payment)) then return; (hint: in Minilang, use the "call-class-method" operation) 3) organizationPartyId = payment.partyIdFrom 4) partyId = payment.partyIdTo and roleTypeId = "BILL_FROM_VENDOR" 5) create an AcctgTransEntry with: 5.1) debitCreditFlag=C, glAccountTypeId: do not set for now (<!--TODO-->), origAmount=payment.amount, origCurrencyUomId=payment.currencyUomId 6) get the debitGlAccountTypeId in the following way: 6.1) get the PaymentGlAccountTypeMap for the given Payment.paymentTypeId and organizationPartyId 6.2) debitGlAccountTypeId = PaymentGlAccountTypeMap.glAccountTypeId 7) for the debit entries: select the PaymentApplications associated to the Payment and for each one: 7.1) create a AcctgTransEntry with: debitCreditFlag=D, origAmount=paymentApplication.amountApplied, origCurrencyUomId=payment.currencyUomId, glAccountTypeId=debitGlAccountTypeId, glAccountId=paymentApplication.overrideGlAccountId OR if (paymentApplication.taxAuthGeoId is not empty) get the glAccountId from the TaxAuthorityGlAccount record using as constraints organizationPartyId, taxAuthGeoId, taxAuthPartyId=partyId, OR payment.overrideGlAccountId 7.2) amountAppliedTotal = amountAppliedTotal + paymentApplication.amountApplied 8) if ((payment.amount - amountAppliedTotal) > 0) then create another debit entry with: debitCreditFlag=D, origAmount=(payment.amount - amountAppliedTotal), origCurrencyUomId=payment.currencyUomId, glAccountId=payment.overrideGlAccountId, glAccountTypeId=debitGlAccountTypeId 9) call the createAcctgTransAndEntries with the following fields 9.1) acctgTransEntries prepared at points 5, 7 and 8 9.2) acctgTransTypeId="OUTGOING_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_SENT"/> <action service="createAcctgTransAndEntriesForOutgoingPayment" mode="sync"/> </eca> <eca service="setPaymentStatus" event="commit"> <condition field-name="statusId" operator="equals" value="PMNT_SENT"/> <condition field-name="oldStatusId" operator="not-equals" value="PMNT_SENT"/> <action service="createAcctgTransAndEntriesForOutgoingPayment" mode="sync"/> </eca> -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
[ https://issues.apache.org/jira/browse/OFBIZ-1491?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] JyotsnaRathore updated OFBIZ-1491: ---------------------------------- Attachment: glPosting1491.patch > Implement an automatic GL posting service for outgoing payments > --------------------------------------------------------------- > > Key: OFBIZ-1491 > URL: https://issues.apache.org/jira/browse/OFBIZ-1491 > Project: OFBiz > Issue Type: Sub-task > Components: accounting > Reporter: Jacopo Cappellato > Attachments: glPosting1491.patch > > > The service is very similar to the one described in OFBIZ-1490. > Name of the service: "createAcctgTransAndEntriesForOutgoingPayment" or similar > Service definition: > <service name="createAcctgTransAndEntriesForOutgoingPayment" engine="simple" auth="true" > location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransAndEntriesForOutgoingPayment"> > <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.isDisbursement(payment)) then return; (hint: in Minilang, use the "call-class-method" operation) > 3) organizationPartyId = payment.partyIdFrom > 4) partyId = payment.partyIdTo and roleTypeId = "BILL_FROM_VENDOR" > 5) create an AcctgTransEntry with: > 5.1) debitCreditFlag=C, glAccountTypeId: do not set for now (<!--TODO-->), origAmount=payment.amount, origCurrencyUomId=payment.currencyUomId > 6) get the debitGlAccountTypeId in the following way: > 6.1) get the PaymentGlAccountTypeMap for the given Payment.paymentTypeId and organizationPartyId > 6.2) debitGlAccountTypeId = PaymentGlAccountTypeMap.glAccountTypeId > 7) for the debit entries: select the PaymentApplications associated to the Payment and for each one: > 7.1) create a AcctgTransEntry with: > debitCreditFlag=D, > origAmount=paymentApplication.amountApplied, > origCurrencyUomId=payment.currencyUomId, > glAccountTypeId=debitGlAccountTypeId, > glAccountId=paymentApplication.overrideGlAccountId OR > if (paymentApplication.taxAuthGeoId is not empty) get the glAccountId from the TaxAuthorityGlAccount record using as constraints organizationPartyId, taxAuthGeoId, taxAuthPartyId=partyId, OR > payment.overrideGlAccountId > 7.2) amountAppliedTotal = amountAppliedTotal + paymentApplication.amountApplied > 8) if ((payment.amount - amountAppliedTotal) > 0) then create another debit entry with: debitCreditFlag=D, origAmount=(payment.amount - amountAppliedTotal), origCurrencyUomId=payment.currencyUomId, glAccountId=payment.overrideGlAccountId, glAccountTypeId=debitGlAccountTypeId > 9) call the createAcctgTransAndEntries with the following fields > 9.1) acctgTransEntries prepared at points 5, 7 and 8 > 9.2) acctgTransTypeId="OUTGOING_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_SENT"/> > <action service="createAcctgTransAndEntriesForOutgoingPayment" mode="sync"/> > </eca> > <eca service="setPaymentStatus" event="commit"> > <condition field-name="statusId" operator="equals" value="PMNT_SENT"/> > <condition field-name="oldStatusId" operator="not-equals" value="PMNT_SENT"/> > <action service="createAcctgTransAndEntriesForOutgoingPayment" mode="sync"/> > </eca> -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-1491?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Pranay Pandey updated OFBIZ-1491: --------------------------------- Attachment: glPosting1491.patch Jyotsana, I have reviewed your patch according to the description given in the issue and did some small changes in it. The updated patch is attached. I will prefer that you just go through this patch once. --- Pranay > Implement an automatic GL posting service for outgoing payments > --------------------------------------------------------------- > > Key: OFBIZ-1491 > URL: https://issues.apache.org/jira/browse/OFBIZ-1491 > Project: OFBiz > Issue Type: Sub-task > Components: accounting > Reporter: Jacopo Cappellato > Attachments: glPosting1491.patch, glPosting1491.patch > > > The service is very similar to the one described in OFBIZ-1490. > Name of the service: "createAcctgTransAndEntriesForOutgoingPayment" or similar > Service definition: > <service name="createAcctgTransAndEntriesForOutgoingPayment" engine="simple" auth="true" > location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransAndEntriesForOutgoingPayment"> > <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.isDisbursement(payment)) then return; (hint: in Minilang, use the "call-class-method" operation) > 3) organizationPartyId = payment.partyIdFrom > 4) partyId = payment.partyIdTo and roleTypeId = "BILL_FROM_VENDOR" > 5) create an AcctgTransEntry with: > 5.1) debitCreditFlag=C, glAccountTypeId: do not set for now (<!--TODO-->), origAmount=payment.amount, origCurrencyUomId=payment.currencyUomId > 6) get the debitGlAccountTypeId in the following way: > 6.1) get the PaymentGlAccountTypeMap for the given Payment.paymentTypeId and organizationPartyId > 6.2) debitGlAccountTypeId = PaymentGlAccountTypeMap.glAccountTypeId > 7) for the debit entries: select the PaymentApplications associated to the Payment and for each one: > 7.1) create a AcctgTransEntry with: > debitCreditFlag=D, > origAmount=paymentApplication.amountApplied, > origCurrencyUomId=payment.currencyUomId, > glAccountTypeId=debitGlAccountTypeId, > glAccountId=paymentApplication.overrideGlAccountId OR > if (paymentApplication.taxAuthGeoId is not empty) get the glAccountId from the TaxAuthorityGlAccount record using as constraints organizationPartyId, taxAuthGeoId, taxAuthPartyId=partyId, OR > payment.overrideGlAccountId > 7.2) amountAppliedTotal = amountAppliedTotal + paymentApplication.amountApplied > 8) if ((payment.amount - amountAppliedTotal) > 0) then create another debit entry with: debitCreditFlag=D, origAmount=(payment.amount - amountAppliedTotal), origCurrencyUomId=payment.currencyUomId, glAccountId=payment.overrideGlAccountId, glAccountTypeId=debitGlAccountTypeId > 9) call the createAcctgTransAndEntries with the following fields > 9.1) acctgTransEntries prepared at points 5, 7 and 8 > 9.2) acctgTransTypeId="OUTGOING_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_SENT"/> > <action service="createAcctgTransAndEntriesForOutgoingPayment" mode="sync"/> > </eca> > <eca service="setPaymentStatus" event="commit"> > <condition field-name="statusId" operator="equals" value="PMNT_SENT"/> > <condition field-name="oldStatusId" operator="not-equals" value="PMNT_SENT"/> > <action service="createAcctgTransAndEntriesForOutgoingPayment" mode="sync"/> > </eca> -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-1491?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jacopo Cappellato updated OFBIZ-1491: ------------------------------------- Summary: Auto posting: Implement an automatic GL posting service for outgoing payments (was: Implement an automatic GL posting service for outgoing payments) > Auto posting: Implement an automatic GL posting service for outgoing payments > ----------------------------------------------------------------------------- > > Key: OFBIZ-1491 > URL: https://issues.apache.org/jira/browse/OFBIZ-1491 > Project: OFBiz > Issue Type: Sub-task > Components: accounting > Reporter: Jacopo Cappellato > Attachments: glPosting1491.patch, glPosting1491.patch > > > The service is very similar to the one described in OFBIZ-1490. > Name of the service: "createAcctgTransAndEntriesForOutgoingPayment" or similar > Service definition: > <service name="createAcctgTransAndEntriesForOutgoingPayment" engine="simple" auth="true" > location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransAndEntriesForOutgoingPayment"> > <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.isDisbursement(payment)) then return; (hint: in Minilang, use the "call-class-method" operation) > 3) organizationPartyId = payment.partyIdFrom > 4) partyId = payment.partyIdTo and roleTypeId = "BILL_FROM_VENDOR" > 5) create an AcctgTransEntry with: > 5.1) debitCreditFlag=C, glAccountTypeId: do not set for now (<!--TODO-->), origAmount=payment.amount, origCurrencyUomId=payment.currencyUomId > 6) get the debitGlAccountTypeId in the following way: > 6.1) get the PaymentGlAccountTypeMap for the given Payment.paymentTypeId and organizationPartyId > 6.2) debitGlAccountTypeId = PaymentGlAccountTypeMap.glAccountTypeId > 7) for the debit entries: select the PaymentApplications associated to the Payment and for each one: > 7.1) create a AcctgTransEntry with: > debitCreditFlag=D, > origAmount=paymentApplication.amountApplied, > origCurrencyUomId=payment.currencyUomId, > glAccountTypeId=debitGlAccountTypeId, > glAccountId=paymentApplication.overrideGlAccountId OR > if (paymentApplication.taxAuthGeoId is not empty) get the glAccountId from the TaxAuthorityGlAccount record using as constraints organizationPartyId, taxAuthGeoId, taxAuthPartyId=partyId, OR > payment.overrideGlAccountId > 7.2) amountAppliedTotal = amountAppliedTotal + paymentApplication.amountApplied > 8) if ((payment.amount - amountAppliedTotal) > 0) then create another debit entry with: debitCreditFlag=D, origAmount=(payment.amount - amountAppliedTotal), origCurrencyUomId=payment.currencyUomId, glAccountId=payment.overrideGlAccountId, glAccountTypeId=debitGlAccountTypeId > 9) call the createAcctgTransAndEntries with the following fields > 9.1) acctgTransEntries prepared at points 5, 7 and 8 > 9.2) acctgTransTypeId="OUTGOING_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_SENT"/> > <action service="createAcctgTransAndEntriesForOutgoingPayment" mode="sync"/> > </eca> > <eca service="setPaymentStatus" event="commit"> > <condition field-name="statusId" operator="equals" value="PMNT_SENT"/> > <condition field-name="oldStatusId" operator="not-equals" value="PMNT_SENT"/> > <action service="createAcctgTransAndEntriesForOutgoingPayment" mode="sync"/> > </eca> -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-1491?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ashish Vijaywargiya reassigned OFBIZ-1491: ------------------------------------------ Assignee: Ashish Vijaywargiya > Auto posting: Implement an automatic GL posting service for outgoing payments > ----------------------------------------------------------------------------- > > Key: OFBIZ-1491 > URL: https://issues.apache.org/jira/browse/OFBIZ-1491 > Project: OFBiz > Issue Type: Sub-task > Components: accounting > Reporter: Jacopo Cappellato > Assignee: Ashish Vijaywargiya > Attachments: glPosting1491.patch, glPosting1491.patch > > > The service is very similar to the one described in OFBIZ-1490. > Name of the service: "createAcctgTransAndEntriesForOutgoingPayment" or similar > Service definition: > <service name="createAcctgTransAndEntriesForOutgoingPayment" engine="simple" auth="true" > location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransAndEntriesForOutgoingPayment"> > <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.isDisbursement(payment)) then return; (hint: in Minilang, use the "call-class-method" operation) > 3) organizationPartyId = payment.partyIdFrom > 4) partyId = payment.partyIdTo and roleTypeId = "BILL_FROM_VENDOR" > 5) create an AcctgTransEntry with: > 5.1) debitCreditFlag=C, glAccountTypeId: do not set for now (<!--TODO-->), origAmount=payment.amount, origCurrencyUomId=payment.currencyUomId > 6) get the debitGlAccountTypeId in the following way: > 6.1) get the PaymentGlAccountTypeMap for the given Payment.paymentTypeId and organizationPartyId > 6.2) debitGlAccountTypeId = PaymentGlAccountTypeMap.glAccountTypeId > 7) for the debit entries: select the PaymentApplications associated to the Payment and for each one: > 7.1) create a AcctgTransEntry with: > debitCreditFlag=D, > origAmount=paymentApplication.amountApplied, > origCurrencyUomId=payment.currencyUomId, > glAccountTypeId=debitGlAccountTypeId, > glAccountId=paymentApplication.overrideGlAccountId OR > if (paymentApplication.taxAuthGeoId is not empty) get the glAccountId from the TaxAuthorityGlAccount record using as constraints organizationPartyId, taxAuthGeoId, taxAuthPartyId=partyId, OR > payment.overrideGlAccountId > 7.2) amountAppliedTotal = amountAppliedTotal + paymentApplication.amountApplied > 8) if ((payment.amount - amountAppliedTotal) > 0) then create another debit entry with: debitCreditFlag=D, origAmount=(payment.amount - amountAppliedTotal), origCurrencyUomId=payment.currencyUomId, glAccountId=payment.overrideGlAccountId, glAccountTypeId=debitGlAccountTypeId > 9) call the createAcctgTransAndEntries with the following fields > 9.1) acctgTransEntries prepared at points 5, 7 and 8 > 9.2) acctgTransTypeId="OUTGOING_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_SENT"/> > <action service="createAcctgTransAndEntriesForOutgoingPayment" mode="sync"/> > </eca> > <eca service="setPaymentStatus" event="commit"> > <condition field-name="statusId" operator="equals" value="PMNT_SENT"/> > <condition field-name="oldStatusId" operator="not-equals" value="PMNT_SENT"/> > <action service="createAcctgTransAndEntriesForOutgoingPayment" mode="sync"/> > </eca> -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-1491?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Pranay Pandey updated OFBIZ-1491: --------------------------------- Attachment: glPosting1491.patch There were some changes required to fulfill the requirement in the previous patch for this issue which are as follows : 1. Calculation of Amount differece needs to be calculated out of the iterator. 2. One debit entry needed to be taken out of the iterator. 3. There were some problems related to field initializations. I have updated these points and the attaching the updated patch. -- Pranay > Auto posting: Implement an automatic GL posting service for outgoing payments > ----------------------------------------------------------------------------- > > Key: OFBIZ-1491 > URL: https://issues.apache.org/jira/browse/OFBIZ-1491 > Project: OFBiz > Issue Type: Sub-task > Components: accounting > Reporter: Jacopo Cappellato > Assignee: Ashish Vijaywargiya > Attachments: glPosting1491.patch, glPosting1491.patch, glPosting1491.patch > > > The service is very similar to the one described in OFBIZ-1490. > Name of the service: "createAcctgTransAndEntriesForOutgoingPayment" or similar > Service definition: > <service name="createAcctgTransAndEntriesForOutgoingPayment" engine="simple" auth="true" > location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransAndEntriesForOutgoingPayment"> > <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.isDisbursement(payment)) then return; (hint: in Minilang, use the "call-class-method" operation) > 3) organizationPartyId = payment.partyIdFrom > 4) partyId = payment.partyIdTo and roleTypeId = "BILL_FROM_VENDOR" > 5) create an AcctgTransEntry with: > 5.1) debitCreditFlag=C, glAccountTypeId: do not set for now (<!--TODO-->), origAmount=payment.amount, origCurrencyUomId=payment.currencyUomId > 6) get the debitGlAccountTypeId in the following way: > 6.1) get the PaymentGlAccountTypeMap for the given Payment.paymentTypeId and organizationPartyId > 6.2) debitGlAccountTypeId = PaymentGlAccountTypeMap.glAccountTypeId > 7) for the debit entries: select the PaymentApplications associated to the Payment and for each one: > 7.1) create a AcctgTransEntry with: > debitCreditFlag=D, > origAmount=paymentApplication.amountApplied, > origCurrencyUomId=payment.currencyUomId, > glAccountTypeId=debitGlAccountTypeId, > glAccountId=paymentApplication.overrideGlAccountId OR > if (paymentApplication.taxAuthGeoId is not empty) get the glAccountId from the TaxAuthorityGlAccount record using as constraints organizationPartyId, taxAuthGeoId, taxAuthPartyId=partyId, OR > payment.overrideGlAccountId > 7.2) amountAppliedTotal = amountAppliedTotal + paymentApplication.amountApplied > 8) if ((payment.amount - amountAppliedTotal) > 0) then create another debit entry with: debitCreditFlag=D, origAmount=(payment.amount - amountAppliedTotal), origCurrencyUomId=payment.currencyUomId, glAccountId=payment.overrideGlAccountId, glAccountTypeId=debitGlAccountTypeId > 9) call the createAcctgTransAndEntries with the following fields > 9.1) acctgTransEntries prepared at points 5, 7 and 8 > 9.2) acctgTransTypeId="OUTGOING_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_SENT"/> > <action service="createAcctgTransAndEntriesForOutgoingPayment" mode="sync"/> > </eca> > <eca service="setPaymentStatus" event="commit"> > <condition field-name="statusId" operator="equals" value="PMNT_SENT"/> > <condition field-name="oldStatusId" operator="not-equals" value="PMNT_SENT"/> > <action service="createAcctgTransAndEntriesForOutgoingPayment" mode="sync"/> > </eca> -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-1491?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ashish Vijaywargiya closed OFBIZ-1491. -------------------------------------- Resolution: Fixed Thanks to Jyotsna Rathore and Pranay Pandey for your valuable patches. I had applied the recent patch from Pranay Pandey that resolve all the issues from the previous patch. Your patch is in rev # 606500. -- Ashish Vijaywargiya > Auto posting: Implement an automatic GL posting service for outgoing payments > ----------------------------------------------------------------------------- > > Key: OFBIZ-1491 > URL: https://issues.apache.org/jira/browse/OFBIZ-1491 > Project: OFBiz > Issue Type: Sub-task > Components: accounting > Reporter: Jacopo Cappellato > Assignee: Ashish Vijaywargiya > Attachments: glPosting1491.patch, glPosting1491.patch, glPosting1491.patch > > > The service is very similar to the one described in OFBIZ-1490. > Name of the service: "createAcctgTransAndEntriesForOutgoingPayment" or similar > Service definition: > <service name="createAcctgTransAndEntriesForOutgoingPayment" engine="simple" auth="true" > location="org/ofbiz/accounting/ledger/GeneralLedgerServices.xml" invoke="createAcctgTransAndEntriesForOutgoingPayment"> > <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.isDisbursement(payment)) then return; (hint: in Minilang, use the "call-class-method" operation) > 3) organizationPartyId = payment.partyIdFrom > 4) partyId = payment.partyIdTo and roleTypeId = "BILL_FROM_VENDOR" > 5) create an AcctgTransEntry with: > 5.1) debitCreditFlag=C, glAccountTypeId: do not set for now (<!--TODO-->), origAmount=payment.amount, origCurrencyUomId=payment.currencyUomId > 6) get the debitGlAccountTypeId in the following way: > 6.1) get the PaymentGlAccountTypeMap for the given Payment.paymentTypeId and organizationPartyId > 6.2) debitGlAccountTypeId = PaymentGlAccountTypeMap.glAccountTypeId > 7) for the debit entries: select the PaymentApplications associated to the Payment and for each one: > 7.1) create a AcctgTransEntry with: > debitCreditFlag=D, > origAmount=paymentApplication.amountApplied, > origCurrencyUomId=payment.currencyUomId, > glAccountTypeId=debitGlAccountTypeId, > glAccountId=paymentApplication.overrideGlAccountId OR > if (paymentApplication.taxAuthGeoId is not empty) get the glAccountId from the TaxAuthorityGlAccount record using as constraints organizationPartyId, taxAuthGeoId, taxAuthPartyId=partyId, OR > payment.overrideGlAccountId > 7.2) amountAppliedTotal = amountAppliedTotal + paymentApplication.amountApplied > 8) if ((payment.amount - amountAppliedTotal) > 0) then create another debit entry with: debitCreditFlag=D, origAmount=(payment.amount - amountAppliedTotal), origCurrencyUomId=payment.currencyUomId, glAccountId=payment.overrideGlAccountId, glAccountTypeId=debitGlAccountTypeId > 9) call the createAcctgTransAndEntries with the following fields > 9.1) acctgTransEntries prepared at points 5, 7 and 8 > 9.2) acctgTransTypeId="OUTGOING_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_SENT"/> > <action service="createAcctgTransAndEntriesForOutgoingPayment" mode="sync"/> > </eca> > <eca service="setPaymentStatus" event="commit"> > <condition field-name="statusId" operator="equals" value="PMNT_SENT"/> > <condition field-name="oldStatusId" operator="not-equals" value="PMNT_SENT"/> > <action service="createAcctgTransAndEntriesForOutgoingPayment" mode="sync"/> > </eca> -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
Free forum by Nabble | Edit this page |