Skip to content

[Event Request] Table 1293 "Payment Application Proposal" Procedure Apply #29209

Description

@AntonioMirandaLopezPWE

Why do you need this change?

There are events to prevent errors in payment registration by checking whether the posting date is earlier. However, there is one message that cannot be avoided as there is no event to subscribe to.

Describe the request

We need add event in Apply procedure

local procedure Apply(AmtToApply: Decimal; SuggestDiscAmt: Boolean)
var
AppliedPaymentEntry: Record "Applied Payment Entry";
BankAccReconciliationLine: Record "Bank Acc. Reconciliation Line";
MatchBankPayments: Codeunit "Match Bank Payments";

    IsHandled: Boolean;
begin
    AppliedPaymentEntry.TransferFields(Rec);
    BankAccReconciliationLine.Get(
      AppliedPaymentEntry."Statement Type", AppliedPaymentEntry."Bank Account No.",
      AppliedPaymentEntry."Statement No.", AppliedPaymentEntry."Statement Line No.");
    MatchBankPayments.SetApplicationDataInCVLedgEntry(
      "Account Type", "Applies-to Entry No.", BankAccReconciliationLine.GetAppliesToID());

    if AmtToApply = 0 then
        Error(StmtAmtIsFullyAppliedErr);

    if SuggestDiscAmt then
        AppliedPaymentEntry.Validate("Applies-to Entry No.")
    else
        AppliedPaymentEntry.Validate("Applied Amount", AmtToApply);

    AppliedPaymentEntry.Insert(true);

    TransferFields(AppliedPaymentEntry);
    Applied := true;
    UpdateRemainingAmountExclDiscount();
    "Applied Amt. Incl. Discount" := "Applied Amount" - "Applied Pmt. Discount";
    Modify(true);

    // >>>> New Code >>>>>>>>>>>>>>>>
    IsHandled := false;
    OnBeforeCheckIfPostingDateIsEarlier(BankAccReconciliationLine,"Posting Date",IsHandled);
    if IsHandled then
        exit;
    // <<<< New Code <<<<<<<<<<<<<<<<
    if BankAccReconciliationLine."Transaction Date" < "Posting Date" then
        Message(StrSubstNo(TransactionDateIsBeforePostingDateMsg, BankAccReconciliationLine."Transaction Date", "Posting Date"));
end;

// >>>> New Code >>>>>>>>>>>>>>>>
[IntegrationEvent(false, false)]
local procedure OnBeforeCheckIfPostingDateIsEarlier(var BankAccReconciliationLine: Record BankAccReconciliationLine: Record "Bank Acc. Reconciliation Line"; PostingDate: Date; var IsHandled: Boolean)
begin
end;
// <<<< New Code <<<<<<<<<<<<<<<<

Internal work item: AB#604901

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FinanceGitHub request for Finance areaevent-requestRequest for adding an eventships-in-future-updateFix ships in a future update

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions