Esempio n. 1
0
        public void QuantityCheckonSales()
        {
            string quantitytextbox = Pqty_textbox.Text;

            if (quantitytextbox == "")
            {
            }
            else
            {
                SqlDataReader Rread;
                string        Connect   = ConfigurationManager.ConnectionStrings["coonstring"].ToString();
                string        Qquantity = "";


                SqlConnection Connected = new SqlConnection(Connect);
                Connected.Open();
                SqlCommand Command = new SqlCommand("FetchQuantityfromstock", Connected);
                Command.CommandType = CommandType.StoredProcedure;
                Command.Parameters.AddWithValue("@itemname", itemauto_textbox.Text);
                Command.Parameters.AddWithValue("@Batch", Batchnocombobox.Text);
                // command.ExecuteNonQuery();
                Rread = Command.ExecuteReader();
                if (Rread.Read())
                {
                    Qquantity = Rread["PQty"].ToString();
                }
                Rread.Close();
                Connected.Close();

                int i = Convert.ToInt32(Qquantity);
                int j = Convert.ToInt32(quantitytextbox);


                if (j > i)
                {
                    Pqty_textbox.Clear();
                    itemauto_textbox.BackColor = Color.Red;
                    MessageBox.Show("Out Of Stock");
                    MessageBox.Show("Stock Available:" + Qquantity);
                }
            }
        }
Esempio n. 2
0
        ////QUANTITY UPDATE IN STOCK
        //public void QuantityUpdateINStock()
        //{
        //    string itno="";//itemno
        //    SqlDataReader reader_stock;
        //    string stockconnection = ConfigurationManager.ConnectionStrings["coonstring"].ToString();
        //    SqlConnection stockcon = new SqlConnection(stockconnection);
        //    stockcon.Open();
        //    SqlCommand commandstock = new SqlCommand("readfromsalesdummyforitemnameandbatch",stockcon);
        //    commandstock.CommandType = CommandType.StoredProcedure;
        //   reader_stock= commandstock.ExecuteReader();
        //    while(reader_stock.Read())
        //    {

        //        quantity_UPDATE = reader_stock["Qty"].ToString();
        //        batch_UPDATE = reader_stock["Batch"].ToString();
        //        itno = reader_stock["ItemNo"].ToString();

        //        string QuantityUpdateConnection = ConfigurationManager.ConnectionStrings["coonstring"].ToString();

        //        // int noitem = Convert.ToInt32(itemno.ToString());

        //        SqlConnection connection = new SqlConnection(QuantityUpdateConnection);
        //        connection.Open();
        //        SqlCommand command = new SqlCommand("update_quantity_in_stock", connection);
        //        command.CommandType = CommandType.StoredProcedure;
        //        command.Parameters.AddWithValue("@quantity", quantity_UPDATE.ToString());
        //        command.Parameters.AddWithValue("@itemno", itno.ToString());
        //        command.Parameters.AddWithValue("@batch", batch_UPDATE.ToString());
        //        command.ExecuteNonQuery();
        //        connection.Close();



        //    }
        //    reader_stock.Close();



        //}
        //OUT OF STOCK
        public void Outofstock()
        {
            if (itemauto_textbox.Text == "")
            {
            }
            else
            {
                string productlimit = "";
                // string itemname = itemauto_textbox.Text;
                string quantity = "";


                //FOR FETCHING MIN LEVEL FROM PRODUCT MASTER

                SqlDataReader read;
                string        connect = ConfigurationManager.ConnectionStrings["coonstring"].ToString();

                SqlConnection connected = new SqlConnection(connect);
                connected.Open();
                SqlCommand command = new SqlCommand("fetch_outofstockfromproductmaster", connected);
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@itemname", itemauto_textbox.Text);
                // command.ExecuteNonQuery();
                read = command.ExecuteReader();
                if (read.Read())
                {
                    productlimit = read["MinLevel"].ToString();
                }
                read.Close();
                connected.Close();

                //FOR FETCHING PRODUCT QUANTITY FROM STOCK
                SqlDataReader Rread;
                string        Connect = ConfigurationManager.ConnectionStrings["coonstring"].ToString();

                SqlConnection Connected = new SqlConnection(Connect);
                Connected.Open();
                SqlCommand Command = new SqlCommand("FetchQuantityfromstock", Connected);
                Command.CommandType = CommandType.StoredProcedure;
                Command.Parameters.AddWithValue("@itemname", itemauto_textbox.Text);
                Command.Parameters.AddWithValue("@Batch", Batchnocombobox.Text);
                // command.ExecuteNonQuery();
                Rread = Command.ExecuteReader();
                if (Rread.Read())
                {
                    quantity = Rread["PQty"].ToString();
                }
                Rread.Close();
                Connected.Close();


                int Quantity     = Convert.ToInt32(quantity);
                int ProductLimit = Convert.ToInt32(productlimit.ToString());

                if (Quantity >= ProductLimit)
                {
                    //MessageBox.Show("Available Stock:"+ Quantity);
                }
                else
                {
                    MessageBox.Show("OUT OF STOCK !" + Quantity);
                    itemauto_textbox.BackColor = Color.Red;
                }
            }
        }