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] Page 46 "Sales Order Subform" - Add parameter to OnBeforeCalculateTotals #28175

Open
thomari opened this issue Feb 18, 2025 · 0 comments

Comments

@thomari
Copy link

thomari commented Feb 18, 2025

Describe the request

Please add the parameter "SuppressTotals" to the publisher OnBeforeCalculateTotals.

Previous Code

procedure CalculateTotals()
var
    IsHandled: Boolean;
begin
    IsHandled := false;
    OnBeforeCalculateTotals(Rec, IsHandled, DocumentTotals);
    if IsHandled then
        exit;

    if SuppressTotals then
        exit;

    DocumentTotals.SalesCheckIfDocumentChanged(Rec, xRec);
    DocumentTotals.CalculateSalesSubPageTotals(TotalSalesHeader, TotalSalesLine, VATAmount, InvoiceDiscountAmount, InvoiceDiscountPct);
    DocumentTotals.RefreshSalesLine(Rec);
end;

...

[IntegrationEvent(false, false)]
local procedure OnBeforeCalculateTotals(var SalesLine: Record "Sales Line"; var IsHandled: Boolean; var DocumentTotals: Codeunit "Document Totals")
begin
end;

New Code

procedure CalculateTotals()
var
    IsHandled: Boolean;
begin
    IsHandled := false;
    OnBeforeCalculateTotals(Rec, IsHandled, DocumentTotals, SuppressTotals);
    if IsHandled then
        exit;

    if SuppressTotals then
        exit;

    DocumentTotals.SalesCheckIfDocumentChanged(Rec, xRec);
    DocumentTotals.CalculateSalesSubPageTotals(TotalSalesHeader, TotalSalesLine, VATAmount, InvoiceDiscountAmount, InvoiceDiscountPct);
    DocumentTotals.RefreshSalesLine(Rec);
end;

...

[IntegrationEvent(false, false)]
local procedure OnBeforeCalculateTotals(var SalesLine: Record "Sales Line"; var IsHandled: Boolean; var DocumentTotals: Codeunit "Document Totals"; SuppressTotals: Boolean)
begin
end;

Additional context

We extended the CalculateTotals procedure and need the SuppressTotals variable to replicate it correctly.

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