action("Post and &Print")
{
ApplicationArea = Basic, Suite;
Caption = 'Post and &Print';
Image = PostPrint;
Promoted = true;
PromotedCategory = Category8;
PromotedIsBig = true;
ShortCutKey = 'Shift+F9';
ToolTip = 'Finalize and prepare to print the document or journal. The values and quantities are posted to the related accounts. A report request window where you can specify what to include on the print-out.';
trigger OnAction()
begin
CODEUNIT.Run(CODEUNIT::"Gen. Jnl.-Post+Print", Rec);
CurrentJnlBatchName := GetRangeMax("Journal Batch Name");
SetJobQueueVisibility();
CurrPage.Update(false);
end;
}
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Batch Posting Print Mgt.", 'OnBeforeGLRegPostingReportPrint', '', true, true)]
local procedure "Batch Posting Print Mgt._OnBeforeGLRegPostingReportPrint"(var ReportID: Integer; ReqWindow: Boolean; SystemPrinter: Boolean; var GLRegister: Record "G/L Register"; var Handled: Boolean
)
var
GeneralLedgerEntries: Record "G/L Entry";
BankAccountLedgerEntriesAmount: Record "Bank Account Ledger Entry";
BankAccountLedgerEntriesAmountNegative: Record "Bank Account Ledger Entry";
R1: Report "DTI Payment from Bank";
R2: Report "DTI Cash Mandate from Bank";
SelectionMngt: Codeunit SelectionFilterManagement;
RecRef: RecordRef;
LastDocumentNo: Code[20];
TotalDocumentNo: Text;
TotalPostingDate: Text;
TotalPostingDateDate: Date;
begin
Clear(LastDocumentNo);
Clear(TotalDocumentNo);
Clear(TotalPostingDate);
GeneralLedgerEntries.Reset();
GeneralLedgerEntries.SetFilter("Entry No.", '%1..%2', GLRegister."From Entry No.", GLRegister."To Entry No.");
GeneralLedgerEntries.SetCurrentKey("Document No.");
GeneralLedgerEntries.Ascending();
if GeneralLedgerEntries.FindSet() then begin
Clear(RecRef);
RecRef.GetTable(GeneralLedgerEntries);
Evaluate(TotalPostingDateDate, SelectionMngt.GetSelectionFilter(RecRef, GeneralLedgerEntries.FieldNo("Posting Date")));
BankAccountLedgerEntriesAmount.Reset();
BankAccountLedgerEntriesAmount.SetFilter("Document No.", SelectionMngt.GetSelectionFilter(RecRef, GeneralLedgerEntries.FieldNo("Document No.")));
BankAccountLedgerEntriesAmount.SetFilter("Posting Date", '%1', TotalPostingDateDate);
BankAccountLedgerEntriesAmountNegative.Copy(BankAccountLedgerEntriesAmount);
BankAccountLedgerEntriesAmount.SetFilter(Amount, '>%1', 0);
if BankAccountLedgerEntriesAmount.FindSet() then begin
Clear(RecRef);
RecRef.GetTable(BankAccountLedgerEntriesAmount);
R1.setDocNoFilter(SelectionMngt.GetSelectionFilter(RecRef, BankAccountLedgerEntriesAmount.FieldNo("Entry No.")), '');
Report.Print(Report::"R1", '');
end;
BankAccountLedgerEntriesAmountNegative.Copy(BankAccountLedgerEntriesAmount);
BankAccountLedgerEntriesAmountNegative.SetFilter(Amount, '<%1', 0);
if BankAccountLedgerEntriesAmountNegative.FindSet() then begin
Clear(RecRef);
RecRef.GetTable(BankAccountLedgerEntriesAmountNegative);
R2.setDocNoFilter(SelectionMngt.GetSelectionFilter(RecRef, R2.FieldNo("Entry No.")), '');
Report.Print(Report::"R2 '');
end;
Handled := true;
end;
end;

Report
All responses (
Answers (