codeunit 50125 PostFAProductNameCodeunit
{
Permissions = tabledata "FA Ledger Entry" = rimd;
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Gen. Jnl.-Post Line", 'OnAfterPostGenJnlLine', '', false, false)]
local procedure OnAfterPostGenJnlLine(var GenJournalLine: Record "Gen. Journal Line")
var
Rec_FaLedgerEntries: Record "FA Ledger Entry";
begin
Clear(Rec_FaLedgerEntries);
Rec_FaLedgerEntries.Reset();
if (GenJournalLine."Product Name" <> '') or (GenJournalLine."Account Type" = GenJournalLine."Account Type"::"Fixed Asset") then begin
Rec_FaLedgerEntries.SetRange("Document No.", GenJournalLine."Document No.");
Rec_FaLedgerEntries.SetRange("FA No.", GenJournalLine."Account No.");
Rec_FaLedgerEntries.SetRange("Posting Date", GenJournalLine."Posting Date");
if Rec_FaLedgerEntries.FindFirst() then begin
Rec_FaLedgerEntries."Product Name" := GenJournalLine."Product Name";
Rec_FaLedgerEntries.Modify(true);
end;
end;
end;
}