ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

Event Request - OnBeforeUpdateInvoicePostingBufferLineDiscounts - codeunit 827 "Service Post Invoice Events"

Open JeremyOrgan-DC opened this issue 3 years ago • 3 comments

Please could we have a OnBeforeUpdateInvoicePostingBufferLineDiscounts - codeunit 827 "Service Post Invoice Events", and call this from codeunit 817 "Service Post Invoice" implements "Invoice Posting" - PrepareLine.

codeunit 827 "Service Post Invoice Events" procedure RunOnBeforeUpdateInvoicePostingBufferLineDiscounts(var InvoicePostingBuffer: Record "Invoice Posting Buffer"; ServiceLine: Record "Service Line") begin OnBeforeUpdateInvoicePostingBufferLineDiscounts(InvoicePostingBuffer, ServiceLine) end;

[IntegrationEvent(false, false)]
local procedure OnBeforeUpdateInvoicePostingBufferLineDiscounts(var InvoicePostingBuffer: Record "Invoice Posting Buffer"; ServiceLine: Record "Service Line")
begin
end;

Then call from here codeunit 817 "Service Post Invoice" implements "Invoice Posting" procedure PrepareLine(DocumentHeaderVar: Variant; DocumentLineVar: Variant; DocumentLineACYVar: Variant) begin if SalesSetup."Discount Posting" in [SalesSetup."Discount Posting"::"Line Discounts", SalesSetup."Discount Posting"::"All Discounts"] then begin CalcLineDiscountPosting(InvoicePostingBuffer, ServiceLine, ServiceLineACY, ServiceHeader); if (InvoicePostingBuffer.Amount <> 0) or (InvoicePostingBuffer."Amount (ACY)" <> 0) then begin InvoicePostingBuffer.SetAccount( GenPostingSetup.GetSalesLineDiscAccount(), TotalVAT, TotalVATACY, TotalAmount, TotalAmountACY); InvoicePostingBuffer.UpdateVATBase(TotalVATBase, TotalVATBaseACY); ServicePostInvoiceEvents.RunOnBeforeCalcInvoiceDiscountPosting(InvoicePostingBuffer, ServiceLine); UpdateInvoicePostingBuffer(InvoicePostingBuffer, ServiceLine); end; end;

Additional context

This will allow us to amend the Account used for Posting Line Discounts dependent on whether the contract is prepaid or not.

JeremyOrgan-DC avatar Jul 17 '23 10:07 JeremyOrgan-DC

Sorry line in PrepareLine should read ServicePostInvoiceEvents.RunOnBeforeUpdateInvoicePostingBufferLineDiscounts(InvoicePostingBuffer, ServiceLine);

JeremyOrgan-DC avatar Jul 17 '23 10:07 JeremyOrgan-DC

Hi, is there any update on this request? Many Thanks

JeremyOrgan-DC avatar Aug 23 '23 08:08 JeremyOrgan-DC

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: 15512.

JesperSchulz avatar Jan 22 '24 07:01 JesperSchulz