Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Event Request] Codeunit 10090 "Export Payments (ACH)" - OnBeforeStartExportBatchAddDataToPrnString #27712

Open
skuchana93 opened this issue Nov 27, 2024 · 0 comments

Comments

@skuchana93
Copy link

Describe the request

In Codeunit 10090, please include the OnBeforeStartExportBatchAddDataToPrnString event within the StartExportBatch procedure.

Actual Code:
procedure StartExportBatch(ServiceClassCode: Code[10]; EntryClassCode: Code[10]; SourceCode: Code[10]; SettleDate: Date)
var
BatchHeaderRec: Text[250];
IsHandled: Boolean;
begin
IsHandled := false;
OnBeforeStartExportBatch(ServiceClassCode, EntryClassCode, SourceCode, SettleDate, IsHandled);
if IsHandled then
exit;
if not FileIsInProcess then
Error(ExportFileNotStartedErr);
if BatchIsInProcess then
Error(ExportFileNotCompletedErr);
BatchIsInProcess := true;
BatchNo := BatchNo + 1;
BatchHashTotal := 0;
TotalBatchDebit := 0;
TotalBatchCredit := 0;
EntryAddendaCount := 0;
TraceNo := 0;
BatchHeaderRec := '';
AddNumToPrnString(BatchHeaderRec, 5, 1, 1); // Record Type
AddToPrnString(BatchHeaderRec, ServiceClassCode, 2, 3, Justification::Right, '0'); // Service Class Code
AddToPrnString(BatchHeaderRec, CompanyInformation.Name, 5, 36, Justification::Left, ' '); // Company Name (+ Discretionary Data)
AddFedIDToPrnString(BatchHeaderRec, CompanyInformation."Federal ID No.", 41, 10); // Company ID
AddToPrnString(BatchHeaderRec, EntryClassCode, 51, 3, Justification::Left, ' '); // Entry Class Code
AddToPrnString(BatchHeaderRec, SourceCode, 54, 10, Justification::Left, ' '); // Entry Description
AddToPrnString(BatchHeaderRec, Format(WorkDate(), 0, '<Month,2><Day,2>'), 64, 6, Justification::Left, ' '); // Descriptive Date
AddToPrnString(BatchHeaderRec, Format(SettleDate, 0, '<Month,2><Day,2>'), 70, 6, Justification::Left, ' ');
// Effective Entry Date
AddNumToPrnString(BatchHeaderRec, 1, 79, 1); // Originator Status Code
AddToPrnString(BatchHeaderRec, BankAccount."Transit No.", 80, 8, Justification::Left, ' '); // Originating DFI ID
AddNumToPrnString(BatchHeaderRec, BatchNo, 88, 7); // Batch Number
ExportPrnString(BatchHeaderRec);
end;

Required Code with a new event request:
procedure StartExportBatch(ServiceClassCode: Code[10]; EntryClassCode: Code[10]; SourceCode: Code[10]; SettleDate: Date)
var
BatchHeaderRec: Text[250];
IsHandled: Boolean;
begin
IsHandled := false;
OnBeforeStartExportBatch(ServiceClassCode, EntryClassCode, SourceCode, SettleDate, IsHandled);
if IsHandled then
exit;
if not FileIsInProcess then
Error(ExportFileNotStartedErr);
if BatchIsInProcess then
Error(ExportFileNotCompletedErr);
BatchIsInProcess := true;
BatchNo := BatchNo + 1;
BatchHashTotal := 0;
TotalBatchDebit := 0;
TotalBatchCredit := 0;
EntryAddendaCount := 0;
TraceNo := 0;
BatchHeaderRec := '';
OnBeforeStartExportBatchAddDataToPrnString(BatchHeaderRec, ServiceClassCode, EntryClassCode, SourceCode, SettleDate, IsHandled);
if not IsHandled then begin

AddNumToPrnString(BatchHeaderRec, 5, 1, 1); // Record Type
AddToPrnString(BatchHeaderRec, ServiceClassCode, 2, 3, Justification::Right, '0'); // Service Class Code
AddToPrnString(BatchHeaderRec, CompanyInformation.Name, 5, 36, Justification::Left, ' '); // Company Name (+ Discretionary Data)
AddFedIDToPrnString(BatchHeaderRec, CompanyInformation."Federal ID No.", 41, 10); // Company ID
AddToPrnString(BatchHeaderRec, EntryClassCode, 51, 3, Justification::Left, ' '); // Entry Class Code
AddToPrnString(BatchHeaderRec, SourceCode, 54, 10, Justification::Left, ' '); // Entry Description
AddToPrnString(BatchHeaderRec, Format(WorkDate(), 0, '<Month,2><Day,2>'), 64, 6, Justification::Left, ' '); // Descriptive Date
AddToPrnString(BatchHeaderRec, Format(SettleDate, 0, '<Month,2><Day,2>'), 70, 6, Justification::Left, ' ');
// Effective Entry Date
AddNumToPrnString(BatchHeaderRec, 1, 79, 1); // Originator Status Code
AddToPrnString(BatchHeaderRec, BankAccount."Transit No.", 80, 8, Justification::Left, ' '); // Originating DFI ID
AddNumToPrnString(BatchHeaderRec, BatchNo, 88, 7); // Batch Number
end;
ExportPrnString(BatchHeaderRec);
end;
[IntegrationEvent(false, false)]
local procedure OnBeforeStartExportBatchAddDataToPrnString(var BatchHeaderRec: Text[250]; ServiceClassCode: Code[10]; EntryClassCode:
Code[10]; SourceCode: Code[10]; SettleDate: Date; var IsHandled: Boolean)
begin
end;

Additional context

This new event is necessary to enable subscription for implementing custom code and to provide the option to bypass the base code when needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant