0

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,

4

1 回答 1

0

FIFO has nothing to do with your problem. Just use a MySQL database and learn about the ORDER BY keyword. Your goal seems to be some sort of persistent data storage anyhow.

于 2013-02-10T23:26:39.910 回答