using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using SOH.Kernel; using EAS.Services; using SOH.BLL; using SOH.Entities; using SOH.Data; using SOH.Common; using System.Text.RegularExpressions; using FastReport; using FastReport.Data; using FastReport.Design; namespace SOH.KeFu { public partial class frmShowYiGan : Form { string tm = ""; public bool showview = false; DataTable dt = new DataTable(); public frmShowYiGan() { InitializeComponent(); } public frmShowYiGan(string tmh) { tm = tmh; InitializeComponent(); } private void frmShowYiGan_Load(object sender, EventArgs e) { } public FastReport.Report re = new FastReport.Report(); public void init(string tmh) { string yiganString = ServiceContainer.GetService().GetYiGanZhxm(int.Parse(tmh.Trim())); if (yiganString.Length > 2) { DataTable yiganDt = yiganDt = Newtonsoft.Json.JsonConvert.DeserializeObject(yiganString, typeof(DataTable)) as DataTable; DataRow[] yiganDr = yiganDt.Select("zhmc like '%乙肝%'"); if (yiganDr.Count() > 0) { int fddm = Convert.ToInt32(LoginUser.yydm); this.FormBorderStyle = FormBorderStyle.SizableToolWindow; this.WindowState = FormWindowState.Maximized; if(fddm==1) { re.Load(Application.StartupPath + "\\Report\\ygbg_dz.frx"); }else { re.Load(Application.StartupPath + "\\Report\\ygbg_zb.frx"); } string grgzbString = ServiceContainer.GetService().GetGrgzbListByTm(int.Parse(tmh.Trim())); string ttgzbString = ServiceContainer.GetService().GetTtgzbListByTm(int.Parse(tmh.Trim())); string yiganTjjgString = ServiceContainer.GetService().GetYiGanTjjgString(int.Parse(tmh.Trim()), Convert.ToInt32(yiganDr[0][2])); string yiganTjjdString = ServiceContainer.GetService().GetYiGanTjjdString(int.Parse(tmh.Trim()), Convert.ToInt32(yiganDr[0][2])); DataTable yiganTjjgDt = Newtonsoft.Json.JsonConvert.DeserializeObject(yiganTjjgString, typeof(DataTable)) as DataTable; re.RegisterData(yiganTjjgDt, "ygjg"); DataTable yiganTjjdDt = Newtonsoft.Json.JsonConvert.DeserializeObject(yiganTjjdString, typeof(DataTable)) as DataTable; re.SetParameterValue("jyys", yiganTjjdDt.Rows[0][3]); //创建个人report或者团体report if (ttgzbString.Length < 3) { DataTable grgzbDt = Newtonsoft.Json.JsonConvert.DeserializeObject(grgzbString, typeof(DataTable)) as DataTable; re.RegisterData(grgzbDt, "xxTable"); } else { DataTable ttgzbDt = Newtonsoft.Json.JsonConvert.DeserializeObject(ttgzbString, typeof(DataTable)) as DataTable; re.RegisterData(ttgzbDt, "xxTable"); } re.Preview = previewControl1; //re.Show(); } else { this.Close(); } } else { this.Close(); } } public void print() { if (previewControl1.Report == null) { //MessageBox.Show("请先初始化数据!"); return; } if (showview) { if (!this.Visible) { this.Show(); //printpreview.Report.Show(); } return; } //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)) //{ // previewControl1.Report.PrintSettings.Printer = printname; // } previewControl1.Report.PrintSettings.ShowDialog = false; previewControl1.Report.Print(); } } }