Click here to Skip to main content
15,905,238 members
Please Sign up or sign in to vote.
3.67/5 (3 votes)
See more:
how to decrease no. of items after sale in stock inventory system.i m not getting d codes in order to decrease items when sales is done and increase when number of items is added.plz help me out
shakil0304003 20-Nov-12 3:34am    
Your question is unclear.
OriginalGriff 20-Nov-12 3:38am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
As a result, we have no idea how or where you are storing the information, and can't help you change it!
Use the "Improve question" widget to edit your question and provide better information.
DHARMENDRA520 20-Nov-12 4:21am    
actualy i m making a project similar to stock inventory for bar and restaurent in c#.i need to decrease the no. of beers or wine bottle when any of these produst is sold and add new items in that when new entries comes.i am not getting the code for that.if any one of u hav cmoplete code then plz help me out

1 solution

Hi Dharmendra,

You can update inventory as below after sell happen.

Call below method for each item of cart after sells completion means from thank you page.

public void UpdateInventory(string skuID, int count)
   //use below query to update inventory table
   string query = "UPDATE inventory SET itemCount = (itemCount - " + count.ToString() + ") WHERE skuID = '" + skuID + "'";
  //write more code to execute this query

For updation of inventory when item is added to the system use below method.

public void RefreshInventory(Product product)
  //Write your code to update the invenroty

Hope this will help you.

For more specific answer you need to post code snippet as well, which you have tried.
Share this answer
faisal23 20-Nov-12 4:16am    
Hi, I understand your question but its more better if you provide your code and procedure.
You have to make one master table for items. On sales procedure you have to minus the items from master table by particular id and vice-versa for purchase.
DHARMENDRA520 20-Nov-12 4:38am    
thanx faisal..i got ur idea and i was implementing d same.but each product has its own id in a particular table.i can manage with only one id but can't for multiple id..if u hav done that ever before plz send me the codes.
faisal23 20-Nov-12 4:47am    
yes i have done same in windows application but i cant sent you the codes i lost it. So give me your code i correct it. And the simple way is that make separate forms for sales and purchase and do all the process in stored procedure. At the time of selling update the stock in same query.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900