256 lines
9.8 KiB
C#
256 lines
9.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using FastReport;
|
|
using FastReport.Data;
|
|
using FastReport.Design;
|
|
using EAS;
|
|
using EAS.Services;
|
|
using SOH.BLL;
|
|
using SOH.Entities.DTO;
|
|
using System.Linq;
|
|
|
|
namespace SOH.ShouFei
|
|
{
|
|
public partial class frmPrintDaoJianDan : SOH.Window.baseChildForm
|
|
{
|
|
public bool showview = false;
|
|
public frmPrintDaoJianDan()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void frmPrintDaoJianDan_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
public void init(int tm)
|
|
{
|
|
var vser = ServiceContainer.GetService<IShouFei>();
|
|
var gzb = vser.getgzbbytm(tm.ToString());
|
|
lbl_xm.Text = gzb.xm;
|
|
lbl_xb.Text = gzb.v_xb;
|
|
if (gzb.lx == 2)
|
|
lbl_tjtc.Text = gzb.tcmc;
|
|
else
|
|
{
|
|
var vtcser = ServiceContainer.GetService<ITaoCan>();
|
|
var tc = vtcser.GetModelBytcbm(gzb.tcbm);
|
|
lbl_tjtc.Text = gzb.tcmc = tc.tcmc;
|
|
}
|
|
//select '生化' as xmmc ,'抽血工作台' as wlks,'A01_02' as fjh, '餐前检查项目' xmlx
|
|
/*
|
|
select '郑志强' as xm,'男' as xb, '0000123456' as hyh,'1010123456' as tm,
|
|
30 as nl, '18653582965' as lxdh,'希望之星免费体检' tcmc,'希望之星' as gzdw,
|
|
'开发部' as ygbm
|
|
*/
|
|
DataTable dt = new DataTable();
|
|
dt.Columns.Add("xm", typeof(string));
|
|
dt.Columns.Add("xb", typeof(string));
|
|
dt.Columns.Add("hyh", typeof(string));
|
|
dt.Columns.Add("tm", typeof(string));
|
|
dt.Columns.Add("nl", typeof(int));
|
|
dt.Columns.Add("lxdh", typeof(string));
|
|
dt.Columns.Add("tcmc", typeof(string));
|
|
dt.Columns.Add("gzdw", typeof(string));
|
|
dt.Columns.Add("ygbm", typeof(string));
|
|
dt.Columns.Add("hyzk", typeof(string));
|
|
dt.Columns.Add("csrq", typeof(string));
|
|
DataRow dr = dt.NewRow();
|
|
dr["xm"] = gzb.xm;
|
|
dr["xb"] = gzb.v_xb;
|
|
dr["hyh"] = gzb.hyh.ToString("0000000000");
|
|
dr["tm"] = gzb.tm.ToString("0000000000");
|
|
dr["nl"] = gzb.nl;
|
|
dr["lxdh"] = gzb.ygdh;
|
|
dr["tcmc"] = gzb.tcmc;
|
|
dr["gzdw"] = gzb.dwmc;
|
|
dr["ygbm"] = gzb.ygbm;
|
|
dr["hyzk"] = gzb.v_hyzk;
|
|
dr["csrq"] = gzb.csrq.ToShortDateString();
|
|
dt.Rows.Add(dr);
|
|
|
|
List<dto_dxjm> dxjms = vser.getdjxmbytm(gzb.tm);
|
|
//select '生化' as xmmc ,'抽血工作台' as wlks,'A01_02' as fjh, '餐前检查项目' xmlx
|
|
DataTable dtxm = new DataTable();
|
|
dtxm.Columns.Add("xmmc", typeof(string));
|
|
dtxm.Columns.Add("fjh", typeof(string));
|
|
dtxm.Columns.Add("xmlx", typeof(string));
|
|
dtxm.Columns.Add("wlks", typeof(string));
|
|
if (dxjms != null)
|
|
{
|
|
dxjms.GroupBy(t => new { t.cqxm, t.wlks, t.quyu }).ToList().ForEach(t =>
|
|
{
|
|
DataRow drmx = dtxm.NewRow();
|
|
drmx["fjh"] = t.Key.quyu;
|
|
drmx["wlks"] = t.Key.wlks;
|
|
drmx["xmlx"] = t.Key.cqxm;
|
|
foreach (var vin in dxjms.Where(k => k.quyu == t.Key.quyu && k.wlks == t.Key.wlks && k.cqxm == t.Key.cqxm).ToList())
|
|
{
|
|
if (t.Key.wlks == "彩超室")
|
|
{
|
|
drmx["xmmc"]= vin.zhmc;
|
|
dtxm.Rows.Add(drmx);
|
|
drmx = dtxm.NewRow();
|
|
drmx["fjh"] = t.Key.quyu;
|
|
drmx["wlks"] = t.Key.wlks;
|
|
drmx["xmlx"] = t.Key.cqxm;
|
|
continue;
|
|
}
|
|
else
|
|
{
|
|
drmx["xmmc"] = drmx["xmmc"].ToString() + " " + vin.zhmc;
|
|
}
|
|
}
|
|
if (t.Key.wlks != "彩超室")
|
|
dtxm.Rows.Add(drmx);
|
|
});
|
|
}
|
|
|
|
string zbrq = DateTime.Now.ToShortDateString();
|
|
|
|
Report r = new Report();
|
|
r.Load(System.Windows.Forms.Application.StartupPath + "\\report\\report_zhiyindan.frx");
|
|
r.RegisterData(dt, "tj_jbxx");
|
|
r.RegisterData(dtxm, "tj_xmmx");
|
|
r.SetParameterValue("zbrq", zbrq);
|
|
r.Preview = printpreview;
|
|
r.Refresh();
|
|
//r.Print();
|
|
r.Show();
|
|
}
|
|
|
|
public void init2(int tm)
|
|
{
|
|
var vser = ServiceContainer.GetService<IShouFei>();
|
|
var gzb = vser.getgzbbytm(tm.ToString());
|
|
lbl_xm.Text = gzb.xm;
|
|
lbl_xb.Text = gzb.v_xb;
|
|
if (gzb.lx == 2)
|
|
lbl_tjtc.Text = gzb.tcmc;
|
|
else
|
|
{
|
|
var vtcser = ServiceContainer.GetService<ITaoCan>();
|
|
var tc = vtcser.GetModelBytcbm(gzb.tcbm);
|
|
lbl_tjtc.Text = gzb.tcmc = tc.tcmc;
|
|
}
|
|
//select '生化' as xmmc ,'抽血工作台' as wlks,'A01_02' as fjh, '餐前检查项目' xmlx
|
|
/*
|
|
select '郑志强' as xm,'男' as xb, '0000123456' as hyh,'1010123456' as tm,
|
|
30 as nl, '18653582965' as lxdh,'希望之星免费体检' tcmc,'希望之星' as gzdw,
|
|
'开发部' as ygbm
|
|
*/
|
|
DataTable dt = new DataTable();
|
|
dt.Columns.Add("xm", typeof(string));
|
|
dt.Columns.Add("xb", typeof(string));
|
|
dt.Columns.Add("hyh", typeof(string));
|
|
dt.Columns.Add("tm", typeof(string));
|
|
dt.Columns.Add("nl", typeof(int));
|
|
dt.Columns.Add("lxdh", typeof(string));
|
|
dt.Columns.Add("tcmc", typeof(string));
|
|
dt.Columns.Add("gzdw", typeof(string));
|
|
dt.Columns.Add("ygbm", typeof(string));
|
|
dt.Columns.Add("hyzk", typeof(string));
|
|
dt.Columns.Add("csrq", typeof(string));
|
|
DataRow dr = dt.NewRow();
|
|
dr["xm"] = gzb.xm;
|
|
dr["xb"] = gzb.v_xb;
|
|
dr["hyh"] = gzb.hyh.ToString("0000000000");
|
|
dr["tm"] = gzb.tm.ToString("0000000000");
|
|
dr["nl"] = gzb.nl;
|
|
dr["lxdh"] = gzb.ygdh;
|
|
dr["tcmc"] = gzb.tcmc;
|
|
dr["gzdw"] = gzb.dwmc;
|
|
dr["ygbm"] = gzb.ygbm;
|
|
dr["hyzk"] = gzb.v_hyzk;
|
|
dr["csrq"] = gzb.csrq.ToShortDateString();
|
|
dt.Rows.Add(dr);
|
|
|
|
List<dto_dxjm> dxjms = vser.getdjxmbytm2(gzb.tm);
|
|
//select '生化' as xmmc ,'抽血工作台' as wlks,'A01_02' as fjh, '餐前检查项目' xmlx
|
|
DataTable dtxm = new DataTable();
|
|
dtxm.Columns.Add("xmmc", typeof(string));
|
|
dtxm.Columns.Add("fjh", typeof(string));
|
|
dtxm.Columns.Add("xmlx", typeof(string));
|
|
dtxm.Columns.Add("wlks", typeof(string));
|
|
if (dxjms != null)
|
|
{
|
|
dxjms.GroupBy(t => new { t.cqxm, t.wlks, t.quyu }).ToList().ForEach(t =>
|
|
{
|
|
DataRow drmx = dtxm.NewRow();
|
|
drmx["fjh"] = t.Key.quyu;
|
|
drmx["wlks"] = t.Key.wlks;
|
|
drmx["xmlx"] = t.Key.cqxm;
|
|
foreach (var vin in dxjms.Where(k => k.quyu == t.Key.quyu && k.wlks == t.Key.wlks && k.cqxm == t.Key.cqxm).ToList())
|
|
{
|
|
if (t.Key.wlks == "彩超室")
|
|
{
|
|
drmx["xmmc"] = vin.zhmc;
|
|
dtxm.Rows.Add(drmx);
|
|
drmx = dtxm.NewRow();
|
|
drmx["fjh"] = t.Key.quyu;
|
|
drmx["wlks"] = t.Key.wlks;
|
|
drmx["xmlx"] = t.Key.cqxm;
|
|
continue;
|
|
}
|
|
else
|
|
{
|
|
drmx["xmmc"] = drmx["xmmc"].ToString() + " " + vin.zhmc;
|
|
}
|
|
}
|
|
if (t.Key.wlks != "彩超室")
|
|
dtxm.Rows.Add(drmx);
|
|
});
|
|
}
|
|
|
|
string zbrq = DateTime.Now.ToShortDateString();
|
|
|
|
Report r = new Report();
|
|
r.Load(System.Windows.Forms.Application.StartupPath + "\\report\\report_zhiyindan.frx");
|
|
r.RegisterData(dt, "tj_jbxx");
|
|
r.RegisterData(dtxm, "tj_xmmx");
|
|
r.SetParameterValue("zbrq", zbrq);
|
|
r.Preview = printpreview;
|
|
r.Refresh();
|
|
//r.Print();
|
|
r.Show();
|
|
}
|
|
public void print()
|
|
{
|
|
if (printpreview.Report == null)
|
|
{
|
|
MessageBox.Show("请先初始化数据!");
|
|
return;
|
|
}
|
|
if (showview)
|
|
{
|
|
if (!this.Visible)
|
|
{
|
|
this.Show();
|
|
//printpreview.Report.Show();
|
|
}
|
|
return;
|
|
}
|
|
btn_print_Click(null, null);
|
|
}
|
|
|
|
private void btn_print_Click(object sender, EventArgs e)
|
|
{
|
|
string printname = "";
|
|
System.Configuration.Configuration cm = System.Configuration.ConfigurationManager.OpenExeConfiguration(AppDomain.CurrentDomain.BaseDirectory + "\\local.ext");
|
|
printname = cm.AppSettings.Settings["bgdyjmc"].Value;
|
|
if (!string.IsNullOrEmpty(printname))
|
|
{
|
|
printpreview.Report.PrintSettings.Printer = printname;
|
|
}
|
|
printpreview.Report.PrintSettings.ShowDialog = false;
|
|
printpreview.Report.Print();
|
|
}
|
|
}
|
|
}
|