ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] Codeunit 370 Bank Acc. Reconciliation Post - OnAfterPostGenJnlLine

Open MatjazSega opened this issue 6 years ago • 1 comments

Hello,

We need a new event OnAfterPostGenJnlLine() in codeunit 370 "Bank Acc. Reconciliation Post". I am not sure I need to specify it explicitly, but we would need this event in ALL supported BC versions (15 and above).

Example of code:

  [IntegrationEvent(false, false)]
  local procedure OnAfterPostGenJnlLine(var GenJournalLine: Record "Gen. Journal Line"; var GenJnlPostLine: Codeunit "Gen. Jnl.-Post Line")
  begin
  end;

Called from local procedure PostPaymentApplications:

  local procedure PostPaymentApplications(BankAccReconLine: Record "Bank Acc. Reconciliation Line"; var AppliedAmount: Decimal)
  var
      ... some variables declared ...
  begin
      ... many lines of code ...

      OnPostPaymentApplicationsOnBeforeValidateApplyRequirements(BankAccReconLine, GenJnlLine, AppliedAmount);

      GenJnlLine.ValidateApplyRequirements(GenJnlLine);
      GenJnlPostLine.RunWithCheck(GenJnlLine);

      // --------- NEW CODE BEGIN ----------
      OnAfterPostGenJnlLine(GenJnlLine, GenJnlPostLine);
      // --------- NEW CODE END ----------

      if not PostPaymentsOnly then begin
          BankAccountLedgerEntry.SetRange(Open, true);
          BankAccountLedgerEntry.SetRange("Bank Account No.", BankAcc."No.");
          BankAccountLedgerEntry.SetRange("Document Type", GenJnlLine."Document Type");
          BankAccountLedgerEntry.SetRange("Document No.", BankAccReconLine."Statement No.");
          BankAccountLedgerEntry.SetRange("Posting Date", GenJnlLine."Posting Date");
          if BankAccountLedgerEntry.FindLast then
              CloseBankAccountLedgerEntry(BankAccountLedgerEntry."Entry No.", BankAccountLedgerEntry.Amount);
      end;
  end;

Thank you and best regards, Matjaz

MatjazSega avatar Sep 28 '20 14:09 MatjazSega

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. We will update this issue with information about availability.

bc-ghost avatar Oct 01 '20 05:10 bc-ghost