public string InsertKitchenStock(Stock aStock) { Stock stock = new Stock(); StockDAO aDao = new StockDAO(); string sr = aDao.InsertKitchenStock(aStock); return sr; }
public void InsertStockOrUpdate(Stock aStock) { Stock stock=new Stock(); StockDAO aDao=new StockDAO(); stock = aDao.GetStockByItemid(aStock.Item.ItemId); if(stock.StockId==0) { aDao.InsertStock(aStock); } else if(stock.StockId>0) { double pricePrevious = stock.Stocks*stock.UnitPrice; double priceNow = aStock.Stocks * aStock.UnitPrice; double totalStocks = stock.Stocks + aStock.Stocks; double totalPrice = priceNow + pricePrevious; stock.Stocks = totalStocks; if (totalStocks != 0 && totalPrice != 0) { aStock.UnitPrice = totalPrice / totalStocks; } else aStock.UnitPrice = 0; stock.StockId = stock.StockId; aDao.UpdateStock(stock); } }
public Stock GetStockByItemidFrominventory_kitchen_stock(InventoryItem item) { Stock stock = new Stock(); StockDAO aDao = new StockDAO(); stock = aDao.GetStockByItemidFrominventory_kitchen_stock(item.ItemId); return stock; }
public Stock GetStockByItemid(int itemId) { Stock stock = new Stock(); StockDAO aDao = new StockDAO(); stock = aDao.GetStockByItemid(itemId); return stock; }
public List<InventoryStockReport> GetAllStockForReport() { List<InventoryStockReport> aReports=new List<InventoryStockReport>(); StockDAO aDao = new StockDAO(); aReports = aDao.GetAllStockForReport(); return aReports; }
private void TransactionWhenProfessionalPackageIsActive() { InventoryItem aItem = new InventoryItem(); aItem = (InventoryItem)itemNamecomboBox.SelectedItem; InventoryCategory aInventoryCategory = new InventoryCategory(); aInventoryCategory = (InventoryCategory)categoryNamecomboBox.SelectedItem; Stock aStock = new Stock(); StockBLL aStockBll = new StockBLL(); string transactiontype = transactionTypecomboBox.SelectedItem.ToString(); Transaction aTransaction = new Transaction(); aTransaction.TransactionDate = DateTime.Now; aTransaction.Item = aItem; aTransaction.Category = aInventoryCategory; aTransaction.TransactionType = transactiontype; CUserInfo aUserInfo = new CUserInfo(); aUserInfo.UserName = RMSGlobal.LogInUserName; aTransaction.UserInfo = aUserInfo; string sr = string.Empty; if (transactiontype == "Damage_in_Stock") { if (danmagetextBox.Text.Length > 0) { aStock = aStockBll.GetStockByItemid(aItem.ItemId); if ((aStock.Stocks >= Convert.ToDouble(quantitytextBox.Text)) && (Convert.ToDouble(quantitytextBox.Text) != 0)) { aStock.Stocks = Convert.ToDouble(quantitytextBox.Text); aStock.Item = aItem; aStock.Category = aInventoryCategory; aTransaction.Stock = aStock; aTransaction.DamageReport = danmagetextBox.Text.Replace("'", "''"); TransactionBLL aBll = new TransactionBLL(); sr = aBll.DamageInStock(aTransaction); ShowAndClear(sr); } else MessageBox.Show("Your Quantity Must be Greater than 0 and less than or equal to " + aStock.Stocks + " " + unittypelabel.Text); } else MessageBox.Show("Please Check Your Damage Report Field It's Never Empty"); } if (transactiontype == "Send_to_Kitchen") { aStock = aStockBll.GetStockByItemid(aItem.ItemId); if ((aStock.Stocks >= Convert.ToDouble(quantitytextBox.Text)) && (Convert.ToDouble(quantitytextBox.Text) != 0)) { aStock.Stocks = Convert.ToDouble(quantitytextBox.Text); aStock.Item = aItem; aStock.Category = aInventoryCategory; aTransaction.Stock = aStock; TransactionBLL aBll = new TransactionBLL(); sr = aBll.SendToKitchen(aTransaction); ShowAndClear(sr); } else MessageBox.Show("Your Quantity Must be Greater than 0 and less than or equal to " + aStock.Stocks + " " + unittypelabel.Text); } //aStock = aStockBll.GetStockByItemidFrominventory_kitchen_stock(aItem); if (transactiontype == "Return_from_Kitchen") { aStock = aStockBll.GetStockByItemidFrominventory_kitchen_stock(aItem); if ((aStock.Stocks >= Convert.ToDouble(quantitytextBox.Text)) && (Convert.ToDouble(quantitytextBox.Text) != 0)) { aStock.Stocks = Convert.ToDouble(quantitytextBox.Text); aStock.Item = aItem; aStock.Category = aInventoryCategory; aTransaction.Stock = aStock; TransactionBLL aBll = new TransactionBLL(); sr = aBll.ReturnFromKitchen(aTransaction); ShowAndClear(sr); } else MessageBox.Show("Your Quantity Must be Greater than 0 and less than or equal to " + aStock.Stocks + " " + unittypelabel.Text); } if (transactiontype == "Damage_in_kitchen") { if (danmagetextBox.Text.Length > 0) { aStock = aStockBll.GetStockByItemidFrominventory_kitchen_stock(aItem); if ((aStock.Stocks >= Convert.ToDouble(quantitytextBox.Text)) && (Convert.ToDouble(quantitytextBox.Text) != 0)) { aStock.Stocks = Convert.ToDouble(quantitytextBox.Text); aStock.Item = aItem; aStock.Category = aInventoryCategory; aTransaction.Stock = aStock; aTransaction.DamageReport = danmagetextBox.Text.Replace("'", "''"); TransactionBLL aBll = new TransactionBLL(); sr = aBll.DamageInKitchen(aTransaction); ShowAndClear(sr); } else MessageBox.Show("Your Quantity Must be Greater than 0 and less than or equal to " + aStock.Stocks + " " + unittypelabel.Text); } else MessageBox.Show("Please Check Your Damage Report Field It's Never Empty"); } if (transactiontype == "Stock_Out_In_Kitchen") { if (danmagetextBox.Text.Length > 0) { aStock = aStockBll.GetStockByItemidFrominventory_kitchen_stock(aItem); if ((aStock.Stocks >= Convert.ToDouble(quantitytextBox.Text)) && (Convert.ToDouble(quantitytextBox.Text) != 0)) { aStock.Stocks = Convert.ToDouble(quantitytextBox.Text); aStock.Item = aItem; aStock.Category = aInventoryCategory; aTransaction.Stock = aStock; aTransaction.DamageReport = danmagetextBox.Text.Replace("'", "''"); TransactionBLL aBll = new TransactionBLL(); sr = aBll.SendOutInKitchen(aTransaction); StockDAO aStockDao=new StockDAO(); aStockDao.InsertOrUpdateSaleRawmaterialsReport(aTransaction.Item.ItemId, Convert.ToDouble(quantitytextBox.Text),aStock.UnitPrice); ShowAndClear(sr); } else MessageBox.Show("Your Quantity Must be Greater than 0 and less than or equal to " + aStock.Stocks + " " + unittypelabel.Text); } else MessageBox.Show("Please Check Your Damage Report Field It's Never Empty"); } }
public void UpdateKitchenStockForDamage(Stock aStock) { Stock stock = new Stock(); StockDAO aDao = new StockDAO(); stock = aDao.GetStockByItemidFrominventory_kitchen_stock(aStock.Item.ItemId); if (stock.StockId == 0) { aDao.InsertStock(aStock); } else if (stock.StockId > 0) { double pricePrevious = stock.Stocks * stock.UnitPrice; //double priceNow = aStock.Stocks * aStock.UnitPrice; double totalStocks = stock.Stocks - aStock.Stocks; // double totalPrice = priceNow + pricePrevious; stock.Stocks = totalStocks; if (pricePrevious != 0 && totalStocks != 0) { stock.UnitPrice = pricePrevious / totalStocks; } else stock.UnitPrice = 0; stock.StockId = stock.StockId; aDao.UpdateKitchenStock(stock); } }
public void UpdateKitchenStockByStockId(Stock cStock) { StockDAO aDao = new StockDAO(); aDao.UpdateKitchenStockByStockId(cStock); }
public string UpdateKitchenStock(Stock aStock) { StockDAO aDao = new StockDAO(); string sr = aDao.UpdateKitchenStock(aStock); return sr; }
public string UpdateStockByStockId(Stock stock) { StockDAO aDao = new StockDAO(); string sr = aDao.UpdateStockByStockId(stock); return sr; }
public void UpdateKitchenStockForSendOut(Stock aStock) { Stock stock = new Stock(); StockDAO aDao = new StockDAO(); stock = aDao.GetStockByItemidFrominventory_kitchen_stock(aStock.Item.ItemId); if (stock.StockId == 0) { aDao.InsertStock(aStock); } else if (stock.StockId > 0) { double totalStocks = stock.Stocks - aStock.Stocks; // double totalPrice = priceNow + pricePrevious; stock.Stocks = totalStocks; stock.StockId = stock.StockId; aDao.UpdateKitchenStock(stock); } }