Best way to split quantities
docwisdom
Posts: 28
I have a serial input coming from a POS system with a quantity. I want to divide the quantity by the 6 output machines so each output machine maintains even quantity and one doesnt run out prematurely. Then have the remainder come out of the next unused output machine.
for example
input quantity 13
machine output
1: 3
2: 2
3: 2
4: 2
5: 2
6: 2
input quantity 13
machine output
1: 2
2: 3
3: 2
4: 2
5: 2
6: 2
input quantity 13
machine output
1: 2
2: 2
3: 3
4: 2
5: 2
6: 2
for example
input quantity 13
machine output
1: 3
2: 2
3: 2
4: 2
5: 2
6: 2
input quantity 13
machine output
1: 2
2: 3
3: 2
4: 2
5: 2
6: 2
input quantity 13
machine output
1: 2
2: 2
3: 3
4: 2
5: 2
6: 2
Comments
I took that an put it in a for loop and came up with this...works great!
fk_rolls = QTY
fk_hopr(0) = $00
fk_hopr(1) = $00
fk_hopr(2) = $00
fk_hopr(3) = $00
fk_hopr(4) = $00
fk_hopr(5) = $00
FOR q = 1 TO fk_rolls
fk_hopr(i) = fk_hopr(i)+1
i = i+1
IF i = 6 THEN i = 0
NEXT
DEBUG ? fk_hopr(0)
DEBUG ? fk_hopr(1)
DEBUG ? fk_hopr(2)
DEBUG ? fk_hopr(3)
DEBUG ? fk_hopr(4)
DEBUG ? fk_hopr(5)