示例#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);
                }
            }
        }
示例#2
0
        private void Delete_btn_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(conStr);

            con.Open();
            SqlCommand cmd = new SqlCommand("DeleteItemandStockupdatein_Sales", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@billno", label1.Text);
            cmd.Parameters.AddWithValue("@Itemname", itemauto_textbox.Text);
            cmd.Parameters.AddWithValue("@Batch", Batchnocombobox.Text);
            cmd.Parameters.AddWithValue("@Quantity", Pqty_textbox.Text);
            int i = cmd.ExecuteNonQuery();

            if (i != 0)
            {
                MessageBox.Show("Deleted");
            }
            else
            {
                MessageBox.Show("Not Deleted");
            }
            con.Close();
            DisplayData();
            itemauto_textbox.Clear();
            Hsn_textbox.Clear();
            // Batchnocombobox.Clear();
            company_textbox.Clear();
            Expdate_textbox.Clear();
            Pqty_textbox.Clear();
            Rack_txtbox.Clear();
            Rate_txtbox.Clear();
            MRP_TXTBOX.Clear();
            sgst_textBox.Clear();
            discount_txetbox.Clear();
            amt_textbox.Clear();

            ClearTextBoxes();
        }
示例#3
0
        private void AddItem_btn_Click(object sender, EventArgs e)
        {
            string        itemno     = "";
            string        conStr     = ConfigurationManager.ConnectionStrings["coonstring"].ToString();
            SqlConnection connection = new SqlConnection(conStr);

            connection.Open();
            SqlDataReader read;
            SqlCommand    command = new SqlCommand("FetchItemNo", connection);

            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.AddWithValue("@productname", itemname_txtboxauto.Text);
            read = command.ExecuteReader();
            while (read.Read())
            {
                itemno = read["PrdId"].ToString();
            }
            connection.Close();


            //  SqlCommand cmm = new SqlCommand(@"INSERT INTO tbl_Stock_dummy (PurchaseID,ItemName,Company,Batch,ExpDate,PQty,Rate,Amount)VALUES('" + PURCHASEid_auto_label.Text + "','" + itemname_txtboxauto.Text + "','" + company_textbox.Text + "','" + Batch_textbox.Text + "','" + Exp_textbox.Text + "','" + Pqty_textbox.Text + "','" + Rate_txtbox.Text + "','" + amt_textbox.Text + "')", conn);

            SqlConnection conn = new SqlConnection(conStr);
            SqlCommand    cmm  = new SqlCommand("insert_into_Tablestockdummy", conn);

            cmm.CommandType = CommandType.StoredProcedure;
            cmm.Parameters.AddWithValue("@purchaseid", PURCHASEid_auto_label.Text);
            cmm.Parameters.AddWithValue("@itemno", itemno);
            cmm.Parameters.AddWithValue("@itemname", itemname_txtboxauto.Text);
            cmm.Parameters.AddWithValue("@company", company_textbox.Text);
            cmm.Parameters.AddWithValue("@batch", Batch_textbox.Text);
            cmm.Parameters.AddWithValue("@expdate", ExpdateTimePicker.Text);
            cmm.Parameters.AddWithValue("@pqty", Pqty_textbox.Text);
            cmm.Parameters.AddWithValue("@rate", Rate_txtbox.Text);
            cmm.Parameters.AddWithValue("@amount", amt_textbox.Text);
            ///NEWLY ADDED as per requirements
            cmm.Parameters.AddWithValue("@MRP", MRP_TXTBOX.Text);
            cmm.Parameters.AddWithValue("@Rack", Rack_txtbox.Text);
            cmm.Parameters.AddWithValue("@SGST", sgst_textBox.Text);
            cmm.Parameters.AddWithValue("@HSNcode", Hsn_textbox.Text);
            cmm.Parameters.AddWithValue("@Discount", discount_txetbox.Text);
            cmm.Parameters.AddWithValue("@NetRate", Net_Rate_txtbox.Text);
            cmm.Parameters.AddWithValue("@Srate", Srate_txtbox.Text);
            cmm.Parameters.AddWithValue("@Free", Freetxtbox.Text);



            conn.Open();
            cmm.ExecuteNonQuery();
            conn.Close();
            DisplayData();
            itemname_txtboxauto.Clear();
            Batch_textbox.Clear();

            Rate_txtbox.Clear();
            MRP_TXTBOX.Clear();
            Rack_txtbox.Clear();
            sgst_textBox.Clear();
            discount_txetbox.Clear();
            Net_Rate_txtbox.Clear();
            Hsn_textbox.Clear();
            Srate_txtbox.Clear();
            Freetxtbox.Clear();
            Pqty_textbox.Clear();
            company_textbox.Clear();
            amt_textbox.Clear();
            conn.Open();

            SqlDataReader myReader     = null;
            SqlConnection myConnection = new SqlConnection(conStr);
            //SqlCommand myCommand = new SqlCommand("select SUM(Amount)from tbl_Stock_dummy ", myConnection);
            SqlCommand myCommand = new SqlCommand("sumfromdummyStock ", myConnection);

            myConnection.Open();
            myReader = myCommand.ExecuteReader();
            if (myReader.Read())
            {
                Grandtotal_txtbox.Text = myReader.GetValue(0).ToString();
            }

            conn.Close();
            DisplayData();
            itemname_txtboxauto.Focus();
        }