示例#1
0
文件: StockBLL.cs 项目: Jusharra/RMS
 public string InsertKitchenStock(Stock aStock)
 {
     Stock stock = new Stock();
        StockDAO aDao = new StockDAO();
        string sr = aDao.InsertKitchenStock(aStock);
        return sr;
 }
示例#2
0
文件: StockBLL.cs 项目: Jusharra/RMS
 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);
        }
 }
示例#3
0
文件: StockBLL.cs 项目: Jusharra/RMS
 public Stock GetStockByItemidFrominventory_kitchen_stock(InventoryItem item)
 {
     Stock stock = new Stock();
        StockDAO aDao = new StockDAO();
        stock = aDao.GetStockByItemidFrominventory_kitchen_stock(item.ItemId);
        return stock;
 }
示例#4
0
文件: StockBLL.cs 项目: Jusharra/RMS
 public Stock GetStockByItemid(int itemId)
 {
     Stock stock = new Stock();
        StockDAO aDao = new StockDAO();
        stock = aDao.GetStockByItemid(itemId);
        return stock;
 }
示例#5
0
文件: StockBLL.cs 项目: Jusharra/RMS
 public List<InventoryStockReport> GetAllStockForReport()
 {
     List<InventoryStockReport> aReports=new List<InventoryStockReport>();
     StockDAO aDao = new StockDAO();
        aReports = aDao.GetAllStockForReport();
        return aReports;
 }
示例#6
0
        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");
            }
        }
示例#7
0
文件: StockBLL.cs 项目: Jusharra/RMS
        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);
               }
        }
示例#8
0
文件: StockBLL.cs 项目: Jusharra/RMS
 public void UpdateKitchenStockByStockId(Stock cStock)
 {
     StockDAO aDao = new StockDAO();
        aDao.UpdateKitchenStockByStockId(cStock);
 }
示例#9
0
文件: StockBLL.cs 项目: Jusharra/RMS
 public string UpdateKitchenStock(Stock aStock)
 {
     StockDAO aDao = new StockDAO();
        string sr = aDao.UpdateKitchenStock(aStock);
        return sr;
 }
示例#10
0
文件: StockBLL.cs 项目: Jusharra/RMS
 public string UpdateStockByStockId(Stock stock)
 {
     StockDAO aDao = new StockDAO();
        string sr = aDao.UpdateStockByStockId(stock);
        return sr;
 }
示例#11
0
文件: StockBLL.cs 项目: Jusharra/RMS
 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);
        }
 }