private void DgBind() { Hashtable htPara = new Hashtable(); string strCardID = txtCardID.Text.Trim(); htPara.Add("strCardID", strCardID); string strAssName = cmbAssName.Text.Trim(); htPara.Add("strAssName", strAssName); string strOperName = cmbOper.Text.Trim(); string strAssType = cmbAssType.Text.Trim(); string strDeptID = cmbDept.Text.Trim(); if (strAssType == "全部") { strAssType = ""; } else { strAssType = this.GetColEn(strAssType, "AT"); } htPara.Add("strAssType", strAssType); if (strOperName == "全部") { strOperName = ""; } htPara.Add("strOperName", strOperName); if (strDeptID == "全部") { strDeptID = ""; } else { strDeptID = this.GetColEn(strDeptID, "MD"); } htPara.Add("strDeptID", strDeptID); string strBegin = dtpBegin.Value.ToShortDateString() + " 00:00:00"; htPara.Add("strBegin", strBegin); string strEnd = dtpEnd.Value.ToShortDateString() + " 23:59:59"; htPara.Add("strEnd", strEnd); htPara.Add("strTmp22", strTmp22); Exception err = null; DataTable dt = new DataTable(); dt = cs.GetFillQuery(htPara, out err); if (dt != null && dt.Rows.Count >= 0) { this.DataTableConvert(dt, "vcAssType", "AT", "vcCommCode", "vcCommName"); this.DataTableConvert(dt, "vcDeptID", "MD", "vcCommCode", "vcCommName"); double dFillFee = 0; double dProm = 0; for (int i = 0; i < dt.Rows.Count; i++) { dFillFee += double.Parse(dt.Rows[i]["nFillFee"].ToString()); dProm += double.Parse(dt.Rows[i]["nFillProm"].ToString()); } txtCount.Text = dt.Rows.Count.ToString(); txtFee.Text = Math.Round(dFillFee, 2).ToString(); txtTolProm.Text = Math.Round(dProm, 2).ToString(); this.dataGrid1.CaptionText = "会员充值及消费统计报表"; this.dataGrid1.SetDataBinding(dt, ""); this.EnToCh("流水号,会员名称,会员类型,会员卡号,充值金额(-为消费),赠款金额,上次余额,当前余额,充值日期,操作员,操作员门店,备注", "80,100,80,80,130,80,80,80,140,80,160,100", dt, this.dataGrid1); if (dt.Rows.Count > 0) { this.sbtnExcel.Enabled = true; } else { this.sbtnExcel.Enabled = false; } } else { MessageBox.Show("查询出错,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); if (err != null) { clog.WriteLine(err); } } }