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 strAssType = cmbAssType.Text.Trim(); string strOperName = cmbOper.Text.Trim(); string strDeptID = cmbDept.Text.Trim(); string strConsType = this.cmbConsFlag.Text.Trim(); string strPTType = this.cmbConsType.Text.Trim(); if (strAssType == "全部") { strAssType = ""; } else { strAssType = this.GetColEn(strAssType, "AT"); } if (strConsType == "全部") { strConsType = ""; } if (strConsType == "正常消费") { strConsType = "0"; } if (strConsType == "已撤销") { strConsType = "9"; } if (strPTType == "全部") { strPTType = ""; } else { strPTType = this.GetColEn(strPTType, "PT"); } htPara.Add("strConsType", strConsType); htPara.Add("strAssType", strAssType); htPara.Add("strPTType", strPTType); if (strOperName == "全部") { strOperName = ""; } htPara.Add("strOperName", strOperName); if (strDeptID == "全部") { strDeptID = ""; } else { strDeptID = this.GetColEn(strDeptID, "MD"); } htPara.Add("strDeptID", strDeptID); string strGoodsName = cmbGoodsName.Text.Trim(); htPara.Add("strGoodsName", strGoodsName); string strBegin = dtpBegin.Value.ToShortDateString() + " 00:00:00"; htPara.Add("strBegin", strBegin); string strEnd = dtpEnd.Value.ToShortDateString() + " 23:59:59"; htPara.Add("strEnd", strEnd); Exception err = null; DataTable dt = new DataTable(); dt = cs.GetConsQuery(htPara, out err); if (dt != null && dt.Rows.Count >= 0) { this.DataTableConvert(dt, "vcAssType", "AT", "vcCommCode", "vcCommName"); this.DataTableConvert(dt, "vcConsType", "PT", "vcCommCode", "vcCommName"); this.DataTableConvert(dt, "vcDeptID", "MD", "vcCommCode", "vcCommName"); int iCount = dt.Rows.Count; double dFee = 0; double dRate = 0; for (int i = 0; i < dt.Rows.Count; i++) { dFee += double.Parse(dt.Rows[i]["nFee"].ToString()); dRate += double.Parse(dt.Rows[i]["nTRate"].ToString()); // if(dt.Rows[i]["Flag"].ToString()=="正常消费") // { // dFee+=double.Parse(dt.Rows[i]["nFee"].ToString()); // } } txtCount.Text = iCount.ToString(); txtFee.Text = Math.Round(dFee, 2).ToString(); txtTolRate.Text = Math.Round(dRate, 2).ToString(); this.dataGrid1.CaptionText = "会员消费明细报表"; this.dataGrid1.SetDataBinding(dt, ""); this.EnToCh("流水号,会员名称,会员类型,会员卡号,商品名称,单价,数量,应收,折扣,实收,付款类型,撤消情况,消费日期,操作员,门店,备注", "120,100,80,80,120,80,80,80,80,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); } } }