ALAppExtensions
ALAppExtensions copied to clipboard
[EVENT REQUEST] - Codeunit 90 Purch. Post - Function CalculateVATAmountInBuffer
Describe the request
Hi AL Dev Team!
Please, I need a new event in the CalculateVATAmountInBuffer function:
Old Code:
TempInvoicePostBuffer."VAT Calculation Type"::"Sales Tax":
if TempInvoicePostBuffer."Use Tax" then begin
TempInvoicePostBuffer."VAT Amount" := Round(SalesTaxCalculate.CalculateTax(
TempInvoicePostBuffer."Tax Area Code", TempInvoicePostBuffer."Tax Group Code",
TempInvoicePostBuffer."Tax Liable", PurchHeader."Posting Date",
TempInvoicePostBuffer.Amount, TempInvoicePostBuffer.Quantity, 0));
if GLSetup."Additional Reporting Currency" <> '' then
TempInvoicePostBuffer."VAT Amount (ACY)" := CurrExchRate.ExchangeAmtLCYToFCY(
PurchHeader."Posting Date", GLSetup."Additional Reporting Currency",
TempInvoicePostBuffer."VAT Amount", 0);
end;
New Code
// Init new code (local variable IsHandle in function CalculateVATAmountInBuffer
var
IsHandled: Boolean;
// End new code
TempInvoicePostBuffer."VAT Calculation Type"::"Sales Tax":
if TempInvoicePostBuffer."Use Tax" then begin
TempInvoicePostBuffer."VAT Amount" := Round(SalesTaxCalculate.CalculateTax(
TempInvoicePostBuffer."Tax Area Code", TempInvoicePostBuffer."Tax Group Code",
TempInvoicePostBuffer."Tax Liable", PurchHeader."Posting Date",
TempInvoicePostBuffer.Amount, TempInvoicePostBuffer.Quantity, 0));
if GLSetup."Additional Reporting Currency" <> '' then
// Init new code
IsHandled := false;
OnBeforeAssignVATAmountACY(PurchHeader, GLSetup, TempInvoicePostBuffer)
If not IsHandled then
// End new code
TempInvoicePostBuffer."VAT Amount (ACY)" := CurrExchRate.ExchangeAmtLCYToFCY(
PurchHeader."Posting Date", GLSetup."Additional Reporting Currency",
TempInvoicePostBuffer."VAT Amount", 0);
end;
New Publisher
[IntegrationEvent(false, false)]
local procedure OnBeforeAssignVATAmountACY(PurchHeader: Record "Purchase Header"; GLSetup: Record "General Ledger Setup"; var TempInvoicePostBuffer: Record "Invoice Post. Buffer"; var IsHandled: Booleanl)
begin
end;
Thank you!!
Ismael
Additional context
I need this parameters for rounding with the "Document date" instead of the "Posting Date":
TempInvoicePostBuffer."VAT Amount (ACY)" := CurrExchRate.ExchangeAmtLCYToFCY( PurchHeader."Posting Date", GLSetup."Additional Reporting Currency", TempInvoicePostBuffer."VAT Amount", 0); Internal work item: AB#535498
Hi,
We can't add publisher in procedure that is within CLEAN23 tag. Please try to switch to new posting implementation and see if you need publisher there.