ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] CU 80 Sales Post

Open BWilczewski opened this issue 6 years ago • 3 comments

Hello, I would like to modfiy function FillInvoicePostingBuffer and move eisting events like this: ` //mod IsHandled := not (SalesSetup."Discount Posting" in [SalesSetup."Discount Posting"::"Invoice Discounts", SalesSetup."Discount Posting"::"All Discounts"]); OnBeforeCalcInvoiceDiscountPosting( TempInvoicePostBuffer, InvoicePostBuffer, SalesHeader, SalesLine, TotalVAT, TotalVATACY, TotalAmount, TotalAmountACY, IsHandled); if not IsHandled then begin // end CalcInvoiceDiscountPosting(SalesHeader, SalesLine, SalesLineACY, InvoicePostBuffer); if (InvoicePostBuffer.Amount <> 0) or (InvoicePostBuffer."Amount (ACY)" <> 0) then begin IsHandled := false; OnFillInvoicePostingBufferOnBeforeSetInvDiscAccount(SalesLine, GenPostingSetup, InvDiscAccount, IsHandled); if not IsHandled then InvDiscAccount := GenPostingSetup.GetSalesInvDiscAccount; InvoicePostBuffer.SetAccount(InvDiscAccount, TotalVAT, TotalVATACY, TotalAmount, TotalAmountACY); InvoicePostBuffer.UpdateVATBase(TotalVATBase, TotalVATBaseACY); UpdateInvoicePostBuffer(TempInvoicePostBuffer, InvoicePostBuffer, true); end; end;

    // mod
    IsHandled := not (SalesSetup."Discount Posting" in
      [SalesSetup."Discount Posting"::"Invoice Discounts", SalesSetup."Discount Posting"::"All Discounts"]);
    OnBeforeCalcLineDiscountPosting(
      TempInvoicePostBuffer, InvoicePostBuffer, SalesHeader, SalesLine, TotalVAT, TotalVATACY, TotalAmount, TotalAmountACY, IsHandled);
    if not IsHandled then begin
        CalcLineDiscountPosting(SalesHeader, SalesLine, SalesLineACY, InvoicePostBuffer);
        if (InvoicePostBuffer.Amount <> 0) or (InvoicePostBuffer."Amount (ACY)" <> 0) then begin
            IsHandled := false;
            OnFillInvoicePostingBufferOnBeforeSetLineDiscAccount(SalesLine, GenPostingSetup, LineDiscAccount, IsHandled);
            if not IsHandled then
                LineDiscAccount := GenPostingSetup.GetSalesLineDiscAccount;
            InvoicePostBuffer.SetAccount(LineDiscAccount, TotalVAT, TotalVATACY, TotalAmount, TotalAmountACY);
            InvoicePostBuffer.UpdateVATBase(TotalVATBase, TotalVATBaseACY);
            UpdateInvoicePostBuffer(TempInvoicePostBuffer, InvoicePostBuffer, true);
            OnFillInvoicePostingBufferOnAfterSetLineDiscAccount(SalesLine, GenPostingSetup, InvoicePostBuffer, TempInvoicePostBuffer);
        end;
    end;

`

these would allow to perform calculations on custom discount postings types. Thanks, Bartek

BWilczewski avatar Oct 28 '20 13:10 BWilczewski

Hi @BWilczewski . We cannot move events. Instead, we could do something like this: image

Is it ok for you? If yes, please specify the needed parameters for events OnAfterCalcInvoiceDiscountPosting/OnAfterCalcInvoiceDiscountPosting

RomanZanizdra avatar Nov 02 '20 08:11 RomanZanizdra

Hey @RomanZanizdra, thanks for the input, mod fits my needs, sales header and sales line parameters will be fine.

BWilczewski avatar Nov 02 '20 12:11 BWilczewski

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. We will update this issue with information about availability.

bc-ghost avatar Nov 07 '20 06:11 bc-ghost