void MakeReport(double LeftMargin, double RightMargin) { this.RpViewer.CancelRendering(0); this.RpViewer.Reset(); Stream s = new FileStream(this.ReportPath, FileMode.Open); this.RpViewer.LocalReport.LoadReportDefinition(RecalcPrescriptionLayout(ChangeMargins(s, this.PageWidth, this.PageHeight + 0.25, LeftMargin, RightMargin), (double)this.numHCProvider.Maximum, (double)this.numHCProvider.Value, (double)this.numMedList.Maximum, (double)this.numMedList.Value, (double)this.numDateFields.Minimum, (double)this.numDateFields.Value)); int MedWidthMax = (int)(this.MedListWidth * 10.0 - 2.5); int MedHeightMax = (int)(this.numMedList.Value * 10.0m); #region Budowanie listy leków Medicines med = new Medicines(MedWidthMax, MedHeightMax, -1, this.NormalFont, this.BoldFont, this.g); this.LoadData(med); this.RpViewer.LocalReport.DataSources.Clear(); this.RpViewer.LocalReport.DataSources.Add(med.GetDataSource()); #endregion #region Ustawienie parametrów Update_danePacjent(); Update_danePrzychodni(); Update_daneRecepta(); Update_kodRecepta(); ReportParameter PrintWireframe = new ReportParameter("PrintWireframe", this.cbPrintFrames.Checked.ToString()); ReportParameter PrintLabels = new ReportParameter("PrintLabels", this.cbPrintLabels.Checked.ToString()); ReportParameter PrintPrescriptionNumber = new ReportParameter("PrintPrescriptionNumber", this.cbPrintPrescNum.Checked.ToString()); ReportParameter PrintHCProvider = new ReportParameter("PrintHCProvider", this.cbPrintHCProvider.Checked.ToString()); ReportParameter HCP = new ReportParameter("HealthcareProvider", this.danePrzychodni); ReportParameter PNum = new ReportParameter("PrescriptionNumber", this.kodRecepty); //this.GenerateRandomRpNumber() ReportParameter NFZ = new ReportParameter("NFZDivision", this.Nfz); ReportParameter PP = new ReportParameter("PatientPersmissions", this.uprawnienia); ReportParameter PESEL = new ReportParameter("PESEL", this.Pesel); ReportParameter PatientData = new ReportParameter("PatientData", ImieNazwisko + Environment.NewLine + Adres); ReportParameter PrescriptionDate = new ReportParameter("PrescriptionDate", Convert.ToDateTime(this.data).ToString("yyyy-MM-dd")); ReportParameter FromDate = new ReportParameter("FromDate", this.dataRealizacji); this.RpViewer.LocalReport.SetParameters(new ReportParameter[] { PrintWireframe, PrintLabels, HCP, PNum, NFZ, PP, PESEL, PatientData, PrescriptionDate, FromDate, PrintPrescriptionNumber, PrintHCProvider }); #endregion this.RpViewer.LocalReport.AddTrustedCodeModuleInCurrentAppDomain("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"); this.RpViewer.LocalReport.AddTrustedCodeModuleInCurrentAppDomain("I25, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"); this.RpViewer.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout); this.RpViewer.ZoomPercent = 100; this.RpViewer.ZoomMode = ZoomMode.Percent; this.RpViewer.RefreshReport(); }
private LocalReport PrintReportSilently(string ReportPath) { LocalReport lrep = new LocalReport(); Stream s = new FileStream(ReportPath, FileMode.Open); lrep.LoadReportDefinition(RecalcPrescriptionLayout(ChangeMargins(s, this.PageWidth, this.PageHeight + 0.25, 0, 0), (double)this.numHCProvider.Maximum, (double)this.numHCProvider.Value, (double)this.numMedList.Maximum, (double)this.numMedList.Value, (double)this.numDateFields.Minimum, (double)this.numDateFields.Value)); int RpWidth = 85; // odczytywać z raportu! int MedHMax = 75 - (20 - (int)this.numMedList.Value * 10); // odczytać z raportu! #region Budowanie listy leków Medicines med = new Medicines(RpWidth, MedHMax, -1, this.NormalFont, this.BoldFont, this.g); this.LoadData(med); lrep.DataSources.Clear(); lrep.DataSources.Add(med.GetDataSource()); #endregion #region Ustawienie parametrów Update_danePacjent(); Update_danePrzychodni(); ReportParameter PrintWireframe = new ReportParameter("PrintWireframe", this.cbPrintFrames.Checked.ToString()); ReportParameter PrintLabels = new ReportParameter("PrintLabels", this.cbPrintLabels.Checked.ToString()); ReportParameter PrintPrescriptionNumber = new ReportParameter("PrintPrescriptionNumber", this.cbPrintPrescNum.Checked.ToString()); ReportParameter PrintHCProvider = new ReportParameter("PrintHCProvider", this.cbPrintHCProvider.Checked.ToString()); ReportParameter HCP = new ReportParameter("HealthcareProvider", this.danePrzychodni); ReportParameter PNum = new ReportParameter("PrescriptionNumber", this.GenerateRandomRpNumber()); ReportParameter PESEL = new ReportParameter("PESEL", "12345678901"); ReportParameter PatientData = new ReportParameter("PatientData", "Joanna Kołodziejczyk-Krasnodębska" + Environment.NewLine + "90-110 Łódź, Prosta 6 m. 2"); ReportParameter PrescriptionDate = new ReportParameter("PrescriptionDate", DateTime.Now.ToString("dd-MM-yyyy")); ReportParameter FromDate = new ReportParameter("FromDate", DateTime.Now.ToString("dd-MM-yyyy")); lrep.SetParameters(new ReportParameter[] { PrintWireframe, PrintLabels, HCP, PNum, PESEL, PatientData, PrescriptionDate, FromDate, PrintPrescriptionNumber, PrintHCProvider }); #endregion lrep.AddTrustedCodeModuleInCurrentAppDomain("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"); lrep.AddTrustedCodeModuleInCurrentAppDomain("I25, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"); return(lrep); }
void LoadData(Medicines med) { MySqlDataAdapter myDataAdapter = new MySqlDataAdapter(); Database database = new Database(); myDataAdapter = database.Select("select * from receptalek where idrecepty = '" + this.idrecepta + "'", database.Conect()); DataTable dt = new DataTable(); myDataAdapter.Fill(dt); for (int i = 0; i < dt.Rows.Count; i++) { string bazyl = dt.Rows[i]["bazyl"].ToString(); string dawka = dt.Rows[i]["dawkowanie"].ToString(); string ilosc = dt.Rows[i]["ilosc"].ToString(); string odplatnosc = dt.Rows[i]["odplatnosc"].ToString(); string nazwa; string opakowanie; bool LastItem = false; OleDbDataAdapter myDataAdapterOleDb = new OleDbDataAdapter(); Database databaseOleDb = new Database(); myDataAdapterOleDb = databaseOleDb.SelectDbf("select * from PODSTAW.DBF where BAZYL = '" + bazyl + "'", dbconnection_lek); DataTable dtOleDb = new DataTable(); myDataAdapterOleDb.Fill(dtOleDb); if (dtOleDb.Rows.Count == 1) { DataRow element = dtOleDb.Rows[0]; nazwa = element["NAZWA"].ToString(); opakowanie = element["OPAKOWANIE"].ToString(); if (i == (dt.Rows.Count)) { LastItem = true; } med.AddMedicine(nazwa + ", " + opakowanie + " (Ilość: " + ilosc + ")" + " Odpłatność:" + odplatnosc, "Dawka: " + dawka, LastItem); dtOleDb.Clear(); } } }