entity framework - How to implement FIFO with a ORM? -


i'm developing web pos using symfony. system works, i'm worried database. i'm storing product qty float, because products can sold in qty 0.3, 0.2, 0.99, 1.69, etc. bread. when save sell call save method. save method use foreach walk array collection of details , detail entity has qty, price, , product, every sale has @ least 1 detail. anyways update qty this:

detail->getproduct()->setqty(detail->getproduct()->getqty - detail->getqty )  

is easy update , delete sale. not support fifo or lifo.

now want support fifo , lifo @ first tried create stock entity,

stock{ var  productid ; var cost; var sell;  var detail; } 

and detail table wich hold this:

detail{ var  product[]; var  price;  } 

and sell class,

sell{   var details[];   var total; } 

so example sell of 3 units of x product. 3 entities of stock no detail added yet, , if fifo results should ordered id asc.

but still products bread don't know how can work, cannot have 1000 entities representing 1kg of bread in database xd.

how should implemented fifo orm?


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -