コード例 #1
0
ファイル: Sales.cs プロジェクト: pranavspradeep/aimtrade
        private void ADDItem_button_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(conStr);
            // SqlCommand cmm = new SqlCommand(@"INSERT INTO Tbl_SalesItem_DUMMY (BillNo,ItemName,Batch,Exp,Qty,Rate,Total)VALUES('" + label1.Text + "','"+ itemauto_textbox.Text + "','" +Batchno_txtbox.Text+"','"+Expdate_textbox.Text+"','" + qty_txtbox.Text + "','" + Price_txtbox.Text + "','"  +Amount_txtbox.Text+ "')", conn);

            SqlCommand cmm = new SqlCommand("insertintosalesdummy_Sales", conn);

            cmm.CommandType = CommandType.StoredProcedure;
            cmm.Parameters.AddWithValue("@itemno", itemno);
            cmm.Parameters.AddWithValue("@billno", label1.Text);
            cmm.Parameters.AddWithValue("@itemname", itemauto_textbox.Text);
            cmm.Parameters.AddWithValue("@batch", Batchnocombobox.Text);
            cmm.Parameters.AddWithValue("@Company", company_textbox.Text);
            cmm.Parameters.AddWithValue("@exp", Expdate_textbox.Text);
            cmm.Parameters.AddWithValue("@qty", Pqty_textbox.Text);
            cmm.Parameters.AddWithValue("@rate", Rate_txtbox.Text);
            cmm.Parameters.AddWithValue("@total", amt_textbox.Text);
            //New updation on 18/10/2017 as per requirements
            cmm.Parameters.AddWithValue("@MRP", MRP_TXTBOX.Text);
            cmm.Parameters.AddWithValue("@Discount", discount_txetbox.Text);
            cmm.Parameters.AddWithValue("@SGST", sgst_textBox.Text);

            cmm.Parameters.AddWithValue("@HSNCode", Hsn_textbox.Text);



            conn.Open();
            cmm.ExecuteNonQuery();
            conn.Close();
            DisplayData();
            ClearTextBoxes();
            conn.Open();

            SqlDataReader myReader     = null;
            SqlConnection myConnection = new SqlConnection(conStr);
            SqlCommand    myCommand    = new SqlCommand("sumtotal_Sales", myConnection);

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

            conn.Close();
            itemauto_textbox.Focus();
            itemauto_textbox.Focus();
            itemauto_textbox.Focus();
            itemauto_textbox.Focus();
            Rate_txtbox.Clear();
            MRP_TXTBOX.Clear();
            Rack_txtbox.Clear();
            sgst_textBox.Clear();
            discount_txetbox.Clear();
            Hsn_textbox.Clear();
            amt_textbox.Clear();

            itemauto_textbox.Focus();
        }
コード例 #2
0
ファイル: Sales.cs プロジェクト: pranavspradeep/aimtrade
        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();
        }