[main] - Incorrect Prepayment Invoice Amount for Sales Orders with Invoice Discount, Prices Including VAT and negative non-inventory line.#9656
Draft
v-ankitgoyal wants to merge 5 commits into
Conversation
…invoice discounts in SalesPostPrepayments
…ounts in SalesPostPrepayments
…Bug-643210-Master-Incorrect-Prepmt-Inv.-Amt.-for-SO-with-Discount
…tive non-inventory line
…and negative non-inventory line
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes : AB#643210
Issue :- Incorrect Prepayment Invoice Amount for Sales Orders with Invoice Discount, Prices Including VAT and a negative non-inventory line (regression). The posted prepayment invoice is lower than the sum of the lines' "Prepmt. Line Amount".
Root cause :-
The UpdateDifferenceAmount correction (added for work item 612821) derived the expected prepayment from the header: SalesHeader.Amount * SalesHeader."Prepayment %". SalesHeader.Amount includes negative and non-prepayment lines, and the single header Prepayment % does not reflect per-line prepayment, so the base is too low. The valid prepayment is then misread as a rounding difference and subtracted from the last buffer line, understating the invoice.
Solutions :-
Compute the expected prepayment amount line by line from the actual prepayment lines, using each line's own Amount and Prepayment %, so negative/non-prepayment lines are excluded and mixed percentages are respected. The correction still only fires on a genuine rounding surplus.