php - How to handle differnet purched price and quantity in same product -


i'm developing automobile parts inventory system using php , mysql. system have purchase module add/update/increase quantity of parts & sale module decrease/out quantity of parts. query have 2 section

a. storing data

  1. suppose have parts a1 in our stock quantity 30 , price of parts a1 $20 when purchase it.
  2. now want stock parts more example want buy 50 more items of parts a1 new price of parts a1 $24.

what best way/logic make these items separate know how parts purchased price $20 , new price $24 on sale page.

1. store same parts more once in database 2. normalize database: parts hasmany parttransctions purchased price , quantity 

b. retrieving data

  1. what decrease method when sale (suppose 60 unit in above example) a1 parts
  2. also want calculate the profit of sale

how handle of situation. in advance

  1. normalize database: parts hasmany parttransctions purchased price , quantity

or

you can handle issue using batch purchase. need create table called purchasebatches. table store every purchase history. transaction table parttransctions store batchid. that's it. think, know next steps.

also in sale need find method of lifo or fifo & many of sales rate manage average value calculate other costs.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -