Results 1 to 2 of 2
Jun 1, 2007, 08:37 #1
- Join Date
- Jun 2002
- Buenos Aires, Argentina
- 0 Post(s)
- 0 Thread(s)
Which value is nearer than these?
I have a value that defines the quantity of bottles of wine each box has. For eg: Each box has 50.
My customer sent me a quantity of bottles that he wants to buy, that may accord or not to the exact number of bottles per box. I can't sell an incomplete box, so all the quantity's I can sell are: 50 and it's multipliers, such as 100, 150, 200, 250.
In case the bottles of the customer doesn't fix an exact-box-quantity, I need a script that chooses from the nearer higher value. For example:
If he wants to buy 60, he has to take 100. If he wants to have 430, he needs to take 450.
Thanx!My SOHO: http://www.contactopuro.com.ar
Jun 1, 2007, 08:42 #2PHP Code:
$qty = ceil($howmanyuserwants / $howmanyperbox) * $howmanyperbox;
// eg. 60/50 = 2 * 50 = 100.