public static byte[] GetBarCode(string txt, BarcodeType type, BarcodeTextPosition txtpos) { string path = Application.StartupPath + "\\log.bmp"; string strtxm = txt; FileStream filestr = new FileStream(path, FileMode.Create); Cobainsoft.Windows.Forms.BarcodeControl control = new BarcodeControl(); //实例化 control.BarcodeType = type; //启用的编码 control.Data = strtxm; //生成编码的字符串 control.StretchText = false; control.CopyRight = ""; //显示标题 control.TextPosition = txtpos; //显示位置,Above,NotShown,Below filestr.Close(); //关闭文件 control.SaveImage(ImageFormat.Bmp, 1, 90, true, false, null, path); byte[] imgs = SetImageToByteArray(path); if (System.IO.File.Exists(path)) { try { System.IO.File.Delete(path); } catch { MessageBox.Show("缺少log.bmp文件"); } } return(imgs); }
void PrintRdlc(string tjbh, string tjcs, string djlsh) { BarcodeControl barcode = new BarcodeControl(); barcode.BarcodeType = BarcodeType.CODE128C; barcode.Data = djlsh; barcode.CopyRight = ""; MemoryStream stream = new MemoryStream(); barcode.MakeImage(ImageFormat.Png, 1, 40, 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; LocalReport report = new LocalReport(); DataTable dt2 = rdlcbiz.Get_v_tj_tjdjb(tjbh, tjcs); report.ReportPath = Application.StartupPath + @"/rdlcreport/Report_tjtxm.rdlc"; report.EnableExternalImages = true; ReportParameter rp1 = new ReportParameter("barcode", str_path); report.DataSources.Clear(); report.SetParameters(new ReportParameter[] { rp1 }); report.DataSources.Add(new ReportDataSource("PEISDataSet_v_tj_tjdjb", dt2)); RdlcPrintNew rdlcprint = new RdlcPrintNew(); rdlcprint.Run(report, "体检条形码打印", false, "tmdy"); }
public NewBarcodeWindow(BarcodeControl barcodeToEdit = null) { InitializeComponent(); if (barcodeToEdit != null) { EditMode = true; NewBarcodeVM.SetBarcodeTmp(barcodeToEdit); } }
/// <summary> /// Ustawienie wszystkich właściwości z obiektu przysłanego z okna głównego /// </summary> /// <param name="barocdeTmp"></param> internal void SetBarcodeTmp(BarcodeControl barocdeTmp) { CodeName = barocdeTmp.Name; CodeWidth = barocdeTmp.Width; CodeHeight = barocdeTmp.Height; CodeMargin = barocdeTmp.CodeMargin; CodeText = barocdeTmp.CodeText; PureCode = barocdeTmp.PureCode; ImgSource = barocdeTmp.Source; SelectedCodeFormat = barocdeTmp.CodeType; }
private void reportView_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.SetParameters(new ReportParameter[] { rp1, rp2, rp3, rp4 }); reportView.LocalReport.DataSources.Add(new ReportDataSource("PEISDataSet_v_tj_zyb_ryxx", dt2)); this.reportView.RefreshReport(); }
/// <summary> /// Konstruktor ustawiający parametry obiektu tymczasowego, który zostanie zwrócony do okna głównego /// </summary> public NewBarcodeViewModel() { BarcodeTmp = new BarcodeControl() { Name = CodeName, Width = CodeWidth, Height = CodeHeight, CodeMargin = CodeMargin, CodeText = CodeText, PureCode = PureCode, Source = ImgSource, CodeType = selectedCodeFormat }; RefreshCode(); }
public void WriteBarcode(string barcode, BarcodeType barcodeType) { BarcodeControl BCctrl = new BarcodeControl(); BCctrl.TextPosition = BarcodeTextPosition.NotShown; BCctrl.HorizontalAlignment = BarcodeHorizontalAlignment.Center; BCctrl.Location = new Point(0, 0); BCctrl.BarcodeType = barcodeType; BCctrl.CopyRight = ""; BCctrl.Size = new Size(200, 40); BCctrl.Data = barcode; Rectangle rect = new Rectangle(0, 0, BCctrl.Width, BCctrl.Height); Bitmap bitmap = new Bitmap(BCctrl.Width, BCctrl.Height); BCctrl.DrawToBitmap(bitmap, rect); WriteImage(bitmap); }
void PrintRdlc(string tjbh, string tjcs, string djlsh) { BarcodeControl barcode = new BarcodeControl(); barcode.BarcodeType = BarcodeType.CODE128C; barcode.Data = 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 strLog = "file:///" + Application.StartupPath + @"/Img/log.jpg"; //DataTable dt1 = rdlcbiz.Get_tj_tjjlb(tjbh, tjcs); DataTable dt2 = rdlcbiz.Get_v_tj_tjdjb(tjbh, tjcs); DataTable dt3 = rdlcbiz.Get_v_tj_fyxx(tjbh, tjcs); DataTable dt1 = rdlcbiz.Get_tj_tjjlb_ks(tjbh, tjcs); LocalReport report = new LocalReport(); //report.ReportPath = Application.StartupPath + @"/rdlcreport/Report_tjzyd.rdlc"; report.ReportPath = Application.StartupPath + @"/rdlcreport/Report_tjzyd_zyb_0120.rdlc";//by zhz report.EnableExternalImages = true; ReportParameter rp1 = new ReportParameter("tjdw", Program.reg_dwmc); ReportParameter rp2 = new ReportParameter("barcode", str_path); ReportParameter rp3 = new ReportParameter("tjdh", str_dwdh); ReportParameter rp4 = new ReportParameter("log", strLog); report.DataSources.Clear(); report.SetParameters(new ReportParameter[] { rp1, rp2, rp3, rp4 }); report.DataSources.Add(new ReportDataSource("PEISDataSet_tj_tjjlb", dt1)); report.DataSources.Add(new ReportDataSource("PEISDataSet_v_tj_tjdjb", dt2)); report.DataSources.Add(new ReportDataSource("PEISDataSet_v_tj_fyxx", dt3)); RdlcPrintNew rdlcprint = new RdlcPrintNew(); rdlcprint.Run(report, "体检指引单打印", false, "A4"); }
private void GenerateBarcode(object sender, RoutedEventArgs e) { BarcodeControl.GenerateBarcode(); // string data = ""; // int count = 6; // Random random = new Random(); // for (int i = 0; i < count; i++) // { // data += random.Next(0, 9).ToString(); // } // ///////////////////////////////////// // // Encode The Data // ///////////////////////////////////// // BarcodeControl.BarcodeType = BarcodeEnum.Code39; // BarcodeControl.Data = data; // BarcodeControl.HasCheckDigit = true; // BarcodeControl.Encode(); }
//private PrintWaiting pw = new PrintWaiting(); void PrintRdlc(string tjbh, string tjcs, string djlsh) { //pw BarcodeControl barcode = new BarcodeControl(); barcode.BarcodeType = BarcodeType.CODE128C; barcode.Data = 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; string sqd_ts = xtbiz.GetXtCsz("sqd_ts"); LocalReport report = new LocalReport(); DataTable dt1 = rdlcbiz.Get_tj_sqdlx_hd(tjbh, tjcs); DataTable dt2 = rdlcbiz.Get_v_tj_tjdjb(tjbh, tjcs); report.ReportPath = Application.StartupPath + @"/rdlcreport/Report_tjsqd.rdlc"; report.EnableExternalImages = true; ReportParameter rp1 = new ReportParameter("tjdw", Program.reg_dwmc); ReportParameter rp2 = new ReportParameter("barcode", str_path); ReportParameter rp3 = new ReportParameter("sqd_ts", sqd_ts); report.DataSources.Clear(); report.SetParameters(new ReportParameter[] { rp1, rp2, rp3 }); report.DataSources.Add(new ReportDataSource("PEISDataSet_tj_sqdlx_hd", dt1)); report.DataSources.Add(new ReportDataSource("PEISDataSet_v_tj_tjdjb", dt2)); RdlcPrintNew rdlcprint = new RdlcPrintNew(); rdlcprint.Run(report, "体检申请单打印", false, "A4"); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "image/jpeg"; int fontSize = 9; if (context.Request.QueryString["fontSize"] != null) { fontSize = Convert.ToInt32(context.Request.QueryString["fontSize"]); } BarcodeControl barcode = new BarcodeControl(); barcode.BarcodeData = context.Request.QueryString["code"]; barcode.Symbology = BarcodeControl.BarcodeSymbology.CODE39; barcode.DisplayCheckDigitText = BarcodeControl.BarcodeDisplayCheckDigitText.No; barcode.DisplayStartStopCharacter = BarcodeControl.BarcodeDisplayStartStopCharacter.No; barcode.Font = new Font("Verdana, Arial, Helvetica, sans-serif", fontSize); byte[] b = barcode.GetImageJPG(); context.Response.OutputStream.Write(b, 0, b.Length - 1); }
private void bt_yl_Click(object sender, EventArgs e) { panel.Controls.Clear(); //数据库获取 dt = lisbiz.Get_TJ_DJINFO(txt_txm.Text.Trim()); if (dt.Rows.Count > 0)//存在记录 { for (int i = 0; i < lisbiz.Get_TJ_BB(txt_txm.Text.Trim()).Rows.Count; i++) { UCBarCode UcBarCode = new UCBarCode(); UcBarCode.Location = new Point((i % 4) * 140, (i / 4) * 110); panel.Controls.Add(UcBarCode); foreach (Control control in UcBarCode.Controls) { if (control.Name == "barcode") { BarcodeControl barcode = (BarcodeControl)control; barcode.Data = dt.Rows[0]["djlsh"].ToString().Trim(); barcode.CopyRight = dt.Rows[0]["xm"].ToString().Trim() + " " + dt.Rows[0]["xb"].ToString().Trim() + " " + dt.Rows[0]["nl"].ToString().Trim(); } if (control.Name == "label") { Label label = (Label)control; label.Text = lisbiz.Exec_Proc_tj_bbmx(lisbiz.Get_TJ_BB(txt_txm.Text.Trim()).Rows[i]["bbbh"].ToString().Trim(), lisbiz.Get_TJ_BB(txt_txm.Text.Trim()).Rows[i]["bblx"].ToString().Trim()); } } } Invalidate(); } else { MessageBox.Show("该人员信息不存在,请核实!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); txt_txm.Text = ""; this.ActiveControl = this.txt_txm; } }
void PrintRdlc(string tjbh, string tjcs, string djlsh) { BarcodeControl barcode = new BarcodeControl(); barcode.BarcodeType = BarcodeType.CODE128A; //CODE128C barcode.Data = tjbh; //djlsh流水号变编号tjbh 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 strLog = "file:///" + Application.StartupPath + @"/Img/log.jpg"; //DataTable dt1 = rdlcbiz.Get_tj_tjjlb(tjbh, tjcs); DataTable dt2 = rdlcbiz.Get_v_tj_tjdjb(tjbh, tjcs); DataTable dt3 = rdlcbiz.Get_v_tj_fyxx(tjbh, tjcs); DataTable dt1 = rdlcbiz.Get_tj_tjjlb_ks(tjbh, tjcs); LocalReport report = new LocalReport(); if (xtbiz.GetXtCsz("version").Trim() == "1") //职业体检 { report.ReportPath = Application.StartupPath + @"/rdlcreport/Report_tjzyd_zyb.rdlc"; } else { ///report.ReportPath = Application.StartupPath + @"/rdlcreport/Report_tjzyd.rdlc"; report.ReportPath = Application.StartupPath + @"/rdlcreport/Report_tjzyd_zyb_0120.rdlc"; } report.EnableExternalImages = true; ReportParameter rp1 = new ReportParameter("tjdw", Program.reg_dwmc); ReportParameter rp2 = new ReportParameter("barcode", str_path); ReportParameter rp3 = new ReportParameter("tjdh", str_dwdh); ReportParameter rp4 = new ReportParameter("log", strLog); ReportParameter rp5 = new ReportParameter("dwcz", str_dwczhm); ReportParameter rp6 = new ReportParameter("dwlxr", str_dwlxr); ReportParameter rp7 = new ReportParameter("version", str_version); ReportParameter rp8 = new ReportParameter("dwdz", str_dwdz); report.DataSources.Clear(); report.SetParameters(new ReportParameter[] { rp1, rp2, rp3, rp4, rp5, rp6, rp7, rp8 }); report.DataSources.Add(new ReportDataSource("PEISDataSet_tj_tjjlb", dt1)); report.DataSources.Add(new ReportDataSource("PEISDataSet_v_tj_tjdjb", dt2)); report.DataSources.Add(new ReportDataSource("PEISDataSet_v_tj_fyxx", dt3)); RdlcPrintNew rdlcprint = new RdlcPrintNew(); rdlcprint.PrinterName = cboxPrinter.SelectedItem.ToString(); rdlcprint.Page_x = Convert.ToInt32(tb_zyd_x.Text); rdlcprint.Page_y = Convert.ToInt32(tb_zyd_y.Text); //rdlcprint.PageWidth = tb_zyd_w.Text; //rdlcprint.PageHeight = tb_zyd_h.Text; rdlcprint.Page_scale = (float)numericUpDown_scale.Value; rdlcprint.Hxdy = cb_heng.Checked; rdlcprint.Run(report, "体检指引单打印", false, "A4"); }
public void PrintRdlc(string tjbh, string tjcs, string djlsh, string pagefw, string bggs) { str_tjbh = tjbh; str_tjcs = tjcs; str_djlsh = djlsh; if (bggs == "") { bggs = "标准格式"; } 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_picpath = Application.StartupPath + @"/Img/医院徽标.bmp"; string str_barpath = Application.StartupPath + @"/barcode.png"; string str_ZYBG_Top = Application.StartupPath + @"/Img/ZYBG_Top.png"; string str_yyewm = Application.StartupPath + @"/Img/微信.png"; myimge.Save(str_barpath, ImageFormat.Png); str_picpath = "file:///" + str_picpath; str_barpath = "file:///" + str_barpath; str_ZYBG_Top = "file:///" + str_ZYBG_Top; str_yyewm = "file:///" + str_yyewm;//微信二维码 DataTable dt2 = rdlcbiz.Get_v_tj_tjdjb(str_tjbh, str_tjcs); LocalReport report = new LocalReport(); RdlcPrintNew rdlcprint = new RdlcPrintNew(); string str_tjlb = dt2.Rows[0]["lbbh"].ToString();//中医体检 2014-06-26 if (str_tjlb == "05") { DataTable dt = tjjgbiz.Get_v_tj_zyjgb(str_tjbh, str_tjcs); byte[] bytes = PEIS.Properties.Resources.Report_tjbg_zytj; FileStream fstream = File.Create(@"C:\WINDOWS\Temp\Report_tjbg_temp", bytes.Length); try { fstream.Write(bytes, 0, bytes.Length); //二进制转换成文件 } catch (Exception ex) { //抛出异常信息 MessageBox.Show("报表文件处理异常,请联系技术支持人员!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { fstream.Close(); } File.Copy(@"C:\WINDOWS\Temp\Report_tjbg_temp", @"C:\WINDOWS\Temp\Report_tjbg_zytj", true); report.ReportPath = @"C:\WINDOWS\Temp\Report_tjbg_zytj"; //report.ReportPath = Application.StartupPath + @"/rdlcreport/Report_tjbg_zytj.rdlc"; report.DisplayName = "蒙藏医体质识别报告"; report.EnableExternalImages = true; report.DataSources.Clear(); ReportParameter rp = new ReportParameter("dwmc", Program.reg_dwmc); ReportParameter rp_top = new ReportParameter("ZYBG_Top", str_ZYBG_Top); report.SetParameters(new ReportParameter[] { rp, rp_top }); report.DataSources.Add(new ReportDataSource("PEISDataSet_v_tj_zyjgb", dt)); rdlcprint.Run(report, "蒙藏医体质识别报告", false, "A4", pagefw); tjjgbiz.Update_tj_tjdjb_Dycs(str_tjbh, str_tjcs);//修改打印次数 return; } report.SubreportProcessing += new SubreportProcessingEventHandler(report_SubreportProcessing); if (bggs == "明细结果格式") { report.ReportPath = Application.StartupPath + @"/rdlcreport/Report_tjbg_jgjcb.rdlc"; } else if (bggs == "结论格式") { report.ReportPath = Application.StartupPath + @"/rdlcreport/Report_tjbg_zsbg.rdlc"; } else//标准格式 // report.ReportPath = Application.StartupPath + @"/rdlcreport/Report_tjbg.rdlc"; { report.ReportPath = Application.StartupPath + @"/rdlc/Report_tjbg_zs_贺州.rdlc"; } report.EnableExternalImages = true; ReportParameter rp1 = new ReportParameter("tjdw", Program.reg_dwmc); ReportParameter rp2 = new ReportParameter("barcode", str_barpath); ReportParameter rp3 = new ReportParameter("tjdh", str_dwdh); ReportParameter rp4 = new ReportParameter("yypic", str_picpath); ReportParameter rp5 = new ReportParameter("yyewm", str_yyewm); report.DataSources.Clear(); //report.SetParameters(new ReportParameter[] { rp1, rp2, rp3, rp4,rp5 });//改变格式 report.DataSources.Add(new ReportDataSource("PEISDataSet_v_tj_tjdjb", dt2)); rdlcprint.PrinterName = cboxPrinter.SelectedItem.ToString(); //rdlcprint.Run(report, "体检报告打印", false, "A4",pagefw); rdlcprint.Run(report, "体检报告打印", false, "A4"); tjjgbiz.Update_tj_tjdjb_Dycs(str_tjbh, str_tjcs);//修改打印次数 }
private void Form_report_Load(object sender, EventArgs e) { str_tjdw = xtbiz.GetXtCsz("TjDwMc"); str_dwdh = xtbiz.GetXtCsz("TjDwDh"); sqd_ts = xtbiz.GetXtCsz("sqd_ts"); BarcodeControl barcode = new BarcodeControl(); barcode.BarcodeType = BarcodeType.CODE128A; //CODE128C barcode.Data = str_tjbh; //流水号改编号 by zhz barcode.CopyRight = ""; MemoryStream stream = new MemoryStream(); barcode.MakeImage(ImageFormat.Png, 1, 50, true, false, null, stream); Bitmap myimge = new Bitmap(stream); string str_picpath = Application.StartupPath + @"/Img/医院徽标.bmp"; string str_barpath = Application.StartupPath + @"/barcode.png"; string str_ZYBG_Top = Application.StartupPath + @"/Img/ZYBG_Top.png"; string str_yyewm = Application.StartupPath + @"/Img/微信.png"; myimge.Save(str_barpath, ImageFormat.Png); str_picpath = "file:///" + str_picpath; str_barpath = "file:///" + str_barpath; str_ZYBG_Top = "file:///" + str_ZYBG_Top; string strLog = "file:///" + Application.StartupPath + @"/Img/log.jpg"; str_yyewm = "file:///" + str_yyewm;//微信二维码 if (str_type == "tjzyd") { string str_dwlxr = ""; //联系人 string str_dwczhm = ""; //传真 string str_version = ""; //版本 string str_dwdz = ""; //地址 str_dwczhm = xtbiz.GetXtCsz("dwczdh").Trim(); str_dwlxr = xtbiz.GetXtCsz("dwlxr").Trim(); str_dwdz = xtbiz.GetXtCsz("dwdz").Trim(); str_version = xtbiz.GetXtCsz("version").Trim(); //DataTable dt1 = rdlcbiz.Get_tj_tjjlb(str_tjbh, str_tjcs); DataTable dt2 = rdlcbiz.Get_v_tj_tjdjb(str_tjbh, str_tjcs); DataTable dt3 = rdlcbiz.Get_v_tj_fyxx(str_tjbh, str_tjcs); DataTable dt1 = rdlcbiz.Get_tj_tjjlb_ks(str_tjbh, str_tjcs); if (xtbiz.GetXtCsz("version").Trim() == "1") //职业 { reportView.LocalReport.ReportPath = Application.StartupPath + @"/rdlcreport/Report_tjzyd_zyb.rdlc"; } else { //reportView.LocalReport.ReportPath = Application.StartupPath + @"/rdlcreport/Report_tjzyd.rdlc"; reportView.LocalReport.ReportPath = Application.StartupPath + @"/rdlcreport/Report_tjzyd_zyb_0120.rdlc";//by zhz 0121 } reportView.LocalReport.EnableExternalImages = true; ReportParameter rp1 = new ReportParameter("tjdw", str_tjdw); ReportParameter rp2 = new ReportParameter("barcode", str_barpath); ReportParameter rp3 = new ReportParameter("tjdh", str_dwdh); ReportParameter rp4 = new ReportParameter("log", strLog); ReportParameter rp5 = new ReportParameter("dwcz", str_dwczhm); ReportParameter rp6 = new ReportParameter("dwlxr", str_dwlxr); ReportParameter rp7 = new ReportParameter("version", str_version); ReportParameter rp8 = new ReportParameter("dwdz", str_dwdz); reportView.LocalReport.DataSources.Clear(); reportView.LocalReport.SetParameters(new ReportParameter[] { rp1, rp2, rp3, rp4, rp5, rp6, rp7, rp8 }); reportView.LocalReport.DataSources.Add(new ReportDataSource("PEISDataSet_tj_tjjlb", dt1));// by zhz reportView.LocalReport.DataSources.Add(new ReportDataSource("PEISDataSet_v_tj_tjdjb", dt2)); reportView.LocalReport.DataSources.Add(new ReportDataSource("PEISDataSet_v_tj_fyxx", dt3)); } if (str_type == "tjsqd") { DataTable dt1 = rdlcbiz.Get_tj_sqdlx_hd(str_tjbh, str_tjcs); DataTable dt2 = rdlcbiz.Get_v_tj_tjdjb(str_tjbh, str_tjcs); reportView.LocalReport.ReportPath = Application.StartupPath + @"/rdlcreport/Report_tjsqd.rdlc"; reportView.LocalReport.EnableExternalImages = true; ReportParameter rp1 = new ReportParameter("tjdw", str_tjdw); ReportParameter rp2 = new ReportParameter("barcode", str_barpath); ReportParameter rp3 = new ReportParameter("sqd_ts", sqd_ts); reportView.LocalReport.DataSources.Clear(); reportView.LocalReport.SetParameters(new ReportParameter[] { rp1, rp2, rp3 }); reportView.LocalReport.DataSources.Add(new ReportDataSource("PEISDataSet_tj_sqdlx_hd", dt1)); reportView.LocalReport.DataSources.Add(new ReportDataSource("PEISDataSet_v_tj_tjdjb", dt2)); } if (str_type == "tjtxm") { DataTable dt2 = rdlcbiz.Get_v_tj_tjdjb(str_tjbh, str_tjcs); reportView.LocalReport.ReportPath = Application.StartupPath + @"/rdlcreport/Report_tjtxm.rdlc"; reportView.LocalReport.EnableExternalImages = true; ReportParameter rp1 = new ReportParameter("barcode", str_barpath); reportView.LocalReport.DataSources.Clear(); reportView.LocalReport.SetParameters(new ReportParameter[] { rp1 }); reportView.LocalReport.DataSources.Add(new ReportDataSource("PEISDataSet_v_tj_tjdjb", dt2)); } if (str_type == "tjbg") { DataTable dt2 = rdlcbiz.Get_v_tj_tjdjb(str_tjbh, str_tjcs); string str_tjlb = dt2.Rows[0]["lbbh"].ToString(); if (str_tjlb == "05")//中医体检 2014-06-26 { DataTable dt = tjjgbiz.Get_v_tj_zyjgb(str_tjbh, str_tjcs); byte[] bytes = PEIS.Properties.Resources.Report_tjbg_zytj; FileStream fstream = File.Create(@"C:\WINDOWS\Temp\Report_tjbg_temp", bytes.Length); try { fstream.Write(bytes, 0, bytes.Length); //二进制转换成文件 } catch (Exception ex) { //抛出异常信息 MessageBox.Show("报表文件处理异常,请联系技术支持人员!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { fstream.Close(); } File.Copy(@"C:\WINDOWS\Temp\Report_tjbg_temp", @"C:\WINDOWS\Temp\Report_tjbg_zytj", true); reportView.LocalReport.ReportPath = @"C:\WINDOWS\Temp\Report_tjbg_zytj"; //reportView.LocalReport.ReportPath = Application.StartupPath + @"/rdlcreport/Report_tjbg_zytj.rdlc"; reportView.LocalReport.EnableExternalImages = true; reportView.LocalReport.DataSources.Clear(); ReportParameter rp = new ReportParameter("dwmc", Program.reg_dwmc); ReportParameter rp_top = new ReportParameter("ZYBG_Top", str_ZYBG_Top); reportView.LocalReport.SetParameters(new ReportParameter[] { rp, rp_top }); reportView.LocalReport.DataSources.Add(new ReportDataSource("PEISDataSet_v_tj_zyjgb", dt)); this.reportView.RefreshReport(); return; } reportView.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing); if (str_bggs == "明细结果格式") { reportView.LocalReport.ReportPath = Application.StartupPath + @"/rdlcreport/Report_tjbg_jgjcb.rdlc"; } else if (str_bggs == "结论格式") { reportView.LocalReport.ReportPath = Application.StartupPath + @"/rdlcreport/Report_tjbg_zsbg.rdlc"; } else//标准格式 //reportView.LocalReport.ReportPath = Application.StartupPath + @"/rdlcreport/Report_tjbg.rdlc"; { reportView.LocalReport.ReportPath = Application.StartupPath + @"/rdlc/Report_tjbg_zs_贺州.rdlc"; } reportView.LocalReport.EnableExternalImages = true; ReportParameter rp1 = new ReportParameter("tjdw", str_tjdw); ReportParameter rp2 = new ReportParameter("barcode", str_barpath); ReportParameter rp3 = new ReportParameter("tjdh", str_dwdh); ReportParameter rp4 = new ReportParameter("yypic", str_picpath); ReportParameter rp5 = new ReportParameter("yyewm", str_yyewm); reportView.LocalReport.DataSources.Clear(); //reportView.LocalReport.SetParameters(new ReportParameter[] { rp1, rp2, rp3,rp4,rp5 }); //reportView.LocalReport.DataSources.Add(new ReportDataSource("PEISDataSet_tj_tjjlb", dt1)); reportView.LocalReport.DataSources.Add(new ReportDataSource("PEISDataSet_v_tj_tjdjb", dt2)); } this.reportView.RefreshReport(); }
/// <summary> /// 打印健康档案 /// </summary> /// <param name="tjbh">体检编号</param> /// <param name="tjcs">体检次数</param> /// <param name="djlsh">登记流水号</param> /// <param name="pagefw">打印页码范围,""表示所有</param> public void PrintJkda(string tjbh, string tjcs, string djlsh, string pagefw) { BarcodeControl barcode = new BarcodeControl(); barcode.BarcodeType = BarcodeType.CODE128C; barcode.Data = 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 str_dwlxr = xtBiz.GetXtCsz("dwlxr").Trim(); str_dwdz = xtBiz.GetXtCsz("dwdz").Trim(); str_dwdh = xtBiz.GetXtCsz("TjDwDh").Trim(); str_tjzgzbh = xtBiz.GetXtCsz("zytjzgbh").Trim();//职业健康体检资格编号 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //this.strTjbh = tjbh; //this.strTjcs = tjcs; //LocalReport report = new LocalReport(); //report.SubreportProcessing += new SubreportProcessingEventHandler(report_SubreportProcessing); //string title = "职业健康检查表"; //DataTable dt2 = GetZybRyxx(tjbh, tjcs); //report.ReportPath = Application.StartupPath + @"/rdlcreport/Report_zyb_jkda_new.rdlc"; //report.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); //report.DataSources.Clear(); //report.SetParameters(new ReportParameter[] { rp1, rp2, rp3, rp4, rp5, rp6, rp7, rp8 }); ////report.SetParameters(new ReportParameter[] { rp1, rp2, rp3, rp4,rp8 }); //report.DataSources.Add(new ReportDataSource("PEISDataSet_v_tj_zyb_ryxx", dt2)); //RdlcPrintNew rdlcprint = new RdlcPrintNew(); //rdlcprint.Run(report, "职业健康检查表打印", false, "A4", pagefw); //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ this.strTjbh = tjbh; this.strTjcs = tjcs; LocalReport report = new LocalReport(); report.SubreportProcessing += new SubreportProcessingEventHandler(report_SubreportProcessing); string title = xtBiz.GetXtCsz("TjDwMc"); DataTable dt2 = GetZybRyxx(tjbh, tjcs); report.ReportPath = Application.StartupPath + @"/rdlcreport/Report_zyb_jkda_new.rdlc"; report.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); report.DataSources.Clear(); report.SetParameters(new ReportParameter[] { rp1, rp2, rp3, rp4, rp5, rp6, rp7, rp8 }); //report.SetParameters(new ReportParameter[] { rp1, rp2, rp3, rp4,rp8 }); report.DataSources.Add(new ReportDataSource("PEISDataSet_v_tj_zyb_ryxx", dt2)); RdlcPrintNew rdlcprint = new RdlcPrintNew(); rdlcprint.Run(report, "职业健康检查表打印", false, "A4", pagefw); }