Y
Y
ylebedev2014-12-08 04:49:17
Algorithms
ylebedev, 2014-12-08 04:49:17

How to calculate the discount on the goods, if the goods are taken by the piece?

Let's take the example of 1 buyer:
There are 5 pieces of Vacuum cleaners at the price of a piece. for 1000 rubles.
And 8 pieces of irons for the price of a piece. for 800 rubles.
There is a discount for the total amount - 150 rubles.
The buyer pays the entire amount at once or some part.
how to calculate everything correctly if it is taken 1 piece each time?
There must be some amount of 1 pc. goods that need to be punched at the checkout.
(the amount that has been entered at the checkout can no longer be changed)
And
they may not get some goods - take 2 vacuum cleaners and 1 iron.
that is, we do not know how many goods will be purchased in the end.
From what to change and the total amount.
And how to take into account the goods already punched at the checkout with a discount (or without)?
Worse, if there is, how to calculate the return of the goods?
or maybe there is a fundamentally crooked delivery system for the entire algorithm.
need help.

What my brain gave out
Let them punch what they want at the checkout. the system takes this into account.
At the very end, when everything is already over.
We calculate the amount sold minus the amount of the discount = the final cost of the entire product.
The amount that the buyer paid in money - the final amount of the goods = the balance (plus or minus)
If there is a balance - then the balance is returned at the checkout.
am i thinking right?

in essence, I need to organize everything, as we will allow in YULMART.
The only problem is that the goods are taken by the piece, once a day. (taking into account discounts and bonuses)
and it is not known how many goods will be taken away.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Philipp, 2014-12-08
@zoonman

Everything is very simple - the order stores information about two product prices: the price of the product with a discount and without.
After all, the discount is formed depending on the conditions that must be met before the recalculation is made. For example, a discount on the total order amount of 150 rubles. In the order of 3 vacuum cleaners and 2 irons.
You can distribute the discount between all products or apply it to one product. Returns will be subject to the discounted price. Those. as soon as the discount is applied to the product, the price line with the applied discount should be reflected in the receipt.
This is how normal stores do it. And in case of a return, the amount with the discounted amount is returned.
Do not look at other stores, be guided by sound logic, sometimes such things are agreed with the pricing department.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question