private void btnQuery_Click(object sender, System.EventArgs e) { strBeginDate = Request.Form["txtBegin"].ToString(); strEndDate = Request.Form["txtEnd"].ToString(); if (strBeginDate == "" || strEndDate == "" || strBeginDate == null || strEndDate == null) { this.SetErrorMsgPageBydir("时间不能为空,请重新选择时间!"); return; } Session.Remove("QUERY"); Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; msb1 = new MaterialSBusi(strcons); try { DataTable dtout = msb1.GetMaterialsEnterOutModList(this.ddlEnterOutType.SelectedValue, strBeginDate, strEndDate); if (dtout == null) { this.SetErrorMsgPageBydir("查询出错,请重试!"); btnExcel.Enabled = false; return; } else { dtout.TableName = "原材料入出库修正报表"; this.TableConvert(dtout, "原材料类型", "tbNameCodeToStorage", "vcCommSign='MaterialType'"); this.TableConvert(dtout, "操作类型", "tbNameCodeToStorage", "vcCommSign='MaEnterOutType'"); this.TableConvert(dtout, "部门", "NewDept"); DataTable dtexcel = dtout.Copy(); Session["QUERY"] = dtout; // for(int i=0;i<dtexcel.Rows.Count;i++) // { // dtexcel.Rows[i][0]="'"+dtexcel.Rows[i][0].ToString(); // } Session["toExcel"] = dtexcel; if (dtout.Rows.Count <= 0) { btnExcel.Enabled = false; } else { btnExcel.Enabled = true; } } UcPageView1.MyDataGrid.PageSize = 30; DataView dvOut = new DataView(dtout); this.UcPageView1.MyDataSource = dvOut; this.UcPageView1.BindGrid(); } catch (Exception er) { this.clog.WriteLine(er); this.SetErrorMsgPageBydir("查询错误,请重试!"); return; } }
private void DataGrid1_UpdateCommand(object source, DataGridCommandEventArgs e) { try { string newEnterCount = ((TextBox)e.Item.Cells[10].Controls[0]).Text.Trim(); string EnterSerial = e.Item.Cells[0].Text.Trim(); if (newEnterCount == "") { this.Popup("请输入入库量"); return; } if (!this.JudgeIsNum(newEnterCount, "入库量")) { return; } double dnewEnterCount = Math.Round(double.Parse(newEnterCount), 2); double doldEnterCount = Math.Round(double.Parse(Session["oldEnterCount"].ToString()), 2); double dLastCount = Math.Round(double.Parse(e.Item.Cells[9].Text.Trim()), 2); string strChangeCount = (doldEnterCount - dnewEnterCount).ToString(); string strNewCurCount = (dLastCount + dnewEnterCount).ToString(); CMSMStruct.LoginStruct ls1 = (CMSMStruct.LoginStruct)Session["Login"]; Hashtable htpara = new Hashtable(); htpara.Add("strNewEnterCount", newEnterCount); htpara.Add("strNewCurCount", strNewCurCount); htpara.Add("strSerialOld", EnterSerial); htpara.Add("strOperDate", DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString()); htpara.Add("strOperName", ls1.strOperName); htpara.Add("strDeptID", ls1.strNewDeptID); htpara.Add("strChangeCount", strChangeCount); htpara.Add("strMaterialCode", e.Item.Cells[2].Text.Trim()); htpara.Add("strBatchNo", e.Item.Cells[1].Text.Trim()); Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; msb1 = new MaterialSBusi(strcons); if (msb1.MaterialEnterMod(htpara)) { this.Popup("原材料入库修正成功!"); this.DBbind(); return; } else { this.SetErrorMsgPageBydir("原材料入库修正失败!"); return; } } catch (Exception er) { this.clog.WriteLine(er); this.SetErrorMsgPageBydir("查询错误,请重试!"); return; } }
private void Button1_Click(object sender, System.EventArgs e) { Session.Remove("QUERY"); Session.Remove("toExcel"); Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; msb1 = new MaterialSBusi(strcons); string strMaterialCode = txtMaterialCode.Text.Trim(); string strMaterialName = txtMaterialName.Text.Trim(); string strMaterialType = ddlMaterialType.SelectedValue; string strBatchNo = txtBatchNo.Text.Trim(); try { DataTable dtout = msb1.GetMaterials(strMaterialCode, strMaterialName, strMaterialType, strBatchNo); if (dtout == null) { this.SetErrorMsgPageBydir("查询出错,请重试!"); btnExcel.Enabled = false; return; } else { dtout.TableName = "原材料资料清单"; DataTable dtexcel = dtout.Copy(); Session["QUERY"] = dtout; // for(int i=0;i<dtexcel.Rows.Count;i++) // { // dtexcel.Rows[i][0]="'"+dtexcel.Rows[i][0].ToString(); // } dtexcel.Columns.Remove("操作"); Session["toExcel"] = dtexcel; if (dtout.Rows.Count <= 0) { btnExcel.Enabled = false; } else { btnExcel.Enabled = true; } } UcPageView1.MyDataGrid.PageSize = 30; DataView dvOut = new DataView(dtout); this.UcPageView1.MyDataSource = dvOut; this.UcPageView1.BindGrid(); } catch (Exception er) { this.clog.WriteLine(er); this.SetErrorMsgPageBydir("查询错误,请重试!"); return; } }
private void btnQuery_Click(object sender, System.EventArgs e) { Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; msb1 = new MaterialSBusi(strcons); DataTable dt = msb1.GetMaterialsBySelect(this.txtQueryMaterialCode.Text.Trim(), this.txtQueryMaterialName.Text.Trim()); this.DataGrid1.DataSource = dt; this.DataGrid1.DataBind(); }
private void btnQuery_Click(object sender, System.EventArgs e) { Session.Remove("QUERY"); Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; msb1 = new MaterialSBusi(strcons); try { DataTable dtout = msb1.GetMaterialsSimpleAnalyse(this.ddlMaterialType.SelectedValue, this.ddlMonth.SelectedValue); if (dtout == null) { this.SetErrorMsgPageBydir("查询出错,请重试!"); btnExcel.Enabled = false; return; } else { dtout.TableName = "原材料分析报表"; DataTable dtexcel = dtout.Copy(); Session["QUERY"] = dtout; // for(int i=0;i<dtexcel.Rows.Count;i++) // { // dtexcel.Rows[i][0]="'"+dtexcel.Rows[i][0].ToString(); // } Session["toExcel"] = dtexcel; if (dtout.Rows.Count <= 0) { btnExcel.Enabled = false; } else { btnExcel.Enabled = true; } } upPager = true; this.DataGrid1.DataSource = dtout; this.DataGrid1.DataBind(); } catch (Exception er) { this.clog.WriteLine(er); this.SetErrorMsgPageBydir("查询错误,请重试!"); return; } }
private void Page_Load(object sender, System.EventArgs e) { // 在此处放置用户代码以初始化页面 if (Session["Login"] == null) { Response.Redirect("../Exit.aspx"); return; } string strid = Request.QueryString["id"]; string strBatch = Request.QueryString["batch"]; Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; ms1 = new MaterialSBusi(strcons); if (!IsPostBack) { this.FillDropDownList("tbNameCodeToStorage", this.ddlMaterialType, "vcCommSign='MaterialType'"); Session["mssold"] = null; if (strid == "" || strid == null) { this.btAdd.Enabled = true; this.btDel.Enabled = false; this.btMod.Enabled = false; lbltitle.Text = "新原材料资料录入"; } else { this.btAdd.Enabled = false; this.btDel.Enabled = true; this.btMod.Enabled = true; this.txtBatchNo.Enabled = false; CMSMStruct.MaterialSStruct mss = ms1.GetMaterialInfo(strBatch, strid); this.txtBatchNo.Text = mss.strBatchNo; this.txtMaterialName.Text = mss.strMaterialName; this.txtStandardUnit.Text = mss.strStandardUnit; this.txtUnit.Text = mss.strUnit; this.txtPrice.Text = mss.dPrice.ToString(); this.txtProviderName.Text = mss.strProviderName; this.ddlMaterialType.SelectedIndex = this.ddlMaterialType.Items.IndexOf(this.ddlMaterialType.Items.FindByValue(mss.strMaterialType)); lbltitle.Text = "原材料资料修改--正在编辑的原材料编码为:" + strid; Session["mssold"] = mss; this.txtPrice.Enabled = false; } } }
private void DataGrid1_SelectedIndexChanged(object sender, EventArgs e) { DataGridItem item = this.DataGrid1.SelectedItem; Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; msb1 = new MaterialSBusi(strcons); CMSMStruct.MaterialSStruct mss = msb1.GetMaterialInfo(item.Cells[0].Text.Trim(), item.Cells[1].Text.Trim()); this.txtBatchNo.Text = mss.strBatchNo; this.txtMaterialCode.Text = mss.strMaterialCode; this.txtMaterialName.Text = mss.strMaterialName; this.txtStandardUnit.Text = mss.strStandardUnit; this.txtUnit.Text = mss.strUnit; this.txtPrice.Text = mss.dPrice.ToString(); this.txtProviderName.Text = mss.strProviderName; this.txtCurCount.Text = mss.dCurCount.ToString(); this.ddlMaterialType.SelectedIndex = this.ddlMaterialType.Items.IndexOf(this.ddlMaterialType.Items.FindByValue(mss.strMaterialType)); }
private void DataGrid1_DeleteCommand(object source, DataGridCommandEventArgs e) { try { CMSMStruct.LoginStruct ls1 = (CMSMStruct.LoginStruct)Session["Login"]; Hashtable htpara = new Hashtable(); htpara.Add("strEnterCount", e.Item.Cells[10].Text.Trim()); htpara.Add("strSerialOld", e.Item.Cells[0].Text.Trim()); htpara.Add("strOperDate", DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString()); htpara.Add("strOperName", ls1.strOperName); htpara.Add("strDeptID", ls1.strNewDeptID); htpara.Add("strMaterialCode", e.Item.Cells[2].Text.Trim()); htpara.Add("strBatchNo", e.Item.Cells[1].Text.Trim()); Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; msb1 = new MaterialSBusi(strcons); if (msb1.MaterialEnterModDetele(htpara)) { this.Popup("原材料入库修正删除成功!"); this.DBbind(); return; } else { this.SetErrorMsgPageBydir("原材料入库修正删除失败!"); return; } } catch (Exception er) { this.clog.WriteLine(er); this.SetErrorMsgPageBydir("查询错误,请重试!"); return; } }
private void DBbind() { Session.Remove("oldEnterCount"); Session.Remove("EnterForMod"); strBeginDate = Request.Form["txtBegin"].ToString(); strEndDate = Request.Form["txtEnd"].ToString(); if (strBeginDate == "" || strEndDate == "" || strBeginDate == null || strEndDate == null) { this.SetErrorMsgPageBydir("时间不能为空,请重新选择时间!"); return; } Session.Remove("QUERY"); Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; msb1 = new MaterialSBusi(strcons); string strMaterialCode = txtMaterialCode.Text.Trim(); string strMaterialName = txtMaterialName.Text.Trim(); string strMaterialType = ddlMaterialType.SelectedValue; string strEnterSerial = txtEnterSerial.Text.Trim(); Hashtable htpara = new Hashtable(); htpara.Add("strMaterialCode", strMaterialCode); htpara.Add("strMaterialName", strMaterialName); htpara.Add("strMaterialType", strMaterialType); htpara.Add("strEnterSerial", strEnterSerial); htpara.Add("strBeginDate", strBeginDate); htpara.Add("strEndDate", strEndDate); htpara.Add("strBatchNo", this.txtBatchNo.Text.Trim()); htpara.Add("strDeptID", this.ddlDept.SelectedValue); try { DataTable dtout = msb1.GetMaterialEnterForMod(htpara); if (dtout == null) { this.SetErrorMsgPageBydir("查询出错,请重试!"); return; } else { dtout.TableName = "原材料入库查询"; Session["EnterForMod"] = dtout; this.DataGrid1.EditItemIndex = -1; this.DataGrid1.Columns[16].Visible = true; CMSMStruct.LoginStruct ls1 = (CMSMStruct.LoginStruct)Session["Login"]; if (ls1.strDeptID == "CEN00" || ls1.strNewDeptID == "") { this.DataGrid1.Columns[15].Visible = false; this.DataGrid1.Columns[16].Visible = false; } this.DataGrid1.DataSource = dtout; this.DataGrid1.DataBind(); } this.DataGrid1.DataSource = dtout; this.DataGrid1.DataBind(); } catch (Exception er) { this.clog.WriteLine(er); this.SetErrorMsgPageBydir("查询错误,请重试!"); return; } }
private void btAdd_Click(object sender, System.EventArgs e) { CMSMStruct.LoginStruct ls1 = (CMSMStruct.LoginStruct)Session["Login"]; if (ls1.strDeptID == "CEN00" || ls1.strNewDeptID == "") { this.Popup("没有操作权限,请使用部门帐号!"); this.btnQuery.Enabled = false; this.btAdd.Enabled = false; return; } if (this.txtMaterialCode.Text.Trim() == "") { this.SetErrorMsgPageBydirHistory("请选择要入库有原材料!"); return; } string strEnterCount = this.txtEnterCount.Text.Trim(); if (strEnterCount == "") { this.SetErrorMsgPageBydirHistory("请输入本次入库数量!"); return; } if (!this.JudgeIsNum(strEnterCount, "本次入库数量")) { return; } CMSMStruct.MaterialEnterStruct mes1 = new CommCenter.CMSMStruct.MaterialEnterStruct(); mes1.dEnterCount = Math.Round(double.Parse(strEnterCount), 2); mes1.strBatchNo = this.txtBatchNo.Text.Trim(); mes1.strMaterialCode = this.txtMaterialCode.Text.Trim(); mes1.strMaterialName = this.txtMaterialName.Text.Trim(); mes1.strStandardUnit = this.txtStandardUnit.Text.Trim(); mes1.strUnit = this.txtUnit.Text.Trim(); mes1.dPrice = Math.Round(double.Parse(this.txtPrice.Text.Trim()), 2); mes1.strProviderName = this.txtProviderName.Text.Trim(); mes1.strMaterialType = this.ddlMaterialType.SelectedValue; mes1.dLastCount = Math.Round(double.Parse(this.txtCurCount.Text.Trim()), 2); mes1.dCount = mes1.dLastCount + mes1.dEnterCount; mes1.strOperType = "0"; mes1.strEnterDate = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString(); // mes1.strDeptID=ls1.strNewDeptID; mes1.strDeptID = ls1.strDeptID; mes1.strOperDate = mes1.strEnterDate; mes1.strOperName = ls1.strOperName; Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; msb1 = new MaterialSBusi(strcons); if (msb1.InsertMaterialEnter(mes1)) { this.SetSuccMsgPageBydir("录入原材料入库成功!", ""); return; } else { this.SetErrorMsgPageBydir("录入原材料入库失败,请重试!"); return; } }
private void Page_Load(object sender, System.EventArgs e) { // 在此处放置用户代码以初始化页面 this.btnExcel.Attributes.Add("onclick", "javascript:window.open('../DataGridToExcel.aspx', 'Sample', 'toolbar=no,location=no,directories=no,status=yes,menubar=yes,scrollbars=no,resizable=yes,copyhistory=yes,width=790,height=520,left=0,top=0')"); if (Session["Login"] != null) { if (!IsPostBack) { this.ddlQueryType.Items.Add(new ListItem("原材料入库明细", "0")); this.ddlQueryType.Items.Add(new ListItem("入库供应商月报表", "1")); this.ddlQueryType.Items.Add(new ListItem("入库供应商汇总月报表", "2")); string strvalue = ""; string strYear = DateTime.Now.Year.ToString(); for (int i = 0; i < 12; i++) { if (i != 0 && DateTime.Now.AddMonths(-i).Month == 12) { strYear = DateTime.Now.AddYears(-1).Year.ToString(); } if (DateTime.Now.AddMonths(-i).Month < 10) { strvalue = strYear + "0" + (DateTime.Now.AddMonths(-i).Month).ToString(); } else { strvalue = strYear + (DateTime.Now.AddMonths(-i).Month).ToString(); } this.ddlMonth.Items.Add(new ListItem(strvalue, strvalue)); } this.FillDropDownList("tbNameCodeToStorage", this.ddlMaterialType, "vcCommSign='MaterialType'", "全部"); Session.Remove("QUERY"); Session.Remove("toExcel"); Session.Remove("page_view"); Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; msb1 = new MaterialSBusi(strcons); DataTable dtProviderList = msb1.GetProviderList(); this.FillDropDownList(dtProviderList, this.ddlProviderName, "全部"); } if (this.UcPageView1.MyDataGrid.DataSource != null) { if (((DataView)this.UcPageView1.MyDataGrid.DataSource).Count > 0) { UcPageView1.FootBar.Visible = true; btnExcel.Enabled = true; } else { btnExcel.Enabled = false; } } else { btnExcel.Enabled = false; } } else { Response.Redirect("../Exit.aspx"); } }
private void btnQuery_Click(object sender, System.EventArgs e) { Session.Remove("QUERY"); string strQueryType = this.ddlQueryType.SelectedValue; if (strQueryType == "1") { if (this.ddlProviderName.SelectedValue == "全部") { this.Popup("请指定要统计的供应商!"); return; } } string strProviderName = this.ddlProviderName.SelectedValue; if (strProviderName == "全部") { strProviderName = ""; } string strMaterialType = this.ddlMaterialType.SelectedValue; if (strMaterialType == "全部") { strMaterialType = ""; } Hashtable htpara = new Hashtable(); htpara.Add("strMonth", this.ddlMonth.SelectedValue); htpara.Add("strProviderName", strProviderName); htpara.Add("strMaterialType", strMaterialType); htpara.Add("strMaterialName", this.txtMaterialName.Text.Trim()); Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; msb1 = new MaterialSBusi(strcons); try { DataSet dsout = msb1.GetMaterialsEnterReport(strQueryType, htpara); DataTable dtout = dsout.Tables["QueryResult"]; if (dtout == null) { this.SetErrorMsgPageBydir("查询出错,请重试!"); btnExcel.Enabled = false; return; } else { txtRecordCount.Text = dsout.Tables["SumState"].Rows[0]["RecordCount"].ToString(); txtToltalCount.Text = dsout.Tables["SumState"].Rows[0]["TotalCount"].ToString(); txtTotalFee.Text = dsout.Tables["SumState"].Rows[0]["TotalFee"].ToString(); dtout.TableName = "原材料资料清单"; if (strQueryType == "0") { this.TableConvert(dtout, "原材料类型", "tbNameCodeToStorage", "vcCommSign='MaterialType'"); this.TableConvert(dtout, "操作类型", "tbNameCodeToStorage", "vcCommSign='MaEnterOutType'"); this.TableConvert(dtout, "部门", "NewDept"); } DataTable dtexcel = dtout.Copy(); Session["QUERY"] = dtout; // for(int i=0;i<dtexcel.Rows.Count;i++) // { // dtexcel.Rows[i][0]="'"+dtexcel.Rows[i][0].ToString(); // } Session["toExcel"] = dtexcel; if (dtout.Rows.Count <= 0) { btnExcel.Enabled = false; } else { btnExcel.Enabled = true; } } UcPageView1.MyDataGrid.PageSize = 30; DataView dvOut = new DataView(dtout); this.UcPageView1.MyDataSource = dvOut; this.UcPageView1.BindGrid(); } catch (Exception er) { this.clog.WriteLine(er); this.SetErrorMsgPageBydir("查询错误,请重试!"); return; } }