sde1000 / quicktill

Figure out where all the money and stock went to
GNU General Public License v3.0
43 stars 8 forks source link

Negative prices / custom discounts #281

Closed sde1000 closed 4 months ago

sde1000 commented 4 months ago

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

sde1000 commented 4 months ago

We should now be able to implement the cup re-use discount for EMF.