3. I am using event subscriber ==>
EventSubscriber(ObjectType::Codeunit, Codeunit::"LSC POS Print Utility", 'OnBeforePrintInvoice', '', false, false)]
// "LSC Transaction Header"
local procedure OnBeforePrintInvoice(Transaction: Record "LSC Transaction Header")
var
transactions: Record "LSC Transaction Header"; // Replace with an existing table or define "LSC POS Transactions"
XXXInvoiceManagement: Codeunit POS_XXXInvoiceManagement; // Declare the missing variable
begin
// Add
// MRAInvoiceManagement := Codeunit POS_MRAInvoiceManagement; // Instantiate the codeunit
if not XXXInvoiceManagement.DocumentCheckIsOk(Transaction.Date) then
exit;
transactions.Reset();
transactions.SetRange("Transaction No.", Transaction."Transaction No.");
transactions.SetRange("xxx Code Generated", false);
if transactions.FindFirst() then begin
;
MRAInvoiceManagement.POSGetMraDocLog(transactions, true)
end else begin
transactions.Reset();
transactions.SetRange("Transaction No.", Transaction."Transaction No.");
transactions.SetRange("xxxQR Code Generated", false);
if transactions.FindFirst() then
MRAInvoiceManagement.GetMraPOSDocLog(transactions, true);
end;
UpdateDateTimePosted(Transaction);
if not xxxInvoiceManagement.DocumentCheckIsOk(Transaction.date) then
exit;
CheckRecord(Transaction);
Message('Event subscriber triggered for PrintInvoice.');
end;
,4. I want to add custom field(QR Code) in "LSC Transaction Header", is that ok ?