You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We could use an new Event Publisher for procedure ShouldRedistributeInvoiceDiscountAmount.
Existing Code ist following:
procedure ShouldRedistributeInvoiceDiscountAmount(var SalesHeader: Record "Sales Header"): Boolean
var
ApplicationAreaMgmtFacade: Codeunit "Application Area Mgmt. Facade";
IsHandled: Boolean;
begin
IsHandled := false;
OnBeforeShouldRedistributeInvoiceDiscountAmount(SalesHeader, IsHandled);
if IsHandled then
exit(true);
SalesHeader.CalcFields("Recalculate Invoice Disc.");
if not SalesHeader."Recalculate Invoice Disc." then
exit(false);
case SalesHeader."Invoice Discount Calculation" of
SalesHeader."Invoice Discount Calculation"::Amount:
exit(SalesHeader."Invoice Discount Value" <> 0);
SalesHeader."Invoice Discount Calculation"::"%":
exit(true);
SalesHeader."Invoice Discount Calculation"::None:
begin
if ApplicationAreaMgmtFacade.IsFoundationEnabled() then
exit(true);
exit(not InvoiceDiscIsAllowed(SalesHeader."Invoice Disc. Code"));
end;
else
exit(true);
end;
end;
Our suggestion:
procedure ShouldRedistributeInvoiceDiscountAmount(var SalesHeader: Record "Sales Header"): Boolean
var
ApplicationAreaMgmtFacade: Codeunit "Application Area Mgmt. Facade";
IsHandled: Boolean;
ExitValue: Boolean;
begin
IsHandled := false;
OnBeforeShouldRedistributeInvoiceDiscountAmount(SalesHeader, IsHandled);
if IsHandled then
exit(true);
SalesHeader.CalcFields("Recalculate Invoice Disc.");
if not SalesHeader."Recalculate Invoice Disc." then
exit(false);
case SalesHeader."Invoice Discount Calculation" of
SalesHeader."Invoice Discount Calculation"::Amount:
exit(SalesHeader."Invoice Discount Value" <> 0);
SalesHeader."Invoice Discount Calculation"::"%":
exit(true);
SalesHeader."Invoice Discount Calculation"::None:
begin
if ApplicationAreaMgmtFacade.IsFoundationEnabled() then
exit(true);
ExitValue := not InvoiceDiscIsAllowed(SalesHeader."Invoice Disc. Code");
OnShouldRedistributeInvoiceDiscountAmountCaseInvDiscCalcNone(SalesHeader, ExitValue);
exit(ExitValue);
end;
else
exit(true);
end;
end;
[IntegrationEvent(false, false)]
local procedure OnShouldRedistributeInvoiceDiscountAmountCaseInvDiscCalcNone(SalesHeader: Record "Sales Header"; var ExitValue: Boolean)
begin
end;
Additional context
In some cases we need to bee able to edit the exit value by our own.
The text was updated successfully, but these errors were encountered:
Describe the request
We could use an new Event Publisher for procedure ShouldRedistributeInvoiceDiscountAmount.
Existing Code ist following:
Our suggestion:
Additional context
In some cases we need to bee able to edit the exit value by our own.
The text was updated successfully, but these errors were encountered: