Ejemplo n.º 1
0
        private void add_button_Click(object sender, EventArgs e)
        {
            string        con        = ConfigurationManager.ConnectionStrings["coonstring"].ToString();
            SqlConnection connection = new SqlConnection(con);

            connection.Open();
            SqlCommand command = new SqlCommand("InsertIntoTableSalesReturnDisplay", connection);

            command.CommandType = CommandType.StoredProcedure;
            // command.Parameters.AddWithValue("@ReturnNo",ReturnNo_txtbox.Text);
            command.Parameters.AddWithValue("@Date", dateTimePicker_Sr.Text);
            //command.Parameters.AddWithValue("@SupplierName",SupplierName_txtbox.Text);
            command.Parameters.AddWithValue("@Itemname", ItemName_txtbox.Text);
            command.Parameters.AddWithValue("@CompanyName", CompanyName_txtbox.Text);
            command.Parameters.AddWithValue("@Batch", Batch_txtbox.Text);
            command.Parameters.AddWithValue("@Quantity", Quantity_Txtbox.Text);
            command.Parameters.AddWithValue("@Rate", Rate_textBox.Text);
            command.Parameters.AddWithValue("@ReturnTo", Return_txtbox.Text);
            command.Parameters.AddWithValue("@Total", total_txtbox.Text);
            command.ExecuteNonQuery();
            connection.Close();

            DisplayData();
            //SupplierName_txtbox.Clear();
            ItemName_txtbox.Clear();
            CompanyName_txtbox.Clear();
            Batch_txtbox.Clear();
            Quantity_Txtbox.Clear();
            Rate_textBox.Clear();
            Return_txtbox.Clear();
            total_txtbox.Clear();
        }
Ejemplo n.º 2
0
 private void Clear_Click(object sender, EventArgs e)
 {
     //SupplierName_txtbox.Clear();
     ItemName_txtbox.Clear();
     CompanyName_txtbox.Clear();
     Batch_txtbox.Clear();
     Quantity_Txtbox.Clear();
     Rate_textBox.Clear();
     Return_txtbox.Clear();
     total_txtbox.Clear();
 }
Ejemplo n.º 3
0
        private void ReturnQuantity_Click(object sender, EventArgs e)
        {
            string        conStr = ConfigurationManager.ConnectionStrings["coonstring"].ToString();
            SqlConnection con    = new SqlConnection(conStr);

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

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@SupplierName", SupplierName_txtbox.Text);
            cmd.Parameters.AddWithValue("@ItemName", ItemName_txtbox.Text);
            cmd.Parameters.AddWithValue("@CompanyName", CompanyName_txtbox.Text);
            cmd.Parameters.AddWithValue("@Batch", Batch_txtbox.Text);
            cmd.Parameters.AddWithValue("@Reason", Reason_Txtbox.Text);
            cmd.Parameters.AddWithValue("@Rate", Rate_textBox.Text);
            cmd.Parameters.AddWithValue("@Quantity", QuantitytextBox.Text);
            int i = cmd.ExecuteNonQuery();

            if (i != 0)
            {
                //  MessageBox.Show("DataEntered");
                DisplayData();
            }
            // else
            //{
            ////MessageBox.Show("Data Not Saved");
            //  }
            con.Close();
            SupplierName_txtbox.Clear();
            ItemName_txtbox.Clear();

            CompanyName_txtbox.Clear();
            Batch_txtbox.Clear();
            Rate_textBox.Clear();
            Reason_Txtbox.Clear();
            QuantitytextBox.Clear();
            SqlDataReader myReader     = null;
            SqlConnection myConnection = new SqlConnection(conStr);
            SqlCommand    myCommand    = new SqlCommand("sumtotal_PurchaseReturn", myConnection);

            myConnection.Open();
            myReader = myCommand.ExecuteReader();
            if (myReader.Read())
            {
                total_txtbox.Text = myReader.GetValue(0).ToString();
            }
        }
Ejemplo n.º 4
0
        private void Save_button_Click(object sender, EventArgs e)
        {
            int           i = 0;
            SqlDataReader sqlData;
            string        constr        = ConfigurationManager.ConnectionStrings["coonstring"].ToString();
            SqlConnection sqlConnection = new SqlConnection(constr);

            sqlConnection.Open();

            SqlCommand command = new SqlCommand("FetchdatafromPurchaseReturnDisplay", sqlConnection);

            command.CommandType = CommandType.StoredProcedure;
            sqlData             = command.ExecuteReader();

            while (sqlData.Read())
            {
                string SupplierName = sqlData["SupplierName"].ToString();
                string Itemname     = sqlData["ItemName"].ToString();
                string CompanyName  = sqlData["Company"].ToString();
                string Batch        = sqlData["Batch"].ToString();
                string Reason       = sqlData["Reason"].ToString();
                string R            = sqlData["Amount"].ToString();
                float  Rate         = float.Parse(R);
                string quantity     = sqlData["Quantity"].ToString();
                float  Quantity     = float.Parse(quantity);

                string        conStr = ConfigurationManager.ConnectionStrings["coonstring"].ToString();
                SqlConnection con    = new SqlConnection(conStr);

                SqlCommand cmd = new SqlCommand("InsertToPurchaseReturn", con);
                con.Open();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@SupplierName", SupplierName);
                cmd.Parameters.AddWithValue("@ItemName", Itemname);
                cmd.Parameters.AddWithValue("@CompanyName", CompanyName);
                cmd.Parameters.AddWithValue("@Batch", Batch);
                cmd.Parameters.AddWithValue("@Reason", Reason);
                cmd.Parameters.AddWithValue("@Rate", Rate);
                ///from this design
                cmd.Parameters.AddWithValue("@PurchaseId", purchaseid_txtbox.Text);
                cmd.Parameters.AddWithValue("@Date", dateTimePicker_p.Text);
                //cmd.Parameters.AddWithValue("@Total", total_txtbox.Text);
                cmd.Parameters.AddWithValue("@ReturnTo", Return_txtbox.Text);
                cmd.Parameters.AddWithValue("@Quantity", quantity);



                i = cmd.ExecuteNonQuery();
            }
            sqlData.Dispose();
            if (i != 0)
            {
                string        conn = ConfigurationManager.ConnectionStrings["coonstring"].ToString();
                SqlConnection sql  = new SqlConnection(constr);
                sql.Open();
                SqlCommand mycommand = new SqlCommand("TRUNICATE_PURCHASERETURNDISPLAY", sql);
                mycommand.ExecuteReader();
                sql.Close();
                // ClearTextBoxes();
                purchaseid_txtbox.Clear();
                SupplierName_txtbox.Clear();
                ItemName_txtbox.Clear();
                CompanyName_txtbox.Clear();
                Batch_txtbox.Clear();
                Reason_Txtbox.Clear();
                Rate_textBox.Clear();
                ReturnNo_txtbox.Clear();
                total_txtbox.Clear();

                DisplayData();
                sqlData.Close();
                MessageBox.Show("DataEntered");
                sqlConnection.Close();
            }
            else
            {
                MessageBox.Show("Data Not Saved");
                sqlConnection.Close();
            }
            PurchaseReturnID();
            //StockUPdate();
        }