We're updating the issue view to help you get more done. 

Add support to automatically invoice SFS treatment decreases

Description

If a SFS treatment is billed in OpenVPMS, a Customer Order will be created.
If the treatment quantity decreases, and:

  • the Customer Order hasn't been invoiced, it is updated

  • the Customer Order has been invoiced, a Customer Return will be created with the difference in quantity

If the Customer Return in the second case is invoiced, a Credit will be created.
This is because it isn't associated with any Invoice Item.
To avoid this:
1. get the latest invoice for the customer
2. look for any line item(s) matching the Customer Return product that are uncorrelated (i.e. haven't generated their own orders)
3. decrease their quantities as appropriate
If the quantity available for return is less than the Customer Return, create the Credit as before.

Environment

None

Status

Assignee

Tim Anderson

Reporter

Tim Anderson

Labels

None

Components

Fix versions

Affects versions

2.0

Priority

Minor