I would like to Implement FIFO with PHP coding.
How can I write php coding minus stock by using FIFO?
In Examle,
Sotck In
ID Itemname QtyIn Price Total Date
1 A 2 $3 5$ 01-jan-2013
2 A 4 $2 8$ 02-jan-2013
3 B 3 $2 6$ 01-jan-2013
Sotck Out
ID Itemname QtyOut Date
1 A 3 05-jan-2013
Than i will insert into transactions as the following:
ID Itemname QtyOut Price Total Date
1 A 2 $3 6$ 05-jan-2013
2 A 1 $2 2$ 05-jan-2013
Sotck In Remain Balance :
ID Itemname Qty Price Total Date
1 A 0 $3 0$ 01-jan-2013
2 A 3 $2 6$ 02-jan-2013
3 B 3 $2 6$ 01-jan-2013
Please give solution and tell flow in php check and minus qtyIn by date asc.
Regards,