private void btnPrint_Click(object sender, EventArgs e) { try { XtraReport report = new XtraReport(); report.LoadLayout(Application.StartupPath + "/Print/AnQingCount.repx"); report.DataSource = (DataTable)grd.DataSource; //添加参数 report.Parameters.Clear(); DevExpress.XtraReports.Parameters.Parameter p2 = new DevExpress.XtraReports.Parameters.Parameter(); p2.Name = "标题"; p2.Description = "标题"; p2.Value = "交通事故案情报统计 " + CommonInfo.CDate(this.dateEdit1.EditValue).ToString("yyyy-MM-dd") + "至" + CommonInfo.CDate(this.dateEdit2.EditValue).ToString("yyyy-MM-dd"); report.Parameters.Add(p2); DevExpress.XtraReports.Parameters.Parameter p3_1 = new DevExpress.XtraReports.Parameters.Parameter(); p3_1.Name = "统计"; p3_1.Description = "统计"; p3_1.Value = gridColumn2.SummaryText;;;; report.Parameters.Add(p3_1); DevExpress.XtraReports.Parameters.Parameter p3_2 = new DevExpress.XtraReports.Parameters.Parameter(); p3_2.Name = "A统计"; p3_2.Description = "A统计"; p3_2.Value = " " + gridColumn5.SummaryText; report.Parameters.Add(p3_2); DevExpress.XtraReports.Parameters.Parameter p3_3 = new DevExpress.XtraReports.Parameters.Parameter(); p3_3.Name = "B统计"; p3_3.Description = "B统计"; p3_3.Value = " " + gridColumn7.SummaryText; report.Parameters.Add(p3_3); DevExpress.XtraReports.Parameters.Parameter p3_4 = new DevExpress.XtraReports.Parameters.Parameter(); p3_4.Name = "D统计"; p3_4.Description = "D统计"; p3_4.Value = " " + gridColumn8.SummaryText; report.Parameters.Add(p3_4); DevExpress.XtraReports.Parameters.Parameter p3_5 = new DevExpress.XtraReports.Parameters.Parameter(); p3_5.Name = "S统计"; p3_5.Description = "S统计"; p3_5.Value = " " + gridColumn9.SummaryText; report.Parameters.Add(p3_5); if (Program.sOperID != "admin") { report.Print(); } else { report.ShowDesignerDialog(); } } catch { } }
private void btnSel_Click(object sender, EventArgs e) { string sError = ""; string sCon = ""; if (this.checkEdit2.Checked == true) { sCon += " and State ='进行中' "; } if (this.checkEdit1.Checked == true) { sCon += " and State = '未检测' "; } if (this.checkEdit4.Checked == true) { sCon += " and State ='作废' "; } if (this.checkEdit5.Checked == true) { sCon += " and State ='已结算' "; } if (this.txtAnQingSelect.Text.Trim() != "") { sCon += " and AnQingNo like '%" + this.txtAnQingSelect.Text.Trim() + "%'"; } if (this.dtpDateBegin.Text.Trim() != "") { sCon += " and AnQingDate>='" + CommonInfo.CDate(this.dtpDateBegin.Text.Trim()).ToString("yyyy-MM-dd") + " 00:00:00'"; } if (this.dtpDateEnd.Text.Trim() != "") { sCon += " and AnQingDate<='" + CommonInfo.CDate(this.dtpDateEnd.Text.Trim()).ToString("yyyy-MM-dd") + " 23:59:59'"; } sCon += " and OperName like '" + Program.sOperName + "'"; // sCon += " and State in ('未报','已报','不合格') "; string strSql = "select * from T_CarBaoFei where 1=1 " + sCon + " order by ID"; StringBuilder strSql1 = new StringBuilder(); strSql1 = new StringBuilder(); strSql1.Append(" SELECT AnQingID, AnQingNo, AnQingDiDian,"); strSql1.Append(" AnQingDesc, DeftName, OperName, AnQingTeShuXiang, AnQingDate,AnQingDieCount,AnQingBeiZhu,isOk,AnQingTwo,State,insDate"); strSql1.Append(" FROM T_AnQing"); strSql1.Append(" WHERE 1=1 and AnQingTwo=0 " + sCon + "order by AnQingNo desc"); DataTable dt = SqlHelper.RunQuery(CommandType.Text, strSql1.ToString(), null, out sError); this.grd.DataSource = dt; }
private void btnDcExcel_Click(object sender, EventArgs e) { SaveFileDialog sDialog = new SaveFileDialog(); sDialog.FileName = "交通事故案情报表" + CommonInfo.CDate(this.dateEdit1.EditValue).ToString("yyyy-MM-dd") + "至" + CommonInfo.CDate(this.dateEdit2.EditValue).ToString("yyyy-MM-dd") + ".xls"; if (sDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { DevExpress.XtraPrinting.XlsExportOptions options = new DevExpress.XtraPrinting.XlsExportOptions(); grd.ExportToXls(sDialog.FileName, options); DevExpress.XtraEditors.XtraMessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void FrmCarTaiZhuang_Load(object sender, EventArgs e) { string sError = ""; this.dateEdit1.EditValue = DateTime.Now.ToString("yyyy-MM-01"); this.dateEdit2.EditValue = CommonInfo.CDate(DateTime.Now.ToString("yyyy-MM-01")).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd"); //地址分类 DataTable dt3 = SqlHelper.RunQuery(CommandType.Text, "select * from T_DiZHi", null, out sError); comDidIan.DisplayMember = "DiZhiDesc"; comDidIan.ValueMember = "DiZhiID"; comDidIan.DataSource = dt3; comDidIan.SelectedValue = "1"; }
private void FrmCarTaiZhuang_Load(object sender, EventArgs e) { this.dateEdit1.EditValue = DateTime.Now.ToString("yyyy-MM-01"); this.dateEdit2.EditValue = CommonInfo.CDate(DateTime.Now.ToString("yyyy-MM-01")).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd"); string sError = ""; string strSql = "select '' as TypeID,'全部' as TypeName,-1 as SortID union all SELECT DeptID as TypeID,DeptName as TypeName,SortID FROM TQx_Dept WHERE State='使用' Order by SortID "; DataTable dt = SqlHelper.RunQuery(CommandType.Text, strSql, null, out sError); this.cmbDeptID.Properties.DataSource = dt; this.cmbDeptID.EditValue = Program.sDeptID; strSql = "select '全部' as TypeName,-1 as TypeID union all select '('+bt.Bao_Name+')'+GongSiName as TypeName ,GongSiId as TypeID from T_GongSi gs join T_BaoType bt on gs.BaoTypeNo=bt.Bao_TypeId where GongSiId<>0 "; DataTable dt1 = SqlHelper.RunQuery(CommandType.Text, strSql, null, out sError); this.cmbgs.Properties.DataSource = dt1; this.cmbgs.EditValue = -1; if (Program.sRoleID == "002") { this.cmbDeptID.Enabled = false; } }
/// <summary> /// 查询 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSel_Click(object sender, EventArgs e) { string sError = ""; string sCon = ""; if (ckd.Checked == true) { sCon += $" and AnQingDiZhi='{this.comDidIan.Text}' "; } if (ckt.Checked == true) { if (this.txtDateSS.Text.Trim() == "") { MessageBox.Show("时间段不允许为空"); return; } if (this.txtT3.Text.Trim() == "") { MessageBox.Show("时间段不允许为空"); return; } sCon += $" and AnQingDateSS>='{this.txtDateSS.Text.Trim()}' and AnQingDateSS<='{this.txtT3.Text.Trim()}' "; } if (CommonInfo.CObjectToStr(this.dateEdit1.EditValue).Trim() != "") { sCon += " and AnQingDate>='" + CommonInfo.CDate(this.dateEdit1.EditValue).ToString("yyyy-MM-dd") + " 00:00:00' "; } if (CommonInfo.CObjectToStr(this.dateEdit2.EditValue).Trim() != "") { sCon += " and AnQingDate<='" + CommonInfo.CDate(this.dateEdit2.EditValue).ToString("yyyy-MM-dd") + " 23:59:59' "; } DataBind(sCon); }
//查询 private void btnSel_Click(object sender, EventArgs e) { string sError = ""; string sCon = ""; if (this.ckhdy.Checked == true) { sCon += " and StateMo ='已核对'"; } if (this.ckhdn.Checked == true) { sCon += " and StateMo ='未核对'"; } if (this.ck1.Checked == true) { sCon += " and State ='已结算' "; } if (this.ck2.Checked == true) { sCon += " and State ='进行中' "; } if (this.ck3.Checked == true) { sCon += " and State ='(二次)已结算' "; } if (this.ck4.Checked == true) { sCon += " and State ='(二次)进行中' "; } if (this.textEdit1.Text.Trim() != "") { sCon += " and AnQingNo like '%" + this.textEdit1.Text.Trim() + "%'"; } if (CommonInfo.CObjectToStr(this.cmbDeptID.Text) != "") { if (this.cmbDeptID.Text == "全部") { sCon += " "; } else { sCon += " and DeftName like '" + CommonInfo.CObjectToStr(this.cmbDeptID.Text) + "' "; } } if (CommonInfo.CObjectToStr(this.cmbgs.Text) != "") { if (this.cmbgs.Text == "全部") { sCon += " "; } else { if (Convert.ToInt32(this.cmbgs.EditValue) <= 3) { sCon += " and GongSiA = '" + Convert.ToInt32(this.cmbgs.EditValue) + "' "; } if (Convert.ToInt32(this.cmbgs.EditValue) > 3 && Convert.ToInt32(this.cmbgs.EditValue) <= 6) { sCon += " and GongSiB = '" + Convert.ToInt32(this.cmbgs.EditValue) + "' "; } if (Convert.ToInt32(this.cmbgs.EditValue) > 6 && Convert.ToInt32(this.cmbgs.EditValue) <= 9) { sCon += " and GongSiD = '" + Convert.ToInt32(this.cmbgs.EditValue) + "' "; } } } if (CommonInfo.CObjectToStr(this.dateEdit1.EditValue).Trim() != "") { sCon += " and AnQingDate>='" + CommonInfo.CDate(this.dateEdit1.EditValue).ToString("yyyy-MM-dd") + " 00:00:00' "; } if (CommonInfo.CObjectToStr(this.dateEdit2.EditValue).Trim() != "") { sCon += " and AnQingDate<='" + CommonInfo.CDate(this.dateEdit2.EditValue).ToString("yyyy-MM-dd") + " 23:59:59' "; } DataBind(sCon); }
private void FrmBaoFeiList_Load(object sender, EventArgs e) { this.dtpDateBegin.EditValue = DateTime.Now.ToString("yyyy-MM-01"); this.dtpDateEnd.EditValue = CommonInfo.CDate(DateTime.Now.ToString("yyyy-MM-01")).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd"); }
private void btnSel_Click(object sender, EventArgs e) { string sError = ""; string sCon = ""; if (this.txtAnQingSelect.Text.Trim() != "") { sCon += " and AnQingNo like '%" + this.txtAnQingSelect.Text.Trim() + "%'"; } if (this.dtpDateBegin.Text.Trim() != "") { sCon += " and AnQingDate>='" + CommonInfo.CDate(this.dtpDateBegin.Text.Trim()).ToString("yyyy-MM-dd") + " 00:00:00'"; } if (this.dtpDateEnd.Text.Trim() != "") { sCon += " and AnQingDate<='" + CommonInfo.CDate(this.dtpDateEnd.Text.Trim()).ToString("yyyy-MM-dd") + " 23:59:59'"; } if (Program.sOperID.Trim() != "admin") { if (Program.sRoleID == "002") { sCon += " and DeftName='" + Program.sDeptName + "' "; } } if (this.checkEdit2.Checked == true) { sCon += " and State = '进行中' "; } if (this.checkEdit3.Checked == true) { sCon += " and State = '已结算' "; } if (this.checkEdit4.Checked == true) { sCon += " and State = '作废' "; } if (this.ckrw.Checked == true) { sCon += " and State = '(二次)未检测' "; } if (this.ckrj.Checked == true) { sCon += " and State = '(二次)进行中' "; } if (this.ckrs.Checked == true) { sCon += " and State = '(二次)已结算' "; } if (this.ckrz.Checked == true) { sCon += " and State = '(二次)作废' "; } StringBuilder strSql1 = new StringBuilder(); strSql1 = new StringBuilder(); strSql1.Append(" SELECT AnQingID, AnQingNo, AnQingDiDian,"); strSql1.Append(" AnQingDesc, DeftName, OperName, AnQingTeShuXiang, AnQingDate,AnQingDieCount,AnQingBeiZhu,isOk,AnQingTwo,State,insDate"); strSql1.Append(" FROM T_AnQing"); strSql1.Append(" WHERE 1=1 and State !='未检测' " + sCon + "order by AnQingNo"); DataTable dt = SqlHelper.RunQuery(CommandType.Text, strSql1.ToString(), null, out sError); this.grd.DataSource = dt; }