//Hàm lấy dữ liệu và in private void GetDataForPrint(DataTable mDsReport) { var crpt = new VD_1C_crpt_DetailTestReport_ALL(); var objForm = new frmPrintPreview("", crpt, true, true); try { crpt.SetDataSource(mDsReport); //crpt.DataDefinition.FormulaFields["Formula_1"].Text = Strings.Chr(34) + // " Bác sĩ điều trị " // .Replace("#$X$#", // Strings.Chr(34) + "&Chr(13)&" + // Strings.Chr(34)) + Strings.Chr(34); crpt.SetParameterValue("ShowSubReport", 1); crpt.SetParameterValue("ShowMainReport", 0); crpt.SetParameterValue("ParentBranchName", LablinkBusinessConfig.GetParentBranchName()); crpt.SetParameterValue("BranchName", LablinkBusinessConfig.GetBranchName()); string sss = LablinkBusinessConfig.GetPhone(); crpt.SetParameterValue("Address", LablinkBusinessConfig.GetAddress()); crpt.SetParameterValue("sPhone", LablinkBusinessConfig.GetPhone()); objForm.crptViewer.ReportSource = crpt; objForm.ShowDialog(); Utility.DefaultNow(this); } catch (Exception ex) { throw ex; } }
private void PrintAction(bool Quick) { try { if (grdPatients.CurrentRow != null) { var frm = new FrmTestTypeSelection(); frm.dtTestTypeCLB = _patientTestTypeRegistered; frm.ShowInTaskbar = false; frm.ShowDialog(); if (!frm.vCancel) { int patientId = Convert.ToInt32(grdPatients.CurrentRow.Cells["Patient_ID"].Value); DataTable result = TestInfoBusiness.GetIndividualTestResult(patientId, frm.strSelectedTestType); if (result.Rows.Count > 0) { DataRow PatientInfo = TestInfoBusiness.GetPatientInfo(patientId); var crpt = new crpt_IndividualTestResult(); crpt.SetDataSource(result); // crpt.SetDataSource(_testAllResult); crpt.SetParameterValue("ShowSubReport", 1); crpt.SetParameterValue("ShowMainReport", 0); crpt.SetParameterValue("ParentBranchName", LablinkBusinessConfig.GetParentBranchName()); crpt.SetParameterValue("BranchName", LablinkBusinessConfig.GetBranchName()); // string sss = LablinkBusinessConfig.GetPhone(); crpt.SetParameterValue("Address", LablinkBusinessConfig.GetAddress()); crpt.SetParameterValue("sPhone", LablinkBusinessConfig.GetPhone()); crpt.SetParameterValue("Patient_Name", PatientInfo[LPatientInfo.Columns.PatientName].ToString()); crpt.SetParameterValue("Patient_Age", PatientInfo[LPatientInfo.Columns.Age].ToString()); crpt.SetParameterValue("Patient_Diagnose", PatientInfo[LPatientInfo.Columns.Diagnostic].ToString()); crpt.SetParameterValue("Patient_Address", PatientInfo[LPatientInfo.Columns.Address].ToString()); crpt.SetParameterValue("Patient_Department", PatientInfo[LDepartment.Columns.SName].ToString()); crpt.SetParameterValue("Patient_Sex", PatientInfo["Sex_Name"].ToString()); crpt.SetParameterValue("Patient_Insurance", PatientInfo[LPatientInfo.Columns.InsuranceNum].ToString()); crpt.SetParameterValue("Patient_Room", PatientInfo[LPatientInfo.Columns.Room].ToString()); crpt.SetParameterValue("Patient_Bed", PatientInfo[LPatientInfo.Columns.Bed].ToString()); if (!Quick) { var objForm = new frmPrintPreview("", crpt, true, true); objForm.ShowDialog(); } else { //objForm.crptViewer.ReportSource = crpt; crpt.PrintToPrinter(1, false, 0, 0); } Utility.DefaultNow(this); } else { SetWarningStatus(new WarningBoxStatus("Bệnh nhân không có kết quả", true)); } } } else { SetWarningStatus(new WarningBoxStatus("Không có bệnh nhân", true)); } } catch (Exception ex) { SetWarningStatus(new WarningBoxStatus(ex.Message, true)); } }