Jump to content

Fifo Method Calculation


Billz

Recommended Posts

Please help me let me explain with this.....

purchase table

 

 

id

purchase_id

product_id

product_batch_id

variant_id

imei_number

qty

recieved

purchase_unit_id

net_unit_cost

discount

tax_rate

tax

total

created_at

updated_at

   
       

1

1

1

NULL

NULL

NULL

10

10

1

40

0

0

0

400

2022-10-01 14:37:01

2022-10-01 14:37:01

         
       

2

2

1

NULL

NULL

NULL

15

15

1

45

0

0

0

675

2022-10-01 14:39:09

2022-10-01 14:39:09

         

 

 

 

 

3

3

1

NULL

NULL

NULL

15

15

1

48

0

0

0

720

2022-10-01 14:40:44

2022-10-01 14:40:44

         

Sale Table

 

 

sale_id

product_id

qty

net_unit_price

total

created_at

 

 

 Edit

 Copy

 Delete

1

1

10

50

500

2022-10-01 14:37:22

       

 

 Edit

 Copy

 Delete

2

1

10

50

500

2022-10-01 14:39:35

       

 

 Edit

 Copy

 Delete

3

1

15

50

750

2022-10-01 14:41:12

       

 

 Edit

 Copy

 Delete

4

1

5

50

250

2022-10-01 15:55:21

       

 

 Edit

 Copy

 Delete

5

1

1

50

50

2022-10-03 15:02:43

       

 

 Edit

 Copy

 Delete

6

1

1

40

40

2022-10-03 15:06:12

       

 

 Edit

 Copy

 Delete

7

1

1

40

40

2022-10-03 15:06:15

       

 

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...