Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Negative prices / custom discounts #281

Closed
sde1000 opened this issue Apr 17, 2024 · 1 comment
Closed

Negative prices / custom discounts #281

sde1000 opened this issue Apr 17, 2024 · 1 comment

Comments

@sde1000
Copy link
Owner

sde1000 commented Apr 17, 2024

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 added a commit that referenced this issue Apr 19, 2024
PLUs can have negative prices. Spot this, and sell a negative number of
items at a positive price instead.

Also, add a register hook to enable plugins to veto PLU sales.

Related issue: #281 on github.
sde1000 added a commit that referenced this issue Apr 19, 2024
Related issue: #281 on github.

We may want to support stock with a negative price in the future (for
example, where the "stock" is a limited number of discounts) but for now
let's just pop up an error when someone attempts to sell stock that has
a negative price.
@sde1000
Copy link
Owner Author

sde1000 commented Apr 19, 2024

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

@sde1000 sde1000 closed this as completed Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant