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] Codeunit 5986 "Serv-Amounts Mgt." #27858

Closed
germanaltamiranoAW opened this issue Dec 27, 2024 · 1 comment
Closed

[Event Request] Codeunit 5986 "Serv-Amounts Mgt." #27858

germanaltamiranoAW opened this issue Dec 27, 2024 · 1 comment
Labels
event-request Request for adding an event SCM GitHub request for SCM area ships-in-future-update Fix ships in a future update

Comments

@germanaltamiranoAW
Copy link

germanaltamiranoAW commented Dec 27, 2024

Describe the request

Dear ALAppExtensions Team,
Please add the following Event to procedure InvoiceRounding in Codeunit 5986 "Serv-Amounts Mgt.":

     if InvoiceRoundingAmount <> 0 then begin
            CustPostingGr.Get(ServiceHeader."Customer Posting Group");
            ServiceLine.Init();
            BiggestLineNo += 10000;
            ServiceLine."System-Created Entry" := true;
            OnInvoiceRoundingAmountOnBeforeCheckUseTempData(ServiceHeader, ServiceLine);
            if UseTempData then begin
                ServiceLine."Line No." := 0;
                ServiceLine.Type := ServiceLine.Type::"G/L Account";
                TempServiceLineForCalc := ServiceLine;
                TempServiceLineForCalc.Validate("No.", CustPostingGr.GetInvRoundingAccount());
                ServiceLine := TempServiceLineForCalc;
            end else begin
                ServiceLine."Line No." := BiggestLineNo;
                RoundingServiceLine := ServiceLine;
                RoundingServiceLine.Validate(Type, ServiceLine.Type::"G/L Account");
                RoundingServiceLine.Validate("No.", CustPostingGr.GetInvRoundingAccount());
                ServiceLine := RoundingServiceLine;
            end;
            OnInvoiceRoundingAmountOnAfterCheckUseTempData(ServiceHeader, ServiceLine);

            ServiceLine."Tax Area Code" := '';
            ServiceLine."Tax Liable" := false;
            ServiceLine.Validate(ServiceLine.Quantity, 1);
            if ServiceHeader."Prices Including VAT" then
                ServiceLine.Validate(ServiceLine."Unit Price", InvoiceRoundingAmount)
            else
                ServiceLine.Validate(
                  ServiceLine."Unit Price",
                  Round(
                    InvoiceRoundingAmount /
                    (1 + (1 - ServiceHeader."VAT Base Discount %" / 100) * ServiceLine."VAT %" / 100),
                    Currency."Amount Rounding Precision"));
            ServiceLine.Validate(ServiceLine."Amount Including VAT", InvoiceRoundingAmount);
            ServiceLine."Line No." := BiggestLineNo;

            LastLineRetrieved := false;
            RoundingLineIsInserted := true;
            RoundingLineNo := ServiceLine."Line No.";
      end;

//NEW EVENT

end;

The event should be like this

[IntegrationEvent(false, false)]
local procedure OnAfterInvoiceRoundingAmount(ServiceHeader: Record "Service Header"; var ServiceLine: Record "Service Line"; var TotalServiceLine: Record "Service Line"; UseTempData: Boolean; InvoiceRoundingAmount: Decimal; Currency: Record Currency; var BiggestLineNo: Integer; var LastLineRetrieved: Boolean; var RoundingLineIsInserted: Boolean; var RoundingLineNo: Integer)
    begin
    end;

Additional context

This modification will allow us to better manage calculations in statistics with VAT amounts in our developments.
Internal work item: AB#561381

@JakovljevicDusan JakovljevicDusan added event-request Request for adding an event SCM GitHub request for SCM area labels Dec 30, 2024
@JesperSchulz JesperSchulz added the ships-in-future-update Fix ships in a future update label Dec 31, 2024
@JesperSchulz
Copy link
Contributor

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.

Build ID: 28412.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
event-request Request for adding an event SCM GitHub request for SCM area ships-in-future-update Fix ships in a future update
Projects
None yet
Development

No branches or pull requests

3 participants