Please help me let me explain with this.....
```
purchase table
id purchase_id product_id qty net_unit_cost created_at
1 1 1 10 10 2022-10-10
2 2 1 20 12 2022-10-10
Sale table
sale_id product_id qty net_unit_price created_at
1 1 11 15 2022-10-10
```
in this, if i sold '11' units then how can i subtract from the rows to get remaining units? i've to subtract '10' units from first row and '1' unit from second row.
Please help how to calculate fifo in php