Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[IT][Event Request][Codeunit][12173] "Vendor Bill List - Post" - Function PostVendorBillLine() & Function PostBalanceAccount()

Aperta Adatta ai principianti
#12,422 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
66/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Ambito
backend

Direzione di ricerca

Apri il codeunit 12173 "Vendor Bill List - Post" e individua le procedure PostVendorBillLine() e PostBalanceAccount(). Aggiungi le due dichiarazioni [IntegrationEvent(false, false)] esattamente come indicato nell'issue, introduci la variabile IsHandled e racchiudi il blocco di inizializzazione di Gen. Journal Line in if not IsHandled then begin ... end; mantenendo gli eventi OnBefore* esistenti e le chiamate a GenJnlPostLine.RunWithCheck al di fuori del guard. È completato quando il pacchetto AL compila e i nuovi eventi sono richiamabili da un'estensione; nota che si tratta di un repository di proprietà di Microsoft in cui le richieste di estensibilità vengono triaggiate, quindi conferma che i maintainer accettino la modifica prima di investire.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

missing-info Team: Finance
Why do you need this change?

Hello,
We would need new events in the "PostVendorBillLine" and "PostBalanceAccount" procedures of Codeunit 12173 "Vendor Bill List - Post", in order to manage custom fields.

New Events and Code:

    procedure PostVendorBillLine(var GenJnlLine: Record "Gen. Journal Line"; VendorBillHeader: Record "Vendor Bill Header"; VendorBillLine: Record "Vendor Bill Line"; VendLedgEntry: Record "Vendor Ledger Entry"; Bill: Record Bill; var AmountLCY: Decimal)
    var
        Tax: Option " ",Withhold,"Free Lance",Company;
       //New Variable
        IsHandled: Boolean;
    begin
        GenJnlLine.Init();
//New Code
        IsHandled:=False; 
OnAfterInitGenJnlLineOnPostVendorBillLine(GenJnlLine,VendorBillHeader,VendorBillLine,VendLedgEntry,Bill,AmountLCY,IsHandled);
       if not IsHandled then begin
//
        GenJnlLine.Validate("Posting Date", VendorBillHeader."Posting Date");
        GenJnlLine."Document Type" := GenJnlLine."Document Type"::Payment;
        GenJnlLine."Document No." := VendorBillHeader."Vendor Bill List No.";
        GenJnlLine."Document Date" := VendorBillHeader."List Date";
        GenJnlLine."Account Type" := GenJnlLine."Account Type"::Vendor;
        GenJnlLine.Validate("Account No.", VendorBillLine."Vendor No.");
        GenJnlLine."Due Date" := VendorBillLine."Due Date";
        GenJnlLine."External Document No." := VendorBillLine."Vendor Bill List No.";
        GenJnlLine.Validate(Amount, VendorBillLine."Amount to Pay");
        GenJnlLine.Validate("Currency Code", VendorBillHeader."Currency Code");
        if not VendorBillLine."Manual Line" then begin
            GenJnlLine.Validate("Salespers./Purch. Code", VendLedgEntry."Purchaser Code");
            ApplyInvAndUpdateLedgEntry(GenJnlLine, VendorBillLine, Tax::" ");
        end else
            GenJnlLine."Applies-to Occurrence No." := VendorBillLine."Document Occurrence";
        GenJnlLine.Description := Bill.Description;
        GenJnlLine."Source Code" := Bill."Vend. Bill Source Code";
        GenJnlLine."System-Created Entry" := true;
        GenJnlLine."Reason Code" := VendorBillHeader."Reason Code";
        GenJnlLine."Shortcut Dimension 1 Code" := VendLedgEntry."Global Dimension 1 Code";
        GenJnlLine."Shortcut Dimension 2 Code" := VendLedgEntry."Global Dimension 2 Code";
        if not VendorBillLine."Manual Line" then
            GenJnlLine."Dimension Set ID" := VendLedgEntry."Dimension Set ID"
        else
            GenJnlLine."Dimension Set ID" := VendorBillLine."Dimension Set ID";
        GenJnlLine."Payment Method Code" := VendorBillHeader."Payment Method Code";
        AmountLCY := GenJnlLine."Amount (LCY)";
//New Code      
 end;
//
        OnBeforePostVendorBillLine(GenJnlLine, VendorBillHeader, VendorBillLine, VendLedgEntry);
        GenJnlPostLine.RunWithCheck(GenJnlLine);
    end;

    procedure PostBalanceAccount(GenJnlLine: Record "Gen. Journal Line"; VendorBillHeader: Record "Vendor Bill Header"; VendorBillLine: Record "Vendor Bill Line"; VendLedgEntry: Record "Vendor Ledger Entry"; Bill: Record Bill)
var
IsHandled:Boolean;    
begin
        GenJnlLine.Init();
//New Code
        IsHandled:=False; OnAfterInitGenJnlLineOnPostBalanceAccount(GenJnlLine,VendorBillHeader,VendorBillLine,VendLedgEntry,Bill,IsHandled);
if not IsHandled then begin
//
        GenJnlLine.Validate("Posting Date", VendorBillHeader."Posting Date");
        GenJnlLine."Document Type" := GenJnlLine."Document Type"::Payment;
        GenJnlLine."Document No." := VendorBillHeader."Vendor Bill List No.";
        GenJnlLine."Document Date" := VendorBillHeader."List Date";
        GenJnlLine."Account Type" := GenJnlLine."Account Type"::"Bank Account";
        GenJnlLine.Validate("Account No.", VendorBillHeader."Bank Account No.");
        GenJnlLine."Currency Code" := VendorBillHeader."Currency Code";
        GenJnlLine.Validate(Amount, -BalanceAmount);
        GenJnlLine.Validate("Amount (LCY)", -BalanceAmountLCY);
        GenJnlLine.Description := Bill.Description;
        GenJnlLine."Source Code" := Bill."Vend. Bill Source Code";
        GenJnlLine."System-Created Entry" := true;
        GenJnlLine."Reason Code" := VendorBillHeader."Reason Code";
        if not VendorBillLine."Manual Line" then
            GenJnlLine.Validate("Salespers./Purch. Code", VendLedgEntry."Purchaser Code");

        GenJnlLine."Shortcut Dimension 1 Code" := VendLedgEntry."Global Dimension 1 Code";
        GenJnlLine."Shortcut Dimension 2 Code" := VendLedgEntry."Global Dimension 2 Code";
        if not VendorBillLine."Manual Line" then
            GenJnlLine."Dimension Set ID" := VendLedgEntry."Dimension Set ID"
        else
            GenJnlLine."Dimension Set ID" := VendorBillLine."Dimension Set ID";
//New Code
end;
//
        GenJnlLine.CreateDimFromDefaultDim(GenJnlLine.FieldNo("Account No."));
        OnBeforePostBalanceAccount(GenJnlLine, VendorBillHeader, VendorBillLine, VendLedgEntry);
        GenJnlPostLine.RunWithCheck(GenJnlLine);
    end;

Signature:

 [IntegrationEvent(false, false)]
  OnAfterInitGenJnlLineOnPostVendorBillLine(var GenJnlLine: Record "Gen. Journal Line"; VendorBillHeader: Record "Vendor Bill Header"; VendorBillLine: Record "Vendor Bill Line"; VendLedgEntry: Record "Vendor Ledger Entry"; Bill: Record Bill; var AmountLCY: Decimal;var IsHandled:Boolean)
  begin
  end;
 [IntegrationEvent(false, false)]
  OnAfterInitGenJnlLineOnPostBalanceAccount(GenJnlLine: Record "Gen. Journal Line"; VendorBillHeader: Record "Vendor Bill Header"; VendorBillLine: Record "Vendor Bill Line"; VendLedgEntry: Record "Vendor Ledger Entry"; Bill: Record Bill;var IsHandled:Boolean)
  begin
  end;

Thank You,
Luca

Describe the request

We need this events to be able to manage custom fields on the Line Insert procedures, and we need to manage the validate triggers of the fields.
This request is a follow-up to an issue opened about a year ago. The requested change has not yet been implemented in the Business Central Base Application.

For reference, please see the previous discussion: https://github.com/microsoft/ALAppExtensions/issues/29093#issuecomment-3883244614

Provide an implementation (optional)
  • I will provide the implementation for this extensibility request
Lingua principale
AL
Stelle
697
Fork
473
Merge medio
2g 19h
PR unite (30g)
493

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/BCApps

Tutte le issue di microsoft/BCApps

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.