Good Day,
Location Table
LOCNO..ITEMNO..LOTNO...QTY
A1...........X01........24-02....10
B2...........X01........24-01..... 6
C6...........X01........24-03....20
(FIFO = The Lowest LOTNO)
If i sell <= 6 pieces of X01 i should pick the items from B2 Location(FIFO)
Requested Query Result should be
LOCNO..ITEMNO..LOTNO...QTY
B2...........X01........24-01..... 6
If i sell 10 pieces of X01 then
first i should pick 6 pieces from B2 Location(FIFO)
second i should pick 4 pieces from A1 Location(FIFO)
Requested Query Result should be
LOCNO..ITEMNO..LOTNO...QTY
B2...........X01........24-01......6
A1...........X01........24-02..... 4
If i sell 20 pieces of X01 part then
first i should pick 6 pieces from B2 Location(FIFO)
second i should pick 10 pieces from A1 Location(FIFO)
third i should pick 4 pieces from C6 Location(FIFO)
Requested Query Result should be
LOCNO..ITEMNO..LOTNO...QTY
B2...........X01........24-01...... 6
A1...........X01........24-02.....10
C6...........X01........24-03...... 4
Could someone please help ?
Thank You