Skip to content

OBPIH-6671 Fix amount outstanding on orders report calculation#4832

Merged
awalkowiak merged 1 commit intorelease/0.9.2-hotfix1from
OBPIH-6671
Sep 10, 2024
Merged

OBPIH-6671 Fix amount outstanding on orders report calculation#4832
awalkowiak merged 1 commit intorelease/0.9.2-hotfix1from
OBPIH-6671

Conversation

@awalkowiak
Copy link
Collaborator

✨ Description of Change

A concise summary of what is being changed. Please provide enough context for reviewers to be able to understand the change and why it is necessary. If the issue/ticket already provides enough information, you can put "See ticket" as the description.

Link to GitHub issue or Jira ticket:
https://pihemr.atlassian.net/browse/OBPIH-6671

Description:
There was an issue with calculating the report when there were multiple (partial) invoice items per shipment item (the quantity shipped was unnecessarily duplicated). Fixed it by grouping rows by shipment item and summing the quantity invoiced.

@github-actions github-actions bot added the domain: backend Changes or discussions relating to the backend server label Sep 9, 2024
AND (invoice_item.inverse IS NULL OR invoice_item.inverse = FALSE)
${additionalFilter}
GROUP BY o.id, order_item.id, shipment_item.id, invoice_item.id
GROUP BY o.id, order_item.id, shipment_item.id
Copy link
Member

Choose a reason for hiding this comment

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

why were we grouping by invoice item before? It seems like doing that would only ever result in one line per grouping and so make the SUM in line 902 pointless. What you've done here looks correct. I suppose the only reason it was working before was that an order item only ever had one invoice item so it just happened to work?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah I am not sure. IMHO it should not have been done since the beginning, and I am not sure why it was done. I think the regular invoices (not prepaid) were broken because of this before, but this bug was hard to spot.

@awalkowiak awalkowiak merged commit 4f50ad7 into release/0.9.2-hotfix1 Sep 10, 2024
@awalkowiak awalkowiak deleted the OBPIH-6671 branch September 10, 2024 11:36
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