microsoft / ALAppExtensions

Repository for collaboration on Microsoft AL application add-on and localization extensions for Microsoft Dynamics 365 Business Central.
MIT License
748 stars 600 forks source link

[Event Request] - New events in table Sales Header #26798

Open zacktkd opened 3 days ago

zacktkd commented 3 days ago

Describe the request

Hi dev team, please consider adding the following events in table 36 Sales Header:

    [IntegrationEvent(false, false)]
    local procedure onAfterAddSplitVATLinesIgnoringALineSplitSalesLineFilters(var SplitSalesLine: Record "Sales Line"; SalesHeader: Record "Sales Header")
    begin
    end;

and insert reference to this like this:

    [Scope('OnPrem')]
    procedure AddSplitVATLinesIgnoringALine(SalesLineToIgnore: Record "Sales Line")
    var
        SplitSalesLine: Record "Sales Line";
        TotalingSalesLine: Record "Sales Line";
        VATProdPostingGroupIterator: Code[20];
        CurrentLineNo: Integer;
    begin
        // Group lines per VAT Prod. Posting Group
        SplitSalesLine.SetCurrentKey("Document Type", "Document No.", "VAT Prod. Posting Group");
        // Select only lines that are not auto-generated
        SplitSalesLine.SetRange("Automatically Generated", false);
        SplitSalesLine.SetRange("Document Type", "Document Type");
        SplitSalesLine.SetRange("Document No.", "No.");
        SplitSalesLine.SetFilter(Type, '<>''''');
        ********************************* REQUEST *************************
        onAfterAddSplitVATLinesIgnoringALineSplitSalesLineFilters(SplitSalesLine, Rec);
        *******************************************************************
        if (SalesLineToIgnore."Document Type" = "Document Type") and (SalesLineToIgnore."Document No." = "No.") then
            SplitSalesLine.SetFilter("Line No.", '<>%1', SalesLineToIgnore."Line No.");

        if not SplitSalesLine.FindSet() then
            exit;

Additional context

I neet to insert this event to filter the record SplitSalesLine because otherwise i have to duplicate a lot of code. I'm working on the italian version.