OBPIH-6689 Fix amount available to inverse calculation#4851
OBPIH-6689 Fix amount available to inverse calculation#4851awalkowiak merged 2 commits intorelease/0.9.2-hotfix1from
Conversation
| // prepaymentItem.amount = -5, orderAdjustment.inversedAmount = 2, expected available to inverse = -3 | ||
| // The actual inverse item sign will be switched while saving the inverse, becaue now we only determine | ||
| // how much of prepayment item's amount is available for inversing. | ||
| return prepaymentAmount + inversedAmount |
There was a problem hiding this comment.
for future evan to understand: the amount available to invoice is the absolute difference between the prepayment amount and the amount that has already been invoiced.
There was a problem hiding this comment.
is the scenario you listed above realistic? If an adjustment is prepaid as a negative adjustment, when would we need to be able to regular invoice it later as a positive adjustment? Seems like a "discount" adjustment wouldn't make sense to be invoiced as an additional cost and vice versa for "tax" (or whatever) adjustments.
I suppose it's fine to be able to support that case since it doesn't seem to be complicating calculations too much, but I can see users getting confused about whether to set a negative or positive amount. Maybe we'd want a warning on the frontend if a user tries to do something like the above unintentionally.
✨ Description of Change
Link to GitHub issue or Jira ticket:
https://pihemr.atlassian.net/browse/OBPIH-6689
Description:
Previously this value was wrongly calculated. Instead of subtraction, it should be addition.