private void Form_report_Load(object sender, EventArgs e) { BarcodeControl barcode = new BarcodeControl(); barcode.BarcodeType = BarcodeType.CODE128C; barcode.Data = str_djlsh; barcode.CopyRight = ""; MemoryStream stream = new MemoryStream(); barcode.MakeImage(ImageFormat.Png, 1, 50, true, false, null, stream); Bitmap myimge = new Bitmap(stream); string str_path = Application.StartupPath + @"/barcode.png"; myimge.Save(str_path, ImageFormat.Png); str_path = "file:///" + str_path; myimge.Dispose(); //201203 string str_dwlxr = xtBiz.GetXtCsz("dwlxr").Trim(); //单位联系人 string str_dwdz = xtBiz.GetXtCsz("dwdz").Trim(); //单位地址 string str_dwdh = xtBiz.GetXtCsz("tjdwdh").Trim(); //体检单位电话 string str_tjzgzbh = xtBiz.GetXtCsz("zytjzgbh").Trim(); //职业健康体检资格编号 //string str_dwlxr ="hh";//单位联系人 //string str_dwdz = "hh";//单位地址 //string str_dwdh = "hh";//体检单位电话 //string str_tjzgzbh = "hh";//职业健康体检资格编号 //LocalReport report = new LocalReport(); reportView.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(report_SubreportProcessing); string title = "职业健康检查表"; DataTable dt2 = GetZybRyxx(strTjbh, strTjcs); reportView.LocalReport.ReportPath = Application.StartupPath + @"/rdlcreport/Report_zyb_jkda_new.rdlc"; reportView.LocalReport.EnableExternalImages = true; ReportParameter rp1 = new ReportParameter("dqrq", xtBiz.GetDataNow().ToString("yyyy-MM-dd")); ReportParameter rp2 = new ReportParameter("title", title); ReportParameter rp3 = new ReportParameter("bbmc", Program.reg_dwmc); ReportParameter rp4 = new ReportParameter("barcode", str_path); ReportParameter rp5 = new ReportParameter("dz", str_dwdz); ReportParameter rp6 = new ReportParameter("dh", str_dwdh); ReportParameter rp7 = new ReportParameter("lxr", str_dwlxr); ReportParameter rp8 = new ReportParameter("zgbh", str_tjzgzbh); reportView.LocalReport.DataSources.Clear(); reportView.LocalReport.SetParameters(new ReportParameter[] { rp1, rp2, rp3, rp4, rp5, rp6, rp7, rp8 }); reportView.LocalReport.DataSources.Add(new ReportDataSource("PEISDataSet_v_tj_zyb_ryxx", dt2)); this.reportView.RefreshReport(); }
private void Form_tzs_ly_Load(object sender, EventArgs e) { string tjrq = DateTime.Now.ToString("yyyy年MM月dd日"); DataTable dtTjrq = tzs.GetTjrq(str_dwbh, from, to, ""); if (dtTjrq.Rows.Count > 0) { DateTime mindate = Convert.ToDateTime(dtTjrq.Rows[0]["mindate"].ToString().Trim()); DateTime maxdate = Convert.ToDateTime(dtTjrq.Rows[0]["maxdate"].ToString().Trim()); string date1 = mindate.ToString("yyyy年MM月dd日"); string date2 = maxdate.ToString("yyyy年MM月dd日"); if (date1 == date2) { tjrq = date1; } else { tjrq = date1 + "—" + date2; } } StringBuilder gzjwhys = new StringBuilder(); for (int i = 0; i < dt.Rows.Count; i++) { //bgid,maxdate,mindate,sjdw,tjrs,tjxm,tjjl,gz,zrs,jkycrs,zyycrs,dwmc,rylb,whys gzjwhys.Append(dt.Rows[i]["gz"].ToString().Trim() + "共" + dt.Rows[i]["zrs"] + "人,接触的主要职业病危害因素是" + dt.Rows[i]["whys"].ToString().Trim() + ";"); } LocalReport report = reportViewer1.LocalReport; report.SubreportProcessing += new SubreportProcessingEventHandler(report_SubreportProcessing); report.ReportPath = Application.StartupPath + @"/rdlcreport/Report_zyjc_main.rdlc"; report.EnableExternalImages = true; DateTime dqrq = xtbiz.GetDataNow(); ReportParameter rp1 = new ReportParameter("dwmc", dw); ReportParameter rp2 = new ReportParameter("tjrq", tjrq); ReportParameter rp3 = new ReportParameter("bgrqdx", tzs.ChangeTime(dqrq)); ReportParameter rp4 = new ReportParameter("gzjwhys", gzjwhys.ToString()); ReportParameter rp5 = new ReportParameter("ys", "1"); //ReportParameter rp4 = new ReportParameter("bblx", str_bblx); report.DataSources.Clear(); report.SetParameters(new ReportParameter[] { rp1, rp2, rp3, rp4, rp5 }); //report.DataSources.Add(new ReportDataSource("PEISDataSet_v_sz_tjbg", dt)); this.reportViewer1.RefreshReport(); }
private void btnPrint_Click(object sender, EventArgs e) { #region 输入判断 if (dtpFrom.Value > dtpTo.Value) { MessageBox.Show("开始日期不能大于结束日期!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.ActiveControl = dtpFrom; return; } if (txtDw.Text == "") { txtDw.Tag = ""; MessageBox.Show("请选择体检单位!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } #endregion pw.StartThread(); #region 报表换行处理 /////////////////////////////////////报表换行处理//////默认1行50个中文字符//////////////////////////////////////////////// //增加行数的参数,控制显示的孙报表 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //string page1 = ""; string page2 = ""; string page3 = ""; string page4 = ""; string page5 = ""; string page6 = ""; string page7 = ""; string page8 = ""; string page9 = ""; string page10 = ""; //string str_zwhys = gzjwhys.ToString(); //string str_rylb = dt.Rows[0]["rylb"].ToString(); //string str_ztjrs = dt.Rows[0]["tjrs"].ToString(); //string str_sql = ", //string str_sql2 = " " + comn.CharConverter(tjrq) + str_sql; string str_maxlen = ""; //str_maxlen = str_sql2 + str_sql.Replace("1", "1 ").Replace("0", "0 ").Replace("2", "2 ").Replace("8", "8 ").Replace("4", "4 ").Replace(",", ","); str_maxlen = richTextBox1.Text.Trim(); //MessageBox.Show(str_maxlen.Length.ToString(),""); //string rownum=""; //if (str_maxlen.Length > 500) //{ // MessageBox.Show("内容超过10行了(500个字),系统暂时不支持!", "提示"); // pw.StopThread(); // return; //} //try //{ // if (str_maxlen.Length <= 50) //单行时 // { // rownum = "1"; // page1 = str_maxlen; // } // else //多行时 // { // if (str_maxlen.Length <= 100 && str_maxlen.Length >50) //2行 // { // rownum = "2"; // ////处理倒数第2为是特殊符号的问题,最后1位则为空 // //if (str_maxlen.Substring(0, 49) == "," || str_maxlen.Substring(0, 49) == "。" || str_maxlen.Substring(0, 49) == "、" || str_maxlen.Substring(0, 49) == "+") // //{ // // str_maxlen = str_maxlen.Substring(0, 49); // // MessageBox.Show(str_maxlen); // //} // page1 = str_maxlen.Substring(0, 50); //1行 // page2 = str_maxlen.Substring(51, str_maxlen.Length-50); //2行 // } // if (str_maxlen.Length <= 150 && str_maxlen.Length > 100) // { // rownum = "3"; // page1 = str_maxlen.Substring(0, 50); //1行 // page2 = str_maxlen.Substring(51, 50); //2行 // //page3 = str_maxlen.Substring(101, str_maxlen.Length-100); //3行 // page3 = str_maxlen.Substring(page2.Length, str_maxlen.Length - page2.Length); // } // if (str_maxlen.Length <= 200 && str_maxlen.Length > 150) // { // rownum = "4"; // page1 = str_maxlen.Substring(0, 50); //1行 // page2 = str_maxlen.Substring(51, 50); //2行 // page3 = str_maxlen.Substring(101, 50); //3行 // page4 = str_maxlen.Substring(151, str_maxlen.Length-150); //4行 // } // if (str_maxlen.Length <= 250 && str_maxlen.Length > 200) // { // rownum = "5"; // page1 = str_maxlen.Substring(0, 50); //1行 // page2 = str_maxlen.Substring(51, 50); //2行 // page3 = str_maxlen.Substring(101, 50); //3行 // page4 = str_maxlen.Substring(151, 50); //4行 // page5 = str_maxlen.Substring(201, str_maxlen.Length-200); //5行 // } // if (str_maxlen.Length <= 300 && str_maxlen.Length > 250) // { // rownum = "6"; // page1 = str_maxlen.Substring(0, 50); //1行 // page2 = str_maxlen.Substring(51, 50); //2行 // page3 = str_maxlen.Substring(101, 50); //3行 // page4 = str_maxlen.Substring(151, 50); //4行 // page5 = str_maxlen.Substring(201, 50); //5行 // page6 = str_maxlen.Substring(251, str_maxlen.Length-250); //6行 // } // if (str_maxlen.Length <= 350 && str_maxlen.Length > 300) // { // rownum = "7"; // page1 = str_maxlen.Substring(0, 50); //1行 // page2 = str_maxlen.Substring(51, 50); //2行 // page3 = str_maxlen.Substring(101, 50); //3行 // page4 = str_maxlen.Substring(151, 50); //4行 // page5 = str_maxlen.Substring(201, 50); //5行 // page6 = str_maxlen.Substring(251, 50); //6行 // page7 = str_maxlen.Substring(301, str_maxlen.Length-301); //7行 // } // if (str_maxlen.Length <= 400 && str_maxlen.Length > 350) // { // rownum = "8"; // page1 = str_maxlen.Substring(0, 50); //1行 // page2 = str_maxlen.Substring(51, 50); //2行 // page3 = str_maxlen.Substring(101, 50); //3行 // page4 = str_maxlen.Substring(151, 50); //4行 // page5 = str_maxlen.Substring(201, 50); //5行 // page6 = str_maxlen.Substring(251, 50); //6行 // page7 = str_maxlen.Substring(301, 50); //7行 // page8 = str_maxlen.Substring(351, str_maxlen.Length-350); //8行 // } // if (str_maxlen.Length <= 450 && str_maxlen.Length > 400) // { // rownum = "9"; // page1 = str_maxlen.Substring(0, 50); //1行 // page2 = str_maxlen.Substring(51, 50); //2行 // page3 = str_maxlen.Substring(101, 50); //3行 // page4 = str_maxlen.Substring(151, 50); //4行 // page5 = str_maxlen.Substring(201, 50); //5行 // page6 = str_maxlen.Substring(251, 50); //6行 // page7 = str_maxlen.Substring(301, 50); //7行 // page8 = str_maxlen.Substring(351, 50); //8行 // page9 = str_maxlen.Substring(401, str_maxlen.Length-400); //9行 // } // if (str_maxlen.Length <= 500 && str_maxlen.Length > 450) // { // rownum = "10"; // page1 = str_maxlen.Substring(0, 50); //1行 // page2 = str_maxlen.Substring(51, 50); //2行 // page3 = str_maxlen.Substring(101, 50); //3行 // page4 = str_maxlen.Substring(151, 50); //4行 // page5 = str_maxlen.Substring(201, 50); //5行 // page6 = str_maxlen.Substring(251, 50); //6行 // page7 = str_maxlen.Substring(301, 50); //7行 // page8 = str_maxlen.Substring(351, 50); //8行 // page9 = str_maxlen.Substring(401, 50); //9行 // page10 = str_maxlen.Substring(451, str_maxlen.Length-450); //10行 // } // } //} //catch (Exception ex) //{ // pw.StopThread(); // MessageBox.Show(ex.ToString()); // return; //} #endregion ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// LocalReport report = new LocalReport(); report.SubreportProcessing += new SubreportProcessingEventHandler(report_SubreportProcessing); report.ReportPath = Application.StartupPath + @"/rdlcreport/Report_zyjc_main.rdlc"; report.EnableExternalImages = true; DateTime dqrq = xtbiz.GetDataNow(); ReportParameter rp1 = new ReportParameter("dwmc", txtDw.Text.Trim()); ReportParameter rp2 = new ReportParameter("tjrq", tjrq); ReportParameter rp3 = new ReportParameter("bgrqdx", tzs.ChangeTime(dqrq)); ReportParameter rp4 = new ReportParameter("gzjwhys", gzjwhys.ToString()); ReportParameter rp5 = new ReportParameter("ys", txtYs.Text.Trim()); ReportParameter rp6 = new ReportParameter("rownum", "0"); //行数,确定使用哪个子报表 ReportParameter rp7 = new ReportParameter("page1", richTextBox1.Text.Trim()); //每行对应的内容 ReportParameter rp8 = new ReportParameter("page2", page2); ReportParameter rp9 = new ReportParameter("page3", page3); ReportParameter rp10 = new ReportParameter("page4", page4); ReportParameter rp11 = new ReportParameter("page5", page5); ReportParameter rp12 = new ReportParameter("page6", page6); ReportParameter rp13 = new ReportParameter("page7", page7); ReportParameter rp14 = new ReportParameter("page8", page8); ReportParameter rp15 = new ReportParameter("page9", page9); ReportParameter rp16 = new ReportParameter("page10", page10); report.DataSources.Clear(); report.SetParameters(new ReportParameter[] { rp1, rp2, rp3, rp4,rp5,rp6,rp7,rp8,rp9,rp10,rp11,rp12,rp13,rp14,rp15,rp16}); //打印 RdlcPrintNew rdlcprint = new RdlcPrintNew(); rdlcprint.Hxdy = true; rdlcprint.Run(report, "体检通知书", false, "tjjgdy"); pw.StopThread(); }
private void bt_select_Click(object sender, EventArgs e) { if (dtp_begin.Value > dtp_end.Value) { MessageBox.Show("开始日期不能大于结束日期!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.ActiveControl = dtp_begin; return; } if (txt_tjdw.Text == "") { txt_tjdw.Tag = ""; MessageBox.Show("请选择体检单位!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (txt_whys.Text == "") { txt_whys.Tag = ""; MessageBox.Show("请选择危害因素!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } string str_dwbh = txt_tjdw.Tag.ToString().Trim(); string str_bmbh = ""; if (str_dwbh.Length > 4) { str_bmbh = str_dwbh; str_dwbh = str_dwbh.Substring(0, 4); } DataTable dt = tzs.GetHzmx(dtp_begin.Value.AddDays(-1).ToString("yyyy-MM-dd") + " 23:59:59", dtp_end.Value.ToString("yyyy-MM-dd") + " 23:59:59", str_dwbh, txt_whys.Text.Trim()); DataTable dtHeader = tzs.GetHeader(dtp_begin.Value.AddDays(-1).ToString("yyyy-MM-dd") + " 23:59:59", dtp_end.Value.ToString("yyyy-MM-dd") + " 23:59:59", str_dwbh, txt_whys.Text.Trim()); for (int i = 0; i < dt.Rows.Count; i++) { for (int j = 12; j < 29; j++)//组合项目所在列序号 { dt.Rows[i][j] = tzs.GetJcjg(dt.Rows[i][j].ToString().Trim()); } } string tjrq = DateTime.Now.ToString("yyyy年MM月dd日"); DataTable dtTjrq = tzs.GetTjrq(str_dwbh, dtp_begin.Value.AddDays(-1).ToString("yyyy-MM-dd") + " 23:59:59", dtp_end.Value.ToString("yyyy-MM-dd") + " 23:59:59", txt_whys.Text.Trim()); if (dtTjrq.Rows.Count > 0) { try { DateTime mindate = Convert.ToDateTime(dtTjrq.Rows[0]["mindate"].ToString().Trim()); DateTime maxdate = Convert.ToDateTime(dtTjrq.Rows[0]["maxdate"].ToString().Trim()); string date1 = mindate.ToString("yyyy年MM月dd日"); string date2 = maxdate.ToString("yyyy年MM月dd日"); if (date1 == date2) { tjrq = date1; } else { tjrq = date1 + "至" + date2; } } catch { } } DataTable dtZhxm = tzs.GetZhxm_tz(str_dwbh, dtp_begin.Value.AddDays(-1).ToString("yyyy-MM-dd") + " 23:59:59", dtp_end.Value.ToString("yyyy-MM-dd") + " 23:59:59", txt_whys.Text.Trim()); int count = dtZhxm.Rows.Count; if (count <= 0) { return; } if (count < 7) { count = 7; } string path = @"/rdlcreport/Report_zyjc_tzs_column7.rdlc"; switch (count) { case 7: path = @"/rdlcreport/Report_zyjc_tzs_column7.rdlc"; break; case 8: path = @"/rdlcreport/Report_zyjc_column8.rdlc"; break; case 9: path = @"/rdlcreport/Report_zyjc_column9.rdlc"; break; case 10: path = @"/rdlcreport/Report_zyjc_column10.rdlc"; break; case 11: path = @"/rdlcreport/Report_zyjc_column11.rdlc"; break; case 12: path = @"/rdlcreport/Report_zyjc_column12.rdlc"; break; case 13: path = @"/rdlcreport/Report_zyjc_column13.rdlc"; break; case 14: path = @"/rdlcreport/Report_zyjc_column14.rdlc"; break; case 15: path = @"/rdlcreport/Report_zyjc_column15.rdlc"; break; case 16: path = @"/rdlcreport/Report_zyjc_column16.rdlc"; break; case 17: path = @"/rdlcreport/Report_zyjc_column17.rdlc"; break; default: path = @"/rdlcreport/Report_zyjc_tzs_column7.rdlc"; break; } //if (dt.Rows.Count>0) //{ // tjrq = Convert.ToDateTime(dt.Rows[0]["tjrq"].ToString().Trim()); //} //reportView.LocalReport. //reportView.RefreshReport(); //reportView = new ReportViewer(); reportView.LocalReport.ReportPath = Application.StartupPath + path; reportView.LocalReport.EnableExternalImages = true; DateTime dqrq = xtbiz.GetDataNow(); ReportParameter rp1 = new ReportParameter("bgsj", dqrq.ToString("yyyy年MM月dd日")); ReportParameter rp2 = new ReportParameter("tjrq", tjrq); ReportParameter rp3 = new ReportParameter("dwmc", txt_tjdw.Text.Trim()); ReportParameter rp4 = new ReportParameter("zrs", (dt.Rows.Count).ToString()); ReportParameter rp5 = new ReportParameter("bbmc", Program.yljgmc); ReportParameter rp6 = new ReportParameter("whys", txt_whys.Text.Trim()); reportView.LocalReport.DataSources.Clear(); reportView.LocalReport.SetParameters(new ReportParameter[] { rp1, rp2, rp3, rp4, rp5, rp6 }); reportView.LocalReport.DataSources.Add(new ReportDataSource("PEISDataSet_v_zyjk_jgtzs", dt)); reportView.LocalReport.DataSources.Add(new ReportDataSource("PEISDataSet_v_zyjk_jgtzs_header", dtHeader)); //reportView.LocalReport.DataSources.Add(new ReportDataSource("PEISDataSet_v_tj_tjdjb", dt2)); //reportView.Refresh(); reportView.RefreshReport(); }
void LoadDjxx() { string djh = txtDjh.Text.Trim(); djh = comn.CharConverter(djh); djh = ChangeNum(djh); txtDjh.Text = djh; dt = new DataTable(); dt = jyjkBiz.GetDjxx(djh, comn.CharConverter(txtTjbh.Text.Trim())); if (dt.Rows.Count == 0) { MessageBox.Show("登记流水号【" + djh + "】无效!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.ActiveControl = txtDjh; txtDjh.SelectAll(); return; } string jyjx = cmbJyyq.SelectedValue.ToString().Trim(); string djbh = dt.Rows[0]["djlsh"].ToString().Trim(); cmbFb.SelectedIndex = 2; if (jyjkBiz.HasExist(jyjx, djbh))//如果已存在,将光标指向该项 PEIS.jyjk.Form_jysjlr { LoadDgvJydj(jyjx, "", djbh, cmbFb.SelectedIndex); int i = 0; for (; i < dgvJydj.Rows.Count; i++) { string djlsh2 = dgvJydj.Rows[i].Cells["djlsh"].Value.ToString().Trim(); if (djlsh2 == djbh) { break; } } if (dgvJydj.Rows.Count > 0) { dgvJydj.CurrentCell = dgvJydj.Rows[i].Cells[3]; } } else//不存在则插入记录 { Jydj jydj = new Jydj(); jydj.Djlsh = dt.Rows[0]["djlsh"].ToString().Trim(); jydj.Djrq = dtpDjrq.Value.ToString(); jydj.Dwmc = dt.Rows[0]["dwmc"].ToString().Trim(); jydj.Jyjx = jyjx; jydj.Nl = dt.Rows[0]["nl"].ToString().Trim(); jydj.Rylb = dt.Rows[0]["rylb"].ToString().Trim(); jydj.Sfzh = dt.Rows[0]["sfzh"].ToString().Trim(); jydj.Tjbh = dt.Rows[0]["tjbh"].ToString().Trim(); jydj.Xb = dt.Rows[0]["xb"].ToString().Trim(); jydj.Xm = dt.Rows[0]["xm"].ToString().Trim(); jydj.Gz = dt.Rows[0]["gz"].ToString().Trim(); string czyid = ""; if (cmbJcys.SelectedIndex != -1) { czyid = cmbJcys.SelectedValue.ToString(); } jydj.Jcys = czyid; jydj.Shrq = xtBiz.GetDataNow().ToString(); jydj.Shys = Program.userid; jydj.Tcmc = dt.Rows[0]["tcmc"].ToString().Trim().Split('(')[0]; int count = jyjkBiz.Insert(jydj); if (count > 0) { LoadDgvJydj(jyjx, dtpDjrq.Value.ToString("yyyy-MM-dd"), "", cmbFb.SelectedIndex); } } string zdtx = xtBiz.GetXtCsz("zdtx"); if (zdtx == "1" && cmbJyyq.SelectedValue.ToString() == "0002")//目前只有BC5300具备通讯功能 { btnTx_Click(null, null); } }