Jump to content

Fifo Method Calculation php


Billz

Recommended Posts

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

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...