Hi there,
I have 2 tables: STOCK table and STOCKTRANSACTIONS table. The stock table shows me how much product I have in every bin right now. STOCKTRANSACTIONS have every product transaction recorded (could be in multiple bins). I am trying to display all the latest transactions that apply to a certain bin, up to the qty in that bin.
For example, I have product ABC in bin DMG. STOCK table shows QTY = 5 in that location. I can link both the bin location and the product to the STOCKTRANSACTIONS table. I see that there were 20 transactions for the item ABC in the last year. I am trying to display only the latest transactions that will equal to the QTY in that bin location (5).
STOCK
ITM: ABC QTY: 5 BIN: DMG
ITM: DFE QTY: 1 BIN: DMG
STOCKTRANSACTIONS
TXN: 6 ITM: ABC BIN: DMG DATE: 07/23/2019 QTY: 3
TXN: 5 ITM: ABC BIN: DMG DATE: 07/21/2019 QTY: -1
TXN: 4 ITM: ABC BIN: DMG DATE: 07/21/2019 QTY: 2
TXN: 3 ITM: ABC BIN: DMG DATE: 07/19/2019 QTY: 1
TXN: 1 ITM: ABC BIN: DMG DATE: 07/17/2019 QTY: 1
TXN: 2 ITM: DFE BIN: DMG DATE: 07/18/2019 QTY: 1
I have everything grouped by the STOCK.ITM and have a running total for the QTY in the details and in the DESC order from the STOCKTRANSACTIONS table. Basically, I am looking for something where once the STOCK.QTY = Running Total QTY, it stops printing records. What would be the easier way to accomplish this?
Thank you very much for your help!
I have 2 tables: STOCK table and STOCKTRANSACTIONS table. The stock table shows me how much product I have in every bin right now. STOCKTRANSACTIONS have every product transaction recorded (could be in multiple bins). I am trying to display all the latest transactions that apply to a certain bin, up to the qty in that bin.
For example, I have product ABC in bin DMG. STOCK table shows QTY = 5 in that location. I can link both the bin location and the product to the STOCKTRANSACTIONS table. I see that there were 20 transactions for the item ABC in the last year. I am trying to display only the latest transactions that will equal to the QTY in that bin location (5).
STOCK
ITM: ABC QTY: 5 BIN: DMG
ITM: DFE QTY: 1 BIN: DMG
STOCKTRANSACTIONS
TXN: 6 ITM: ABC BIN: DMG DATE: 07/23/2019 QTY: 3
TXN: 5 ITM: ABC BIN: DMG DATE: 07/21/2019 QTY: -1
TXN: 4 ITM: ABC BIN: DMG DATE: 07/21/2019 QTY: 2
TXN: 3 ITM: ABC BIN: DMG DATE: 07/19/2019 QTY: 1
TXN: 1 ITM: ABC BIN: DMG DATE: 07/17/2019 QTY: 1
TXN: 2 ITM: DFE BIN: DMG DATE: 07/18/2019 QTY: 1
I have everything grouped by the STOCK.ITM and have a running total for the QTY in the details and in the DESC order from the STOCKTRANSACTIONS table. Basically, I am looking for something where once the STOCK.QTY = Running Total QTY, it stops printing records. What would be the easier way to accomplish this?
Thank you very much for your help!