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: SVN 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

        No work has yet been logged on this issue.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development