The database schema permits stock types and price lookups to have negative prices.
Attempting to make use of a price lookup or stock type with a negative price creates a transaction line with a negative price, which fails because prices in transaction lines cannot be less than zero.
We can probably make this do something sensible by spotting negative prices in the register and creating a transaction line with a positive price and a negative number of items. Dealing with repeats will also need attention.
This could be useful to implement per-item discounts, for example a button for "cup re-use" at EMF.
We would also need a register hook prior to the creation or updating of a transaction line, to enable hook code to look at the whole transaction and decide whether to permit the update. (In the case of cup re-use it would need to prevent there being more re-use discounts than drinks served.)
The database schema permits stock types and price lookups to have negative prices.
Attempting to make use of a price lookup or stock type with a negative price creates a transaction line with a negative price, which fails because prices in transaction lines cannot be less than zero.
We can probably make this do something sensible by spotting negative prices in the register and creating a transaction line with a positive price and a negative number of items. Dealing with repeats will also need attention.
This could be useful to implement per-item discounts, for example a button for "cup re-use" at EMF.
We would also need a register hook prior to the creation or updating of a transaction line, to enable hook code to look at the whole transaction and decide whether to permit the update. (In the case of cup re-use it would need to prevent there being more re-use discounts than drinks served.)