private void DgBind() { string strCardID = txtCardID.Text.Trim(); string strSerial = txtSerial.Text.Trim(); string strBegin = dtpBegin.Value.ToShortDateString() + " 00:00:00"; string strEnd = dtpEnd.Value.ToShortDateString() + " 23:59:59"; string strDeptID = SysInitial.LocalDept; if (this.cmbDept.Text == "全部") { strDeptID = "all"; } else { strDeptID = this.GetColEn(this.cmbDept.Text, "MD"); } DataTable dt = new DataTable(); err = null; dt = cs.GetConsRepeat(strCardID, strSerial, strBegin, strEnd, strDeptID, out err); if (dt.Rows.Count >= 0) { this.DataTableConvert(dt, "vcDeptID", "MD", "vcCommCode", "vcCommName"); } if (dt != null) { int consCount = dt.Rows.Count; double consfee = 0; for (int i = 0; i < dt.Rows.Count; i++) { consfee += double.Parse(dt.Rows[i]["nFee"].ToString()); } this.txtCount.Text = consCount.ToString(); this.txtTolFee.Text = consfee.ToString(); this.dataGrid1.SetDataBinding(dt, ""); this.EnToCh("流水号,会员卡号,会员名称,总折扣,总金额,付款金额,找零,收银员,消费日期,门店", "120,80,100,50,50,60,50,80,150,150", dt, this.dataGrid1); } else { MessageBox.Show("查询小票出错,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); if (err != null) { clog.WriteLine(err); } } }
private void DgBind() { string strCardID = txtCardID.Text.Trim(); string strCompName = cmbCompName.Text.Trim(); string strBegin = dtpBegin.Value.ToShortDateString() + " 00:00:00"; string strEnd = dtpEnd.Value.ToShortDateString() + " 23:59:59"; string strCompID = ""; if (strCompName == "全部") { strCompID = ""; } else { CMSMStruct.CompDeptStruct comp1 = this.GetComDeptByCompName(strCompName); strCompID = comp1.strCompanyID; } DataTable dt = new DataTable(); err = null; dt = cs.GetConsRepeat(strCardID, strCompID, strBegin, strEnd, out err); if (dt != null) { int consCount = dt.Rows.Count; double consfee = 0; for (int i = 0; i < dt.Rows.Count; i++) { consfee += double.Parse(dt.Rows[i]["cnnFee"].ToString()); } this.txtCount.Text = consCount.ToString(); this.txtTolFee.Text = consfee.ToString(); this.dataGrid1.SetDataBinding(dt, ""); this.EnToCh("流水号,会员卡号,车牌号,油料名称,油料型号,计量单位,密度,数量,单价,金额,备注,单位名称,消费日期", "120,80,100,50,50,60,50,80,80,100,80", dt, this.dataGrid1); } else { MessageBox.Show("查询小票出错,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); if (err != null) { clog.WriteLine(err); } } }