protected void TextBox1_TextChanged(object sender, System.EventArgs e) { SqlConnection con1 = new SqlConnection(ConfigurationManager.AppSettings["connection"]); con1.Open(); string query = "Select * from product_stock where Com_Id='" + company_id + "' and barcode='" + TextBox1.Text + "'"; SqlCommand cmd1 = new SqlCommand(query, con1); SqlDataReader dr = cmd1.ExecuteReader(); if (dr.Read()) { TextBox12.Text = dr["Product_name"].ToString(); TextBox17.Text = dr["mrp"].ToString(); TextBox5.Text = "1"; } con1.Close(); TextBox12.Focus(); try { float a = float.Parse(TextBox17.Text); float b = float.Parse(TextBox5.Text); TextBox18.Text = (a * b).ToString(); Button3.Focus(); } catch (Exception we) { } }
protected void TextBox15_TextChanged(object sender, System.EventArgs e) { float tax = float.Parse(TextBox15.Text); float total = float.Parse(TextBox18.Text); TextBox16.Text = string.Format("{0:0.00}", (total * tax / 100)).ToString(); float A = float.Parse(TextBox16.Text); TextBox18.Text = string.Format("{0:0.00}", (total - A)).ToString(); Button3.Focus(); }
protected void TextBox14_TextChanged(object sender, System.EventArgs e) { try { float tax = float.Parse(TextBox14.Text); float total = float.Parse(TextBox16.Text); TextBox15.Text = string.Format("{0:0.00}", (total * tax / 100)).ToString(); float A = float.Parse(TextBox15.Text); TextBox16.Text = string.Format("{0:0.00}", (A + total)).ToString(); Button3.Focus(); } catch (Exception we) { } }
private void Button2_Click(object sender, RoutedEventArgs e) { try { Tip2.FadeOut(); Tip3.AfterFadeIn += (s, evt) => { Button3.Focus(); }; Tip3.FadeIn(); } catch (Exception ex) { Diagnostics.LogException(ex); OnError(); } }
protected void Button3_Click(object sender, EventArgs e) { try { string sql1 = "select order_id,order_date,date_year,operate_person,supply_person,supplier_phone,book_id,book_name,book_price,remain_num from Storage_management_end where book_id=" + book_id; DataTable dt = SQLHelper.GetDataTable(sql1); GridView1.AllowSorting = false; GridView1.DataSource = dt; GridView1.DataBind(); SqlDataReader read = SQLHelper.ExecuteReader("select * from Storage_management_end where book_id =" + book_id); //记录下书号和订单号,作为一本书的唯一标示 int amount = 0; for (; read.Read();) { //amount = int.Parse(read["remain_num"].ToString()); amount = int.Parse(TextBox17.Text); if (TextBox3.Text == "" && TextBox3.Text == "0") { WebMessageBox.Show("不能输入空值或零!"); } if (int.Parse(TextBox3.Text) > amount) { WebMessageBox.Show("输入的数量有错!"); } else { int remain = amount - Convert.ToInt32(TextBox3.Text); string sql = "insert into return_history (order_id,operate_person,operater_phone,date_year ,semester ,supply_person,supplier_phone,book_id ,book_name,press_name,book_price,plan_num,auto_num,total_price,order_discount ,arrived_discount ,sell_discount ,arrived_amount ,unarrived_amount ,arrival_amount ,arrived_date ,Campus ,Storage_location ,out_num,remain_num ,order_date, press_time,state_id,total_num,return_num,return_date)"; sql += "values('" + read["order_id"].ToString() + "','" + read["operate_person"].ToString() + "','" + read["operater_phone"].ToString() + "','" + read["date_year"].ToString() + "','" + read["semester"].ToString() + "','" + read["supply_person"].ToString() + "','" + read["supplier_phone"].ToString() + "','" + read["book_id"].ToString() + "','" + read["book_name"].ToString() + "','" + read["press_name"].ToString() + "','" + read["book_price"].ToString() + "','" + read["plan_num"].ToString() + "','" + read["auto_num"].ToString() + "','" + read["total_price"].ToString() + "','" + read["order_discount"].ToString() + "','" + read["arrived_discount"].ToString() + "','" + read["sell_discount"].ToString() + "','" + read["arrived_amount"].ToString() + "','" + read["unarrived_amount"].ToString() + "','" + read["arrival_amount"].ToString() + "','" + read["arrived_date"].ToString() + "','" + read["Campus"].ToString() + "','" + read["Storage_location"].ToString() + "','" + read["out_num"].ToString() + "','" + read["remain_num"].ToString() + "','" + read["order_date"].ToString() + "','" + read["press_time"].ToString() + "','" + read["state_id"].ToString() + "','" + read["total_num"].ToString() + "','" + TextBox3.Text.ToString() + "','" + System.DateTime.Now.ToString("d") + "')"; SQLHelper.ExecuteNonQuery(sql); SQLHelper.ExecuteReader("update Storage_management_end set remain_num='" + remain.ToString() + "'where book_id= '" + book_id + "' "); string sql2 = "select date_year,semester,supply_person,book_id,book_name,press_name,return_num,return_date,Storage_location from return_history where book_id =" + book_id; DataTable dt1 = SQLHelper.GetDataTable(sql2); GridView2.DataSource = dt1; GridView2.DataBind(); string sql3 = "delete from Storage_management_end where remain_num='0'"; SQLHelper.ExecuteNonQuery(sql3); Button4.Visible = true; } } Button3.Focus(); } catch (Exception ex) { WebMessageBox.Show(ex.Message); } }
protected void TextBox1_TextChanged(object sender, System.EventArgs e) { if (User.Identity.IsAuthenticated) { SqlConnection con2 = new SqlConnection(ConfigurationManager.AppSettings["connection"]); SqlCommand cmd2 = new SqlCommand("select * from user_details where Name='" + User.Identity.Name + "'", con2); SqlDataReader dr2; con2.Open(); dr2 = cmd2.ExecuteReader(); if (dr2.Read()) { company_id = Convert.ToInt32(dr2["com_id"].ToString()); SqlConnection con1 = new SqlConnection(ConfigurationManager.AppSettings["connection"]); con1.Open(); string query = "Select * from product_stock where Com_Id='" + company_id + "' and barcode='" + TextBox1.Text + "'"; SqlCommand cmd1 = new SqlCommand(query, con1); SqlDataReader dr = cmd1.ExecuteReader(); if (dr.Read()) { TextBox12.Text = dr["Product_name"].ToString(); TextBox17.Text = dr["mrp"].ToString(); TextBox5.Text = "1"; TextBox15.Text = "0"; TextBox16.Text = "0.0"; } con1.Close(); TextBox12.Focus(); try { float a = float.Parse(TextBox17.Text); float b = float.Parse(TextBox5.Text); TextBox18.Text = (a * b).ToString(); Button3.Focus(); } catch (Exception we) { } } con2.Close(); } }