protected void IsRose() { string strPath = Server.HtmlEncode(Request.FilePath); //请求的虚拟路径 if (strPath != "/Index.aspx") { Model.UserBase _UserBase = Session["USER_SESSION"] as Model.UserBase; //获取当前登录人能访问的页面权限 DataTable dt = new UserBLL().SelectSystemRole(Convert.ToInt32(_UserBase.UA01024)); bool bl = false; foreach (DataRow item in dt.Rows) { if (item["GA01004"].ToString() == strPath) { bl = true; break; } } if (!bl) { Response.Redirect("/Login.aspx?NotLogin=Yes"); } } }
/// <summary> /// 窗体初始化 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (Session["USER_SESSION"] != null) { Model.UserBase _UserBase = Session["USER_SESSION"] as Model.UserBase; DataTable dt = _UserBLL.SelectSystemRole(Convert.ToInt32(_UserBase.UA01024)); if (dt.Rows.Count > 0) { DataRow[] dr = dt.Select("GA01003 = 'PA01btnNew'"); //新增按钮 if (!(dr.Length > 0)) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript1", "<script>RemoveNewCss();</script>"); } dr = dt.Select("GA01003= 'PA01btnExport'"); //导出 if (!(dr.Length > 0)) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript2", "<script>RemoveExportCss();</script>"); } dr = dt.Select("GA01003= 'PA01btnImport'"); //导入 if (!(dr.Length > 0)) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript3", "<script>RemoveImportCss();</script>"); } dr = dt.Select("GA01003= 'PA01btnView'"); //浏览 if (!(dr.Length > 0)) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript4", "<script>RemoveViewCss();</script>"); } dr = dt.Select("GA01003= 'PA01btnEdit'"); //编辑 if (!(dr.Length > 0)) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript5", "<script>RemoveEditCss();</script>"); } dr = dt.Select("GA01003= 'PA01btnDel'"); //删除 if (!(dr.Length > 0)) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript6", "<script>RemoveDelCss();</script>"); } } } if (!IsPostBack) { if (string.IsNullOrEmpty(Request["PageIndex"])) //判断当前页 { this.InitData(1, true); } else { this.InitData(Convert.ToInt32(Request["PageIndex"]), true); } } }
/// <summary> /// 获取页面条件Where语句 /// </summary> /// <returns></returns> public string GetSqlWhere() { string strWhere = string.Empty; //客户名称 strWhere += (this.txtCA01003.Text.Trim() == "" ? "" : string.Format(" AND CA01003 LIKE '%{0}%'", this.txtCA01003.Text.Trim())); //订单号 strWhere += (this.txtOA01002.Text.Trim() == "" ? "" : string.Format(" AND OA01002 LIKE '%{0}%'", this.txtOA01002.Text.Trim())); //上传时间 if (!string.IsNullOrEmpty(this.txtOA01009Start.Text.Trim()) && !string.IsNullOrEmpty(this.txtOA01009End.Text.Trim())) { strWhere += string.Format(" AND OA01009 BETWEEN '{0}' AND '{1}'", this.txtOA01009Start.Text.Trim(), this.txtOA01009End.Text.Trim()); } else if (!string.IsNullOrEmpty(this.txtOA01009Start.Text.Trim()) && string.IsNullOrEmpty(this.txtOA01009End.Text.Trim())) { strWhere += string.Format(" AND OA01009>= '{0}'", this.txtOA01009Start.Text.Trim()); } else if (string.IsNullOrEmpty(this.txtOA01009Start.Text.Trim()) && !string.IsNullOrEmpty(this.txtOA01009End.Text.Trim())) { strWhere += string.Format(" AND OA01009<= '{0}'", this.txtOA01009End.Text.Trim()); } Model.UserBase _UserBase = Session["USER_SESSION"] as Model.UserBase; if (_UserBase.UA01009 == 1) //如果是1 则为销售员 { DataTable dt = _OrderBLL.SelectCustomerBaseByoOrderID(_UserBase.UA01001.ToString()); if (dt.Rows.Count > 0) { string OA01038 = string.Empty; foreach (DataRow item in dt.Rows) { OA01038 += "'" + item["OA01001"].ToString() + "',"; } strWhere += string.Format(" AND GA07002 in ({0})", OA01038.Substring(0, OA01038.Length - 1)); } else { strWhere += string.Format(" AND 1=2 "); } } if (_UserBase.UA01024 == 44) //Leader权限:customer file、order file、arrival notice、order list、pending alert、weekly pending只能看到自己区域内的 { strWhere += string.Format(" AND UA01013 = '{0}' ", _UserBase.UA01013); } return(strWhere); }
/// <summary> /// 窗体初始化 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (Session["USER_SESSION"] != null) { Model.UserBase _UserBase = Session["USER_SESSION"] as Model.UserBase; DataTable dt = _UserBLL.SelectSystemRole(Convert.ToInt32(_UserBase.UA01024)); if (dt.Rows.Count > 0) { DataRow[] dr = dt.Select("GA01003 = 'OA0102btnNew'"); //新增按钮 if (!(dr.Length > 0)) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript1", "<script>RemoveNewCss();</script>"); } dr = dt.Select("GA01003= 'OA0102btnView'"); //浏览 if (!(dr.Length > 0)) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript4", "<script>RemoveViewCss();</script>"); } dr = dt.Select("GA01003= 'OA0102btnEdit'"); //编辑 if (!(dr.Length > 0)) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript5", "<script>RemoveEditCss();</script>"); } } } if (!IsPostBack) { this.InitData(); ViewState["PageIndex"] = string.IsNullOrEmpty(Request["PageIndex"]) ? 1 : Convert.ToInt32(Request["PageIndex"]); this.SelectDate(Convert.ToInt32(ViewState["PageIndex"])); } }
/// <summary> /// 加载事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (Session["USER_SESSION"] != null) { Model.UserBase _UserBase = Session["USER_SESSION"] as Model.UserBase; DataTable dt = _UserBLL.SelectSystemRole(Convert.ToInt32(_UserBase.UA01024)); if (dt.Rows.Count > 0) { DataRow[] dr = dt.Select("GA01003 = 'CA01btnNew'"); //新增按钮 if (!(dr.Length > 0)) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript1", "<script>RemoveNewCss();</script>"); } dr = dt.Select("GA01003= 'CA01btnExport'"); //导出 if (!(dr.Length > 0)) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript2", "<script>RemoveExportCss();</script>"); } dr = dt.Select("GA01003= 'CA01btnImport'"); //导入 if (!(dr.Length > 0)) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript3", "<script>RemoveImportCss();</script>"); } dr = dt.Select("GA01003= 'CA01btnView'"); //浏览 if (!(dr.Length > 0)) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript4", "<script>RemoveViewCss();</script>"); } dr = dt.Select("GA01003= 'CA01btnEdit'"); //编辑 if (!(dr.Length > 0)) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript5", "<script>RemoveEditCss();</script>"); } dr = dt.Select("GA01003= 'CA01btnDel'"); //删除 if (!(dr.Length > 0)) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript6", "<script>RemoveDelCss();</script>"); } dr = dt.Select("GA01003= 'CA01btnAddOrder'"); //添加订单 if (!(dr.Length > 0)) { ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript7", "<script>RemoveAddOrderCss();</script>"); } } } if (!IsPostBack) { #region 绑定 MDT:行业分类 DataTable DataCB03 = _CustomerBLL.SelectCustomerTradeTypeByCustomerTradeCode(); this.ddlCA01019.DataSource = DataCB03; this.ddlCA01019.DataTextField = "CB03002"; this.ddlCA01019.DataValueField = "CB03001"; this.ddlCA01019.DataBind(); this.ddlCA01019.Items.Insert(0, new ListItem("请选择", "")); #endregion #region 绑定 CTC:客户代码 DataTable DataCB02 = _CustomerBLL.SelectCustomerCode(); this.ddlCA01018.DataSource = DataCB02; this.ddlCA01018.DataTextField = "CB02002"; this.ddlCA01018.DataValueField = "CB02001"; this.ddlCA01018.DataBind(); this.ddlCA01018.Items.Insert(0, new ListItem("请选择", "")); #endregion #region 绑定 CTC:客户类型 DataTable DataCB01 = _CustomerBLL.SelectCustomerType(); this.ddlCA01016.DataSource = DataCB01; this.ddlCA01016.DataTextField = "CB01002"; this.ddlCA01016.DataValueField = "CB01001"; this.ddlCA01016.DataBind(); this.ddlCA01016.Items.Insert(0, new ListItem("请选择", "")); #endregion BindDll(); if (string.IsNullOrEmpty(Request["PageIndex"])) //判断当前页 { this.InitData(1, true); } else { this.InitData(Convert.ToInt32(Request["PageIndex"]), true); } } }
/// <summary> /// 获取查询Sql语句 /// </summary> /// <returns></returns> private string getSqlStr() { string sqlWhere = string.Empty; #region 高级查询 List <string> _list1 = new List <string>(); //行业分类集合 string SIC = this.UserControl.CB03001; //行业分类和代码 string OA01025 = this.UserControl.OB02001; //应用代码 List <string> _list = new List <string>(); string _strjoin = string.Empty; //行业代码 string _strjoin1 = string.Empty; //行业分类 if (!string.IsNullOrEmpty(SIC)) { string[] sic = SIC.Trim().Split(','); for (int i = 0; i < sic.Length; i++) { if (!string.IsNullOrEmpty(sic[i])) { int num = sic[i].IndexOf("child"); if (num == 0) { _list.Add(sic[i]); } else { _list1.Add(sic[i]); } } } foreach (string item in _list) { _strjoin += item.Replace("child", " ").Trim() + ","; } foreach (string item1 in _list1) { _strjoin1 += item1 + ","; } } //拼接行业代码 if (!string.IsNullOrEmpty(_strjoin)) { _strjoin = _strjoin.Substring(0, _strjoin.Length - 1); sqlWhere += string.Format(" AND CA01020 in({0})", _strjoin); } //拼接行业分类 if (!string.IsNullOrEmpty(_strjoin1)) { _strjoin1 = _strjoin1.Substring(0, _strjoin1.Length - 1); sqlWhere += string.Format(" AND CA01019 in({0})", _strjoin1); } if (!string.IsNullOrEmpty(OA01025)) { OA01025 = OA01025.Substring(0, OA01025.Length - 1); sqlWhere += string.Format(" AND OA01025 in({0})", OA01025); } #endregion Model.UserBase _UserBase = Session["USER_SESSION"] as Model.UserBase; if (_UserBase.UA01009 == 1) //如果是1 则为销售员 { sqlWhere += string.Format(" AND UA01001 = '{0}'", _UserBase.UA01001); } if (!string.IsNullOrEmpty(this.txtOC01011Start.Text.Trim())) { sqlWhere += string.Format(" AND OA01009 >= '{0}'", this.txtOC01011Start.Text.Trim()); } if (!string.IsNullOrEmpty(this.txtOC01011End.Text.Trim())) { sqlWhere += string.Format(" AND OA01009 <= '{0}'", this.txtOC01011End.Text.Trim()); } if (string.IsNullOrEmpty(this.txtOC01011Start.Text.Trim()) && string.IsNullOrEmpty(this.txtOC01011End.Text.Trim()) && string.IsNullOrEmpty(this.txtOC01998Start.Text.Trim()) && string.IsNullOrEmpty(this.txtOC01998End.Text.Trim())) { sqlWhere += "AND DATEPART(DAY,GETDATE()) = DATEPART(DAY,OA01009) AND DATEPART(yy,GETDATE()) = DATEPART(yy,OA01009) AND DATEPART(month,GETDATE()) = DATEPART(month,OA01009)"; } if (!string.IsNullOrEmpty(this.txtOC01998Start.Text.Trim())) { sqlWhere += string.Format(" AND OC01015 >= '{0}'", this.txtOC01998Start.Text.Trim()); } if (!string.IsNullOrEmpty(this.txtOC01998End.Text.Trim())) { sqlWhere += string.Format(" AND OC01015 <= '{0}'", this.txtOC01998End.Text.Trim()); } if (this.rbtnOA01044Yes.Checked) { sqlWhere += "AND OA01044 = '1' "; } if (this.rbtnOA01044No.Checked) { sqlWhere += "AND OA01044 = '0' "; } if (!string.IsNullOrEmpty(this.ddlUA01013.SelectedValue) && this.ddlUA01013.SelectedValue != "全区域") { if (this.ddlUA01013.SelectedValue == "North") { sqlWhere += " AND UA01013 not in ('Fluid Air','BOF')"; } else { sqlWhere += string.Format(" AND UA01013 = '{0}'", this.ddlUA01013.SelectedValue); } } if (!string.IsNullOrEmpty(Request.Form["ddlUA01"])) { sqlWhere += string.Format(" AND UA01001 = '{0}'", Request.Form["ddlUA01"]); } if (this.rbtnOA010031.Checked == true) { sqlWhere += string.Format(" AND OA01002 NOT LIKE 'A%'"); } if (this.rbtnOA010032.Checked == true) { sqlWhere += string.Format(" AND OA01002 LIKE 'A%'"); } if (_UserBase.UA01024 == 44) //Leader权限:customer file、order file、arrival notice、order list、pending alert、weekly pending只能看到自己区域内的 { if (!_UserBase.UA01013.Equals("全区域")) { sqlWhere += string.Format(" AND UA01013 = '{0}' ", _UserBase.UA01013); } } return(sqlWhere); }
/// <summary> /// 初始化数据 /// </summary> private void InitData() { bool total = true; //是否显示成本 Model.UserBase _UserBase = Session["USER_SESSION"] as Model.UserBase; #region 如果为销售员、主管、系统调试不显示成本 if (_UserBase.UA01024 == 43 || _UserBase.UA01024 == 46 || _UserBase.UA01024 == 44) { total = false; } #endregion if (!string.IsNullOrEmpty(Request.QueryString["OA01001"])) //当前退货单数据 { #region 退货单 DataTable dt = _OrderBLL.SelectOrderBaseById(Request.QueryString["OA01001"]); if (dt.Rows.Count <= 0) { return; } this.labOA01002.Text = dt.Rows[0]["OA01002"].ToString(); this.labOA01008.Text = dt.Rows[0]["OA01008"].ToString(); this.labOA01009.Text = Convert.ToDateTime(dt.Rows[0]["OA01009"]).ToString("yyyy-MM-dd"); this.labOA01015.Text = dt.Rows[0]["OA01015"].ToString(); this.labOA01017.Text = dt.Rows[0]["OA01017"].ToString(); if (dt.Rows[0]["OA01020"] is DBNull) { this.labOA01020.Text = ""; } else { string str = dt.Rows[0]["OA01020"].ToString(); str = str.Substring(1); this.labOA01020.Text = Math.Round(Convert.ToDecimal(str), 2).ToString(); } this.labOA01021.Text = dt.Rows[0]["OA01021"].ToString(); if (dt.Rows[0]["OA01022"] is DBNull) { this.labOA01022.Text = ""; } else { string str = dt.Rows[0]["OA01022"].ToString(); str = str.Substring(1); this.labOA01022.Text = Math.Round(Convert.ToDecimal(str), 2).ToString(); } this.labOA01027.Text = dt.Rows[0]["OA01027"].ToString(); this.labOA01039.Text = dt.Rows[0]["OA01039"].ToString(); this.labOA01049.Text = string.IsNullOrEmpty(dt.Rows[0]["OA01049"].ToString()) ? "" : "其它人1:" + dt.Rows[0]["OA01049"].ToString(); this.labOA01050.Text = string.IsNullOrEmpty(dt.Rows[0]["OA01050"].ToString()) ? "" : "其它人2:" + dt.Rows[0]["OA01050"].ToString(); this.labOA01013.Text = dt.Rows[0]["UA01005"].ToString(); if (!(dt.Rows[0]["OA01016"] == "" || dt.Rows[0]["OA01016"] is DBNull)) { this.labOA01016.Text = Convert.ToInt32((Convert.ToDecimal(dt.Rows[0]["OA01016"]) * 100)).ToString() + "%"; } if (!(dt.Rows[0]["OA01018"] == "" || dt.Rows[0]["OA01018"] is DBNull)) { this.labOA01018.Text = Convert.ToInt32((Convert.ToDecimal(dt.Rows[0]["OA01018"]) * 100)).ToString() + "%"; } this.labOA01025.Text = dt.Rows[0]["OB02002"].ToString(); if (dt.Rows[0]["OA01005"].ToString() == "0") { this.labOA01005.Text = "否"; } if (dt.Rows[0]["OA01005"].ToString() == "1") { this.labOA01005.Text = "是"; } #endregion #region 退单商品明细 DataTable dt1 = _OrderBLL.SelectOrderProductByProductNo(dt.Rows[0]["OA01999"].ToString(), 2); if (dt1.Rows.Count <= 0) { return; } //隐藏成本 if (!total) { foreach (DataRow item in dt1.Rows) { item["OB01013"] = "0"; item["OB01014"] = "0"; } } this.rptmingxi.DataSource = dt1; //绑定明细 this.rptmingxi.DataBind(); #endregion #region 退单发票 string strguid = string.Empty; //记录商品明细 foreach (DataRow item in dt1.Rows) { strguid += "'" + item["OB01999"].ToString() + "',"; } strguid = strguid.Substring(0, strguid.Length - 1); DataTable dt2 = _OrderBLL.SelectOrderInvoiceByGUID(strguid, 2); if (dt2.Rows.Count <= 0) { return; } this.rptfapiao.DataSource = dt2; //绑定发票信息 this.rptfapiao.DataBind(); #endregion } }
/// <summary> /// 查询条件 /// </summary> /// <returns></returns> private string GetWhere(bool bl) { string strWhereAdd = string.Empty; #region 高级查询 List <string> _list1 = new List <string>(); //行业分类集合 string SIC = this.UserControl.CB03001; //行业分类和代码 string OA01025 = this.UserControl.OB02001; //应用代码 List <string> _list = new List <string>(); string _strjoin = string.Empty; //行业代码 string _strjoin1 = string.Empty; //行业分类 if (!string.IsNullOrEmpty(SIC)) { string[] sic = SIC.Trim().Split(','); for (int i = 0; i < sic.Length; i++) { if (!string.IsNullOrEmpty(sic[i])) { int num = sic[i].IndexOf("child"); if (num == 0) { _list.Add(sic[i]); } else { _list1.Add(sic[i]); } } } foreach (string item in _list) { _strjoin += item.Replace("child", " ").Trim() + ","; } foreach (string item1 in _list1) { _strjoin1 += item1 + ","; } } //拼接行业代码 if (!string.IsNullOrEmpty(_strjoin)) { _strjoin = _strjoin.Substring(0, _strjoin.Length - 1); strWhereAdd += string.Format(" AND CA01020 in({0})", _strjoin); } //拼接行业分类 if (!string.IsNullOrEmpty(_strjoin1)) { _strjoin1 = _strjoin1.Substring(0, _strjoin1.Length - 1); strWhereAdd += string.Format(" AND CA01019 in({0})", _strjoin1); } if (!string.IsNullOrEmpty(OA01025)) { OA01025 = OA01025.Substring(0, OA01025.Length - 1); strWhereAdd += string.Format(" AND OA01025 in({0})", OA01025); } #endregion Model.UserBase _UserBase = Session["USER_SESSION"] as Model.UserBase; if (_UserBase.UA01009 == 1) //如果是1 则为销售员 { strWhereAdd += string.Format(" AND UA01001 = '{0}'", _UserBase.UA01001); } if (!string.IsNullOrEmpty(this.txtBeginOrderTime.Text.Trim())) { strWhereAdd += string.Format(" AND OA01009 >= '{0}'", txtBeginOrderTime.Text.Trim()); } if (!string.IsNullOrEmpty(this.txtEndOrderTime.Text.Trim())) { strWhereAdd += string.Format(" AND OA01009 <= '{0}'", txtEndOrderTime.Text.Trim()); } if (string.IsNullOrEmpty(this.txtBeginOrderTime.Text.Trim()) && string.IsNullOrEmpty(this.txtEndOrderTime.Text.Trim()) && string.IsNullOrEmpty(this.txtBeginArrivalTime.Text.Trim()) && string.IsNullOrEmpty(this.txtEndArrivalTime.Text.Trim()) && string.IsNullOrEmpty(this.txtBeginInvoiceTime.Text.Trim()) && string.IsNullOrEmpty(this.txtEndInvoiceTime.Text.Trim())) { strWhereAdd += "AND DATEPART(wk,GETDATE()) = DATEPART(wk,OA01009) AND DATEPART(yy,GETDATE()) = DATEPART(yy,OA01009)"; } if (!string.IsNullOrEmpty(this.txtBeginArrivalTime.Text.Trim())) { strWhereAdd += string.Format(" AND OC01009 >= '{0}' ", txtBeginArrivalTime.Text.Trim()); } if (!string.IsNullOrEmpty(this.txtEndArrivalTime.Text.Trim())) { strWhereAdd += string.Format(" AND OC01009 <= '{0}' ", txtEndArrivalTime.Text.Trim()); } if (!string.IsNullOrEmpty(this.txtBeginInvoiceTime.Text.Trim())) { strWhereAdd += string.Format(" AND OC01015 >= '{0}' ", txtBeginInvoiceTime.Text.Trim()); } if (!string.IsNullOrEmpty(this.txtEndInvoiceTime.Text.Trim())) { strWhereAdd += string.Format(" AND OC01015 <='{0}' ", txtEndInvoiceTime.Text.Trim()); } if (bl) //判断是否首次加载默认喷嘴 { strWhereAdd += " AND OA01002 NOT LIKE 'A%' "; } else { if (!string.IsNullOrEmpty(Request.Form["OrderType"]) && Request.Form["OrderType"] != "all") { string str = Request.Form["OrderType"] == "Nozzle" ? " NOT LIKE 'A%'" : " LIKE 'A%'"; strWhereAdd += string.Format(" AND OA01002 {0}", str); } } if (!string.IsNullOrEmpty(Request.Form["OA01044"]) && Request.Form["OA01044"] != "all") { string str = Request.Form["OA01044"] == "Y" ? "1" : "0"; strWhereAdd += string.Format(" AND OA01044 = {0}", str); } if (!string.IsNullOrEmpty(Request.Form["ddlUA01004"]) && Request.Form["ddlUA01004"] != "") { strWhereAdd += string.Format(" AND OA01013 = {0}", Request.Form["ddlUA01004"]); } if (!string.IsNullOrEmpty(Request.Form["ddlUA01013"]) && Request.Form["ddlUA01013"] != "全区域") { if (Request.Form["ddlUA01013"] == "North") { strWhereAdd += " AND UA01013 not in ('Fluid Air','BOF')"; } else { strWhereAdd += string.Format(" AND UA01013 = '{0}'", Request.Form["ddlUA01013"]); } } return(strWhereAdd); }
/// <summary> /// 初始化数据 /// </summary> private void InitData() { bool total = true; //是否显示成本 Model.UserBase _UserBase = Session["USER_SESSION"] as Model.UserBase; #region 如果为销售员、主管、系统调试不显示成本 if (_UserBase.UA01024 == 43 || _UserBase.UA01024 == 46 || _UserBase.UA01024 == 44) { total = false; } #endregion #region 加载 系统/喷嘴-最后一张订单号 DataTable dtAutojet = _OrderBLL.SelectOrderBaseByAutojet((Session["USER_SESSION"] as UserBase).UA01013); this.labOA01006.Text = dtAutojet.Rows.Count > 0 ? dtAutojet.Rows[0]["OA01002"].ToString() : "无"; DataTable dtNozzle = _OrderBLL.SelectOrderBaseByNozzle((Session["USER_SESSION"] as UserBase).UA01013); this.labOA01007.Text = dtNozzle.Rows.Count > 0 ? dtNozzle.Rows[0]["OA01002"].ToString() : "无"; #endregion if (string.IsNullOrEmpty(Request.QueryString["OA01001"])) //当前退货单数据 { return; } #region 销售单 DataTable dt = _OrderBLL.SelectOrderBaseForListById(Request.QueryString["OA01001"]); if (dt.Rows.Count <= 0) { return; } ViewState["CA01001"] = dt.Rows[0]["OA01038"].ToString(); this.labOA01002.Text = dt.Rows[0]["OA01002"].ToString(); this.labOA01003.Text = dt.Rows[0]["OA01003"].ToString() == "3" ? "是" : "否"; this.labOA01005.Text = dt.Rows[0]["OA01005"].ToString() == "1" ? "是" : "否"; this.labOA01008.Text = dt.Rows[0]["OA01008"].ToString(); this.labOA01009.Text = string.IsNullOrEmpty(dt.Rows[0]["OA01009"].ToString()) ? "" : Convert.ToDateTime(dt.Rows[0]["OA01009"]).ToString("yyyy-MM-dd"); this.labOA01010.Text = string.IsNullOrEmpty(dt.Rows[0]["OA01010"].ToString()) ? "" : Convert.ToDateTime(dt.Rows[0]["OA01010"]).ToString("yyyy-MM-dd"); this.labOA01011.Text = string.IsNullOrEmpty(dt.Rows[0]["OA01011"].ToString()) ? "" : Convert.ToDateTime(dt.Rows[0]["OA01011"]).ToString("yyyy-MM-dd"); this.labOA01012.Text = dt.Rows[0]["OA01012"].ToString(); this.labOA01013.Text = dt.Rows[0]["UA01005"].ToString(); this.labOA01014.Text = dt.Rows[0]["OA01014"].ToString(); this.labOA01015.Text = dt.Rows[0]["OA01015"].ToString(); this.labOA01016.Text = string.IsNullOrEmpty(dt.Rows[0]["OA01016"].ToString()) ? "" : dt.Rows[0]["OA01016"].ToString() == "0" ? "" : Convert.ToDecimal(dt.Rows[0]["OA01016"]) * 100 + "%"; this.labOA01017.Text = dt.Rows[0]["OA01017"].ToString(); this.labOA01018.Text = string.IsNullOrEmpty(dt.Rows[0]["OA01018"].ToString()) ? "" : dt.Rows[0]["OA01018"].ToString() == "0" ? "" : Convert.ToDecimal(dt.Rows[0]["OA01018"]) * 100 + "%"; //为true 显示成本 if (total) { this.labOA01019.Text = dt.Rows[0]["OA01019"] is DBNull ? "" : Math.Round(Convert.ToDecimal(dt.Rows[0]["OA01019"]), 2).ToString(); } else { this.labOA01019.Text = "0"; } this.labOA01020.Text = dt.Rows[0]["OA01020"] is DBNull ? "" : Math.Round(Convert.ToDecimal(dt.Rows[0]["OA01020"]), 2).ToString(); this.labOA01021.Text = dt.Rows[0]["OA01021"].ToString(); this.labOA01022.Text = dt.Rows[0]["OA01022"] is DBNull ? "" : Math.Round(Convert.ToDecimal(dt.Rows[0]["OA01022"]), 2).ToString(); //为true 显示成本 if (total) { if (!string.IsNullOrEmpty(dt.Rows[0]["OA01023"].ToString())) { this.labOA01023.Text = Math.Round(Convert.ToDecimal(dt.Rows[0]["OA01023"].ToString()) * 100, 2) + "%"; } } else { this.labOA01023.Text = "0"; } this.labOA01024.Text = string.IsNullOrEmpty(dt.Rows[0]["OA01024"].ToString()) ? "否" : "是"; this.labOA0102401.Text = string.IsNullOrEmpty(dt.Rows[0]["OA01024"].ToString()) ? "" : "内容:" + dt.Rows[0]["OA01024"].ToString(); this.labOA01025.Text = dt.Rows[0]["OB02002"].ToString(); this.labOA01026.Text = dt.Rows[0]["OA01026"].ToString(); this.labOA01027.Text = dt.Rows[0]["OA01027"].ToString(); this.labOA01028.Text = dt.Rows[0]["OA01028"].ToString(); this.labOA01029.Text = dt.Rows[0]["OA01029"].ToString(); this.labOA01030.Text = dt.Rows[0]["OA01030"].ToString(); this.labOA01031.Text = dt.Rows[0]["OA01031"].ToString(); this.labOA01032.Text = dt.Rows[0]["OA01032"].ToString(); this.labOA01033.Text = dt.Rows[0]["OA01033"].ToString(); this.labOA01034.Text = dt.Rows[0]["OA01034"].ToString(); this.labOA01035.Text = dt.Rows[0]["OA01035"].ToString(); this.labOA01044.Text = dt.Rows[0]["OA01044"].ToString() == "0" ? "否" : "是"; this.labOA01045.Text = dt.Rows[0]["OA01045"].ToString() == "0" ? "否" : "是"; this.labOA01046.Text = dt.Rows[0]["OA01046"].ToString(); this.labOA01047.Text = dt.Rows[0]["OD01003"].ToString(); this.labOA01048.Text = string.IsNullOrEmpty(dt.Rows[0]["OA01048"].ToString()) ? "否" : "是"; this.labOA0104801.Text = string.IsNullOrEmpty(dt.Rows[0]["OA01048"].ToString()) ? "" : "内容:" + dt.Rows[0]["OA01048"].ToString(); this.labOA01049.Text = string.IsNullOrEmpty(dt.Rows[0]["OA01049"].ToString()) ? "" : "其它人:" + dt.Rows[0]["OA01049"].ToString(); this.labOA01050.Text = string.IsNullOrEmpty(dt.Rows[0]["OA01050"].ToString()) ? "" : "其它人:" + dt.Rows[0]["OA01050"].ToString(); this.labOA01051.Text = string.IsNullOrEmpty(dt.Rows[0]["OA01051"].ToString()) ? "" : Convert.ToDateTime(dt.Rows[0]["OA01051"]).ToString("yyyy-MM-dd"); this.labOA01053.Text = string.IsNullOrEmpty(dt.Rows[0]["OA01053"].ToString()) ? "" : dt.Rows[0]["OA01053"].ToString(); this.labOA01054.Text = string.IsNullOrEmpty(dt.Rows[0]["OA01054"].ToString()) || dt.Rows[0]["OA01054"].ToString() == "0" ? "否" : "是"; this.labOA01055.Text = dt.Rows[0]["OA01057"].ToString(); this.labOA01056.Text = dt.Rows[0]["OA01058"].ToString(); #endregion #region 付款信息 DataTable dtOP01 = _OrderBLL.SelectOrderPayment(string.Format(" AND OP01003 = '{0}'", dt.Rows[0]["OA01999"].ToString())); if (dtOP01.Rows.Count > 0) { this.labOP01002.Text = dtOP01.Rows[0]["OP01002"].ToString(); this.labOP01003.Text = this.labOA01002.Text; this.labOP01004.Text = dtOP01.Rows[0]["OP01004"] is DBNull ? "" : Convert.ToDateTime(dtOP01.Rows[0]["OP01004"]).ToString("yyyy-MM-dd"); this.labOP01005.Text = dtOP01.Rows[0]["OP01005"] is DBNull ? "" : Math.Round(Convert.ToDecimal(dtOP01.Rows[0]["OP01005"]), 2).ToString(); this.labOP01007.Text = dtOP01.Rows[0]["OP01007"] is DBNull ? "" : Math.Round(Convert.ToDecimal(dtOP01.Rows[0]["OP01007"]), 2).ToString(); this.labOP01008.Text = dtOP01.Rows[0]["OP01008"].ToString(); this.labOP01009.Text = dtOP01.Rows[0]["OP01009"] is DBNull ? "" : Math.Round(Convert.ToDecimal(dtOP01.Rows[0]["OP01009"]), 2).ToString(); this.labOP01010.Text = dtOP01.Rows[0]["OP01010"].ToString(); this.labOP01011.Text = dtOP01.Rows[0]["OP01011"] is DBNull ? "" : Math.Round(Convert.ToDecimal(dtOP01.Rows[0]["OP01011"]), 2).ToString(); this.labOP01012.Text = dtOP01.Rows[0]["OP01012"].ToString(); this.labOP01013.Text = dtOP01.Rows[0]["OP01013"] is DBNull ? "" : Math.Round(Convert.ToDecimal(dtOP01.Rows[0]["OP01013"]), 2).ToString(); this.labOP01014.Text = dtOP01.Rows[0]["OP01014"].ToString(); this.labOP01015.Text = dtOP01.Rows[0]["OP01015"] is DBNull ? "" : Math.Round(Convert.ToDecimal(dtOP01.Rows[0]["OP01015"]), 2).ToString(); this.labOP01016.Text = dtOP01.Rows[0]["OP01016"] is DBNull ? "" : Math.Round(Convert.ToDecimal(dtOP01.Rows[0]["OP01016"]), 2).ToString(); this.labOP01017.Text = dtOP01.Rows[0]["OP01017"] is DBNull ? "" : Math.Round(Convert.ToDecimal(dtOP01.Rows[0]["OP01017"]), 2).ToString(); this.labOP01018.Text = dtOP01.Rows[0]["OP01018"].ToString(); this.labOP01019.Text = dtOP01.Rows[0]["OP01019"] is DBNull ? "" : Math.Round(Convert.ToDecimal(dtOP01.Rows[0]["OP01019"]), 2).ToString(); this.labOP01020.Text = dtOP01.Rows[0]["OP01020"].ToString(); this.labOP01021.Text = dtOP01.Rows[0]["OP01021"] is DBNull ? "" : Math.Round(Convert.ToDecimal(dtOP01.Rows[0]["OP01021"]), 2).ToString(); this.labOP01022.Text = dtOP01.Rows[0]["OP01022"].ToString(); this.labOP01023.Text = dtOP01.Rows[0]["OP01023"] is DBNull ? "" : dtOP01.Rows[0]["OP01023"].ToString();; } #endregion #region 销售单商品明细 DataTable dt1 = _OrderBLL.SelectOrderProductByProductNo(dt.Rows[0]["OA01999"].ToString(), 1); if (dt1.Rows.Count <= 0) { return; } //隐藏成本 if (!total) { foreach (DataRow item in dt1.Rows) { item["OB01013"] = "0"; item["OB01014"] = "0"; } } this.rptmingxi.DataSource = dt1; //绑定明细 this.rptmingxi.DataBind(); #endregion #region 销售单发票 string strguid = string.Empty; //记录商品明细 foreach (DataRow item in dt1.Rows) { strguid += "'" + item["OB01999"].ToString() + "',"; } strguid = strguid.Substring(0, strguid.Length - 1); DataTable dt2 = _OrderBLL.SelectOrderInvoiceByGUID(strguid, 1); if (dt2.Rows.Count <= 0) { return; } this.rptfapiao.DataSource = dt2; //绑定发票信息 this.rptfapiao.DataBind(); #endregion }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { bool total = true; //是否显示成本 Model.UserBase _UserBase = Session["USER_SESSION"] as Model.UserBase; #region 如果为销售员、主管、系统调试不显示成本 if (_UserBase.UA01024 == 43 || _UserBase.UA01024 == 46 || _UserBase.UA01024 == 44) { total = false; } #endregion ViewState["PageIndex"] = string.IsNullOrEmpty(Request.QueryString["PageIndex"]) ? "1" : Request.QueryString["PageIndex"]; string OrderId = Request.QueryString["OA01001"]; //客户ID //订单号查询商品 发票信息 DataTable dt1 = _OrderBLL.SelectOrderAll(OrderId); if (dt1.Rows.Count > 0) { this.labCA01003.Text = dt1.Rows[0]["CA01003"].ToString(); this.labCA01004.Text = dt1.Rows[0]["CA01004"].ToString(); this.labCA01005.Text = dt1.Rows[0]["CA01005"].ToString(); this.labCA01006.Text = dt1.Rows[0]["CA01006"].ToString(); this.labCA01007.Text = dt1.Rows[0]["CA01007"].ToString(); this.labCA01008.Text = dt1.Rows[0]["CA01008"].ToString(); this.labCA01009.Text = dt1.Rows[0]["CA01009"].ToString(); this.labCA01010ANDCA01011.Text = dt1.Rows[0]["CA01010"].ToString() + " " + dt1.Rows[0]["CA01011"].ToString(); this.labCA01014.Text = dt1.Rows[0]["CA01014"].ToString(); this.labCA01015.Text = dt1.Rows[0]["CA01015"].ToString(); this.labCA01021.Text = dt1.Rows[0]["CA01021"].ToString(); this.labCB02002.Text = dt1.Rows[0]["CB02002"].ToString(); if (dt1.Rows[0]["CB04002"].ToString() != "") { this.labCB04002.Text = dt1.Rows[0]["CB04002"].ToString().Substring(0, 3); } ; this.labOA01002.Text = dt1.Rows[0]["OA01002"].ToString(); this.labOA01002Two.Text = Convert.ToDateTime(dt1.Rows[0]["OA01009"]).ToString("yyyy-MM-dd"); this.labOA01010.Text = dt1.Rows[0]["OA01010"] is DBNull ? "" : Convert.ToDateTime(dt1.Rows[0]["OA01010"]).ToString("yyyy-MM-dd"); this.labOA01011.Text = dt1.Rows[0]["OA01011"] is DBNull ? "" : Convert.ToDateTime(dt1.Rows[0]["OA01011"]).ToString("yyyy-MM-dd"); this.labOA01029ANDOA01030.Text = dt1.Rows[0]["OA01029"].ToString() + " " + dt1.Rows[0]["OA01030"].ToString(); this.labOA01033ANDOA01034.Text = dt1.Rows[0]["OA01033"].ToString() + " " + dt1.Rows[0]["OA01034"].ToString(); this.labOA01031.Text = dt1.Rows[0]["OA01031"].ToString(); this.labOA01035.Text = dt1.Rows[0]["OA01035"].ToString(); this.labOA01012.Text = dt1.Rows[0]["OA01012"].ToString(); this.labOA01014.Text = dt1.Rows[0]["OA01014"].ToString(); this.labOA01020.Text = dt1.Rows[0]["OA01020"] is DBNull ? "" : Math.Round(Convert.ToDecimal(dt1.Rows[0]["OA01020"].ToString()), 2).ToString(); //隐藏成本 if (total) { if (dt1.Rows[0]["OA01023"].ToString() != "") { this.labOA01023.Text = Math.Round(Convert.ToDecimal(dt1.Rows[0]["OA01023"].ToString()) * 100, 2).ToString() + "%"; } } this.labOA01032.Text = dt1.Rows[0]["OA01032"].ToString(); this.labOA01028.Text = dt1.Rows[0]["OA01028"].ToString(); this.labUA01004.Text = dt1.Rows[0]["UA01005"].ToString(); if (dt1.Rows[0]["OB02002"].ToString() != "") { this.labOB02002.Text = dt1.Rows[0]["OB02002"].ToString().Substring(0, 3); } this.labOA01008.Text = dt1.Rows[0]["OA01008"].ToString(); this.labCA01002.Text = dt1.Rows[0]["CA01002"].ToString(); this.labShare.Text = dt1.Rows[0]["OA01015"].ToString() + dt1.Rows[0]["OA01016"].ToString() + " " + dt1.Rows[0]["OA01017"].ToString() + dt1.Rows[0]["OA01018"].ToString(); this.labSessionUser.Text = dt1.Rows[0]["TIANZHI"].ToString(); } //订单号查询付款客户信息 DataTable dt2 = _OrderBLL.SelectOrderProduct(OrderId); if (dt2.Rows.Count > 0) { //隐藏成本 if (!total) { foreach (DataRow item in dt2.Rows) { item["OB01013"] = "0"; item["OB01014"] = "0"; } } this.Repeater1.DataSource = dt2; this.Repeater1.DataBind(); } } }