protected void Page_Load(object sender, EventArgs e) { trace_id = Request.QueryString["trace_id"].IsNumber() ? Convert.ToInt32(Request.QueryString["trace_id"]) : 0; SqlHelper helper = LocalSqlHelper.WH; string Sql = "select isnull(sum(price*quantity),0) as all_sales,isnull(sum(price*quantity),0) as all_quantity from Tb_cashier_cart where cashier_id=@cashier_id and is_return=1 and trace_id=@trace_id"; helper.Params.Add("@cashier_id", my_admin_id); helper.Params.Add("@trace_id", trace_id); DataTable dt = helper.ExecDataTable(Sql); all_sales = 0 - Convert.ToDouble(dt.Rows[0]["all_sales"]); if (!Page.IsPostBack) { TextRealMoney.Text = all_sales.ToString(); int all_quantity = Convert.ToInt32(dt.Rows[0]["all_quantity"]); if (all_quantity == 0) { JSHelper.WriteScript("alert('没有待结算商品');history.back();"); return; } helper.Params.Clear(); Sql = "select *,sales=price*quantity from Tb_cashier_cart where cashier_id=@cashier_id and is_return=1 and trace_id=@trace_id"; helper.Params.Add("@cashier_id", my_admin_id); helper.Params.Add("@trace_id", trace_id); dt = helper.ExecDataTable(Sql); for (int i = 0; i < dt.Rows.Count; i++) { // total_money += Convert.ToDouble(dt.Rows[i]["sales"]); // total_goods += Convert.ToDouble(dt.Rows[i]["quantity"]); } GoodsList.DataShow(dt); } }
protected void Page_Load(object sender, EventArgs e) { id = Convert.ToInt32(Request["id"]); work_id = Convert.ToInt32(Request["work_id"]); if (!Page.IsPostBack) { Session["anti_refresh"] = "1"; int wm_id = 0; string Sql = "select a.wm_id,a.quantity,b.*,all_out_cost=0.00,all_do_cost=b.do_cost*a.quantity,all_other_cost=b.other_cost*a.quantity from dbo.Tb_Working_main a left join Tb_template b on a.tpl_id=b.tpl_id where a.work_id=" + work_id + " and a.operator_id=@operator_id"; helper.Params.Add("@operator_id", my_admin_id); DataTable dt = helper.ExecDataTable(Sql); for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i]["all_out_cost"] = Convert.ToDouble(dt.Rows[i]["all_do_cost"]) + Convert.ToDouble(dt.Rows[i]["all_other_cost"]); total_do_cost += Convert.ToDouble(dt.Rows[i]["all_do_cost"]); total_other_cost += Convert.ToDouble(dt.Rows[i]["all_other_cost"]); total_out_cost += Convert.ToDouble(dt.Rows[i]["all_out_cost"]); total_goods += Convert.ToDouble(dt.Rows[i]["quantity"]); } GoodsList.DataShow(dt); //产品,增加,修改,删除 } }
//捆绑搜索订单 protected void bindOrder(int page) { SqlHelper sp = LocalSqlHelper.WH; string sql = "select * from Tb_ComplaintType with(nolock) order by typeid "; DataTable dt = sp.ExecDataTable(sql); GoodsList.DataShow(dt); }
//捆绑搜索订单 protected void bindOrder() { SqlHelper sp = LocalSqlHelper.WH; int count = 0; string sql = "select * from TB_GoodsReturn with (nolock) where ChangeFlag=" + pid.ToString(); DataTable dt = sp.ExecDataTable(sql); GoodsList.DataShow(dt); }
//捆绑搜索订单 protected void bindOrder() { string where = getWhere(); SqlHelper sp = LocalSqlHelper.WH; int count = 0; DataTable dt; dt = sp.ExecDataTable("select * from TB_GoodsReturn where " + getWhere()); GoodsList.DataShow(dt); SiteHelper.ToExcel(GoodsList, "goods"); }
//捆绑搜索订单 protected void bindOrder(int page) { string where = getWhere(); SqlHelper sp = LocalSqlHelper.WH; int count = 0; DataTable dt; dt = sp.TablesPageNew("Tb_Complaint", "*", "Status asc,ID desc", true, Pager.PageSize, page, where, out count); GoodsList.DataShow(dt); Pager.RecordCount = count; Pager.UrlRewritePattern = "ComplaintList.aspx?page={0}&" + queryStr; }
//捆绑搜索订单 protected void bindOrder() { string where = getWhere(); SqlHelper sp = LocalSqlHelper.WH; string sql = "select typeid,typeName,count1=0,count2=0,count3=0 from Tb_ComplaintType order by typeId"; DataTable dt = sp.ExecDataTable(sql); for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i]["count1"] = sp.ExecScalar("select isnull(count(*),0) from Tb_Complaint where " + where + " and typeId=" + dt.Rows[i]["typeid"].ToString() + " and status=0"); //待处理 dt.Rows[i]["count2"] = sp.ExecScalar("select isnull(count(*),0) from Tb_Complaint where " + where + " and typeId=" + dt.Rows[i]["typeid"].ToString() + " and status=1"); //处理中 dt.Rows[i]["count3"] = sp.ExecScalar("select isnull(count(*),0) from Tb_Complaint where " + where + " and typeId=" + dt.Rows[i]["typeid"].ToString() + " and status=2"); //已处理 } GoodsList.DataShow(dt); }
protected void bindTemplatePro() { string Sql = "select a.wm_id,a.quantity,b.*,all_out_cost=0.00,all_do_cost=b.do_cost*a.quantity,all_other_cost=b.other_cost*a.quantity from Tb_Working_main a left join Tb_template b on a.tpl_id=b.tpl_id where a.work_id=" + work_id + " and a.operator_id=@operator_id"; helper.Params.Add("@operator_id", my_admin_id); DataTable dt = helper.ExecDataTable(Sql); for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i]["all_out_cost"] = Convert.ToDouble(dt.Rows[i]["all_do_cost"]) + Convert.ToDouble(dt.Rows[i]["all_other_cost"]); total_do_cost += Convert.ToDouble(dt.Rows[i]["all_do_cost"]); total_other_cost += Convert.ToDouble(dt.Rows[i]["all_other_cost"]); total_out_cost += Convert.ToDouble(dt.Rows[i]["all_out_cost"]); total_goods += Convert.ToDouble(dt.Rows[i]["quantity"]); } GoodsList.DataShow(dt); }
protected void Page_Load(object sender, EventArgs e) { id = Convert.ToInt32(Request["id"]); work_id = Convert.ToInt32(Request["work_id"]); if (!Page.IsPostBack) { string act = Request["act"]; int wm_id = 0; switch (act) { case "add": case "del": wm_id = Request.QueryString["wm_id"].IsNumber() ? Convert.ToInt32(Request.QueryString["wm_id"]) : 0; string del_sql = "delete from Tb_Working_main where operator_id=@operator_id and wm_id=@wm_id"; helper.Params.Add("@operator_id", my_admin_id); helper.Params.Add("@wm_id", wm_id); helper.Execute(del_sql); JSHelper.WriteScript("alert('移除成功');location.href='WorkingCart.Aspx'"); return; break; case "update": int quantity = 0; wm_id = Request.QueryString["wm_id"].IsNumber() ? Convert.ToInt32(Request.QueryString["wm_id"]) : 0; quantity = Request.QueryString["quantity"].IsNumber() ? Convert.ToInt32(Request.QueryString["quantity"]) : 0; if (wm_id == 0 || quantity == 0) { Response.Write(0); Response.End(); return; } update_cart(wm_id, quantity); string Sql_new = "select all_do_cost=sum(b.do_cost*a.quantity),all_other_cost=sum(b.other_cost*a.quantity) from Tb_Working_main a left join Tb_template b on a.tpl_id=b.tpl_id where a.operator_id=@operator_id"; helper.Params.Add("@operator_id", my_admin_id); DataTable dt_new = helper.ExecDataTable(Sql_new); Response.Write(Convert.ToDouble(dt_new.Rows[0]["all_do_cost"]) + "," + Convert.ToDouble(dt_new.Rows[0]["all_other_cost"])); Response.End(); break; } Session["anti_refresh"] = "1"; helper.Params.Add("@operator_id", my_admin_id); DataTable dt_check = helper.ExecDataTable("select b.factory_id,isnull(count(b.factory_id),0) from Tb_Working_main a left join Tb_template b on a.tpl_id=b.tpl_id where a.work_id=" + work_id + " and a.operator_id=@operator_id group by b.factory_id"); factory_num = dt_check.Rows.Count; helper.Params.Clear(); string Sql = "select a.wm_id,a.quantity,b.*,all_out_cost=0.00,all_do_cost=b.do_cost*a.quantity,all_other_cost=b.other_cost*a.quantity from Tb_Working_main a left join Tb_template b on a.tpl_id=b.tpl_id where a.work_id=" + work_id + " and a.operator_id=@operator_id"; helper.Params.Add("@operator_id", my_admin_id); DataTable dt = helper.ExecDataTable(Sql); if (dt.Rows.Count == 0) { JSHelper.WriteScript("alert('请选择待加工产品!');location.href='Template.Aspx';"); Response.End(); } for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i]["all_out_cost"] = Convert.ToDouble(dt.Rows[i]["all_do_cost"]) + Convert.ToDouble(dt.Rows[i]["all_other_cost"]); total_do_cost += Convert.ToDouble(dt.Rows[i]["all_do_cost"]); total_other_cost += Convert.ToDouble(dt.Rows[i]["all_other_cost"]); total_out_cost += Convert.ToDouble(dt.Rows[i]["all_out_cost"]); total_goods += Convert.ToDouble(dt.Rows[i]["quantity"]); } GoodsList.DataShow(dt); //产品,增加,修改,删除 } }
protected void Page_Load(object sender, EventArgs e) { id = Convert.ToInt32(Request["id"]); if (!Page.IsPostBack) { trace_id = Request.QueryString["trace_id"].IsNumber()?Convert.ToInt32(Request.QueryString["trace_id"]):0; string act = Request["act"]; int rec_id = 0; switch (act) { case "add": string txm = Request.QueryString["product_sn"]; int flag = -1; if (txm.IsNullOrEmpty()) { JSHelper.WriteScript("alert('条码不能为空');history.back();"); return; } flag = add_into_cart(txm, trace_id); switch (flag) { case 1: JSHelper.WriteScript("alert('提交成功');location.href='SellGoods.aspx'"); return; break; case 0: JSHelper.WriteScript("alert('条码不存在');history.back();"); return; break; } break; case "del": rec_id = Request.QueryString["rec_id"].IsNumber() ? Convert.ToInt32(Request.QueryString["rec_id"]) : 0; string del_sql = "delete from Tb_cashier_cart where cashier_id=@cashier_id and rec_id=@rec_id"; helper.Params.Add("@cashier_id", my_admin_id); helper.Params.Add("@rec_id", rec_id); helper.Execute(del_sql); JSHelper.WriteScript("alert('移除成功');location.href='SellGoods.aspx'"); return; break; case "update": int quantity = 0; rec_id = Request.QueryString["rec_id"].IsNumber() ? Convert.ToInt32(Request.QueryString["rec_id"]) : 0; quantity = Request.QueryString["quantity"].IsNumber() ? Convert.ToInt32(Request.QueryString["quantity"]) : 0; if (rec_id == 0 || quantity == 0) { Response.Write(0); Response.End(); return; } update_cart(rec_id, quantity); string Sql_new = "select sum(price*quantity) from Tb_cashier_cart where cashier_id=@cashier_id and trace_id=@trace_id"; helper.Params.Add("@cashier_id", my_admin_id); helper.Params.Add("@trace_id", trace_id); Response.Write(Convert.ToDouble(helper.ExecScalar(Sql_new))); Response.End(); break; case "hang": int new_trace_id = 0; Random r = new Random(); int new_flag = 0; while (new_flag == 0) { new_trace_id = Convert.ToInt32(my_admin_id.ToString() + r.Next(1000, 9999).ToString()); string check_sql = "select top 1 trace_id from Tb_cashier_cart where trace_id=@trace_id"; helper.Params.Add("@trace_id", new_trace_id); DataTable check_dt = helper.ExecDataTable(check_sql); if (check_dt.Rows.Count == 0) { new_flag = 1; } } string hang_sql = "update Tb_cashier_cart set trace_id=" + new_trace_id + " where cashier_id=@cashier_id and is_return=0 and trace_id=0"; helper.Params.Add("@cashier_id", my_admin_id); helper.Execute(hang_sql); JSHelper.WriteScript("alert('挂起成功');location.href='SellGoods.aspx'"); return; break; } Session["anti_refresh"] = "1"; string Sql = "select *,sales=price*quantity from Tb_cashier_cart where cashier_id=@cashier_id and is_return=0 and trace_id=@trace_id"; helper.Params.Add("@cashier_id", my_admin_id); helper.Params.Add("@trace_id", trace_id); DataTable dt = helper.ExecDataTable(Sql); for (int i = 0; i < dt.Rows.Count; i++) { total_money += Convert.ToDouble(dt.Rows[i]["sales"]); total_goods += Convert.ToDouble(dt.Rows[i]["quantity"]); } GoodsList.DataShow(dt); Sql = "select trace_id from Tb_cashier_cart where cashier_id=@cashier_id and is_return=0 and trace_id>0 group by trace_id"; dt = helper.ExecDataTable(Sql); if (dt.Rows.Count == 0) { HangList.Visible = false; } else { HangList.DataShow(dt); } //产品,增加,修改,删除 } }