OFBiz
  1. OFBiz
  2. OFBIZ-1434 General Ledger
  3. OFBIZ-1492

Auto posting: Implement an automatic GL posting service for payment applications

    Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Trunk
    • Fix Version/s: None
    • Component/s: accounting
    • Labels:
      None

      Description

      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>

      1. ofBiz1492.patch
        9 kB
        SACHIN CHOURASIYA

        Activity

        Hide
        SACHIN CHOURASIYA added a comment -

        Implemented an automatic GL posting service for payment applications

        Show
        SACHIN CHOURASIYA added a comment - Implemented an automatic GL posting service for payment applications
        Hide
        Pranay Pandey added a comment -

        Sachin,
        I have reviewed your patch according to the description given in the issue and i think it is fullfilling the requirement.

        Pranay

        Show
        Pranay Pandey added a comment - Sachin, I have reviewed your patch according to the description given in the issue and i think it is fullfilling the requirement. — Pranay
        Hide
        Sumit Porwal added a comment -

        Hi All,
        I have reviewed and tested the attached patch, its working properly.

        Show
        Sumit Porwal added a comment - Hi All, I have reviewed and tested the attached patch, its working properly.
        Hide
        Ashish Vijaywargiya added a comment -

        Thanks to all contributed in this work.

        Patch is in rev # 609252.


        Ashish

        Show
        Ashish Vijaywargiya added a comment - Thanks to all contributed in this work. Patch is in rev # 609252. – Ashish

          People

          • Assignee:
            Ashish Vijaywargiya
            Reporter:
            Jacopo Cappellato
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development