Codeunit 372 Bank Acc. Recon. Post+Print, source in 29

Source29

src/Layers/W1/BaseApp/Bank/Reconciliation/BankAccReconPostPrint.Codeunit.al52 lines, Copyright (c) Microsoft Corporation. MIT

// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------
namespace Microsoft.Bank.Reconciliation;

using Microsoft.Bank.Statement;
using Microsoft.Foundation.Reporting;

/// <summary>
/// Posts bank account reconciliation and prints the resulting statements.
/// Combines posting and reporting functionality for completed reconciliations.
/// </summary>
codeunit 372 "Bank Acc. Recon. Post+Print"
{
    TableNo = "Bank Acc. Reconciliation";

    trigger OnRun()
    begin
        OnBeforeOnRun(Rec);

        BankAccRecon.Copy(Rec);

        if not Confirm(PostAndPrintReconciliationQst, false) then
            exit;

        CODEUNIT.Run(CODEUNIT::"Bank Acc. Reconciliation Post", BankAccRecon);
        Rec := BankAccRecon;
        Commit();

        if BankAccStmt.Get(Rec."Bank Account No.", Rec."Statement No.") then
            DocPrint.PrintBankAccStmt(BankAccStmt);
    end;

    var
        BankAccRecon: Record "Bank Acc. Reconciliation";
        BankAccStmt: Record "Bank Account Statement";
        DocPrint: Codeunit "Document-Print";
        PostAndPrintReconciliationQst: Label 'Do you want to post and print the Reconciliation?';

    /// <summary>
    /// Integration event raised before running the bank account reconciliation post and print process.
    /// Allows subscribers to perform validation, modify data, or implement custom logic before posting begins.
    /// </summary>
    /// <param name="BankAccReconciliation">Bank account reconciliation record to be posted and printed.</param>
    [IntegrationEvent(false, false)]
    local procedure OnBeforeOnRun(var BankAccReconciliation: Record "Bank Acc. Reconciliation")
    begin
    end;
}