tijian_tieying/winform/cn.xinelu.MedicalCheckup.Client/Printer/Print.cs
2026-01-30 11:32:14 +08:00

5515 lines
232 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using cn.xinelu.MedicalCheckup.Client.Printer;
using CYQ.Data;
using dccdc.Report;
using Dicom;
using FastReport;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.Drawing.Printing;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Windows.Forms;
namespace cn.xinelu.MedicalCheckup.Client
{
public class Print
{
private static string _url = "";
private static string _reportPath = "";
//private static Configuration _config;
private static string _tm_dyj = "";
private static string _zj_dyj = "";
private static string _bg_dyj = "";
private static string _xp_dyj = "";
public static frmMsg formMsg;
public static Configuration Config
{
get
{
//if (_config == null)
//{
return System.Configuration.ConfigurationManager.OpenExeConfiguration(Assembly.GetExecutingAssembly().Location);
// }
//return _config;
}
}
public Print()
{
/*
*/
if ((Config.AppSettings.Settings.AllKeys as ICollection<string>).Contains("tm_dyj"))
{
_tm_dyj = Config.AppSettings.Settings["tm_dyj"].Value;
}
if ((Config.AppSettings.Settings.AllKeys as ICollection<string>).Contains("zj_dyj"))
{
_zj_dyj = Config.AppSettings.Settings["zj_dyj"].Value;
}
if ((Config.AppSettings.Settings.AllKeys as ICollection<string>).Contains("bg_dyj"))
{
_bg_dyj = Config.AppSettings.Settings["bg_dyj"].Value;
}
if ((Config.AppSettings.Settings.AllKeys as ICollection<string>).Contains("xp_dyj"))
{
_xp_dyj = Config.AppSettings.Settings["xp_dyj"].Value;
}
}
public static void readConf()
{
if ((Config.AppSettings.Settings.AllKeys as ICollection<string>).Contains("tm_dyj"))
{
_tm_dyj = Config.AppSettings.Settings["tm_dyj"].Value;
}
if ((Config.AppSettings.Settings.AllKeys as ICollection<string>).Contains("zj_dyj"))
{
_zj_dyj = Config.AppSettings.Settings["zj_dyj"].Value;
}
if ((Config.AppSettings.Settings.AllKeys as ICollection<string>).Contains("bg_dyj"))
{
_bg_dyj = Config.AppSettings.Settings["bg_dyj"].Value;
}
if ((Config.AppSettings.Settings.AllKeys as ICollection<string>).Contains("xp_dyj"))
{
_xp_dyj = Config.AppSettings.Settings["xp_dyj"].Value;
}
}
/// <summary>
/// 打印初始化
/// </summary>
/// <param name="reportname">报表名称</param>
/// <returns></returns>
public bool finit(string reportname)
{
//throw new NotImplementedException();
_url = ConfigurationManager.AppSettings["ReportUrl"];
WebClient wc = new WebClient();
_reportPath = Path.GetTempFileName();
try
{
wc.DownloadFile(_url + "/report/" + reportname, _reportPath);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + ex.StackTrace);
return false;
}
return true;
}
#region
public void PrintJZMYTM(string barcode, string username)
{
DataTable dt = new DataTable();
dt.Columns.Add("barcode");
dt.Columns.Add("username");
DataRow dr = dt.NewRow();
dr["barcode"] = barcode;
dr["username"] = username;
dt.Rows.Add(dr);
FastReport.Report re = new FastReport.Report();
re.Load(_reportPath);
re.RegisterData(dt, "barcode");
re.PrintSettings.ShowDialog = false;
if (!string.IsNullOrEmpty(_tm_dyj))
re.PrintSettings.Printer = _tm_dyj;
re.Print();
}
#endregion
#region
public void PrintTM(string physical_num)
{
//MessageBox.Show(Config.FilePath);
WebClient wc = new WebClient();
string jsonData = "";
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData = wc.DownloadString(_url + "professional/getTMByphysical_num/" + physical_num);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return;
}
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData);
if (dt.Rows.Count == 0)
return;
FastReport.Report re = new FastReport.Report();
re.Load(_reportPath);
re.RegisterData(dt, "barcode");
re.PrintSettings.ShowDialog = false;
//MessageBox.Show(_tm_dyj);
if (!string.IsNullOrEmpty(_tm_dyj))
re.PrintSettings.Printer = _tm_dyj;
re.Print();
}
#endregion
#region
public void Printzyd(string physicalNum)
{
WebClient wc = new WebClient();
string jsonData = "";
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData = wc.DownloadString(_url + "/Registration/GetRegisteModel?tm=" + physicalNum);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData);
FastReport.Report re = new FastReport.Report();
re.Load(_reportPath);
re.RegisterData(dt, "professionalExam_register");
DataTable tjlctop = new DataTable();
tjlctop.Columns.Add("lc");
DataTable tjlcbom = new DataTable();
tjlcbom.Columns.Add("lc");
DataTable zydtop = new DataTable();
zydtop.Columns.Add("zyd");
DataTable imagedt = new DataTable();
imagedt.Columns.Add("image", typeof(byte[]));
DataRow d = imagedt.NewRow();
d["image"] = Convert.FromBase64String(dt.Rows[0]["phone_path"].ToString());
imagedt.Rows.Add(d);
DataRow dr;
switch (dt.Rows[0]["physical_category"].ToString())
{
case "公共场所":
dr = zydtop.NewRow();
dr["zyd"] = "公共场所从业人员健康检查指引单";
zydtop.Rows.Add(dr);
DataRow dr1 = tjlctop.NewRow();
dr1["lc"] = "3. “内科”检查内科项目;";
DataRow dr2 = tjlctop.NewRow();
dr2["lc"] = "4. “皮肤科”检查皮肤;";
//DataRow dr3 = tjlctop.NewRow();
//dr3["lc"] = "5. “培训(201)室”卫生知识培训。";
tjlctop.Rows.Add(dr1); tjlctop.Rows.Add(dr2); //tjlctop.Rows.Add(dr3);
//DataRow dr10 = tjlcbom.NewRow();
//dr10["lc"] = "指引单到“办证室”领取健康证。";
//tjlcbom.Rows.Add(dr10);
break;
case "食品从业":
dr = zydtop.NewRow();
dr["zyd"] = "食品从业人员健康检查指引单";
zydtop.Rows.Add(dr);
DataRow dr4 = tjlctop.NewRow();
dr4["lc"] = "3. “皮肤科”检查皮肤;";
//DataRow dr5 = tjlctop.NewRow();
//dr5["lc"] = "4. “培训(201)室”卫生知识培训。";
tjlctop.Rows.Add(dr4);// tjlctop.Rows.Add(dr5);
//DataRow dr9 = tjlcbom.NewRow();
//dr9["lc"] = "指引单到“办证室”领取健康证。";
//tjlcbom.Rows.Add(dr9);
break;
case "药品从业":
dr = zydtop.NewRow();
dr["zyd"] = "药品从业人员健康检查指引单";
zydtop.Rows.Add(dr);
DataRow dr6 = tjlctop.NewRow();
dr6["lc"] = "3. “内科”检查内科项目;";
DataRow dr7 = tjlctop.NewRow();
dr7["lc"] = "4. “皮肤科”检查皮肤及辨色力;";
tjlctop.Rows.Add(dr6); tjlctop.Rows.Add(dr7);
//DataRow dr8 = tjlcbom.NewRow();
//dr8["lc"] = "指引单到“职业卫生科(206)室”领取检查表。";
//tjlcbom.Rows.Add(dr8);
DataRow dr8 = tjlctop.NewRow();
DataRow dr9 = tjlctop.NewRow();
dr8["lc"] = "5. “一楼院内X光室”检查胸透;";
dr9["lc"] = "6. “心电图室”检查心电图;";
tjlctop.Rows.Add(dr8); tjlctop.Rows.Add(dr9);
break;
default:
dr = zydtop.NewRow();
dr["zyd"] = "从业人员健康检查指引单";
zydtop.Rows.Add(dr);
break;
}
re.RegisterData(tjlcbom, "tjlcbom");
re.RegisterData(tjlctop, "tjlctop");
re.RegisterData(zydtop, "zydtop");
re.RegisterData(imagedt, "imagedt");
re.SetParameterValue("agreement_money", dt.Rows[0]["agreement_money"]);
re.PrintSettings.ShowDialog = false;
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
#endregion
#region
public void Printzyzyd(string physicalNum)
{
WebClient wc = new WebClient();
string jsonData = "";
string jsonqx = "";
string jsonBjxm = "";
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData = wc.DownloadString(_url + "/Registration/GetRegisteModel/?tm=" + physicalNum);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData);
FastReport.Report re = new FastReport.Report();
re.Load(_reportPath);
re.RegisterData(dt, "professionalExam_register");
DataTable qxdt = new DataTable();
qxdt.Columns.Add("qx");
try
{
jsonqx = wc.DownloadString(_url + "/Registration/GetTjxmRoom/?ids=" + dt.Rows[0]["check_item_ids"].ToString().TrimStart(',').TrimEnd(','));
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
DataTable qdt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonqx);
if (qdt.Rows.Count != 0)
{
DataTable ckrs = qdt.DefaultView.ToTable(true, "check_room");
foreach (DataRow drr in ckrs.Rows)
{
DataRow dr1 = qxdt.NewRow();
if (drr["check_room"].ToString().IndexOf("血检", StringComparison.Ordinal) > -1)
{
dr1["qx"] += drr["check_room"] + "上午空腹静脉抽血";// + (qdt.Rows[i]["team_name"].ToString().IndexOf("尿", StringComparison.Ordinal) > -1 ? ",留取尿样" : "");
bool f = false;
DataRow[] drs = qdt.Select("check_room='" + drr["check_room"] + "'");
foreach (DataRow drrr in drs)
{
if (drrr["team_name"].ToString().Contains("尿"))
{
f = true;
break;
}
}
if (f)
{
dr1["qx"] += ",留取尿样";
}
}
else
{
dr1["qx"] += drr["check_room"] + "检查";
}
qxdt.Rows.Add(dr1);
}
}
/*
for (int i = 0; i < qdt.Rows.Count; i++)
{
DataRow dr1 = qxdt.NewRow();
if (qdt.Rows[i]["check_room"].ToString().IndexOf("血检", StringComparison.Ordinal) > -1)
{
dr1["qx"] += qdt.Rows[i]["check_room"] + "上午空腹静脉抽血" + (qdt.Rows[i]["team_name"].ToString().IndexOf("尿", StringComparison.Ordinal) > -1 ? ",留取尿样" : "");
}
else
{
dr1["qx"] += qdt.Rows[i]["check_room"] + "检查";
}
qxdt.Rows.Add(dr1);
}*/
/*
if (qxdt.Select("qx like'%上午空腹静脉抽血,留取尿样'").Length > 0 && qxdt.Select("qx like'%上午空腹静脉抽血'").Length > 0)
{
qxdt.Rows.Remove(qxdt.Select("qx like'%上午空腹静脉抽血'")[0]);
}*/
DataView dv = qxdt.DefaultView;
DataTable distTable = dv.ToTable("Dist", true, "qx");
re.RegisterData(distTable, "qxdt");
try
{
jsonBjxm = wc.DownloadString(_url + "/Registration/GettjxmByIDsReport/?ids=" + dt.Rows[0]["check_item_ids"].ToString().TrimStart(',').TrimEnd(','));
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
DataTable bjxm = new DataTable();
DataTable tjxmdt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonBjxm);
bjxm.Columns.Add("bjxm");
foreach (DataRow daraRow in tjxmdt.Rows)
{
DataRow dr2 = bjxm.NewRow();
dr2["bjxm"] = daraRow["exam_group"].ToString();
bjxm.Rows.Add(dr2);
}
DataView dv1 = bjxm.DefaultView;
DataTable distTable1 = dv1.ToTable("Dist", true, "bjxm");
string g = "";
foreach (DataRow daraRow in distTable1.Rows)
{
g += daraRow["bjxm"] + ",";
}
DataTable dt3 = new DataTable();
dt3.Columns.Add("bjxm");
DataRow tt = dt3.NewRow();
tt["bjxm"] = g;
dt3.Rows.Add(tt);
re.RegisterData(dt3, "bjxmdt");
//说明------
DataTable smdt = new DataTable();
smdt.Columns.Add("sm");
DataRow dr = smdt.NewRow();
if (dt.Rows[0]["exam_type"].ToString().IndexOf("特种", StringComparison.Ordinal) > -1)
{
dr["sm"] = "体检项目完成后请回到二楼职业卫生科(206)领取《特种作业健康检查表》。";
}
else if (dt.Rows[0]["exam_type"].ToString().IndexOf("常规", StringComparison.Ordinal) > -1)
{
dr["sm"] = "1、请当天下午4点后到二楼职业卫生科(206)领取《" + dt.Rows[0]["exam_type"] +
"检查表》。\r\n2、请在空腹状态下接受肝功能检查孕妇接受透视或拍片时请事先告知医生抽血后用棉签按压穿刺处3-5分钟。";
}
else if (dt.Rows[0]["exam_type"].ToString().IndexOf("机动", StringComparison.Ordinal) > -1)
{
dr["sm"] = "1、请体检结束后到二楼职业卫生科(206)领取《" + dt.Rows[0]["exam_type"] +
"检查表》。";
}
else
{
dr["sm"] = "1、请当天下午4点后到二楼职业卫生科(206)领取《" + dt.Rows[0]["exam_type"] +
"检查表》。\r\n2、请在空腹状态下接受肝功能和B超检查孕妇接受透视或拍片时请事先告知医生抽血后用棉签按压穿刺处3-5分钟。";
}
smdt.Rows.Add(dr);
re.SetParameterValue("examtype", dt.Rows[0]["exam_type"].ToString());
re.SetParameterValue("agreement_money", dt.Rows[0]["agreement_money"]);
re.RegisterData(smdt, "smdt");
DataTable zydtop = new DataTable();
zydtop.Columns.Add("zyd");
DataRow dr6 = zydtop.NewRow();
dr6["zyd"] = dt.Rows[0]["exam_type"] + "指引单";
zydtop.Rows.Add(dr6);
re.RegisterData(zydtop, "zydtop");
DataTable imagedt = new DataTable();
imagedt.Columns.Add("image", typeof(byte[]));
DataRow d = imagedt.NewRow();
d["image"] = Convert.FromBase64String(dt.Rows[0]["phone_path"].ToString());
imagedt.Rows.Add(d);
re.RegisterData(imagedt, "imagedt");
re.PrintSettings.ShowDialog = false;
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
#endregion
#region
public void PrintTJB(string id)
{
WebClient wc = new WebClient();
string jsonData1 = "";
string jsonData2 = "";
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "Inspection/getOne1?id=" + id);
jsonData2 = wc.DownloadString(_url + "Inspection/getData3?id=" + id);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
DataTable dt1 = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
switch (dt1.Rows[0]["physical_category"].ToString())
{
case "公共场所":
finit("tjb2.frx");
break;
case "食品从业":
finit("tjb1.frx");
break;
case "药品从业":
finit("tjb.frx");
break;
default:
break;
}
DataTable dt2 = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData2);
FastReport.Report re = new FastReport.Report();
re.Load(_reportPath);
re.RegisterData(dt1, "professionalExam_register");
re.RegisterData(dt1Todt2(dt2), "dt2");
DataTable dt3 = new DataTable();
dt3.Columns.Add("title");
dt3.Columns.Add("image", typeof(byte[]));
DataRow row = dt3.NewRow();
switch (dt1.Rows[0]["physical_category"].ToString())
{
case "公共场所":
row["title"] = "从业人员健康检查表";
break;
case "食品从业":
row["title"] = "食品从业人员健康体检证明";
break;
case "药品从业":
row["title"] = "药品从业人员健康检查表";
break;
default:
row["title"] = "";
break;
}
row["image"] = Convert.FromBase64String(dt1.Rows[0]["phone_path"].ToString());
dt3.Rows.Add(row);
re.RegisterData(dt3, "dt3");
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.PrintSettings.ShowDialog = false;
re.Print();
}
private DataTable dt1Todt2(DataTable dt)
{
string[] arrs = {"肝炎","痢疾","伤寒","肺结核","皮肤病","渗出性皮肤病","化脓性皮肤病","活动性肺结核",
"痢疾杆菌(志贺氏)","伤寒或副伤寒(沙门氏)","谷丙转氨酶(ALT)","甲型病毒性肝炎","戊型病毒性肝炎","心",
"肝","脾","肺","手癣","指甲癣","手部湿疹","银屑(或鳞屑)病","X线胸透","抗HAV-IgM","抗HEV-IgM"};
DataTable dtNew = new DataTable();
dtNew.Columns.Add("ColumnName", typeof(string));
for (int i = 0; i < dt.Rows.Count; i++)
{
dtNew.Columns.Add(dt.Rows[i]["project_name"].ToString(), typeof(string));
}
List<string> listStrs = arrs.ToList();
List<string> listCols = new List<string>();
foreach (DataColumn col in dtNew.Columns)
{
listCols.Add(col.ColumnName);//获取到DataColumn列对象的列名
}
List<string> list = listStrs.Except(listCols).ToList();
//将系统中未设置的体检项目名称添加至报表数据中
for (int i = 0; i < list.Count; i++)
{
dtNew.Columns.Add(list[i], typeof(string));
}
DataRow drNew = dtNew.NewRow();
for (int i = 0; i < dt.Rows.Count; i++)
{
drNew[i] = dt.Rows[i]["project_result"].ToString();
}
dtNew.Rows.Add(drNew);
return dtNew;
}
#endregion
#region
public void PrintYmtj(string lx, string start, string end, string xm)
{
string rq = start + "|" + end;
string jsonData1 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "Charge4/getYmtjList?rq=" + rq + "&xm=" + xm);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//收费统计
DataTable ymDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
DataTable dt = new DataTable();
dt.Columns.Add("ymname1", typeof(string));
dt.Columns.Add("sl1", typeof(string));
dt.Columns.Add("je1", typeof(string));
dt.Columns.Add("ymname2", typeof(string));
dt.Columns.Add("sl2", typeof(string));
dt.Columns.Add("je2", typeof(string));
int i = 1;
if (ymDt.Rows.Count != 0)
{
DataRow dr = dt.NewRow();
foreach (DataRow r in ymDt.Rows)
{
if (i % 2 != 0)
{
dr["ymname1"] = r["name"].ToString();
dr["sl1"] = r["sl"].ToString();
dr["je1"] = r["je"].ToString();
if (ymDt.Rows.Count == i)
{
dr["ymname2"] = "";
dr["sl2"] = "";
dr["je2"] = "";
dt.Rows.Add(dr.ItemArray);
}
}
else
{
dr["ymname2"] = r["name"].ToString();
dr["sl2"] = r["sl"].ToString();
dr["je2"] = r["je"].ToString();
dt.Rows.Add(dr.ItemArray);
}
i++;
}
}
finit("ymtj.frx");
re.Load(_reportPath);
re.RegisterData(dt, "Table1");
re.SetParameterValue("start", start);
re.SetParameterValue("end", end);
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region
public void PrintSftj(string lx, string start, string end)
{
string rq = start + "|" + end;
//收费统计
string jsonData1 = "";
//收费方式统计
string jsonData2 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "QueryStatistics/getSftjList?rq=" + rq);
jsonData2 = wc.DownloadString(_url + "QueryStatistics/getSffsList?rq=" + rq);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//收费统计
DataTable sfDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
string fzName = "";
decimal xj = 0;
decimal hj = 0;
DataTable dt = new DataTable();
dt.Columns.Add("sfxm", typeof(string));
dt.Columns.Add("sl", typeof(string));
dt.Columns.Add("dj", typeof(string));
dt.Columns.Add("xj", typeof(string));
int i = 0;
foreach (DataRow r in sfDt.Rows)
{
DataRow dr = dt.NewRow();
if (fzName == "")
{
fzName = r["fzmc"].ToString();
dr["sfxm"] = r["sfxm"].ToString();
dr["sl"] = r["sl"].ToString();
dr["dj"] = r["dj"].ToString();
dr["xj"] = (Convert.ToDecimal(r["sl"].ToString()) * Convert.ToDecimal(r["dj"].ToString())).ToString();
xj += Convert.ToDecimal(r["sl"].ToString()) * Convert.ToDecimal(r["dj"].ToString());
dt.Rows.Add(dr.ItemArray);
}
else
{
if (r["fzmc"].ToString() == fzName)
{
dr["sfxm"] = r["sfxm"].ToString();
dr["sl"] = r["sl"].ToString();
dr["dj"] = r["dj"].ToString();
dr["xj"] = (Convert.ToDecimal(r["sl"].ToString()) * Convert.ToDecimal(r["dj"].ToString())).ToString();
xj += Convert.ToDecimal(r["sl"].ToString()) * Convert.ToDecimal(r["dj"].ToString());
dt.Rows.Add(dr.ItemArray);
}
else
{
hj += xj;
dr["sfxm"] = "(" + fzName + ")小计:";
dr["sl"] = "";
dr["dj"] = "";
dr["xj"] = xj.ToString();
fzName = "";
xj = 0;
dt.Rows.Add(dr.ItemArray);
DataRow dr1 = dt.NewRow();
fzName = r["fzmc"].ToString();
dr1["sfxm"] = r["sfxm"].ToString();
dr1["sl"] = r["sl"].ToString();
dr1["dj"] = r["dj"].ToString();
dr1["xj"] = (Convert.ToDecimal(r["sl"].ToString()) * Convert.ToDecimal(r["dj"].ToString())).ToString();
xj += Convert.ToDecimal(r["sl"].ToString()) * Convert.ToDecimal(r["dj"].ToString());
dt.Rows.Add(dr1.ItemArray);
}
}
if (i == sfDt.Rows.Count - 1)
{
hj += xj;
dr["sfxm"] = "(" + fzName + ")小计:";
dr["sl"] = "";
dr["dj"] = "";
dr["xj"] = xj.ToString();
fzName = "";
xj = 0;
dt.Rows.Add(dr.ItemArray);
}
i++;
}
//收费方式统计
DataTable sffsDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData2);
string sffsstr = "合计:";
foreach (DataRow s in sffsDt.Rows)
{
sffsstr += s["sffs"].ToString() + "(" + s["je"].ToString() + ")";
}
DataRow dr2 = dt.NewRow();
dr2["sfxm"] = "合计:";
dr2["sl"] = "";
dr2["dj"] = "";
dr2["xj"] = hj.ToString();
dt.Rows.Add(dr2.ItemArray);
finit("sftj.frx");
re.Load(_reportPath);
re.RegisterData(dt, "Table1");
re.SetParameterValue("sffstj", sffsstr);
re.SetParameterValue("start", start);
re.SetParameterValue("end", end);
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region
public void PrintFjrylb(string ids, string lx)
{
//注册信息professionalExam_register
string jsonData1 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "occupationExam/getProListByIds?ids=" + ids);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//取到客户信息表数据professionalExam_register
DataTable registerDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
finit("fjrylb.frx");
re.Load(_reportPath);
re.RegisterData(registerDt, "registerDt");
//选择报表模板
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region
public void PrintCGSQD(string sqdh, string lx)
{
//采购申请单
string jsonData1 = "";
//采购申请单明细
string jsonData2 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "wz/getCgsqdBySqdh?sqdh=" + sqdh);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//取到盘点单
DataTable cgsqdDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
if (cgsqdDt.Rows.Count != 0)
{
re.RegisterData(cgsqdDt, "cgsqd");
jsonData2 = wc.DownloadString(_url + "wz/getCgsqdMxBySqdId?sqdid=" + cgsqdDt.Rows[0]["id"].ToString());
//取到盘点单明细
DataTable cgsqdmxDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData2);
if (cgsqdmxDt.Rows.Count != 0)
{
re.RegisterData(cgsqdmxDt, "cgsqdmx");
}
else
{
DataTable cgsqdmxsDt = new DataTable();
cgsqdmxsDt.Columns.Add("id");
cgsqdmxsDt.Columns.Add("sqdid");
cgsqdmxsDt.Columns.Add("wzid");
cgsqdmxsDt.Columns.Add("wzmc");
cgsqdmxsDt.Columns.Add("sl");
cgsqdmxsDt.Columns.Add("dj");
cgsqdmxsDt.Columns.Add("czsj");
re.RegisterData(cgsqdmxsDt, "cgsqdmx");
}
}
else
{
DataTable cgsqdsDt = new DataTable();
cgsqdsDt.Columns.Add("id");
cgsqdsDt.Columns.Add("sqdh");
cgsqdsDt.Columns.Add("sqrid");
cgsqdsDt.Columns.Add("sqr");
cgsqdsDt.Columns.Add("sqksid");
cgsqdsDt.Columns.Add("sqks");
cgsqdsDt.Columns.Add("sqrq");
cgsqdsDt.Columns.Add("jflyid");
cgsqdsDt.Columns.Add("jfly");
cgsqdsDt.Columns.Add("sqyy");
cgsqdsDt.Columns.Add("cgje");
cgsqdsDt.Columns.Add("zt");
cgsqdsDt.Columns.Add("bmld");
cgsqdsDt.Columns.Add("bmshsj");
cgsqdsDt.Columns.Add("dwld");
cgsqdsDt.Columns.Add("dwshsj");
cgsqdsDt.Columns.Add("czsj");
cgsqdsDt.Columns.Add("cgzt");
re.RegisterData(cgsqdsDt, "cgsqd");
}
finit("cgsqd.frx");
re.Load(_reportPath);
//选择报表模板
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region 退
public void PrintTKD(string tkdh, string lx)
{
//退库单
string jsonData1 = "";
//退库单明细
string jsonData2 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "kc/getTkdByTkdh?tkdh=" + tkdh);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//取到盘点单
DataTable tkdDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
if (tkdDt.Rows.Count != 0)
{
re.RegisterData(tkdDt, "tkd");
jsonData2 = wc.DownloadString(_url + "kc/getTkdMxByTkdId?tkdid=" + tkdDt.Rows[0]["id"].ToString());
//取到盘点单明细
DataTable tkdmxDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData2);
if (tkdmxDt.Rows.Count != 0)
{
re.RegisterData(tkdmxDt, "tkdmx");
}
else
{
DataTable tkdmxsDt = new DataTable();
tkdmxsDt.Columns.Add("id");
tkdmxsDt.Columns.Add("tkdid");
tkdmxsDt.Columns.Add("wzid");
tkdmxsDt.Columns.Add("wzmc");
tkdmxsDt.Columns.Add("sl");
tkdmxsDt.Columns.Add("dj");
tkdmxsDt.Columns.Add("czsj");
re.RegisterData(tkdmxsDt, "tkdmx");
}
}
else
{
DataTable tkdsDt = new DataTable();
tkdsDt.Columns.Add("id");
tkdsDt.Columns.Add("tkdh");
tkdsDt.Columns.Add("tksj");
tkdsDt.Columns.Add("tkrid");
tkdsDt.Columns.Add("tkr");
tkdsDt.Columns.Add("ksid");
tkdsDt.Columns.Add("ksmc");
tkdsDt.Columns.Add("tkje");
tkdsDt.Columns.Add("tkry");
re.RegisterData(tkdsDt, "tkd");
}
finit("tkd.frx");
re.Load(_reportPath);
//选择报表模板
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region 退
public void PrintTHD(string thdh, string lx)
{
//盘点单
string jsonData1 = "";
//盘点单明细
string jsonData2 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "kc/getThdByThdh?thdh=" + thdh);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//取到盘点单
DataTable thdDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
if (thdDt.Rows.Count != 0)
{
re.RegisterData(thdDt, "thd");
jsonData2 = wc.DownloadString(_url + "kc/getThdMxByThdId?thdid=" + thdDt.Rows[0]["id"].ToString());
//取到盘点单明细
DataTable thdmxDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData2);
if (thdmxDt.Rows.Count != 0)
{
re.RegisterData(thdmxDt, "thdmx");
}
else
{
DataTable thdmxsDt = new DataTable();
thdmxsDt.Columns.Add("id");
thdmxsDt.Columns.Add("thdid");
thdmxsDt.Columns.Add("wzid");
thdmxsDt.Columns.Add("wzmc");
thdmxsDt.Columns.Add("sl");
thdmxsDt.Columns.Add("dj");
thdmxsDt.Columns.Add("czsj");
re.RegisterData(thdmxsDt, "thdmx");
}
}
else
{
DataTable thdsDt = new DataTable();
thdsDt.Columns.Add("id");
thdsDt.Columns.Add("thdh");
thdsDt.Columns.Add("thsj");
thdsDt.Columns.Add("thrid");
thdsDt.Columns.Add("thr");
thdsDt.Columns.Add("gysid");
thdsDt.Columns.Add("gys");
thdsDt.Columns.Add("thje");
thdsDt.Columns.Add("thyy");
re.RegisterData(thdsDt, "thd");
}
finit("thd.frx");
re.Load(_reportPath);
//选择报表模板
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region
public void PrintPDD(string pddh, string lx)
{
//盘点单
string jsonData1 = "";
//盘点单明细
string jsonData2 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "kc/getPddByPddh?pddh=" + pddh);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//取到盘点单
DataTable ppdDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
if (ppdDt.Rows.Count != 0)
{
re.RegisterData(ppdDt, "pdd");
jsonData2 = wc.DownloadString(_url + "kc/getPddMxByPddId?ppdid=" + ppdDt.Rows[0]["id"].ToString());
//取到盘点单明细
DataTable pddmxDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData2);
if (pddmxDt.Rows.Count != 0)
{
re.RegisterData(pddmxDt, "pddmx");
}
else
{
DataTable pddmxsDt = new DataTable();
pddmxsDt.Columns.Add("id");
pddmxsDt.Columns.Add("pddid");
pddmxsDt.Columns.Add("wzid");
pddmxsDt.Columns.Add("wzmc");
pddmxsDt.Columns.Add("sl");
pddmxsDt.Columns.Add("dj");
pddmxsDt.Columns.Add("oldsl");
pddmxsDt.Columns.Add("czsj");
re.RegisterData(pddmxsDt, "pddmx");
}
}
else
{
DataTable pddsDt = new DataTable();
pddsDt.Columns.Add("id");
pddsDt.Columns.Add("pddh");
pddsDt.Columns.Add("pdsj");
pddsDt.Columns.Add("pdrid");
pddsDt.Columns.Add("pdr");
pddsDt.Columns.Add("ksid");
pddsDt.Columns.Add("ksmc");
pddsDt.Columns.Add("pdje");
pddsDt.Columns.Add("bz");
re.RegisterData(pddsDt, "pdd");
}
finit("pdd.frx");
re.Load(_reportPath);
//选择报表模板
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region
public void PrintCKD(string ckdh, string lx)
{
//finit("ckd.frx");
//出库单
string jsonData1 = "";
//出库单明细
string jsonData2 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "kc/getCkdByCkdh?ckdh=" + ckdh);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
re.Load(_reportPath);
//取到入库单
DataTable ckdDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
if (ckdDt.Rows.Count != 0)
{
re.RegisterData(ckdDt, "ckd");
jsonData2 = wc.DownloadString(_url + "kc/getCudMxByCkdId?ckdid=" + ckdDt.Rows[0]["id"].ToString());
//取到入库单明细
DataTable ckdmxDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData2);
if (ckdmxDt.Rows.Count != 0)
{
re.RegisterData(ckdmxDt, "ckdmx");
}
else
{
return;
//DataTable ckdmxsDt = new DataTable();
//ckdmxsDt.Columns.Add("id");
//ckdmxsDt.Columns.Add("ckdid");
//ckdmxsDt.Columns.Add("wzid");
//ckdmxsDt.Columns.Add("wzmc");
//ckdmxsDt.Columns.Add("sl");
//ckdmxsDt.Columns.Add("dj");
//ckdmxsDt.Columns.Add("czsj");
//re.RegisterData(ckdmxsDt, "ckdmx");
}
}
else
{
return;
//DataTable ckdsDt = new DataTable();
//ckdsDt.Columns.Add("id");
//ckdsDt.Columns.Add("ckdh");
//ckdsDt.Columns.Add("cksj");
//ckdsDt.Columns.Add("ckrid");
//ckdsDt.Columns.Add("ckr");
//ckdsDt.Columns.Add("ksid");
//ckdsDt.Columns.Add("ksmc");
//ckdsDt.Columns.Add("ckje");
//ckdsDt.Columns.Add("lyr");
//re.RegisterData(ckdsDt, "ckd");
}
//re.RegisterData(registerOneDt, "registerOneDt");
//re.SetParameterValue("fjxmStr", "无");
//选择报表模板
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region
public void PrintRKD(string rkdh, string lx)
{
//入库单
string jsonData1 = "";
//入库单明细
string jsonData2 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "wz/getRudByRkdh?rkdh=" + rkdh);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//取到入库单
DataTable rkdDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
if (rkdDt.Rows.Count != 0)
{
re.RegisterData(rkdDt, "rkd");
jsonData2 = wc.DownloadString(_url + "wz/getRudMxByRkdId?rkdid=" + rkdDt.Rows[0]["id"].ToString());
//取到入库单明细
DataTable rkdmxDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData2);
if (rkdmxDt.Rows.Count != 0)
{
re.RegisterData(rkdmxDt, "rkdmx");
}
else
{
DataTable rkdmxsDt = new DataTable();
rkdmxsDt.Columns.Add("id");
rkdmxsDt.Columns.Add("rkdid");
rkdmxsDt.Columns.Add("wzid");
rkdmxsDt.Columns.Add("wzmc");
rkdmxsDt.Columns.Add("sl");
rkdmxsDt.Columns.Add("dj");
rkdmxsDt.Columns.Add("czsj");
re.RegisterData(rkdmxsDt, "rkdmx");
}
}
else
{
DataTable rkdsDt = new DataTable();
rkdsDt.Columns.Add("id");
rkdsDt.Columns.Add("rkdh");
rkdsDt.Columns.Add("sqdid");
rkdsDt.Columns.Add("rklx");
rkdsDt.Columns.Add("rksj");
rkdsDt.Columns.Add("rkrid");
rkdsDt.Columns.Add("rkr");
rkdsDt.Columns.Add("gysid");
rkdsDt.Columns.Add("gys");
rkdsDt.Columns.Add("rkje");
rkdsDt.Columns.Add("zt");
re.RegisterData(rkdsDt, "rkd");
}
finit("rkd.frx");
re.Load(_reportPath);
//re.RegisterData(registerOneDt, "registerOneDt");
//re.SetParameterValue("fjxmStr", "无");
//选择报表模板
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region
public void PrintFjtzd(string ids, string lx)
{
//注册信息professionalExam_register
string jsonData1 = "";
//不合格项目结果
string jsonData2 = "";
//建议复检的项目
string jsonData3 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "occupationExam/getProListByIds?ids=" + ids);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//取到客户信息表数据professionalExam_register
DataTable registerDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
finit("fjtzd_zy.frx");
re.Load(_reportPath);
//用条码号获取其他信息
foreach (DataRow dr in registerDt.Rows)
{
// 绑定基本信息
DataTable registerOneDt = registerDt.Clone();
registerOneDt.ImportRow(dr);
registerOneDt.Columns.Add("main_user_name_p", typeof(byte[]));
registerOneDt.Rows[0] ["main_user_name_p"] = Convert.FromBase64String(dr["main_user_name"].ToString()); ;
re.RegisterData(registerOneDt, "registerOneDt");
//绑定不合格项目结果
jsonData2 = wc.DownloadString(_url + "occupationExam/getFjbhgxmList?pid=" + dr["id"].ToString());
DataTable fjbhgxmDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData2);
if (fjbhgxmDt.Rows.Count != 0)
{
re.RegisterData(fjbhgxmDt, "fjbhgxmDt");
}
else
{
DataTable fjbhgxmNullDt = new DataTable();
fjbhgxmNullDt.Columns.Add("project_name");
fjbhgxmNullDt.Columns.Add("project_result");
fjbhgxmNullDt.Columns.Add("reference_value");
fjbhgxmNullDt.Columns.Add("unit");
re.RegisterData(fjbhgxmNullDt, "fjbhgxmDt");
}
//绑定建议复检的项目
jsonData3 = wc.DownloadString(_url + "occupationExam/getFjjyfcxmList?physical_num_old=" + dr["physical_num"].ToString());
DataTable fjjyfcxmDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData3);
string fjxmStr = "";
if (fjjyfcxmDt.Rows.Count != 0)
{
foreach (DataRow fjxmDr in fjjyfcxmDt.Rows)
{
fjxmStr += fjxmDr["project_name"].ToString() + ",";
}
re.SetParameterValue("fjxmStr", fjxmStr.Substring(0, fjxmStr.Length - 1));
}
else
{
re.SetParameterValue("fjxmStr", "无");
}
//绑定照片
DataTable photo = new DataTable();
photo.Columns.Add("p", typeof(byte[]));
DataRow photoDr = photo.NewRow();
photoDr["p"] = Convert.FromBase64String(dr["phone_path"].ToString());//phone_path
photo.Rows.Add(photoDr);
re.RegisterData(photo, "photo");
//选择报表模板
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
#endregion
#region
public void PrintFjbg(string ids, string lx)
{
//注册信息professionalExam_register
string jsonData1 = "";
//获取复查体检结果
string jsonData2 = "";
//获取第一次体检结果
string jsonData3 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "occupationExam/getProListByIds?ids=" + ids);
//jsonData9 = wc.DownloadString(_url + "occupationExam/getThreshold");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//取到客户信息表数据professionalExam_register
DataTable registerDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
//用条码号获取其他信息
foreach (DataRow dr in registerDt.Rows)
{
finit("fjbg.frx");
re.Load(_reportPath);
DataTable fcjgDt = new DataTable();
fcjgDt.Columns.Add("xmmc");
fcjgDt.Columns.Add("sctjjg");
fcjgDt.Columns.Add("fcjg");
jsonData2 = wc.DownloadString(_url + "occupationExam/getFcTjjg?physical_num=" + dr["physical_num"].ToString());
DataTable fjTjjgDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData2);
if (fjTjjgDt.Rows.Count != 0)
{
jsonData3 = wc.DownloadString(_url + "occupationExam/getFcTjjg?physical_num=" + dr["physical_num_old"].ToString());
DataTable tjjgDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData3);
DataRow fcjgdr = fcjgDt.NewRow();
foreach (DataRow tdr in fjTjjgDt.Rows)
{
fcjgdr["xmmc"] = tdr["project_name"].ToString();
fcjgdr["fcjg"] = tdr["project_result"].ToString();
fcjgdr["sctjjg"] = tjjgDt.Select("project_id=" + tdr["project_id"].ToString() + "").Length > 0 ? tjjgDt.Select("project_id=" + tdr["project_id"].ToString() + "")[0]["project_result"].ToString() : "";
fcjgDt.Rows.Add(fcjgdr.ItemArray);
}
}
// 绑定基本信息
DataTable registerOneDt = registerDt.Clone();
registerOneDt.ImportRow(dr);
re.RegisterData(registerOneDt, "registerOneDt");
re.RegisterData(fcjgDt, "fcjgDt");
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
#endregion
#region
public void PrintBg(string ids, string lx,int iType = 0,string strExamType = "")
{
#region
if (Application.OpenForms["frmMsg"] == null)
{
formMsg = new frmMsg();
}
else
formMsg = (frmMsg)Application.OpenForms["frmMsg"];
if (lx == "下载")
{
formMsg.Show();
}
else if (lx == "报告下载完成")
{
formMsg.OutPutString("--------------报告下载完成-----------------");
return;
}
if (ids.Trim() == "")
return;
#endregion
//注册信息professionalExam_register
string jsonData1 = "";
//职业史occupation_history
string jsonData2 = "";
//既往病史past_history
string jsonData3 = "";
//其他病史
string jsonData4 = "";
//体征父表
string jsonData5 = "";
//功能及特殊检查的父表
string jsonData6 = "";
//化验检查的父表
string jsonData7 = "";
//体检结果
string jsonData8 = "";
//获取听阈偏差维护表
string jsonData9 = "";
//体征结果
string jsonData10 = "";
//功能及特殊检查结果
string jsonData11 = "";
//化验检查结果
string jsonData12 = "";
//获取问诊的诊断医师
string jsonData13 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
//根据ids查出所有存在复检的初始id补充到ids中
ids = wc.DownloadString(_url + "/occupationExam/getOriginIds?ids=" + ids);
jsonData1 = wc.DownloadString(_url + "/occupationExam/getProListByIds?ids=" + ids);
jsonData9 = wc.DownloadString(_url + "/occupationExam/getThreshold");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//取到客户信息表数据professionalExam_register
DataTable registerDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
//听阈偏差维护表
DataTable thresholdDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData9);
//用条码号获取其他信息
foreach (DataRow dr in registerDt.Rows)
{
if (dr["register_type"].ToString() == "复检登记")
continue;
//----2023.10.13 xulu 根据模板打印报告------
string strType;
if(iType == 0)
{
strType = dr["exam_type"].ToString();
}
else
{
strType = strExamType;
}
//------------------------------------------
switch (strType)
{
case "职业健康检查":
if (dr["sex"].ToString() == "男")
{
finit("zyjkjcN_tjbg.frx");
}
else
{
finit("zyjkjcW_tjbg.frx");
}
break;
case "常规健康检查":
finit("cgjkjc_tjbg.frx");
break;
case "特种作业健康检查":
finit("tzzyjkjc_tjbg.frx");
break;
case "职业常规健康检查":
finit("zycgjkjc_tjbg.frx");
break;
default:
finit("zycgjkjc_tjbg.frx");
break;
}
re.Load(_reportPath);
//取到客户的职业史
jsonData2 = wc.DownloadString(_url + "/occupationExam/getZYS?tmh=" + dr["physical_num"].ToString());
DataTable historyDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData2);
//取到客户的既往病史
jsonData3 = wc.DownloadString(_url + "/occupationExam/getJWBS?tmh=" + dr["physical_num"].ToString());
DataTable pastDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData3);
//取到客户的其他病史
jsonData4 = wc.DownloadString(_url + "/occupationExam/getGZS?tmh=" + dr["physical_num"].ToString());
DataTable doctorDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData4);
string haszz = "true";
//取到症状
if (doctorDt.Rows.Count > 0)
BDdiscript(doctorDt.Rows[0]["inquiry"].ToString().Split('/'), re);
else
{
haszz = "false";
}
//获取体征父表
//2023-12-04 xulu 添加体检类型,若是"职业健康检查",则根据打印项目打印,否则根据检查项目打印
jsonData5 = wc.DownloadString(_url + "/occupationExam/getTZPater?person_id=" + dr["id"].ToString()+ "&strType="+ strType);
DataTable tzPaterDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData5);
//获取功能及特殊检查的父表
//2023-12-04 xulu 添加体检类型,若是"职业健康检查",则根据打印项目打印,否则根据检查项目打印
jsonData6 = wc.DownloadString(_url + "/occupationExam/getGNJTSJCPater?person_id=" + dr["id"].ToString() + "&strType=" + strType);
DataTable gNJTSJCPaterDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData6);
//获取化验检查的父表
//2023-12-04 xulu 添加体检类型,若是"职业健康检查",则根据打印项目打印,否则根据检查项目打印
jsonData7 = wc.DownloadString(_url + "/occupationExam/getHYJCPater?person_id=" + dr["id"].ToString() + "&strType=" + strType);
DataTable hYJCPaterDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData7);
//获取体检小组表
string jsontjszstring = wc.DownloadString(_url + "/occupationExam/getTJXZ?person_id=" + dr["id"].ToString());
DataTable dttjxz = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsontjszstring);
//获取体检结果
//2023-12-04 xulu 添加体检类型,若是"职业健康检查",则根据打印项目打印,否则根据检查项目打印
jsonData8 = wc.DownloadString(_url + "/occupationExam/getTjjg?person_id=" + dr["id"].ToString() + "&physical_num_old=" + dr["physical_num"].ToString() + "&strType=" + strType);
DataTable tjjgDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData8);
//获取体征体检结果
//2023-12-04 xulu 添加体检类型,若是"职业健康检查",则根据打印项目打印,否则根据检查项目打印
jsonData10 = wc.DownloadString(_url + "/occupationExam/getTZTjjg?person_id=" + dr["id"].ToString() + "&strType=" + strType);
DataTable tzTjjgDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData10);
//获取功能及特殊检查体检结果
//2023-12-04 xulu 添加体检类型,若是"职业健康检查",则根据打印项目打印,否则根据检查项目打印
jsonData11 = wc.DownloadString(_url + "/occupationExam/getGNJTSJCTjjg?person_id=" + dr["id"].ToString() + "&physical_num_old=" + dr["physical_num"].ToString() + "&strType=" + strType);
DataTable GNJTSJCTjjgDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData11);
//获取化验检查体检结果
//2023-12-04 xulu 添加体检类型,若是"职业健康检查",则根据打印项目打印,否则根据检查项目打印
jsonData12 = wc.DownloadString(_url + "/occupationExam/getHyTjjg?person_id=" + dr["id"].ToString() + "&physical_num_old=" + dr["physical_num"].ToString() + "&strType=" + strType);
DataTable HYTjjgDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData12);
//获取问诊的诊断医师
jsonData13 = wc.DownloadString(_url + "/occupationExam/getWzZdys?person_id=" + dr["id"].ToString());
DataTable WzZdysDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData13);
DataTable imgDT = new DataTable();
imgDT.Columns.Add("isShowC");
imgDT.Columns.Add("caichaoImg", typeof(byte[]));
imgDT.Columns.Add("isShowX");
imgDT.Columns.Add("xpImg", typeof(byte[]));
imgDT.Columns.Add("isShowXD");
imgDT.Columns.Add("xdImg", typeof(byte[]));
imgDT.Columns.Add("isShowPFT");
imgDT.Columns.Add("pftImg", typeof(byte[]));
// 获取彩超报告base64
string ccImgBase = wc.DownloadString(_url + "/result/getCcImgBase64?tmh=" + dr["physical_num"].ToString() + "&specialConf=B超");
DataRow imgDR = imgDT.NewRow();
imgDT.Rows.Add(imgDR);
imgDR["isShowC"] = !String.IsNullOrEmpty(ccImgBase);
imgDR["caichaoImg"] = Convert.FromBase64String(ccImgBase);
// 获取胸片报告base64
string xpImgBase = wc.DownloadString(_url + "/result/getCcImgBase64?tmh=" + dr["physical_num"].ToString() + "&specialConf=拍片");
imgDR["isShowX"] = !String.IsNullOrEmpty(xpImgBase);
imgDR["xpImg"] = Convert.FromBase64String(xpImgBase);
//re.RegisterData(imgDT, "img");
// 获取心电报告base64
string xdImgBase = wc.DownloadString(_url + "/result/getCcImgBase64?tmh=" + dr["physical_num"].ToString() + "&specialConf=心电");
imgDR["isShowXD"] = !String.IsNullOrEmpty(xdImgBase);
imgDR["xdImg"] = Convert.FromBase64String(xdImgBase);
//re.RegisterData(imgDT, "img");
// 获取肺功能报告base64
string pftImgBase = wc.DownloadString(_url + "/result/getCcImgBase64?tmh=" + dr["physical_num"].ToString() + "&specialConf=FVC");
imgDR["isShowPFT"] = !String.IsNullOrEmpty(pftImgBase);
imgDR["pftImg"] = Convert.FromBase64String(pftImgBase);
re.RegisterData(imgDT, "img");
//计算听阈偏差维护
try
{
computeThreshold(dr["person_age"].ToString(), dr["sex"].ToString(), tjjgDt, thresholdDt, re, dr["id"].ToString());
}
catch
{
re.SetParameterValue("dct_isShow", "no");
}
//绑定 检查结论
//re.SetParameterValue("main_review", dr["main_review"].ToString());
//2023-10-19 xulu 修改为main_result填充体检结论
re.SetParameterValue("main_review", dr["main_result"].ToString());
//绑定 检查建议
re.SetParameterValue("main_result", dr["handle_advise"].ToString());
// 绑定基本信息
DataTable registerOneDt = registerDt.Clone();
registerOneDt.ImportRow(dr);
re.RegisterData(registerOneDt, "registerOneDt");
//绑定职业史
if (historyDt.Rows.Count != 0)
{
re.RegisterData(historyDt, "historyDt");
}
else
{
DataTable historyNullDt = new DataTable();
historyNullDt.Columns.Add("id");
historyNullDt.Columns.Add("inquiry_id");
historyNullDt.Columns.Add("start_date");
historyNullDt.Columns.Add("end_date");
historyNullDt.Columns.Add("util");
historyNullDt.Columns.Add("workshop");
historyNullDt.Columns.Add("work_type");
historyNullDt.Columns.Add("factory");
historyNullDt.Columns.Add("protect_method");
re.RegisterData(historyNullDt, "historyDt");
}
//绑定既往病史
if (pastDt.Rows.Count != 0)
{
re.RegisterData(pastDt, "pastDt");
}
else
{
DataTable pastNullDt = new DataTable();
pastNullDt.Columns.Add("id");
pastNullDt.Columns.Add("inquiry_id");
pastNullDt.Columns.Add("disease");
pastNullDt.Columns.Add("diagnose_date");
pastNullDt.Columns.Add("util");
pastNullDt.Columns.Add("treatment");
pastNullDt.Columns.Add("outcome");
re.RegisterData(pastNullDt, "pastDt");
}
if (doctorDt.Rows.Count != 0)
//绑定其他病史
re.RegisterData(doctorDt, "doctorDt");
else
{
doctorDt = new DataTable();
doctorDt.Columns.Add("physical_num");
doctorDt.Columns.Add("identity_num");
doctorDt.Columns.Add("name");
doctorDt.Columns.Add("status");
doctorDt.Columns.Add("family_history");
doctorDt.Columns.Add("discript");
doctorDt.Columns.Add("symptom");
doctorDt.Columns.Add("inquiry_date");
doctorDt.Columns.Add("personal");
doctorDt.Columns.Add("smoke_status");
doctorDt.Columns.Add("smoke_per_day");
doctorDt.Columns.Add("smoke_years");
doctorDt.Columns.Add("drink_status");
doctorDt.Columns.Add("drink_per_day");
doctorDt.Columns.Add("drink_years");
doctorDt.Columns.Add("menarche_age");
doctorDt.Columns.Add("menarche_time");
doctorDt.Columns.Add("menarche_per_week");
doctorDt.Columns.Add("menarche_stop_age");
doctorDt.Columns.Add("is_menarche");
doctorDt.Columns.Add("children");
doctorDt.Columns.Add("abortion_times");
doctorDt.Columns.Add("abortion_early_times");
doctorDt.Columns.Add("abortion_death_times");
doctorDt.Columns.Add("abortion_except_times");
doctorDt.Columns.Add("speedOrSlow_history_name");
doctorDt.Columns.Add("speedOrSlow_history_date");
doctorDt.Columns.Add("speedOrSlow_history_util");
doctorDt.Columns.Add("speedOrSlow_isOK");
doctorDt.Columns.Add("inquiry");
doctorDt.Columns.Add("ce_shi");
re.RegisterData(doctorDt, "doctorDt");
}
//绑定体征父表
if (tzPaterDt.Rows.Count != 0)
{
re.RegisterData(tzPaterDt, "tzPaterDt");
}
else
{
DataTable tzNullPaterDt = new DataTable();
tzNullPaterDt.Columns.Add("id");
tzNullPaterDt.Columns.Add("team_name");
re.RegisterData(tzNullPaterDt, "tzPaterDt");
}
//绑定功能及特殊检查的父表
if (gNJTSJCPaterDt.Rows.Count != 0)
{
//-----2023.10.12 xulu 报告中去掉某项目------
string str = ConfigurationManager.AppSettings.Get("ExcludeItems");
string[] strArr = str.Split(',');
for (int i = 0; i < gNJTSJCPaterDt.Rows.Count; i++)
{
for (int j = 0; j < strArr.Length; j++)
{
if (gNJTSJCPaterDt.Rows[i]["team_name"].ToString() == strArr[j])
{
gNJTSJCPaterDt.Rows.RemoveAt(i);
break;
}
}
}
gNJTSJCPaterDt.AcceptChanges();
//-----------------------------------------------
re.RegisterData(gNJTSJCPaterDt, "gNJTSJCPaterDt");
}
else
{
DataTable gNJTSJCNullPaterDt = new DataTable();
gNJTSJCNullPaterDt.Columns.Add("id");
gNJTSJCNullPaterDt.Columns.Add("team_name");
re.RegisterData(gNJTSJCNullPaterDt, "gNJTSJCPaterDt");
}
//绑定化验检查的父表
if (hYJCPaterDt.Rows.Count != 0)
{
//-----2023.10.12 xulu 报告中去掉某项目------
string str = ConfigurationManager.AppSettings.Get("ExcludeItems");
string[] strArr = str.Split(',');
for (int i = 0; i < gNJTSJCPaterDt.Rows.Count; i++)
{
for (int j = 0; j < strArr.Length; j++)
{
if (gNJTSJCPaterDt.Rows[i]["team_name"].ToString() == strArr[j])
{
gNJTSJCPaterDt.Rows.RemoveAt(i);
break;
}
}
}
gNJTSJCPaterDt.AcceptChanges();
//-----------------------------------------------
re.RegisterData(hYJCPaterDt, "hYJCPaterDt");
}
else
{
DataTable hYJCNullPaterDt = new DataTable();
hYJCNullPaterDt.Columns.Add("id");
hYJCNullPaterDt.Columns.Add("team_name");
re.RegisterData(hYJCNullPaterDt, "hYJCPaterDt");
}
//绑定体检结果
re.RegisterData(tjjgDt, "tjjgDt");
//绑定体征体检结果
DataTable newTz_tjjgDt = new DataTable();
newTz_tjjgDt.Columns.Add("person_id");
newTz_tjjgDt.Columns.Add("project_id1");
newTz_tjjgDt.Columns.Add("project_name1");
newTz_tjjgDt.Columns.Add("project_result1");
newTz_tjjgDt.Columns.Add("project_id2");
newTz_tjjgDt.Columns.Add("project_name2");
newTz_tjjgDt.Columns.Add("project_result2");
newTz_tjjgDt.Columns.Add("exam_group_maintain_id", typeof(Int64));
//2023-11-06 xulu 医生签名修改为电子图片
newTz_tjjgDt.Columns.Add("presenter", typeof(byte[]));
newTz_tjjgDt.Columns.Add("commit_date");
if (tzTjjgDt.Rows.Count != 0)
{
re.RegisterData(tzTjjgDt, "tz_tjjgDt");
re.SetParameterValue("tz_isShow", "yes");
DataRow r = newTz_tjjgDt.NewRow();
string exam_id = tzTjjgDt.Rows[0]["exam_group_maintain_id"].ToString();
bool is_one = false;
bool is_two = false;
foreach (DataRow tzDr in tzTjjgDt.Rows)
{
if (tzDr["exam_group_maintain_id"].ToString() == exam_id)
{
if (!is_one)
{
r["person_id"] = tzDr["person_id"].ToString();
r["project_id1"] = tzDr["project_id"].ToString();
r["project_name1"] = tzDr["project_name"].ToString();
r["project_result1"] = tzDr["project_result"].ToString();
r["exam_group_maintain_id"] = tzDr["exam_group_maintain_id"];
//2023-11-06 xulu 医生签名修改为电子图片
r["presenter"] = Convert.FromBase64String(tzDr["presenter"].ToString());
r["commit_date"] = tzDr["commit_date"].ToString();
is_one = true;
is_two = false;
if (tzTjjgDt.Rows.IndexOf(tzDr) == tzTjjgDt.Rows.Count - 1)
{
r["project_id2"] = "";
r["project_name2"] = "";
r["project_result2"] = "";
newTz_tjjgDt.Rows.Add(r.ItemArray);
}
}
else
{
r["project_id2"] = tzDr["project_id"].ToString();
r["project_name2"] = tzDr["project_name"].ToString();
r["project_result2"] = tzDr["project_result"].ToString();
newTz_tjjgDt.Rows.Add(r.ItemArray);
is_one = false;
is_two = true;
}
exam_id = tzDr["exam_group_maintain_id"].ToString();
}
else
{
if (!is_two)
{
r["project_id2"] = "";
r["project_name2"] = "";
r["project_result2"] = "";
newTz_tjjgDt.Rows.Add(r.ItemArray);
is_one = false;
is_two = true;
}
r["person_id"] = tzDr["person_id"].ToString();
r["project_id1"] = tzDr["project_id"].ToString();
r["project_name1"] = tzDr["project_name"].ToString();
r["project_result1"] = tzDr["project_result"].ToString();
r["exam_group_maintain_id"] = tzDr["exam_group_maintain_id"];
//2023-11-06 xulu 医生签名修改为电子图片
r["presenter"] = Convert.FromBase64String(tzDr["presenter"].ToString()); ;
r["commit_date"] = tzDr["commit_date"].ToString();
is_one = true;
is_two = false;
exam_id = tzDr["exam_group_maintain_id"].ToString();
if (tzTjjgDt.Rows.IndexOf(tzDr) == tzTjjgDt.Rows.Count - 1)
{
r["project_id2"] = "";
r["project_name2"] = "";
r["project_result2"] = "";
newTz_tjjgDt.Rows.Add(r.ItemArray);
}
}
}
re.RegisterData(newTz_tjjgDt, "newTz_tjjgDt");
}
else
{
DataTable dt = tjjgDt.Clone();
dt.Columns.Add("presenter_img", typeof(byte[]));
re.RegisterData(dt, "tz_tjjgDt");
re.SetParameterValue("tz_isShow", "no");
}
//绑定功能及特殊检查体检结果
if (GNJTSJCTjjgDt.Rows.Count != 0)
{
//2023-11-06 xulu 医生签名修改为电子图片
GNJTSJCTjjgDt.Columns.Add("presenter_img", typeof(byte[]));
foreach (DataRow dr1 in GNJTSJCTjjgDt.Rows)
{
dr1["presenter_img"] = Convert.FromBase64String(dr1["presenter"].ToString());
}
//-----2023.10.12 xulu 报告中去掉某项目------
string str = ConfigurationManager.AppSettings.Get("ExcludeItems");
string[] strArr = str.Split(',');
string strNames = "";
for (int i = 0; i < strArr.Length; i++)
{
strNames += "'" + strArr[i] + "'" + ",";
}
strNames = strNames.Substring(0, strNames.Length - 1);
string strGroup = wc.DownloadString(_url + "/occupationExam/getGroupIdByNames?strNames=" + strNames);
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(strGroup);
for (int i = GNJTSJCTjjgDt.Rows.Count - 1; i >= 0; i--)
{
for (int j = 0; j < dt.Rows.Count; j++)
{
if (GNJTSJCTjjgDt.Rows[i]["exam_group_maintain_id"].ToString() == dt.Rows[j]["id"].ToString())
{
GNJTSJCTjjgDt.Rows.RemoveAt(i);
break;
}
}
}
GNJTSJCTjjgDt.AcceptChanges();
//-----------------------------------------------
re.RegisterData(GNJTSJCTjjgDt, "gn_tjjgDt");
re.SetParameterValue("gn_isShow", "yes");
}
else
{ //2023-11-06 xulu 医生签名修改为电子图片
DataTable dt = tjjgDt.Clone();
dt.Columns.Add("presenter_img", typeof(byte[]));
re.RegisterData(dt, "gn_tjjgDt");
re.SetParameterValue("gn_isShow", "no");
}
//绑定化验检查体检结果
if (HYTjjgDt.Rows.Count != 0)
{
//2023-11-06 xulu 医生签名修改为电子图片
HYTjjgDt.Columns.Add("presenter_img", typeof(byte[]));
foreach (DataRow hyDr in HYTjjgDt.Rows)
{
hyDr["presenter_img"] = Convert.FromBase64String(hyDr["presenter"].ToString());
}
//-----2023.10.12 xulu 报告中去掉某项目------
string str = ConfigurationManager.AppSettings.Get("ExcludeItems");
string[] strArr = str.Split(',');
string strNames = "";
for (int i = 0; i < strArr.Length; i++)
{
strNames += "'" + strArr[i] + "'" + ",";
}
strNames = strNames.Substring(0, strNames.Length - 1);
string strGroup = wc.DownloadString(_url + "/occupationExam/getGroupIdByNames?strNames=" + strNames);
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(strGroup);
for (int i = HYTjjgDt.Rows.Count - 1; i >= 0; i--)
{
for (int j = 0; j < dt.Rows.Count; j++)
{
if (HYTjjgDt.Rows[i]["exam_group_maintain_id"].ToString() == dt.Rows[j]["id"].ToString())
{
HYTjjgDt.Rows.RemoveAt(i);
break;
}
}
}
HYTjjgDt.AcceptChanges();
//-----------------------------------------------
re.RegisterData(HYTjjgDt, "hy_tjjgDt");
re.SetParameterValue("hy_isShow", "yes");
}
else
{//2023-11-06 xulu 医生签名修改为电子图片
DataTable dt = tjjgDt.Clone();
dt.Columns.Add("presenter_img", typeof(byte[]));
re.RegisterData(dt, "hy_tjjgDt");
re.SetParameterValue("hy_isShow", "no");
}
//绑定问诊的诊断医师
DataTable inquery = new DataTable();
inquery.Columns.Add("user", typeof(byte[]));
DataRow inDr = inquery.NewRow();
if (WzZdysDt.Rows.Count != 0)
{
//re.SetParameterValue("wz_zdys", WzZdysDt.Rows[0]["commit_doctor"].ToString());
inDr["user"] = Convert.FromBase64String(WzZdysDt.Rows[0]["commit_doctor"].ToString());//phone_path
}
/* else
{
//re.SetParameterValue("wz_zdys", "");
inDr["user"] = "";
}*/
inquery.Rows.Add(inDr);
re.RegisterData(inquery, "inquery");
//绑定特种作业数据
BDTzzy(tjjgDt, re, dttjxz);
//绑定职业常规报告
BDZycgbg(tjjgDt, re);
//绑定照片
DataTable photo = new DataTable();
photo.Columns.Add("p", typeof(byte[]));
DataRow photoDr = photo.NewRow();
photoDr["p"] = Convert.FromBase64String(dr["phone_path"].ToString());//phone_path
photo.Rows.Add(photoDr);
re.RegisterData(photo, "photo");
re.SetParameterValue("showzz", haszz);
//绑定主检医生
//2023-11-06 xulu 医生签名修改为电子图片
DataTable doc = new DataTable();
doc.Columns.Add("user", typeof(byte[]));
DataRow docDr = doc.NewRow();
docDr["user"] = Convert.FromBase64String(dr["main_user_name"].ToString());//phone_path
doc.Rows.Add(docDr);
re.RegisterData(doc, "doc");
//绑定复检项目及结果
DataTable dtReinspection = new DataTable();
dtReinspection.Columns.Add("project", typeof(string));
dtReinspection.Columns.Add("check_time", typeof(string));
dtReinspection.Columns.Add("main_review", typeof(string));
dtReinspection.Columns.Add("main_result", typeof(string));
//获取复检项目及结果
string strReinspection = wc.DownloadString(_url + "/occupationExam/getReinspection?physical_num_old=" + dr["physical_num"].ToString());
DataTable dtReinspectionData = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(strReinspection);
if(dtReinspectionData.Rows.Count != 0)
{
foreach (DataRow reDr in dtReinspectionData.Rows)
{
DataRow r = dtReinspection.NewRow();
r["project"] = reDr["strReviewProject"].ToString();
r["check_time"] = reDr["main_review_date"].ToString();
r["main_review"] = reDr["main_review"].ToString();
r["main_result"] = reDr["handle_advise"].ToString();
dtReinspection.Rows.Add(r.ItemArray);
}
}
else
{
DataRow r = dtReinspection.NewRow();
r["project"] = "\r\n\r\n\r\n";
dtReinspection.Rows.Add(r.ItemArray);
}
re.RegisterData(dtReinspection, "dtReinspection");
//选择报表模板
if (lx == "预览")
{
try
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
}
catch (Exception ex)
{
throw;
}
return;
}
if (lx == "下载")
{
FastReport.Export.Pdf.PDFExport export = new FastReport.Export.Pdf.PDFExport();
//默认C盘
string reportPath = "c:\\体检报告_新医路";
//读自定义配置
reportPath = ConfigurationManager.AppSettings.Get("reportpath_download")??reportPath;
#region
bool folderExists = Directory.Exists(reportPath);
if (!folderExists)
{
Directory.CreateDirectory(reportPath);
}
//
string userName = registerDt.Rows[0]["person_name"].ToString();
string util_name = registerDt.Rows[0]["util_name"].ToString();
string card_number = registerDt.Rows[0]["card_number"].ToString();
string filePath = reportPath + util_name + "-" + userName + "-" + card_number + ".pdf";
if (File.Exists(filePath))
{
File.Delete(filePath);
}
#endregion
#region PDF文件
//关闭生成进度条
EnvironmentSettings eSet = new EnvironmentSettings();
eSet.ReportSettings.ShowProgress = false;
//关闭对话框
re.PrintSettings.ShowDialog = false;
re.Prepare();
//导出
re.Export(export, filePath);
formMsg.Show();
formMsg.OutPutString(filePath + "已导出");
Application.DoEvents();
#endregion
return;
}
re.PrintSettings.ShowDialog = false;
try
{
//开启生成进度条
EnvironmentSettings eSet = new EnvironmentSettings();
eSet.ReportSettings.ShowProgress = true;
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
if (lx != "下载")
MessageBox.Show(ex.Message);
else
{
#region
if (registerDt != null && registerDt.Rows.Count > 0)
{
string userName = registerDt.Rows[0]["person_name"].ToString();
string util_name = registerDt.Rows[0]["util_name"].ToString();
string card_number = registerDt.Rows[0]["card_number"].ToString();
string filePath = util_name + "-" + userName + "-" + card_number + ".pdf";
formMsg.Show();
formMsg.OutPutString(filePath + "导出失败");
Application.DoEvents();
}
else
{
formMsg.Show();
formMsg.OutPutString("导出异常:" + ex.Message);
Application.DoEvents();
}
#endregion
}
//log
Log.WriteLogToTxt(ex.StackTrace.ToString());
}
}
}
#region
public void BDdiscript(string[] str, FastReport.Report re)
{
re.SetParameterValue("zz1", str[0]);
re.SetParameterValue("zz2", str[1]);
re.SetParameterValue("zz3", str[2]);
re.SetParameterValue("zz4", str[3]);
re.SetParameterValue("zz5", str[4]);
re.SetParameterValue("zz6", str[5]);
re.SetParameterValue("zz7", str[6]);
re.SetParameterValue("zz8", str[7]);
re.SetParameterValue("zz9", str[8]);
re.SetParameterValue("zz10", str[9]);
re.SetParameterValue("zz11", str[10]);
re.SetParameterValue("zz12", str[11]);
re.SetParameterValue("zz13", str[12]);
re.SetParameterValue("zz14", str[13]);
re.SetParameterValue("zz15", str[14]);
re.SetParameterValue("zz16", str[15]);
re.SetParameterValue("zz17", str[16]);
re.SetParameterValue("zz18", str[17]);
re.SetParameterValue("zz19", str[18]);
re.SetParameterValue("zz20", str[19]);
re.SetParameterValue("zz21", str[20]);
re.SetParameterValue("zz22", str[21]);
re.SetParameterValue("zz23", str[22]);
re.SetParameterValue("zz24", str[23]);
re.SetParameterValue("zz25", str[24]);
re.SetParameterValue("zz26", str[25]);
re.SetParameterValue("zz27", str[26]);
re.SetParameterValue("zz28", str[27]);
re.SetParameterValue("zz29", str[28]);
re.SetParameterValue("zz30", str[29]);
re.SetParameterValue("zz31", str[30]);
re.SetParameterValue("zz32", str[31]);
re.SetParameterValue("zz33", str[32]);
re.SetParameterValue("zz34", str[33]);
re.SetParameterValue("zz35", str[34]);
re.SetParameterValue("zz36", str[35]);
re.SetParameterValue("zz37", str[36]);
re.SetParameterValue("zz38", str[37]);
re.SetParameterValue("zz39", str[38]);
re.SetParameterValue("zz40", str[39]);
re.SetParameterValue("zz41", str[40]);
re.SetParameterValue("zz42", str[41]);
re.SetParameterValue("zz43", str[42]);
re.SetParameterValue("zz44", str[43]);
re.SetParameterValue("zz45", str[44]);
re.SetParameterValue("zz46", str[45]);
re.SetParameterValue("zz47", str[46]);
re.SetParameterValue("zz48", str[47]);
re.SetParameterValue("zz49", str[48]);
re.SetParameterValue("zz50", str[49]);
re.SetParameterValue("zz51", str[50]);
re.SetParameterValue("zz52", str[51]);
re.SetParameterValue("zz53", str[52]);
re.SetParameterValue("zz54", str[53]);
re.SetParameterValue("zz55", str[54]);
re.SetParameterValue("zz56", str[55]);
re.SetParameterValue("zz57", str[56]);
re.SetParameterValue("zz58", str[57]);
re.SetParameterValue("zz59", str[58]);
re.SetParameterValue("zz60", str[59]);
re.SetParameterValue("zz61", str[60]);
re.SetParameterValue("zz62", str[61]);
re.SetParameterValue("zz63", str[62]);
re.SetParameterValue("zz64", str[63]);
re.SetParameterValue("zz65", str[64]);
re.SetParameterValue("zz66", str[65]);
re.SetParameterValue("zz67", str[66]);
}
#endregion
#region
public void computeThreshold(string nl, string sex, DataTable tjjg, DataTable thresholdDt, FastReport.Report re,string person_id)
{
//结果
int left500 = 0;
int left1000 = 0;
int left2000 = 0;
int left3000 = 0;
int left4000 = 0;
int left6000 = 0;
int right500 = 0;
int right1000 = 0;
int right2000 = 0;
int right3000 = 0;
int right4000 = 0;
int right6000 = 0;
//偏差值
int left500_deviation = 0;
int left1000_deviation = 0;
int left2000_deviation = 0;
int left3000_deviation = 0;
int left4000_deviation = 0;
int left6000_deviation = 0;
int right500_deviation = 0;
int right1000_deviation = 0;
int right2000_deviation = 0;
int right3000_deviation = 0;
int right4000_deviation = 0;
int right6000_deviation = 0;
//双耳高频平均听阈dB
int srgppjty = 0;
//左耳平均听阈
int left_pjty = 0;
//右耳平均听阈
int right_pjty = 0;
//结果
//2023-11-20 xulu 增加不为null判断
left500 = Convert.ToInt32(tjjg.Select("project_id=11324 and project_result is not null").Length>0 ? tjjg.Select("project_id=11324")[0]["project_result"].ToString() : "0"); //左耳500Hz
left1000 = Convert.ToInt32(tjjg.Select("project_id=11326 and project_result is not null").Length > 0 ? tjjg.Select("project_id=11326")[0]["project_result"].ToString() : "0"); //左耳1000Hz
left2000 = Convert.ToInt32(tjjg.Select("project_id=11328 and project_result is not null").Length > 0 ? tjjg.Select("project_id=11328")[0]["project_result"].ToString() : "0"); //左耳2000Hz
left3000 = Convert.ToInt32(tjjg.Select("project_id=11330 and project_result is not null").Length > 0 ? tjjg.Select("project_id=11330")[0]["project_result"].ToString() : "0"); //左耳3000Hz
left4000 = Convert.ToInt32(tjjg.Select("project_id=11332 and project_result is not null").Length > 0 ? tjjg.Select("project_id=11332")[0]["project_result"].ToString() : "0"); //左耳4000Hz
left6000 = Convert.ToInt32(tjjg.Select("project_id=11334 and project_result is not null").Length > 0 ? tjjg.Select("project_id=11334")[0]["project_result"].ToString() : "0"); //左耳6000Hz
right500 = Convert.ToInt32(tjjg.Select("project_id=11325 and project_result is not null").Length > 0 ? tjjg.Select("project_id=11325")[0]["project_result"].ToString() : "0"); //右耳500Hz
right1000 = Convert.ToInt32(tjjg.Select("project_id=11327 and project_result is not null").Length > 0 ? tjjg.Select("project_id=11327")[0]["project_result"].ToString() : "0"); //右耳1000Hz
right2000 = Convert.ToInt32(tjjg.Select("project_id=11329 and project_result is not null").Length > 0 ? tjjg.Select("project_id=11329")[0]["project_result"].ToString() : "0"); //右耳2000Hz
right3000 = Convert.ToInt32(tjjg.Select("project_id=11331 and project_result is not null").Length > 0 ? tjjg.Select("project_id=11331")[0]["project_result"].ToString() : "0"); //右耳3000Hz
right4000 = Convert.ToInt32(tjjg.Select("project_id=11333 and project_result is not null").Length > 0 ? tjjg.Select("project_id=11333")[0]["project_result"].ToString() : "0"); //右耳4000Hz
right6000 = Convert.ToInt32(tjjg.Select("project_id=11335 and project_result is not null").Length > 0 ? tjjg.Select("project_id=11335")[0]["project_result"].ToString() : "0"); //右耳6000Hz
//偏差值
left500_deviation = Convert.ToInt32(thresholdDt.Select("exam_project_maintain_id=424 and deviation_value is not null and sex='" + sex + "' and age_lower<=" + nl +
" and age_upper>=" + nl + "").Length > 0 ?
thresholdDt.Select("exam_project_maintain_id=424 and deviation_value is not null and sex='" + sex +
"' and age_lower<=" + nl + " and age_upper>=" + nl +
"")[0]["deviation_value"].ToString() : "0"); //左耳500Hz
left1000_deviation = Convert.ToInt32(thresholdDt.Select("exam_project_maintain_id=426 and deviation_value is not null and sex='" + sex + "' and age_lower<=" + nl +
" and age_upper>=" + nl + "").Length > 0 ?
thresholdDt.Select("exam_project_maintain_id=426 and deviation_value is not null and sex='" + sex +
"' and age_lower<=" + nl + " and age_upper>=" + nl +
"")[0]["deviation_value"].ToString() : "0"); //左耳1000Hz
left2000_deviation = Convert.ToInt32(thresholdDt.Select("exam_project_maintain_id=428 and deviation_value is not null and sex='" + sex + "' and age_lower<=" + nl +
" and age_upper>=" + nl + "").Length > 0 ?
thresholdDt.Select("exam_project_maintain_id=428 and deviation_value is not null and sex='" + sex +
"' and age_lower<=" + nl + " and age_upper>=" + nl +
"")[0]["deviation_value"].ToString() : "0"); //左耳2000Hz
left3000_deviation = Convert.ToInt32(thresholdDt.Select("exam_project_maintain_id=430 and deviation_value is not null and sex='" + sex + "' and age_lower<=" + nl +
" and age_upper>=" + nl + "").Length > 0 ?
thresholdDt.Select("exam_project_maintain_id=430 and deviation_value is not null and sex='" + sex +
"' and age_lower<=" + nl + " and age_upper>=" + nl +
"")[0]["deviation_value"].ToString() : "0"); //左耳3000Hz
left4000_deviation = Convert.ToInt32(thresholdDt.Select("exam_project_maintain_id=432 and deviation_value is not null and sex='" + sex + "' and age_lower<=" + nl +
" and age_upper>=" + nl + "").Length > 0 ?
thresholdDt.Select("exam_project_maintain_id=432 and deviation_value is not null and sex='" + sex +
"' and age_lower<=" + nl + " and age_upper>=" + nl +
"")[0]["deviation_value"].ToString() : "0"); //左耳4000Hz
left6000_deviation = Convert.ToInt32(thresholdDt.Select("exam_project_maintain_id=434 and deviation_value is not null and sex='" + sex + "' and age_lower<=" + nl +
" and age_upper>=" + nl + "").Length > 0 ?
thresholdDt.Select("exam_project_maintain_id=434 and deviation_value is not null and sex='" + sex +
"' and age_lower<=" + nl + " and age_upper>=" + nl +
"")[0]["deviation_value"].ToString() : "0"); //左耳6000Hz
right500_deviation = Convert.ToInt32(thresholdDt.Select("exam_project_maintain_id=425 and deviation_value is not null and sex='" + sex + "' and age_lower<=" + nl +
" and age_upper>=" + nl + "").Length > 0 ?
thresholdDt.Select("exam_project_maintain_id=425 and deviation_value is not null and sex='" + sex +
"' and age_lower<=" + nl + " and age_upper>=" + nl +
"")[0]["deviation_value"].ToString() : "0"); //右耳500Hz
right1000_deviation = Convert.ToInt32(thresholdDt.Select("exam_project_maintain_id=427 and deviation_value is not null and sex='" + sex + "' and age_lower<=" + nl +
" and age_upper>=" + nl + "").Length > 0 ?
thresholdDt.Select("exam_project_maintain_id=427 and deviation_value is not null and sex='" + sex +
"' and age_lower<=" + nl + " and age_upper>=" + nl +
"")[0]["deviation_value"].ToString() : "0"); //右耳1000Hz
right2000_deviation = Convert.ToInt32(thresholdDt.Select("exam_project_maintain_id=429 and deviation_value is not null and sex='" + sex + "' and age_lower<=" + nl +
" and age_upper>=" + nl + "").Length > 0 ?
thresholdDt.Select("exam_project_maintain_id=429 and deviation_value is not null and sex='" + sex +
"' and age_lower<=" + nl + " and age_upper>=" + nl +
"")[0]["deviation_value"].ToString() : "0"); //右耳2000Hz
right3000_deviation = Convert.ToInt32(thresholdDt.Select("exam_project_maintain_id=431 and deviation_value is not null and sex='" + sex + "' and age_lower<=" + nl +
" and age_upper>=" + nl + "").Length > 0 ?
thresholdDt.Select("exam_project_maintain_id=431 and deviation_value is not null and sex='" + sex +
"' and age_lower<=" + nl + " and age_upper>=" + nl +
"")[0]["deviation_value"].ToString() : "0"); //右耳3000Hz
right4000_deviation = Convert.ToInt32(thresholdDt.Select("exam_project_maintain_id=433 and deviation_value is not null and sex='" + sex + "' and age_lower<=" + nl +
" and age_upper>=" + nl + "").Length > 0 ?
thresholdDt.Select("exam_project_maintain_id=433 and deviation_value is not null and sex='" + sex +
"' and age_lower<=" + nl + " and age_upper>=" + nl +
"")[0]["deviation_value"].ToString() : "0"); //右耳4000Hz
right6000_deviation = Convert.ToInt32(thresholdDt.Select("exam_project_maintain_id=435 and deviation_value is not null and sex='" + sex + "' and age_lower<=" + nl +
" and age_upper>=" + nl + "").Length > 0 ?
thresholdDt.Select("exam_project_maintain_id=435 and deviation_value is not null and sex='" + sex +
"' and age_lower<=" + nl + " and age_upper>=" + nl +
"")[0]["deviation_value"].ToString() : "0"); //右耳6000Hz
//计算 双耳高频平均听阈dB=(左耳3000Hz+左耳4000Hz+左耳6000Hz + 右耳3000Hz+右耳4000Hz+右耳6000Hz)/6
//双耳高频平均听阈 = 【85-4+80-4+85-6+90-4+85-4+90-6】/6
srgppjty = ((left3000 - left3000_deviation) + (left4000 - left4000_deviation) + (left6000 - left6000_deviation) + (right3000 - right3000_deviation)
+ (right4000 - right4000_deviation) + (right6000 - right6000_deviation)) / 6;
//计算 左耳平均听阈=500Hz+1000Hz+2000Hz+3000Hz/4
//单耳平均听阈 左耳85 - 2+85 - 2+85 - 3+85 - 4】/ 4
left_pjty = ((left500 - left500_deviation) + (left1000 - left1000_deviation) + (left2000 - left2000_deviation)) / 3;
//计算 右耳平均听阈=500Hz+1000Hz+2000Hz+3000Hz/4
//单耳平均听阈 右耳90 - 2+90 - 2+90 - 3+90 - 4】/ 4
right_pjty = ((right500 - right500_deviation) + (right1000 - right1000_deviation) + (right2000 - right2000_deviation)) / 3;
//绑定电测听和计算值 结果
re.SetParameterValue("left500", left500!=0?left500.ToString():"");
re.SetParameterValue("left1000", left1000!=0?left1000.ToString():"");
re.SetParameterValue("left2000", left2000!=0?left2000.ToString():"");
re.SetParameterValue("left3000", left3000!=0?left3000.ToString():"");
re.SetParameterValue("left4000", left4000!=0?left4000.ToString():"");
re.SetParameterValue("left6000", left6000 != 0 ? left6000.ToString() : "");
re.SetParameterValue("right500", right500 != 0 ? right500.ToString() : "");
re.SetParameterValue("right1000", right1000 != 0 ? right1000.ToString() : "");
re.SetParameterValue("right2000", right2000 != 0 ? right2000.ToString() : "");
re.SetParameterValue("right3000", right3000 != 0 ? right3000.ToString() : "");
re.SetParameterValue("right4000", right4000 != 0 ? right4000.ToString() : "");
re.SetParameterValue("right6000", right6000 != 0 ? right6000.ToString() : "");
re.SetParameterValue("lj500", left500_deviation != 0 ? left500_deviation.ToString() : "");
re.SetParameterValue("lj1000", left1000_deviation != 0 ? left1000_deviation.ToString() : "");
re.SetParameterValue("lj2000", left2000_deviation != 0 ? left2000_deviation.ToString() : "");
re.SetParameterValue("lj3000", left3000_deviation != 0 ? left3000_deviation.ToString() : "");
re.SetParameterValue("lj4000", left4000_deviation != 0 ? left4000_deviation.ToString() : "");
re.SetParameterValue("lj6000", left6000_deviation != 0 ? left6000_deviation.ToString() : "");
re.SetParameterValue("rj500", right500_deviation != 0 ? right500_deviation.ToString() : "");
re.SetParameterValue("rj1000", right1000_deviation != 0 ? right1000_deviation.ToString() : "");
re.SetParameterValue("rj2000", right2000_deviation != 0 ? right2000_deviation.ToString() : "");
re.SetParameterValue("rj3000", right3000_deviation != 0 ? right3000_deviation.ToString() : "");
re.SetParameterValue("rj4000", right4000_deviation != 0 ? right4000_deviation.ToString() : "");
re.SetParameterValue("rj6000", right6000_deviation != 0 ? right6000_deviation.ToString() : "");
re.SetParameterValue("srgppjty", srgppjty != 0 ? srgppjty.ToString() : "");
re.SetParameterValue("left_pjty", left_pjty != 0 ? left_pjty.ToString() : "");
re.SetParameterValue("right_pjty", right_pjty != 0 ? right_pjty.ToString() : "");
re.SetParameterValue("dct_presenter", tjjg.Select("project_id=11324").Length > 0 ? tjjg.Select("project_id=11324")[0]["presenter"].ToString() : "");
re.SetParameterValue("dct_commit_date", tjjg.Select("project_id=11324").Length > 0 ? tjjg.Select("project_id=11324")[0]["commit_date"].ToString() : "");
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
//获取电测听医师
string jsonData14 = "";
//获取电测听的诊断医师
jsonData14 = wc.DownloadString(_url + "/occupationExam/getDCT_YS?person_id=" + person_id);
DataTable DCT_YS_Dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData14);
//绑定电测听 医师
if (DCT_YS_Dt.Rows.Count != 0)
{
DataTable doc = new DataTable();
doc.Columns.Add("user", typeof(byte[]));
DataRow docDr = doc.NewRow();
docDr["user"] = Convert.FromBase64String(DCT_YS_Dt.Rows[0]["commit_doctor"].ToString());//phone_path
doc.Rows.Add(docDr);
re.RegisterData(doc, "dct");
//re.SetParameterValue("wz_zdys", WzZdysDt.Rows[0]["commit_doctor"].ToString());
//re.SetParameterValue("dct_presenter_img", Convert.FromBase64String(DCT_YS_Dt.Rows[0]["commit_doctor"].ToString()));//phone_path
}
else
{
DataTable doc = new DataTable();
doc.Columns.Add("user", typeof(byte[]));
DataRow docDr = doc.NewRow();
// docDr["user"] = "";//phone_path
doc.Rows.Add(docDr);
re.RegisterData(doc, "dct");
//re.SetParameterValue("dct_presenter_img","");//phone_path
}
if (tjjg.Select("project_id=11324").Length > 0)
{
re.SetParameterValue("dct_isShow", "yes");
}
else
{
re.SetParameterValue("dct_isShow", "no");
}
}
#endregion
#region
public void BDTzzy(DataTable tjjg, FastReport.Report re, DataTable dttjxz)
{
DataTable tzzyDt = new DataTable();
tzzyDt.Columns.Add("22168", typeof(string)); //身高
tzzyDt.Columns.Add("22169", typeof(string));//体重
tzzyDt.Columns.Add("22217", typeof(string));//精神状态
tzzyDt.Columns.Add("11351", typeof(string));//听力(左:15=11351)
tzzyDt.Columns.Add("11352", typeof(string));//听力(右:15=11352)
tzzyDt.Columns.Add("22199", typeof(string));//视力(左:4.8=22199)
tzzyDt.Columns.Add("22200", typeof(string));//视力(右:4.8=22200)
tzzyDt.Columns.Add("22204", typeof(string));//辨色力(左:正常=22204)
tzzyDt.Columns.Add("22205", typeof(string));//辨色力(右:正常=22205)
tzzyDt.Columns.Add("22163", typeof(string));//血压
tzzyDt.Columns.Add("22164", typeof(string));//脉搏
tzzyDt.Columns.Add("22218", typeof(string));//神经及精神疾病
tzzyDt.Columns.Add("ndt", typeof(string));//脑电图(可或缺)
tzzyDt.Columns.Add("22216", typeof(string));//肺呼吸道疾病
tzzyDt.Columns.Add("22219", typeof(string));//心血管疾病
tzzyDt.Columns.Add("10033", typeof(string));//心电图(可或缺)
tzzyDt.Columns.Add("22195", typeof(string));//腹腔器官疾病
tzzyDt.Columns.Add("22196", typeof(string));//脊柱
tzzyDt.Columns.Add("22197", typeof(string));//四肢
tzzyDt.Columns.Add("22202", typeof(string));//四肢
tzzyDt.Columns.Add("22203", typeof(string));//四肢
DataRow tzzyRr = tzzyDt.NewRow();
tzzyRr["22168"] = tjjg.Select("project_id=22168").Length > 0 ? tjjg.Select("project_id=22168")[0]["project_result"].ToString() : "";
tzzyRr["22169"] = tjjg.Select("project_id=22169").Length > 0 ? tjjg.Select("project_id=22169")[0]["project_result"].ToString() : "";
tzzyRr["22217"] = tjjg.Select("project_id=22217").Length > 0 ? tjjg.Select("project_id=22217")[0]["project_result"].ToString() : "";
tzzyRr["11351"] = tjjg.Select("project_id=11351").Length > 0 ? tjjg.Select("project_id=11351")[0]["project_result"].ToString() : "";
tzzyRr["11352"] = tjjg.Select("project_id=11352").Length > 0 ? tjjg.Select("project_id=11352")[0]["project_result"].ToString() : "";
tzzyRr["22199"] = tjjg.Select("project_id=22199").Length > 0 ? tjjg.Select("project_id=22199")[0]["project_result"].ToString() : "";
tzzyRr["22200"] = tjjg.Select("project_id=22200").Length > 0 ? tjjg.Select("project_id=22200")[0]["project_result"].ToString() : "";
tzzyRr["22204"] = tjjg.Select("project_id=22204").Length > 0 ? tjjg.Select("project_id=22204")[0]["project_result"].ToString() : "";
tzzyRr["22205"] = tjjg.Select("project_id=22205").Length > 0 ? tjjg.Select("project_id=22205")[0]["project_result"].ToString() : "";
tzzyRr["22163"] = tjjg.Select("project_id=22163").Length > 0 ? tjjg.Select("project_id=22163")[0]["project_result"].ToString() : "";
tzzyRr["22164"] = tjjg.Select("project_id=22164").Length > 0 ? tjjg.Select("project_id=22164")[0]["project_result"].ToString() : "";
tzzyRr["22218"] = tjjg.Select("project_id=22218").Length > 0 ? tjjg.Select("project_id=22218")[0]["project_result"].ToString() : "";
tzzyRr["ndt"] = "";
tzzyRr["22216"] = tjjg.Select("project_id=22216").Length > 0 ? tjjg.Select("project_id=22216")[0]["project_result"].ToString() : "";
tzzyRr["22219"] = tjjg.Select("project_id=22219").Length > 0 ? tjjg.Select("project_id=22219")[0]["project_result"].ToString() : "";
tzzyRr["10033"] = tjjg.Select("project_id=10033").Length > 0 ? tjjg.Select("project_id=10033")[0]["project_result"].ToString() : "";
tzzyRr["22195"] = tjjg.Select("project_id=22195").Length > 0 ? tjjg.Select("project_id=22195")[0]["project_result"].ToString() : "";
tzzyRr["22196"] = tjjg.Select("project_id=22196").Length > 0 ? tjjg.Select("project_id=22196")[0]["project_result"].ToString() : "";
tzzyRr["22197"] = tjjg.Select("project_id=22197").Length > 0 ? tjjg.Select("project_id=22197")[0]["project_result"].ToString() : "";
tzzyRr["22202"] = tjjg.Select("project_id=22202").Length > 0 ? tjjg.Select("project_id=22202")[0]["project_result"].ToString() : "";
tzzyRr["22203"] = tjjg.Select("project_id=22203").Length > 0 ? tjjg.Select("project_id=22203")[0]["project_result"].ToString() : "";
tzzyDt.Rows.Add(tzzyRr);
re.RegisterData(tzzyDt, "tzzyDt");
//心电图医生
string xdt_ys = tjjg.Select("exam_group_maintain_id=19").Length > 0 ? tjjg.Select("exam_group_maintain_id=19")[0]["presenter"].ToString() : "";
//心电图时间
string xdt_sj = tjjg.Select("exam_group_maintain_id=19").Length > 0 ? tjjg.Select("exam_group_maintain_id=19")[0]["commit_date"].ToString() : "";
//电测听医生
string dct_ys = tjjg.Select("exam_group_maintain_id=26").Length > 0 ? tjjg.Select("exam_group_maintain_id=26")[0]["presenter"].ToString() : "";
//电测听时间
string dct_sj = tjjg.Select("exam_group_maintain_id=26").Length > 0 ? tjjg.Select("exam_group_maintain_id=26")[0]["commit_date"].ToString() : "";
//内科常规医生
string nkcg_ys = tjjg.Select("exam_group_maintain_id=71").Length > 0 ? tjjg.Select("exam_group_maintain_id=71")[0]["presenter"].ToString() : "";
//内科常规时间
string nkcg_sj = tjjg.Select("exam_group_maintain_id=71").Length > 0 ? tjjg.Select("exam_group_maintain_id=71")[0]["commit_date"].ToString() : "";
//外科常规医生
string wkcg_ys = tjjg.Select("exam_group_maintain_id=80").Length > 0 ? tjjg.Select("exam_group_maintain_id=80")[0]["presenter"].ToString() : "";
//外科常规时间
string wkcg_sj = tjjg.Select("exam_group_maintain_id=80").Length > 0 ? tjjg.Select("exam_group_maintain_id=80")[0]["commit_date"].ToString() : "";
//五官视力医生
string wgsl_ys = tjjg.Select("exam_group_maintain_id=81").Length > 0 ? tjjg.Select("exam_group_maintain_id=81")[0]["presenter"].ToString() : "";
//五官视力时间
string wgsl_sj = tjjg.Select("exam_group_maintain_id=81").Length > 0 ? tjjg.Select("exam_group_maintain_id=81")[0]["commit_date"].ToString() : "";
DataTable yssjDt = new DataTable();
yssjDt.Columns.Add("xdt_ys", typeof(string));
yssjDt.Columns.Add("xdt_sj", typeof(string));
yssjDt.Columns.Add("dct_ys", typeof(string));
yssjDt.Columns.Add("dct_sj", typeof(string));
yssjDt.Columns.Add("nkcg_ys", typeof(string));
yssjDt.Columns.Add("nkcg_sj", typeof(string));
yssjDt.Columns.Add("wkcg_ys", typeof(string));
yssjDt.Columns.Add("wkcg_sj", typeof(string));
yssjDt.Columns.Add("wgsl_ys", typeof(string));
yssjDt.Columns.Add("wgsl_sj", typeof(string));
DataRow yssjRr = yssjDt.NewRow();
yssjRr["xdt_ys"] = xdt_ys;
yssjRr["xdt_sj"] = xdt_sj;
yssjRr["dct_ys"] = dct_ys;
yssjRr["dct_sj"] = dct_sj;
yssjRr["nkcg_ys"] = nkcg_ys;
yssjRr["nkcg_sj"] = nkcg_sj;
yssjRr["wkcg_ys"] = wkcg_ys;
yssjRr["wkcg_sj"] = wkcg_sj;
yssjRr["wgsl_ys"] = wgsl_ys;
yssjRr["wgsl_sj"] = wgsl_sj;
yssjDt.Rows.Add(yssjRr);
re.RegisterData(yssjDt, "yssjDt");
//处理不合格项目
DataRow[] rows = tjjg.Select("qualified='不合格'");
DataTable dtbhgxm = tjjg.Clone();
foreach (DataRow dr in rows)
{
dtbhgxm.Rows.Add(dr.ItemArray);
}
string stjjg = "结果意见:";
foreach (DataRow dr in dttjxz.Rows)
{
var rs = dtbhgxm.Select("exam_group_maintain_id=" + dr["id"].ToString());
if (rs.Length > 0)
{
stjjg += "【" + dr["team_name"].ToString() + "】";
foreach (DataRow r in rs)
{
stjjg += r["project_name"].ToString() + ":" + r["project_result"].ToString();
}
}
}
if (stjjg == "结果意见:")
{
stjjg += "目前未见异常。";
}
re.SetParameterValue("jcjg", stjjg);
}
#endregion
#region
public void BDZycgbg(DataTable tjjgDt, FastReport.Report re)
{
DataTable zycgbgDt = new DataTable();
zycgbgDt.Columns.Add("10933", typeof(string)); //裸 眼 视 力 视力(左:4.8=10933)
zycgbgDt.Columns.Add("10934", typeof(string));//裸 眼 视 力 视力(右:4.8=10934)
zycgbgDt.Columns.Add("10899", typeof(string));//矫 正 视 力(左:4.8=10899)
zycgbgDt.Columns.Add("10900", typeof(string));//矫 正 视 力(右:4.8=10900)
zycgbgDt.Columns.Add("10903", typeof(string));//辨色力= 10903
zycgbgDt.Columns.Add("11346", typeof(string));//嗅 觉 =11346
zycgbgDt.Columns.Add("11351", typeof(string));//听力(左:4.8=11351)
zycgbgDt.Columns.Add("11352", typeof(string));//听力(右:4.8=11352)
zycgbgDt.Columns.Add("11285", typeof(string));//外 耳(外耳=11285)
zycgbgDt.Columns.Add("11287", typeof(string));//外 耳(外耳道=11287)
zycgbgDt.Columns.Add("11353", typeof(string));//耳 疾=11353
zycgbgDt.Columns.Add("11348", typeof(string));//鼻及鼻窦病=11348
zycgbgDt.Columns.Add("11292", typeof(string));//口 腔=11292
zycgbgDt.Columns.Add("11291", typeof(string));//咽 喉=11291
zycgbgDt.Columns.Add("11277", typeof(string));//身 高=11277
zycgbgDt.Columns.Add("11273", typeof(string));//淋巴结=11273
zycgbgDt.Columns.Add("11341", typeof(string));//皮 肤=11341
zycgbgDt.Columns.Add("11278", typeof(string));//体 重=11278
zycgbgDt.Columns.Add("11274", typeof(string));//甲状腺=11274
zycgbgDt.Columns.Add("11303", typeof(string));//脊 柱=11303
zycgbgDt.Columns.Add("11349", typeof(string)); //四 肢=11349
zycgbgDt.Columns.Add("11350", typeof(string));//关 节=11350
zycgbgDt.Columns.Add("11279", typeof(string));//营养发育=11279
zycgbgDt.Columns.Add("10000", typeof(string));//心 脏=10000
zycgbgDt.Columns.Add("10001", typeof(string));//肝 脏=10001
zycgbgDt.Columns.Add("22130", typeof(string));//心 率=22130
zycgbgDt.Columns.Add("10003", typeof(string));//肺 脏=10003
zycgbgDt.Columns.Add("10002", typeof(string));//脾 脏=10002
zycgbgDt.Columns.Add("11034", typeof(string));//血 压=11034mmHg
zycgbgDt.Columns.Add("10033", typeof(string));//心电图=10033
zycgbgDt.Columns.Add("11015", typeof(string));//胸部X线检查=11015
zycgbgDt.Columns.Add("10108", typeof(string));//白细胞数目=10108
zycgbgDt.Columns.Add("10117", typeof(string));//红细胞数目=10117
zycgbgDt.Columns.Add("10110", typeof(string));//血红蛋白=10110
zycgbgDt.Columns.Add("10041", typeof(string));//红细胞压积=10041
zycgbgDt.Columns.Add("10042", typeof(string));//平均红细胞体积=10042
zycgbgDt.Columns.Add("10043", typeof(string));//平均红细胞血红蛋白含量=10043
zycgbgDt.Columns.Add("10044", typeof(string));//平均红细胞血红蛋白浓度=10044
zycgbgDt.Columns.Add("10114", typeof(string));//血小板数目=10114
zycgbgDt.Columns.Add("10045", typeof(string));//淋巴细胞百分比=10045
zycgbgDt.Columns.Add("10047", typeof(string));//中性粒细胞百分比=10047
zycgbgDt.Columns.Add("10112", typeof(string));//淋巴细胞数目=10112
zycgbgDt.Columns.Add("10111", typeof(string));//中性粒细胞数目=10111
zycgbgDt.Columns.Add("10054", typeof(string));//红细胞分布宽度SD=10054
zycgbgDt.Columns.Add("10113", typeof(string));//血小板分布宽度=10113
zycgbgDt.Columns.Add("10034", typeof(string));//平均血小板体积=10034
zycgbgDt.Columns.Add("10035", typeof(string));//血小板压积=10035
zycgbgDt.Columns.Add("11250", typeof(string));//红细胞分布宽度变异系数=11250
zycgbgDt.Columns.Add("11243", typeof(string));//中间细胞总数=11243
zycgbgDt.Columns.Add("11244", typeof(string));//中间细胞百分比=11244
zycgbgDt.Columns.Add("11373", typeof(string));//肝功能=11373
DataRow zycgbgRr = zycgbgDt.NewRow();
zycgbgRr["10933"] = tjjgDt.Select("project_id=10933").Length > 0 ? tjjgDt.Select("project_id=10933")[0]["project_result"].ToString() : "";
zycgbgRr["10934"] = tjjgDt.Select("project_id=10934").Length > 0 ? tjjgDt.Select("project_id=10934")[0]["project_result"].ToString() : "";
zycgbgRr["10899"] = tjjgDt.Select("project_id=10899").Length > 0 ? tjjgDt.Select("project_id=10899")[0]["project_result"].ToString() : "";
zycgbgRr["10900"] = tjjgDt.Select("project_id=10900").Length > 0 ? tjjgDt.Select("project_id=10900")[0]["project_result"].ToString() : "";
zycgbgRr["10903"] = tjjgDt.Select("project_id=10903").Length > 0 ? tjjgDt.Select("project_id=10903")[0]["project_result"].ToString() : "";
zycgbgRr["11346"] = tjjgDt.Select("project_id=11346").Length > 0 ? tjjgDt.Select("project_id=11346")[0]["project_result"].ToString() : "";
zycgbgRr["11351"] = tjjgDt.Select("project_id=11351").Length > 0 ? tjjgDt.Select("project_id=11351")[0]["project_result"].ToString() : "";
zycgbgRr["11352"] = tjjgDt.Select("project_id=11352").Length > 0 ? tjjgDt.Select("project_id=11352")[0]["project_result"].ToString() : "";
zycgbgRr["11285"] = tjjgDt.Select("project_id=11285").Length > 0 ? tjjgDt.Select("project_id=11285")[0]["project_result"].ToString() : "";
zycgbgRr["11287"] = tjjgDt.Select("project_id=11287").Length > 0 ? tjjgDt.Select("project_id=11287")[0]["project_result"].ToString() : "";
zycgbgRr["11353"] = tjjgDt.Select("project_id=11353").Length > 0 ? tjjgDt.Select("project_id=11353")[0]["project_result"].ToString() : "";
zycgbgRr["11348"] = tjjgDt.Select("project_id=11348").Length > 0 ? tjjgDt.Select("project_id=11348")[0]["project_result"].ToString() : "";
zycgbgRr["11292"] = tjjgDt.Select("project_id=11292").Length > 0 ? tjjgDt.Select("project_id=11292")[0]["project_result"].ToString() : "";
zycgbgRr["11291"] = tjjgDt.Select("project_id=11291").Length > 0 ? tjjgDt.Select("project_id=11291")[0]["project_result"].ToString() : "";
zycgbgRr["11277"] = tjjgDt.Select("project_id=11277").Length > 0 ? tjjgDt.Select("project_id=11277")[0]["project_result"].ToString() : "";
zycgbgRr["11273"] = tjjgDt.Select("project_id=11273").Length > 0 ? tjjgDt.Select("project_id=11273")[0]["project_result"].ToString() : "";
zycgbgRr["11341"] = tjjgDt.Select("project_id=11341").Length > 0 ? tjjgDt.Select("project_id=11341")[0]["project_result"].ToString() : "";
zycgbgRr["11278"] = tjjgDt.Select("project_id=11278").Length > 0 ? tjjgDt.Select("project_id=11278")[0]["project_result"].ToString() : "";
zycgbgRr["11274"] = tjjgDt.Select("project_id=11274").Length > 0 ? tjjgDt.Select("project_id=11274")[0]["project_result"].ToString() : "";
zycgbgRr["11303"] = tjjgDt.Select("project_id=11303").Length > 0 ? tjjgDt.Select("project_id=11303")[0]["project_result"].ToString() : "";
zycgbgRr["11349"] = tjjgDt.Select("project_id=11349").Length > 0 ? tjjgDt.Select("project_id=11349")[0]["project_result"].ToString() : "";
zycgbgRr["11350"] = tjjgDt.Select("project_id=11350").Length > 0 ? tjjgDt.Select("project_id=11350")[0]["project_result"].ToString() : "";
zycgbgRr["11279"] = tjjgDt.Select("project_id=11279").Length > 0 ? tjjgDt.Select("project_id=11279")[0]["project_result"].ToString() : "";
zycgbgRr["10000"] = tjjgDt.Select("project_id=10000").Length > 0 ? tjjgDt.Select("project_id=10000")[0]["project_result"].ToString() : "";
zycgbgRr["10001"] = tjjgDt.Select("project_id=10001").Length > 0 ? tjjgDt.Select("project_id=10001")[0]["project_result"].ToString() : "";
zycgbgRr["22130"] = tjjgDt.Select("project_id=22130").Length > 0 ? tjjgDt.Select("project_id=22130")[0]["project_result"].ToString() : "";
zycgbgRr["10003"] = tjjgDt.Select("project_id=10003").Length > 0 ? tjjgDt.Select("project_id=10003")[0]["project_result"].ToString() : "";
zycgbgRr["10002"] = tjjgDt.Select("project_id=10002").Length > 0 ? tjjgDt.Select("project_id=10002")[0]["project_result"].ToString() : "";
zycgbgRr["11034"] = tjjgDt.Select("project_id=11034").Length > 0 ? tjjgDt.Select("project_id=11034")[0]["project_result"].ToString() : "";
zycgbgRr["10033"] = tjjgDt.Select("project_id=10033").Length > 0 ? tjjgDt.Select("project_id=10033")[0]["project_result"].ToString() : "";
zycgbgRr["11015"] = tjjgDt.Select("project_id=11015").Length > 0 ? tjjgDt.Select("project_id=11015")[0]["project_result"].ToString() : "";
zycgbgRr["10108"] = tjjgDt.Select("project_id=10108").Length > 0 ? tjjgDt.Select("project_id=10108")[0]["project_result"].ToString() : "";
zycgbgRr["10117"] = tjjgDt.Select("project_id=10117").Length > 0 ? tjjgDt.Select("project_id=10117")[0]["project_result"].ToString() : "";
zycgbgRr["10110"] = tjjgDt.Select("project_id=10110").Length > 0 ? tjjgDt.Select("project_id=10110")[0]["project_result"].ToString() : "";
zycgbgRr["10041"] = tjjgDt.Select("project_id=10041").Length > 0 ? tjjgDt.Select("project_id=10041")[0]["project_result"].ToString() : "";
zycgbgRr["10042"] = tjjgDt.Select("project_id=10042").Length > 0 ? tjjgDt.Select("project_id=10042")[0]["project_result"].ToString() : "";
zycgbgRr["10043"] = tjjgDt.Select("project_id=10043").Length > 0 ? tjjgDt.Select("project_id=10043")[0]["project_result"].ToString() : "";
zycgbgRr["10044"] = tjjgDt.Select("project_id=10044").Length > 0 ? tjjgDt.Select("project_id=10044")[0]["project_result"].ToString() : "";
zycgbgRr["10114"] = tjjgDt.Select("project_id=10114").Length > 0 ? tjjgDt.Select("project_id=10114")[0]["project_result"].ToString() : "";
zycgbgRr["10045"] = tjjgDt.Select("project_id=10045").Length > 0 ? tjjgDt.Select("project_id=10045")[0]["project_result"].ToString() : "";
zycgbgRr["10047"] = tjjgDt.Select("project_id=10047").Length > 0 ? tjjgDt.Select("project_id=10047")[0]["project_result"].ToString() : "";
zycgbgRr["10112"] = tjjgDt.Select("project_id=10112").Length > 0 ? tjjgDt.Select("project_id=10112")[0]["project_result"].ToString() : "";
zycgbgRr["10111"] = tjjgDt.Select("project_id=10111").Length > 0 ? tjjgDt.Select("project_id=10111")[0]["project_result"].ToString() : "";
zycgbgRr["10054"] = tjjgDt.Select("project_id=10054").Length > 0 ? tjjgDt.Select("project_id=10054")[0]["project_result"].ToString() : "";
zycgbgRr["10113"] = tjjgDt.Select("project_id=10113").Length > 0 ? tjjgDt.Select("project_id=10113")[0]["project_result"].ToString() : "";
zycgbgRr["10034"] = tjjgDt.Select("project_id=10034").Length > 0 ? tjjgDt.Select("project_id=10034")[0]["project_result"].ToString() : "";
zycgbgRr["10035"] = tjjgDt.Select("project_id=10035").Length > 0 ? tjjgDt.Select("project_id=10035")[0]["project_result"].ToString() : "";
zycgbgRr["11250"] = tjjgDt.Select("project_id=11250").Length > 0 ? tjjgDt.Select("project_id=11250")[0]["project_result"].ToString() : "";
zycgbgRr["11243"] = tjjgDt.Select("project_id=11243").Length > 0 ? tjjgDt.Select("project_id=11243")[0]["project_result"].ToString() : "";
zycgbgRr["11244"] = tjjgDt.Select("project_id=11244").Length > 0 ? tjjgDt.Select("project_id=11244")[0]["project_result"].ToString() : "";
zycgbgRr["11373"] = tjjgDt.Select("project_id=11373").Length > 0 ? tjjgDt.Select("project_id=11373")[0]["project_result"].ToString() : "";
zycgbgDt.Rows.Add(zycgbgRr);
re.RegisterData(zycgbgDt, "zycgbgDt");
}
#endregion
#endregion
public void PrintJKZM_BG(string ids, string Preview = "true")
{
eSet.ReportSettings.ShowProgress = false;
WebClient wc = new WebClient();
string jsonData = "";
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData = wc.DownloadString(_url + "professional/getjkzm_bg?ids=" + ids);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData);
dt.Columns.Add("photo", typeof(byte[]));
dt.Columns.Add("yzewm", typeof(byte[]));
foreach (DataRow dr in dt.Rows)
{
dr["photo"] = Convert.FromBase64String(dr["img"].ToString());
dr["yzewm"] = Convert.FromBase64String(dr["ewm"].ToString());
}
FastReport.Report re = new FastReport.Report();
re.Load(_reportPath);
re.RegisterData(dt, "table");
re.PrintSettings.ShowDialog = false;
if (Preview == "true")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#region
public static FastReport.EnvironmentSettings eSet = new EnvironmentSettings();
public void PrintJKZM_SP(string ids, string Preview = "true")
{
eSet.ReportSettings.ShowProgress = false;
WebClient wc = new WebClient();
string jsonData = "";
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData = wc.DownloadString(_url + "/professional/getjkzm_sp?ids=" + ids);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData);
dt.Columns.Add("photo", typeof(byte[]));
dt.Columns.Add("yzewm", typeof(byte[]));
foreach (DataRow dr in dt.Rows)
{
dr["photo"] = Convert.FromBase64String(dr["img"].ToString());
dr["yzewm"] = Convert.FromBase64String(dr["ewm"].ToString());
}
FastReport.Report re = new FastReport.Report();
re.Load(_reportPath);
re.RegisterData(dt, "table");
re.PrintSettings.ShowDialog = false;
if (Preview == "true")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region --
public void PrintJKZM_GG(string ids, string Preview = "true")
{
WebClient wc = new WebClient();
string jsonData = "";
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData = wc.DownloadString(_url + "professional/getjkzm_gg?ids=" + ids);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData);
dt.Columns.Add("photo", typeof(byte[]));
dt.Columns.Add("yzewm", typeof(byte[]));
foreach (DataRow dr in dt.Rows)
{
dr["photo"] = Convert.FromBase64String(dr["img"].ToString());
dr["yzewm"] = Convert.FromBase64String(dr["ewm"].ToString());
}
FastReport.Report re = new FastReport.Report();
re.Load(_reportPath);
re.RegisterData(dt, "table");
re.PrintSettings.ShowDialog = false;
if (Preview == "true")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region --
public void PrintJKZM_YP(string ids, string Preview = "true")
{
WebClient wc = new WebClient();
string jsonData = "";
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData = wc.DownloadString(_url + "professional/getjkzm_yp?ids=" + ids);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData);
dt.Columns.Add("photo", typeof(byte[]));
dt.Columns.Add("yzewm", typeof(byte[]));
foreach (DataRow dr in dt.Rows)
{
dr["photo"] = Convert.FromBase64String(dr["img"].ToString());
dr["yzewm"] = Convert.FromBase64String(dr["ewm"].ToString());
}
FastReport.Report re = new FastReport.Report();
re.Load(_reportPath);
re.RegisterData(dt, "table");
re.PrintSettings.ShowDialog = false;
if (Preview == "true")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region
public void PrintFJTZ(string ids, string preview = "true")
{
WebClient wc = new WebClient();
string jsonData = "";
string jsonData1 = "";
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData = wc.DownloadString(_url + "professional/getfjtzd_main?ids=" + ids);
jsonData1 = wc.DownloadString(_url + "professional/getfjtzd_tjjg?ids=" + ids);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData);
DataTable dt1 = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
dt.Columns.Add("photo", typeof(byte[]));
foreach (DataRow dr in dt.Rows)
{
dr["photo"] = Convert.FromBase64String(dr["img"].ToString());
}
FastReport.Report re = new FastReport.Report();
re.Load(_reportPath);
re.RegisterData(dt, "table");
re.RegisterData(dt1, "tjjg");
re.PrintSettings.ShowDialog = false;
if (preview == "true")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region
public void PrintBHGTZ(string ids, string preview = "true")
{
WebClient wc = new WebClient();
string jsonData = "";
string jsonData1 = "";
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData = wc.DownloadString(_url + "professional/getbhgtzd_main?ids=" + ids);
jsonData1 = wc.DownloadString(_url + "professional/getfjtzd_tjjg?ids=" + ids);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData);
DataTable dt1 = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
dt.Columns.Add("photo", typeof(byte[]));
foreach (DataRow dr in dt.Rows)
{
dr["photo"] = Convert.FromBase64String(dr["img"].ToString());
}
FastReport.Report re = new FastReport.Report();
re.Load(_reportPath);
re.RegisterData(dt, "table");
re.RegisterData(dt1, "tjjg");
re.PrintSettings.ShowDialog = false;
if (preview == "true")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region
public void PrintHZBG(string report_num, string lx)
{
#region
if (Application.OpenForms["frmMsg"] == null)
{
formMsg = new frmMsg();
}
else
formMsg = (frmMsg)Application.OpenForms["frmMsg"];
if (lx == "下载")
{
formMsg.Show();
}
else if (lx == "报告下载完成")
{
formMsg.OutPutString("--------------报告下载完成-----------------");
return;
}
if (report_num.Trim() == "")
return;
#endregion
string hazardsAll = "";
//获取报告数据表
string jsonData1 = "";
//获取注册表
string jsonData2 = "";
//获取单位信息
string jsonData3 = "";
//获取职业病危害因素
string jsonData4 = "";
//获取化验项目参考表
string jsonData5 = "";
//获取职业健康检查的目的
string jsonData6 = "";
//获取检查项目
string jsonData7 = "";
//获取未见异常有异常的体检结果
string jsonData8 = "";
//获取复查有异常的体检结果
string jsonData9 = "";
//获取异常的有异常的体检结果
string jsonData10 = "";
//获取疑似职业病的有异常的体检结果
string jsonData11 = "";
//获取职业禁忌症的有异常的体检结果
string jsonData12 = "";
DataTable dwDt = new DataTable();
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
FastReport.Report re = new FastReport.Report();
re.Load(_reportPath);
try
{
jsonData1 = wc.DownloadString(_url + "Summary/getReportByNum?report_num=" + report_num);
//取到汇总报告表数据occupation_report
DataTable hzbgDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
if (hzbgDt.Rows.Count != 0)
{
//取到人员注册表数据professionalExam_registerreportId
//2023-12-08 xulu 传参修改为reportid
//jsonData2 = wc.DownloadString(_url + "Summary/getRegisterById?ids=" + hzbgDt.Rows[0]["person_ids"].ToString());
jsonData2 = wc.DownloadString(_url + "Summary/getRegisterByReportId?reportId=" + hzbgDt.Rows[0]["id"].ToString());
DataTable registerDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData2);
if (registerDt.Rows.Count != 0)
{
DataView dvWjyc = registerDt.DefaultView;
dvWjyc.RowFilter = "main_review like '%未见%'";
DataTable dtWjyc = dvWjyc.ToTable();
if (dtWjyc.Rows.Count != 0)
{
re.RegisterData(dtWjyc, "wjyc");
re.SetParameterValue("wjyc", "yse");
}
else
{
re.RegisterData(dtWjyc, "wjyc");
re.SetParameterValue("wjyc", "no");
}
DataView dvFc = registerDt.DefaultView;
DataView dvFc1 = registerDt.DefaultView;
//2023-12-11 修改复检筛选条件
//dvFc.RowFilter = "main_review like '%复查%'";
//获取复查人数
dvFc.RowFilter = "physical_num_old is not null";
DataTable dtFc = dvFc.ToTable();
//获取复查人员
dvFc1.RowFilter = "main_review like '%复查%'";
DataTable dtFc1 = dvFc1.ToTable();
if (dtFc1.Rows.Count != 0)
{
re.RegisterData(dtFc1, "fc");
re.SetParameterValue("fc", "yse");
}
else
{
re.RegisterData(dtFc1, "fc");
re.SetParameterValue("fc", "no");
}
DataView dvYc = registerDt.DefaultView;
//dvYc.RowFilter = "main_review not like '%未见%' and main_review not like '%复查%'";
dvYc.RowFilter = "main_review like '%其他疾病%' ";
DataTable dtYc = dvYc.ToTable();
if (dtYc.Rows.Count != 0)
{
re.RegisterData(dtYc, "yc");
re.SetParameterValue("yc", "yse");
}
else
{
re.RegisterData(dtYc, "yc");
re.SetParameterValue("yc", "no");
}
DataView dvYszyb = registerDt.DefaultView;
dvYszyb.RowFilter = "main_review like '%疑似职业病%'";
DataTable dtYszyb = dvYszyb.ToTable();
if (dtYszyb.Rows.Count != 0)
{
re.RegisterData(dtYszyb, "yszyb");
re.SetParameterValue("yszyb", "yse");
}
else
{
re.RegisterData(dtYszyb, "yszyb");
re.SetParameterValue("yszyb", "no");
}
DataView dvZyjjz = registerDt.DefaultView;
dvZyjjz.RowFilter = "main_review like '%职业禁忌证%'";
DataTable dtZyjjz = dvZyjjz.ToTable();
if (dtZyjjz.Rows.Count != 0)
{
re.RegisterData(dtZyjjz, "zyjjz");
re.SetParameterValue("zyjjz", "yse");
}
else
{
re.RegisterData(dtZyjjz, "zyjjz");
re.SetParameterValue("zyjjz", "no");
}
//查体人数
//总记录-复检记录
re.SetParameterValue("perCount", registerDt.Rows.Count- dtFc.Rows.Count);
}
//取到单位信息
jsonData3 = wc.DownloadString(_url + "Summary/getDw?dwmc=" + hzbgDt.Rows[0]["subject_company"].ToString());
dwDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData3);
//2023-12-13 xulu 无用注释
/* //获取职业病危害因素
//2023-12-08 xulu 传参修改为reportid
//jsonData4 = wc.DownloadString(_url + "Summary/getHazards?ids=" + hzbgDt.Rows[0]["person_ids"].ToString());
jsonData4 = wc.DownloadString(_url + "Summary/getHazards?reportId=" + hzbgDt.Rows[0]["id"].ToString());
DataTable hazardsDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData4);
if (hazardsDt.Rows.Count != 0)
{
//职业病危害因素
re.SetParameterValue("hazards", hazardsDt.Rows[0]["Hazards"].ToString());
}
//获取检查项目
jsonData7 = wc.DownloadString(_url + "Summary/getJcxm?str=" + hazardsDt.Rows[0]["Hazards"].ToString() + "|" + hzbgDt.Rows[0]["status"].ToString());
re.SetParameterValue("jcxm", jsonData7);
//获取化验项目
//2023-12-08 xulu 传参修改为reportid
//jsonData5 = wc.DownloadString(_url + "Summary/getHyxm?ids=" + hzbgDt.Rows[0]["person_ids"].ToString());
jsonData5 = wc.DownloadString(_url + "Summary/getHyxm?reportId=" + hzbgDt.Rows[0]["id"].ToString());
DataTable hyxmDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData5);
if (hyxmDt.Rows.Count != 0)
{
//绑定化验项目表
re.RegisterData(hyxmDt, "Table3");
}
//获取职业健康检查的目的
jsonData6 = wc.DownloadString(_url + "Summary/getZyjkjc?str=" + hazardsDt.Rows[0]["Hazards"].ToString() + "|" + hzbgDt.Rows[0]["status"]);
//获取检查项目
re.SetParameterValue("jkjcmd", jsonData6);*/
}
//绑定汇总报告表
re.RegisterData(hzbgDt, "Table1");
//绑定单位信息
re.RegisterData(dwDt, "Table2");
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
//默认C盘
string reportPath = "c:\\体检报告_新医路";
//读自定义配置
reportPath = ConfigurationManager.AppSettings.Get("reportpath_download") ?? reportPath;
if (lx == "下载")
{
FastReport.Export.Pdf.PDFExport export = new FastReport.Export.Pdf.PDFExport();
#region
bool folderExists = Directory.Exists(reportPath);
if (!folderExists)
{
Directory.CreateDirectory(reportPath);
}
//
string util_name = hzbgDt.Rows[0]["subject_company"].ToString();
string filePath = reportPath + util_name + ".pdf";
if (File.Exists(filePath))
{
File.Delete(filePath);
}
#endregion
#region PDF文件
//关闭生成进度条
EnvironmentSettings eSet = new EnvironmentSettings();
eSet.ReportSettings.ShowProgress = false;
//关闭对话框
re.PrintSettings.ShowDialog = false;
re.Prepare();
//导出
re.Export(export, filePath);
formMsg.Show();
formMsg.OutPutString(filePath + "已导出");
Application.DoEvents();
#endregion
return;
}
re.PrintSettings.ShowDialog = false;
try
{
//开启生成进度条
EnvironmentSettings eSet = new EnvironmentSettings();
eSet.ReportSettings.ShowProgress = true;
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
if (lx != "下载")
MessageBox.Show(ex.Message);
else
{
#region
if (hzbgDt != null && hzbgDt.Rows.Count > 0)
{
string util_name = hzbgDt.Rows[0]["subject_company"].ToString();
string filePath = reportPath + util_name + ".pdf";
formMsg.Show();
formMsg.OutPutString(filePath + "导出失败");
Application.DoEvents();
}
else
{
formMsg.Show();
formMsg.OutPutString("导出异常:" + ex.Message);
Application.DoEvents();
}
#endregion
}
//log
Log.WriteLogToTxt(ex.StackTrace.ToString());
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
re.Load(_reportPath);
}
#endregion
#region
public void PrinterSetting()
{
PrinterSetting ps = new PrinterSetting();
ps.ShowDialog();
}
#endregion
#region
public void PrintFPB(string id)
{
WebClient wc = new WebClient();
string jsonData1 = "";
string jsonData2 = "";
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "Charge3/getOne?id=" + id);
jsonData2 = wc.DownloadString(_url + "Charge3/getDetail?id=" + id);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
DataTable dt1 = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
DataTable dt2 = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData2);
//dt1.Columns["invoice_date"].DataType = typeof(DateTime);
FastReport.Report re = new FastReport.Report();
re.Load(_reportPath);
re.RegisterData(dt1, "dt1");
re.RegisterData(dt2, "dt2");
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.PrintSettings.ShowDialog = false;
try
{
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region
public void PrintFPD(string id)
{
WebClient wc = new WebClient();
string jsonData1 = "";
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "Charge/getOne?id=" + id);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
DataTable dt1 = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
FastReport.Report re = new FastReport.Report();
re.Load(_reportPath);
re.RegisterData(dt1, "dt1");
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.PrintSettings.ShowDialog = false;
try
{
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region
public void PrintRJS(string result, string skr, string skrq)
{
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
FastReport.Report re = new FastReport.Report();
re.Load(_reportPath);
re.SetParameterValue("skr", skr);
re.SetParameterValue("skrq", skrq);
DataTable tb = new DataTable();
DataColumn dc1 = new DataColumn("xj", typeof(decimal));
tb.Columns.Add(dc1);
DataColumn dc2 = new DataColumn("zz", typeof(decimal));
tb.Columns.Add(dc2);
DataColumn dc3 = new DataColumn("wx", typeof(decimal));
tb.Columns.Add(dc3);
DataColumn dc4 = new DataColumn("zfb", typeof(decimal));
tb.Columns.Add(dc4);
DataColumn dc5 = new DataColumn("hj", typeof(decimal));
tb.Columns.Add(dc5);
decimal hj = 0;
DataRow row = tb.NewRow();
string[] keyvalues = result.Split(new string[] { "】" }, StringSplitOptions.RemoveEmptyEntries);
foreach (string keyvalue in keyvalues)
{
string k = keyvalue.Split(new string[] { ":【" }, StringSplitOptions.RemoveEmptyEntries)[0];
string v = keyvalue.Split(new string[] { ":【" }, StringSplitOptions.RemoveEmptyEntries)[1];
if (k == "现金")
{
row["xj"] = decimal.Parse(v);
hj += decimal.Parse(v);
}
if (k == "转账")
{
row["zz"] = decimal.Parse(v);
hj += decimal.Parse(v);
}
if (k == "微信")
{
row["wx"] = decimal.Parse(v);
hj += decimal.Parse(v);
}
if (k == "支付宝")
{
row["zfb"] = decimal.Parse(v);
hj += decimal.Parse(v);
}
}
row["hj"] = hj;
tb.Rows.Add(row);
re.RegisterData(tb, "dt2");
//re.RegisterData(tb.DefaultView.ToTable(), "dt3");
//if (!string.IsNullOrEmpty(_bg_dyj))
// re.PrintSettings.Printer = _bg_dyj;
//re.PrintSettings.ShowDialog = false;
try
{
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region
public void PrintFWJSB(string id, string zt)
{
//报销单主表
string jsonData = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData = wc.DownloadString(_url + "sbjfwwhgl/sbjfwwhdy?id=" + id);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData);
if (dt.Rows.Count == 0)
return;
FastReport.Report re = new FastReport.Report();
re.Load(_reportPath);
re.RegisterData(dt, "sbjfwwh");
re.PrintSettings.ShowDialog = false;
if (!string.IsNullOrEmpty(_tm_dyj))
re.PrintSettings.Printer = _tm_dyj;
re.Print();
}
#endregion
#region
public void PrintGWJDGL(string id, string zt)
{
//报销单主表
string jsonData = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData = wc.DownloadString(_url + "jfgwjdgl/gwjdgldy?id=" + id);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData);
if (dt.Rows.Count == 0)
return;
FastReport.Report re = new FastReport.Report();
re.Load(_reportPath);
re.RegisterData(dt, "gwjdgl");
re.PrintSettings.ShowDialog = false;
if (!string.IsNullOrEmpty(_tm_dyj))
re.PrintSettings.Printer = _tm_dyj;
re.Print();
}
#endregion
#region
public void PrintJKXX(string id, string zt)
{
//报销单主表
string jsonData = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData = wc.DownloadString(_url + "jfjkxx/jkxxdy?id=" + id);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData);
if (dt.Rows.Count == 0)
return;
FastReport.Report re = new FastReport.Report();
re.Load(_reportPath);
re.RegisterData(dt, "jfjkxx");
re.PrintSettings.ShowDialog = false;
if (!string.IsNullOrEmpty(_tm_dyj))
re.PrintSettings.Printer = _tm_dyj;
re.Print();
}
#endregion
#region
List<dccdc.Models.Charge_detailModel> _list;
dccdc.Models.ChargeModel _cm;
public void printJFD(string id)
{
try
{
PrintDocument pd = new PrintDocument();
//pd.DefaultPageSettings.PaperSize=
WebClient wc = new WebClient();
string jfxx = "";
string jfmx = "";
//string jsonBjxm = "";
wc.Encoding = System.Text.Encoding.UTF8;
jfxx = wc.DownloadString(_url + "Charge/getsfxx?id=" + id);
jfmx = wc.DownloadString(_url + "Charge/getsfmx?id=" + id);
dccdc.Models.ChargeModel cm = Newtonsoft.Json.JsonConvert.DeserializeObject<dccdc.Models.ChargeModel>(jfxx);
if (cm == null)
{
return;
}
var list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<dccdc.Models.Charge_detailModel>>(jfmx);
_cm = cm;
_list = list;
Bitmap jpg = new Bitmap(500, 800);
//pg.Save()
double h = 5;
Graphics g = Graphics.FromImage(jpg);
double w = 5 / 2.54 * 96;
var s = g.MeasureString("德城区疾控缴费单", new Font("宋体", 14));
h += s.Height + 10;
s = g.MeasureString("姓名:", new Font("宋体", 10));
h += s.Height + 5;
h += s.Height + 5;
ZXing.BarcodeWriter bw = new ZXing.BarcodeWriter();
bw.Format = ZXing.BarcodeFormat.CODE_128;
var code = bw.Write(cm.register_num);
h += code.Height + 10;
foreach (var mx in list)
{
if (mx.pid == -1)
{
s = g.MeasureString("姓名:", new Font("宋体", 10));
h += s.Height + 5;
}
}
s = g.MeasureString("姓名:", new Font("宋体", 10));
h += s.Height + 5;
h += 50;
double pageh = (h / 96 * 2.54);
pd.DefaultPageSettings = new PageSettings();
pd.DefaultPageSettings.PaperSize = new PaperSize("收费小票", (int)(5.8 / 2.54 * 100), (int)(pageh / 2.54 * 100));
pd.PrinterSettings = new PrinterSettings();
if (!string.IsNullOrEmpty(_xp_dyj))
pd.PrinterSettings.PrinterName = _xp_dyj;
pd.DefaultPageSettings.Margins = new Margins(0, 0, (int)(0.4 / 2.54 * 100), (int)(0.4 / 2.54 * 100));
pd.PrintPage += Pd_PrintPage;
pd.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + ex.StackTrace);
}
}
private void Pd_PrintPage(object sender, PrintPageEventArgs e)
{
Graphics g = e.Graphics;
//throw new NotImplementedException();
int w = (int)(5.8 / 2.54 * 96);
//double w = 5 / 2.54 * g.DpiX;
float h = 10;
var s = g.MeasureString("德城区疾控缴费单", new Font("宋体", 14));
g.DrawString("德城区疾控缴费单", new Font("宋体", 14), Brushes.Black, new PointF(w / 2 - s.Width / 2, h));
h += s.Height + 10;
s = g.MeasureString("姓名:", new Font("宋体", 10));
g.DrawString("姓名:" + _cm.person, new Font("宋体", 10), Brushes.Black, new PointF(10, (float)h));
h += s.Height + 5;
ZXing.BarcodeWriter bw = new ZXing.BarcodeWriter();
bw.Format = ZXing.BarcodeFormat.CODE_128;
var code = bw.Write(_cm.register_num);
g.DrawImage(code, new PointF(10, (float)h));
h += code.Height + 10;
decimal wh = 0;
foreach (var mx in _list)
{
if (mx.pid == -1 || mx.pid == 0)
{
decimal nh = 0;
nh = mx.money * mx.count;
foreach (var nmx in _list)
{
if (nmx.pid == mx.id)
{
nh += (nmx.money * nmx.count);
}
}
s = g.MeasureString("姓名:", new Font("宋体", 10));
g.DrawString(mx.projectname + "\t" + nh, new Font("宋体", 10), Brushes.Black, new PointF(10, (float)h));
h += s.Height + 5;
wh += nh;
}
}
s = g.MeasureString("请在:", new Font("宋体", 12, FontStyle.Bold));
g.DrawString("缴费合计:¥" + wh, new Font("宋体", 12, FontStyle.Bold), Brushes.Black, new PointF(10, h));
h += s.Height + 5;
s = g.MeasureString("请在:", new Font("宋体", 10));
g.DrawString("请使用微信共众号扫码缴费", new Font("宋体", 10), Brushes.Black, new PointF(10, (float)h));
h += s.Height + 5;
h += 50;
e.HasMorePages = false;
}
#endregion
#region ActiveX Control Registration
// These routines perform the additional COM registration needed by
// ActiveX controls
[EditorBrowsable(EditorBrowsableState.Never)]
[ComRegisterFunction()]
public static void Register(Type t)
{
try
{
ActiveXCtrlHelper.RegasmRegisterControl(t);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message); // Log the error
throw; // Re-throw the exception
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
[ComUnregisterFunction()]
public static void Unregister(Type t)
{
try
{
ActiveXCtrlHelper.RegasmUnregisterControl(t);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message); // Log the error
throw; // Re-throw the exception
}
}
#endregion
private void Main_Load(object sender, EventArgs e)
{
}
public void PrintSftjws(string lx, string start, string end, string bm)
{
string rq = start + "|" + end + "|" + bm;
//收费统计
string jsonData1 = "";
//收费方式统计
string jsonData2 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "QueryStatistics/getSftjList?rq=" + rq);
jsonData2 = wc.DownloadString(_url + "QueryStatistics/getSffsList?rq=" + rq);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//收费统计
DataTable sfDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
string fzName = "";
decimal xj = 0;
decimal hj = 0;
DataTable dt = new DataTable();
dt.Columns.Add("sfxm", typeof(string));
dt.Columns.Add("sl", typeof(string));
dt.Columns.Add("dj", typeof(string));
dt.Columns.Add("xj", typeof(string));
int i = 0;
foreach (DataRow r in sfDt.Rows)
{
DataRow dr = dt.NewRow();
if (fzName == "")
{
fzName = r["fzmc"].ToString();
dr["sfxm"] = r["sfxm"].ToString();
dr["sl"] = r["sl"].ToString();
dr["dj"] = r["dj"].ToString();
dr["xj"] = (Convert.ToDecimal(r["sl"].ToString()) * Convert.ToDecimal(r["dj"].ToString())).ToString();
xj += Convert.ToDecimal(r["sl"].ToString()) * Convert.ToDecimal(r["dj"].ToString());
dt.Rows.Add(dr.ItemArray);
}
else
{
if (r["fzmc"].ToString() == fzName)
{
dr["sfxm"] = r["sfxm"].ToString();
dr["sl"] = r["sl"].ToString();
dr["dj"] = r["dj"].ToString();
dr["xj"] = (Convert.ToDecimal(r["sl"].ToString()) * Convert.ToDecimal(r["dj"].ToString())).ToString();
xj += Convert.ToDecimal(r["sl"].ToString()) * Convert.ToDecimal(r["dj"].ToString());
dt.Rows.Add(dr.ItemArray);
}
else
{
hj += xj;
dr["sfxm"] = "(" + fzName + ")小计:";
dr["sl"] = "";
dr["dj"] = "";
dr["xj"] = xj.ToString();
fzName = "";
xj = 0;
dt.Rows.Add(dr.ItemArray);
DataRow dr1 = dt.NewRow();
fzName = r["fzmc"].ToString();
dr1["sfxm"] = r["sfxm"].ToString();
dr1["sl"] = r["sl"].ToString();
dr1["dj"] = r["dj"].ToString();
dr1["xj"] = (Convert.ToDecimal(r["sl"].ToString()) * Convert.ToDecimal(r["dj"].ToString())).ToString();
xj += Convert.ToDecimal(r["sl"].ToString()) * Convert.ToDecimal(r["dj"].ToString());
dt.Rows.Add(dr1.ItemArray);
}
}
if (i == sfDt.Rows.Count - 1)
{
hj += xj;
dr["sfxm"] = "(" + fzName + ")小计:";
dr["sl"] = "";
dr["dj"] = "";
dr["xj"] = xj.ToString();
fzName = "";
xj = 0;
dt.Rows.Add(dr.ItemArray);
}
i++;
}
//收费方式统计
DataTable sffsDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData2);
string sffsstr = "合计:";
foreach (DataRow s in sffsDt.Rows)
{
sffsstr += s["sffs"].ToString() + "(" + s["je"].ToString() + ")";
}
DataRow dr2 = dt.NewRow();
dr2["sfxm"] = "合计:";
dr2["sl"] = "";
dr2["dj"] = "";
dr2["xj"] = hj.ToString();
dt.Rows.Add(dr2.ItemArray);
finit("sftj.frx");
re.Load(_reportPath);
re.RegisterData(dt, "Table1");
re.SetParameterValue("sffstj", sffsstr);
re.SetParameterValue("start", start);
re.SetParameterValue("end", end);
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
public void printBSD(string bsdh, string lx)
{
//盘点单
string jsonData1 = "";
//盘点单明细
string jsonData2 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "kc/getBsdByBsd?bsdh=" + bsdh);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//取到盘点单
DataTable ppdDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
if (ppdDt.Rows.Count != 0)
{
re.RegisterData(ppdDt, "pdd");
jsonData2 = wc.DownloadString(_url + "kc/getBsdMxByBsdId?bsdid=" + ppdDt.Rows[0]["id"].ToString());
//取到盘点单明细
DataTable pddmxDt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData2);
if (pddmxDt.Rows.Count != 0)
{
re.RegisterData(pddmxDt, "pddmx");
}
else
{
DataTable pddmxsDt = new DataTable();
pddmxsDt.Columns.Add("id");
pddmxsDt.Columns.Add("pddid");
pddmxsDt.Columns.Add("wzid");
pddmxsDt.Columns.Add("wzmc");
pddmxsDt.Columns.Add("sl");
pddmxsDt.Columns.Add("dj");
pddmxsDt.Columns.Add("oldsl");
pddmxsDt.Columns.Add("czsj");
re.RegisterData(pddmxsDt, "pddmx");
}
}
else
{
DataTable pddsDt = new DataTable();
pddsDt.Columns.Add("id");
pddsDt.Columns.Add("pddh");
pddsDt.Columns.Add("pdsj");
pddsDt.Columns.Add("pdrid");
pddsDt.Columns.Add("pdr");
pddsDt.Columns.Add("ksid");
pddsDt.Columns.Add("ksmc");
pddsDt.Columns.Add("pdje");
pddsDt.Columns.Add("bz");
re.RegisterData(pddsDt, "pdd");
}
re.Load(_reportPath);
//选择报表模板
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
public void PrintKCPDD(string kcid, string wzfl, string key, string lx)
{
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
string jsonData1 = wc.DownloadString(_url + "kc/getkcpdd?kcid=" + kcid + "&wzlb=" + wzfl + "&key=" + HttpUtility.UrlEncode(key));
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
FastReport.Report re = new FastReport.Report();
re.Load(_reportPath);
re.RegisterData(dt, "Table");
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
//re.PrintSettings.ShowDialog = false;
try
{
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
public void PrintCBHS(string b, string e, string lx)
{
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
string jsonData1 = wc.DownloadString(_url + "kc/getcbhs?b=" + b + "&e=" + e);
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
FastReport.Report re = new FastReport.Report();
re.Load(_reportPath);
re.RegisterData(dt, "Table");
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
//re.PrintSettings.ShowDialog = false;
try
{
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
/// <summary>
/// 打印卫生许可证
/// </summary>
/// <param name="id"></param>
public void PrintWSXKZ(string id, string lx)
{
//throw new NotImplementedException();
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
string jsonData1 = wc.DownloadString(_url + "JianDu/getwsxkbg?id=" + id);
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
FastReport.Report re = new FastReport.Report();
re.Load(_reportPath);
re.RegisterData(dt, "Table");
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
//re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
public void PrintWSXKZ1(string id, string lx)
{
//throw new NotImplementedException();
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
string jsonData1 = wc.DownloadString(_url + "JianDu/getwsxkbg?id=" + id);
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
FastReport.Report re = new FastReport.Report();
re.Load(_reportPath);
re.RegisterData(dt, "Table");
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
//re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
/// <summary>
/// 打印放射许可证
/// </summary>
/// <param name="id"></param>
public void PrintFSXKZ(string id, string lx)
{
//throw new NotImplementedException();
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
string jsonData1 = wc.DownloadString(_url + "JianDu/getfsxkbg?id=" + id);
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
FastReport.Report re = new FastReport.Report();
re.Load(_reportPath);
re.RegisterData(dt, "Table");
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
//re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#region
public void PrintFYZC(string id, string lx)
{
//报销单主表
string jsonData1 = "";
//报销单明细
string jsonData2 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "sq2/sqfyzcdy?id=" + id);
jsonData2 = wc.DownloadString(_url + "sq2/sqfyzcdymx?sqdid=" + id);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//取到主表
DataTable mainD = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
mainD.Columns.Add("isp0", typeof(byte[]));
mainD.Columns.Add("isp01", typeof(byte[]));
mainD.Columns.Add("isp1", typeof(byte[]));
mainD.Columns.Add("isp2", typeof(byte[]));
mainD.Columns.Add("isp3", typeof(byte[]));
mainD.Columns.Add("isp4", typeof(byte[]));
mainD.Columns.Add("isp5", typeof(byte[]));
mainD.Columns.Add("isp6", typeof(byte[]));
mainD.Columns.Add("isp7", typeof(byte[]));
if (mainD.Rows.Count > 0)
{
mainD.Rows[0]["isp0"] = getimage(mainD.Rows[0]["sp0"].ToString());
mainD.Rows[0]["isp01"] = getimage(mainD.Rows[0]["sp01"].ToString());
mainD.Rows[0]["isp1"] = getimage(mainD.Rows[0]["sp1"].ToString());
mainD.Rows[0]["isp2"] = getimage(mainD.Rows[0]["sp2"].ToString());
mainD.Rows[0]["isp3"] = getimage(mainD.Rows[0]["sp3"].ToString());
mainD.Rows[0]["isp4"] = getimage(mainD.Rows[0]["sp4"].ToString());
mainD.Rows[0]["isp5"] = getimage(mainD.Rows[0]["sp5"].ToString());
mainD.Rows[0]["isp6"] = getimage(mainD.Rows[0]["sp6"].ToString());
mainD.Rows[0]["isp7"] = getimage(mainD.Rows[0]["sp7"].ToString());
}
re.RegisterData(mainD, "main");
//取到明细
DataTable detailD = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData2);
if (detailD.Rows.Count < 4)
{
int n = 4 - detailD.Rows.Count;
for (int i = 0; i < n; i++)
{
detailD.Rows.Add(detailD.NewRow());
}
}
re.RegisterData(detailD, "detail");
finit("fyzc.frx");
re.Load(_reportPath);
//选择报表模板
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private byte[] getimage(string v)
{
//throw new NotImplementedException();
if (string.IsNullOrEmpty(v))
{
return null;
}
else
{
return Convert.FromBase64String(v);
}
}
#endregion
#region
public void PrintWZCGSP(string id, string lx)
{
//报销单主表
string jsonData1 = "";
//报销单明细
string jsonData2 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "sq2/sqwzcgdy?id=" + id);
jsonData2 = wc.DownloadString(_url + "sq2/sqwzcgdymx?sqdid=" + id);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//取到主表
DataTable mainD = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
mainD.Columns.Add("isp0", typeof(byte[]));
mainD.Columns.Add("isp1", typeof(byte[]));
mainD.Columns.Add("isp2", typeof(byte[]));
mainD.Columns.Add("isp3", typeof(byte[]));
mainD.Columns.Add("isp4", typeof(byte[]));
if (mainD.Rows.Count > 0)
{
mainD.Rows[0]["isp0"] = getimage(mainD.Rows[0]["sp0"].ToString());
mainD.Rows[0]["isp1"] = getimage(mainD.Rows[0]["sp1"].ToString());
mainD.Rows[0]["isp2"] = getimage(mainD.Rows[0]["sp2"].ToString());
mainD.Rows[0]["isp3"] = getimage(mainD.Rows[0]["sp3"].ToString());
mainD.Rows[0]["isp4"] = getimage(mainD.Rows[0]["sp4"].ToString());
}
re.RegisterData(mainD, "main");
//取到明细
DataTable detailD = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData2);
re.RegisterData(detailD, "detail");
finit("wzcgsp.frx");
re.Load(_reportPath);
//选择报表模板
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region
public void PrintJFSP(string id, string lx)
{
//报销单主表
string jsonData1 = "";
//报销单明细
string jsonData2 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "sq2/sqjfdy?id=" + id);
jsonData2 = wc.DownloadString(_url + "sq2/sqjfdymx?sqdid=" + id);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//取到主表
DataTable mainD = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
mainD.Columns.Add("isp0", typeof(byte[]));
mainD.Columns.Add("isp1", typeof(byte[]));
mainD.Columns.Add("isp2", typeof(byte[]));
mainD.Columns.Add("isp3", typeof(byte[]));
mainD.Columns.Add("isp4", typeof(byte[]));
if (mainD.Rows.Count > 0)
{
mainD.Rows[0]["isp0"] = getimage(mainD.Rows[0]["sp0"].ToString());
mainD.Rows[0]["isp1"] = getimage(mainD.Rows[0]["sp1"].ToString());
mainD.Rows[0]["isp2"] = getimage(mainD.Rows[0]["sp2"].ToString());
mainD.Rows[0]["isp3"] = getimage(mainD.Rows[0]["sp3"].ToString());
mainD.Rows[0]["isp4"] = getimage(mainD.Rows[0]["sp4"].ToString());
}
re.RegisterData(mainD, "main");
//取到明细
DataTable detailD = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData2);
re.RegisterData(detailD, "detail");
finit("jfsp.frx");
re.Load(_reportPath);
//选择报表模板
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region
public void PrintYSSP(string id, string lx)
{
//报销单主表
string jsonData1 = "";
//报销单明细
string jsonData2 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "sq2/sqysdy?id=" + id);
jsonData2 = wc.DownloadString(_url + "sq2/sqysdymx?sqdid=" + id);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//取到主表
DataTable mainD = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
mainD.Columns.Add("isp0", typeof(byte[]));
mainD.Columns.Add("isp1", typeof(byte[]));
mainD.Columns.Add("isp2", typeof(byte[]));
mainD.Columns.Add("isp3", typeof(byte[]));
mainD.Columns.Add("isp4", typeof(byte[]));
if (mainD.Rows.Count > 0)
{
mainD.Rows[0]["isp0"] = getimage(mainD.Rows[0]["sp0"].ToString());
mainD.Rows[0]["isp1"] = getimage(mainD.Rows[0]["sp1"].ToString());
mainD.Rows[0]["isp2"] = getimage(mainD.Rows[0]["sp2"].ToString());
mainD.Rows[0]["isp3"] = getimage(mainD.Rows[0]["sp3"].ToString());
mainD.Rows[0]["isp4"] = getimage(mainD.Rows[0]["sp4"].ToString());
}
re.RegisterData(mainD, "main");
//取到明细
DataTable detailD = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData2);
re.RegisterData(detailD, "detail");
finit("yssp.frx");
re.Load(_reportPath);
//选择报表模板
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region
public void PrintCCBXD(string id, string lx)
{
//报销单主表
string jsonData1 = "";
//报销单明细
string jsonData2 = "";
//报销单明细2
string jsonData22 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "sq2/sqccbxdy?id=" + id);
jsonData2 = wc.DownloadString(_url + "sq2/sqccbxdymx?sqdid=" + id);
jsonData22 = wc.DownloadString(_url + "sq2/sqccbxdymx2?sqdid=" + id);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//取到主表
DataTable mainD = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
mainD.Columns.Add("isp0", typeof(byte[]));
mainD.Columns.Add("isp1", typeof(byte[]));
mainD.Columns.Add("isp01", typeof(byte[]));
mainD.Columns.Add("isp2", typeof(byte[]));
mainD.Columns.Add("isp3", typeof(byte[]));
mainD.Columns.Add("isp4", typeof(byte[]));
if (mainD.Rows.Count > 0)
{
mainD.Rows[0]["isp0"] = getimage(mainD.Rows[0]["sp0"].ToString());
mainD.Rows[0]["isp01"] = getimage(mainD.Rows[0]["sp01"].ToString());
mainD.Rows[0]["isp1"] = getimage(mainD.Rows[0]["sp1"].ToString());
mainD.Rows[0]["isp2"] = getimage(mainD.Rows[0]["sp2"].ToString());
mainD.Rows[0]["isp3"] = getimage(mainD.Rows[0]["sp3"].ToString());
mainD.Rows[0]["isp4"] = getimage(mainD.Rows[0]["sp4"].ToString());
}
re.RegisterData(mainD, "main");
//取到明细
DataTable detailD = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData2);
DataTable detailD2 = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData22);
if (detailD.Rows.Count < 4)
{
int n = 4 - detailD.Rows.Count;
for (int i = 0; i < n; i++)
{
detailD.Rows.Add(detailD.NewRow());
}
}
if (detailD2.Rows.Count < 4)
{
int n = 4 - detailD2.Rows.Count;
for (int i = 0; i < n; i++)
{
detailD2.Rows.Add(detailD2.NewRow());
}
}
foreach (DataRow r in detailD.Rows)
{
if (r["count"].ToString() == "0.00")
r["count"] = "";
if (r["je"].ToString() == "0.00")
r["je"] = "";
if (r["rs"].ToString() == "0.00")
r["rs"] = "";
if (r["ts"].ToString() == "0.00")
r["ts"] = "";
if (r["bz"].ToString() == "0.00")
r["bz"] = "";
if (r["je2"].ToString() == "0.00")
r["je2"] = "";
if (r["je3"].ToString() == "0.00")
r["je3"] = "";
}
re.RegisterData(detailD, "detail");
re.RegisterData(detailD2, "detail2");
finit("ccbxd.frx");
re.Load(_reportPath);
//选择报表模板
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region
public void PrintSZYD(string id, string lx)
{
//报销单主表
string jsonData1 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "sq2/szyddy?id=" + id);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//取到主表
DataTable mainD = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
mainD.Columns.Add("isp0", typeof(byte[]));
mainD.Columns.Add("isp1", typeof(byte[]));
mainD.Columns.Add("isp2", typeof(byte[]));
mainD.Columns.Add("isp3", typeof(byte[]));
mainD.Columns.Add("isp4", typeof(byte[]));
mainD.Columns.Add("isp5", typeof(byte[]));
mainD.Columns.Add("isp6", typeof(byte[]));
if (mainD.Rows.Count > 0)
{
mainD.Rows[0]["isp0"] = getimage(mainD.Rows[0]["sp0"].ToString());
mainD.Rows[0]["isp1"] = getimage(mainD.Rows[0]["sp1"].ToString());
mainD.Rows[0]["isp2"] = getimage(mainD.Rows[0]["sp2"].ToString());
mainD.Rows[0]["isp3"] = getimage(mainD.Rows[0]["sp3"].ToString());
mainD.Rows[0]["isp4"] = getimage(mainD.Rows[0]["sp4"].ToString());
mainD.Rows[0]["isp5"] = getimage(mainD.Rows[0]["sp5"].ToString());
mainD.Rows[0]["isp6"] = getimage(mainD.Rows[0]["sp6"].ToString());
}
re.RegisterData(mainD, "main");
finit("szyd.frx");
re.Load(_reportPath);
//选择报表模板
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region
public void PrintCCD(string id, string lx)
{
//报销单主表
string jsonData1 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "sq2/sqccdy?id=" + id);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//取到主表
DataTable mainD = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
mainD.Columns.Add("isp0", typeof(byte[]));
mainD.Columns.Add("isp1", typeof(byte[]));
mainD.Columns.Add("isp2", typeof(byte[]));
mainD.Columns.Add("isp3", typeof(byte[]));
if (mainD.Rows.Count > 0)
{
mainD.Rows[0]["isp0"] = getimage(mainD.Rows[0]["sp0"].ToString());
mainD.Rows[0]["isp1"] = getimage(mainD.Rows[0]["sp1"].ToString());
mainD.Rows[0]["isp2"] = getimage(mainD.Rows[0]["sp2"].ToString());
mainD.Rows[0]["isp3"] = getimage(mainD.Rows[0]["sp3"].ToString());
}
re.RegisterData(mainD, "main");
finit("ccd.frx");
re.Load(_reportPath);
//选择报表模板
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region
public void PrintXXXD(string id, string lx)
{
//报销单主表
string jsonData1 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "sq2/sqxxxddy?id=" + id);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//取到主表
DataTable mainD = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
mainD.Columns.Add("isp0", typeof(byte[]));
mainD.Columns.Add("isp1", typeof(byte[]));
mainD.Columns.Add("isp2", typeof(byte[]));
mainD.Columns.Add("isp3", typeof(byte[]));
mainD.Columns.Add("isp4", typeof(byte[]));
if (mainD.Rows.Count > 0)
{
mainD.Rows[0]["isp0"] = getimage(mainD.Rows[0]["sp0"].ToString());
mainD.Rows[0]["isp1"] = getimage(mainD.Rows[0]["sp1"].ToString());
mainD.Rows[0]["isp2"] = getimage(mainD.Rows[0]["sp2"].ToString());
mainD.Rows[0]["isp3"] = getimage(mainD.Rows[0]["sp3"].ToString());
mainD.Rows[0]["isp4"] = getimage(mainD.Rows[0]["sp4"].ToString());
}
re.RegisterData(mainD, "main");
finit("xxxd.frx");
re.Load(_reportPath);
//选择报表模板
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region
public void PrintJKD(string id, string lx)
{
//报销单主表
string jsonData1 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "sq2/sqjkdy?id=" + id);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//取到主表
DataTable mainD = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
mainD.Columns.Add("isp0", typeof(byte[]));
mainD.Columns.Add("isp1", typeof(byte[]));
mainD.Columns.Add("isp2", typeof(byte[]));
mainD.Columns.Add("isp3", typeof(byte[]));
mainD.Columns.Add("isp4", typeof(byte[]));
if (mainD.Rows.Count > 0)
{
mainD.Rows[0]["isp0"] = getimage(mainD.Rows[0]["sp0"].ToString());
mainD.Rows[0]["isp1"] = getimage(mainD.Rows[0]["sp1"].ToString());
mainD.Rows[0]["isp2"] = getimage(mainD.Rows[0]["sp2"].ToString());
mainD.Rows[0]["isp3"] = getimage(mainD.Rows[0]["sp3"].ToString());
mainD.Rows[0]["isp4"] = getimage(mainD.Rows[0]["sp4"].ToString());
}
re.RegisterData(mainD, "main");
finit("jkd.frx");
re.Load(_reportPath);
//选择报表模板
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region
public void PrintWX(string id, string lx)
{
//报销单主表
string jsonData1 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "sq2/sqwxdy?id=" + id);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//取到主表
DataTable mainD = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
mainD.Columns.Add("isp0", typeof(byte[]));
mainD.Columns.Add("isp1", typeof(byte[]));
mainD.Columns.Add("isp2", typeof(byte[]));
mainD.Columns.Add("isp3", typeof(byte[]));
mainD.Columns.Add("isp4", typeof(byte[]));
if (mainD.Rows.Count > 0)
{
mainD.Rows[0]["isp0"] = getimage(mainD.Rows[0]["sp0"].ToString());
mainD.Rows[0]["isp1"] = getimage(mainD.Rows[0]["sp1"].ToString());
mainD.Rows[0]["isp2"] = getimage(mainD.Rows[0]["sp2"].ToString());
mainD.Rows[0]["isp3"] = getimage(mainD.Rows[0]["sp3"].ToString());
mainD.Rows[0]["isp4"] = getimage(mainD.Rows[0]["sp4"].ToString());
}
re.RegisterData(mainD, "main");
finit("wx.frx");
re.Load(_reportPath);
//选择报表模板
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region
public void PrintJBYC(string id, string lx)
{
//报销单主表
string jsonData1 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "sq2/sqjbycdy?id=" + id);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//取到主表
DataTable mainD = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
mainD.Columns.Add("isp0", typeof(byte[]));
mainD.Columns.Add("isp1", typeof(byte[]));
mainD.Columns.Add("isp2", typeof(byte[]));
mainD.Columns.Add("isp3", typeof(byte[]));
mainD.Columns.Add("isp4", typeof(byte[]));
if (mainD.Rows.Count > 0)
{
mainD.Rows[0]["isp0"] = getimage(mainD.Rows[0]["sp0"].ToString());
mainD.Rows[0]["isp1"] = getimage(mainD.Rows[0]["sp1"].ToString());
mainD.Rows[0]["isp2"] = getimage(mainD.Rows[0]["sp2"].ToString());
mainD.Rows[0]["isp3"] = getimage(mainD.Rows[0]["sp3"].ToString());
mainD.Rows[0]["isp4"] = getimage(mainD.Rows[0]["sp4"].ToString());
}
re.RegisterData(mainD, "main");
finit("jbyc.frx");
re.Load(_reportPath);
//选择报表模板
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region
public void PrintGWJD(string id, string lx)
{
//报销单主表
string jsonData1 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "sq2/sqgwjddy?id=" + id);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//取到主表
DataTable mainD = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
mainD.Columns.Add("isp0", typeof(byte[]));
mainD.Columns.Add("isp1", typeof(byte[]));
mainD.Columns.Add("isp2", typeof(byte[]));
mainD.Columns.Add("isp3", typeof(byte[]));
mainD.Columns.Add("isp4", typeof(byte[]));
if (mainD.Rows.Count > 0)
{
mainD.Rows[0]["isp0"] = getimage(mainD.Rows[0]["sp0"].ToString());
mainD.Rows[0]["isp1"] = getimage(mainD.Rows[0]["sp1"].ToString());
mainD.Rows[0]["isp2"] = getimage(mainD.Rows[0]["sp2"].ToString());
mainD.Rows[0]["isp3"] = getimage(mainD.Rows[0]["sp3"].ToString());
mainD.Rows[0]["isp4"] = getimage(mainD.Rows[0]["sp4"].ToString());
}
re.RegisterData(mainD, "main");
finit("gwjd.frx");
re.Load(_reportPath);
//选择报表模板
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region
public void PrintGWJDbc(string id, string lx)
{
//报销单主表
string jsonData1 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "sq2/sqgwjddy?id=" + id);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//取到主表
DataTable mainD = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
mainD.Columns.Add("isp0", typeof(byte[]));
mainD.Columns.Add("isp1", typeof(byte[]));
mainD.Columns.Add("isp2", typeof(byte[]));
mainD.Columns.Add("isp3", typeof(byte[]));
mainD.Columns.Add("isp4", typeof(byte[]));
for (int i = 1; i <= 13; i++)
{
mainD.Columns.Add("dxxm" + i);
mainD.Columns.Add("dxzw" + i);
}
for (int i = 1; i <= 4; i++)
{
mainD.Columns.Add("hdxm" + i);
mainD.Columns.Add("hdcs" + i);
mainD.Columns.Add("hdsj" + i);
mainD.Columns.Add("hdfy" + i);
}
if (mainD.Rows.Count > 0)
{
mainD.Rows[0]["isp0"] = getimage(mainD.Rows[0]["sp0"].ToString());
mainD.Rows[0]["isp1"] = getimage(mainD.Rows[0]["sp1"].ToString());
mainD.Rows[0]["isp2"] = getimage(mainD.Rows[0]["sp2"].ToString());
mainD.Rows[0]["isp3"] = getimage(mainD.Rows[0]["sp3"].ToString());
mainD.Rows[0]["isp4"] = getimage(mainD.Rows[0]["sp4"].ToString());
DataRow dr = mainD.Rows[0];
if (!string.IsNullOrEmpty(mainD.Rows[0]["bcnr1"].ToString()))
{
//table += "<tr><td>姓名</td><td>单位及职务</td></tr>";
int h = 0;
foreach (string bcnr in mainD.Rows[0]["bcnr1"].ToString().Split(','))
{
h++;
string[] bcnrs = bcnr.Split('|');
if (bcnrs.Length == 2)
{
//table += "<tr><td> " + bcnrs[0] + " </td><td> " + bcnrs[1] + " </td></tr>";
dr["dxxm" + h] = bcnrs[0];
dr["dxzw" + h] = bcnrs[1];
}
}
h = 0;
if (!string.IsNullOrEmpty(mainD.Rows[0]["bcnr2"].ToString()))
{
//table += "<tr><td>项目</td><td>场所</td><td>时间</td><td>费用</td></tr>";
foreach (string bcnr in mainD.Rows[0]["bcnr2"].ToString().Split(','))
{
h++;
string[] bcnrs = bcnr.Split('|');
if (bcnrs.Length == 4)
{
dr["hdxm" + h] = bcnrs[0];
dr["hdcs" + h] = bcnrs[1];
dr["hdsj" + h] = bcnrs[2];
dr["hdfy" + h] = bcnrs[3];
// hd.Rows.Add(dr);
}
}
}
// table += "</table>";
//results[0].bcnr1 = table;
}
}
/*
* //
table = "<table>";
*/
re.RegisterData(mainD, "main");
finit("gwjdbc.frx");
re.Load(_reportPath);
//选择报表模板
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region
public void PrintQTBXD(string id, string lx)
{
//报销单主表
string jsonData1 = "";
//报销单明细
string jsonData2 = "";
//报销单明细2
string jsonData22 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "sq2/sqqtbxdy?id=" + id);
jsonData2 = wc.DownloadString(_url + "sq2/sqqtbxdymx?sqdid=" + id);
jsonData22 = wc.DownloadString(_url + "sq2/sqqtbxdymx2?sqdid=" + id);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//取到主表
DataTable mainD = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
mainD.Columns.Add("isp0", typeof(byte[]));
mainD.Columns.Add("isp1", typeof(byte[]));
mainD.Columns.Add("isp2", typeof(byte[]));
mainD.Columns.Add("isp3", typeof(byte[]));
mainD.Columns.Add("isp4", typeof(byte[]));
if (mainD.Rows.Count > 0)
{
mainD.Rows[0]["isp0"] = getimage(mainD.Rows[0]["sp0"].ToString());
mainD.Rows[0]["isp1"] = getimage(mainD.Rows[0]["sp1"].ToString());
mainD.Rows[0]["isp2"] = getimage(mainD.Rows[0]["sp2"].ToString());
mainD.Rows[0]["isp3"] = getimage(mainD.Rows[0]["sp3"].ToString());
mainD.Rows[0]["isp4"] = getimage(mainD.Rows[0]["sp4"].ToString());
}
re.RegisterData(mainD, "main");
//取到明细
DataTable detailD = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData2);
DataTable detailD2 = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData22);
if (detailD.Rows.Count < 4)
{
int n = 4 - detailD.Rows.Count;
for (int i = 0; i < n; i++)
{
detailD.Rows.Add(detailD.NewRow());
}
}
if (detailD2.Rows.Count < 4)
{
int n = 4 - detailD2.Rows.Count;
for (int i = 0; i < n; i++)
{
detailD2.Rows.Add(detailD2.NewRow());
}
}
re.RegisterData(detailD, "detail");
re.RegisterData(detailD2, "detail2");
finit("qtbxd.frx");
re.Load(_reportPath);
//选择报表模板
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region
public void PrintWZCGBXD(string id, string lx)
{
//报销单主表
string jsonData1 = "";
//报销单明细
string jsonData2 = "";
//报销单明细2
string jsonData22 = "";
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
jsonData1 = wc.DownloadString(_url + "sq2/sqwzcgbxdy?id=" + id);
jsonData2 = wc.DownloadString(_url + "sq2/sqwzcgbxdymx?sqdid=" + id);
jsonData22 = wc.DownloadString(_url + "sq2/sqwzcgbxdymx2?sqdid=" + id);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
FastReport.Report re = new FastReport.Report();
//取到主表
DataTable mainD = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
mainD.Columns.Add("isp0", typeof(byte[]));
mainD.Columns.Add("isp1", typeof(byte[]));
mainD.Columns.Add("isp2", typeof(byte[]));
mainD.Columns.Add("isp3", typeof(byte[]));
mainD.Columns.Add("isp4", typeof(byte[]));
if (mainD.Rows.Count > 0)
{
mainD.Rows[0]["isp0"] = getimage(mainD.Rows[0]["sp0"].ToString());
mainD.Rows[0]["isp1"] = getimage(mainD.Rows[0]["sp1"].ToString());
mainD.Rows[0]["isp2"] = getimage(mainD.Rows[0]["sp2"].ToString());
mainD.Rows[0]["isp3"] = getimage(mainD.Rows[0]["sp3"].ToString());
mainD.Rows[0]["isp4"] = getimage(mainD.Rows[0]["sp4"].ToString());
}
re.RegisterData(mainD, "main");
//取到明细
DataTable detailD = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData2);
DataTable detailD2 = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData22);
//int y = detailD.Rows.Count % 7;
//int n = 7 - y;
//for (int i = 0; i < n; i++)
//{
// detailD.Rows.Add(detailD.NewRow());
//}
if (detailD.Rows.Count < 4)
{
int n = 4 - detailD.Rows.Count;
for (int i = 0; i < n; i++)
{
detailD.Rows.Add(detailD.NewRow());
}
}
if (detailD2.Rows.Count < 4)
{
int n = 4 - detailD2.Rows.Count;
for (int i = 0; i < n; i++)
{
detailD2.Rows.Add(detailD2.NewRow());
}
}
re.RegisterData(detailD, "detail");
re.RegisterData(detailD2, "detail2");
finit("wzcgbxd.frx");
re.Load(_reportPath);
//选择报表模板
if (lx == "预览")
{
ReportPrintPreview rpp = new ReportPrintPreview();
rpp.setReport(re);
rpp.ShowDialog();
return;
}
re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_bg_dyj))
re.PrintSettings.Printer = _bg_dyj;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region
public void PrintXgtm(string id)
{
//throw new NotImplementedException();
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
string jsonData1 = wc.DownloadString(_url + "xg/xgtm?id=" + id);
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
FastReport.Report re = new FastReport.Report();
re.Load(_reportPath);
re.RegisterData(dt, "bg");
//re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_tm_dyj))
re.PrintSettings.Printer = _tm_dyj;
re.PrintSettings.ShowDialog = false;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
public void PrintXgtm1(string id, string a)
{
//throw new NotImplementedException();
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
string jsonData1 = wc.DownloadString(_url + "xg/xgtm?id=" + id + "&hb=" + a);
DataTable dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(jsonData1);
FastReport.Report re = new FastReport.Report();
re.Load(_reportPath);
re.RegisterData(dt, "bg");
//re.PrintSettings.ShowDialog = false;
try
{
if (!string.IsNullOrEmpty(_tm_dyj))
re.PrintSettings.Printer = _tm_dyj;
re.PrintSettings.ShowDialog = false;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
public void PrintXgtmHB(string id, string a)
{
//throw new NotImplementedException();
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.UTF8;
try
{
//string jsonData1 = wc.DownloadString(_url + "xg/xgtm?id=" + id);
DataTable dt = new DataTable();
dt.Columns.Add("xm");
dt.Columns.Add("xlh");
DataRow dr = dt.NewRow();
dr["xm"] = a;
dr["xlh"] = id;
dt.Rows.Add(dr);
FastReport.Report re = new FastReport.Report();
re.Load(_reportPath);
re.RegisterData(dt, "bg");
if (!string.IsNullOrEmpty(_tm_dyj))
re.PrintSettings.Printer = _tm_dyj;
re.PrintSettings.ShowDialog = false;
re.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + ex.StackTrace);
}
}
#endregion
public string PaiZhao()
{
photo.Photo_Form2 from = new photo.Photo_Form2();
from.ShowDialog();
if (from.img64!="" && from.img64!=null)
{
return from.img64;
}
return "";
}
}
}