Skip to content

[Event Request] codeunit 5968 "Serv. Sales Tax Calculate" #29508

@Kelly-cn

Description

@Kelly-cn

Why do you need this change?

Can you add OnBeforeAddServiceLine, OnAfterAddServiceLine, OnAddServiceLineOnAfterTempSalesTaxAmountLineSetFilters and OnAddServiceLineOnAfterSetSalesTaxAmountLineFilter events to the AddServcieLine procedure just like codeunit 398 "Sales Tax Calculate" AddSalesLine procedure ?

Describe the request

We needs to add extra filter to the Sales Tax Amount Line before it insert or modify.

 procedure AddServiceLine(ServiceLine: Record "Service Line")
    var
        TaxArea: Record "Tax Area";
        TaxAreaLine: Record "Tax Area Line";
        TaxJurisdiction: Record "Tax Jurisdiction";
    begin
        OnBeforeAddServiceLine(ServiceLine);
        if not ServHeaderRead then begin
            ServiceHeader.Get(ServiceLine."Document Type", ServiceLine."Document No.");
            ServHeaderRead := true;
 ......
       TempSalesTaxAmountLine.SetRange("Tax Group Code", ServiceLine."Tax Group Code");
        TaxAreaLine.SetCurrentKey("Tax Area", "Calculation Order");
        TaxAreaLine.SetRange("Tax Area", ServiceLine."Tax Area Code");

       OnAddServiceLineOnAfterTempSalesTaxAmountLineSetFilters(TempSalesTaxAmountLine);

        if TaxAreaLine.FindSet() then
            repeat
                TempSalesTaxAmountLine.SetRange("Tax Jurisdiction Code", TaxAreaLine."Tax Jurisdiction Code");
                TempSalesTaxAmountLine."Tax Jurisdiction Code" := TaxAreaLine."Tax Jurisdiction Code";

                OnAddServiceLineOnAfterSetSalesTaxAmountLineFilter (TempSalesTaxAmountLine, ServiceLine, TaxAreaLine);

                if not TempSalesTaxAmountLine.FindFirst() then begin
 ......
             until TaxAreaLine.Next() = 0;
        SalesTaxCalculate.SetSalesTaxAmountLineTable(TempSalesTaxAmountLine);
        OnAfterAddServiceLine(TempSalesTaxAmountLine, ServiceLine)
    end;
[IntegrationEvent(false, false)]
    local procedure OnBeforeAddServiceLine(var ServiceLine: Record "Service Line");
    begin
    end;

[IntegrationEvent(false, false)]
    local procedure OnAddServiceLineOnAfterTempSalesTaxAmountLineSetFilters(var TempSalesTaxAmountLine: Record "Sales Tax Amount Line" temporary)
    begin
    end;

[IntegrationEvent(false, false)]
    local procedure OnAddServiceLineOnAfterSetSalesTaxAmountLineFilter(var TempSalesTaxAmountLine: Record "Sales Tax Amount Line" temporary; ServiceLine: Record "Service Line"; TaxAreaLine: Record "Tax Area Line");
    begin
    end;

[IntegrationEvent(false, false)]
    local procedure OnAfterAddServiceLine(TempSalesTaxLine: Record "Sales Tax Amount Line" temporary; ServiceLine: Record "Service Line")
    begin
    end;

Internal work item: AB#615906

Metadata

Metadata

Assignees

No one assigned

    Labels

    FinanceGitHub request for Finance areaevent-requestRequest for adding an event

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions