Skip to content

OBPIH-6689 Fix amount available to inverse calculation#4851

Merged
awalkowiak merged 2 commits intorelease/0.9.2-hotfix1from
OBPIH-6689
Sep 20, 2024
Merged

OBPIH-6689 Fix amount available to inverse calculation#4851
awalkowiak merged 2 commits intorelease/0.9.2-hotfix1from
OBPIH-6689

Conversation

@awalkowiak
Copy link
Collaborator

✨ 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.

@github-actions github-actions bot added the domain: backend Changes or discussions relating to the backend server label Sep 19, 2024
// 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

@ewaterman ewaterman Sep 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@awalkowiak awalkowiak merged commit 7345fb6 into release/0.9.2-hotfix1 Sep 20, 2024
@awalkowiak awalkowiak deleted the OBPIH-6689 branch September 20, 2024 08:03
jwalbers pushed a commit to jwalbers/openboxes that referenced this pull request Oct 29, 2024
jwalbers pushed a commit to jwalbers/openboxes that referenced this pull request Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: backend Changes or discussions relating to the backend server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants