//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 PrintCreenTest(DataTable m_dsReport) { if (!InvaliData(m_dsReport)) { return; } var crpt = new crpt_CreenTest(); var objForm = new frmPrintPreview("", crpt, true, true); try { crpt.SetDataSource(m_dsReport); //crpt.DataDefinition.FormulaFields["Formula_1"].Text = Strings.Chr(34) + " Nhân viên ".Replace("#$X$#", Strings.Chr(34) + "&Chr(13)&" + Strings.Chr(34)) + Strings.Chr(34); crpt.SetParameterValue("ParentBranchName", LablinkBusinessConfig.GetParentBranchName()); crpt.SetParameterValue("Para_1", "1"); crpt.SetParameterValue("Para_2", "2"); crpt.SetParameterValue("Para_3", "3"); crpt.SetParameterValue("Para_4", "4"); crpt.SetParameterValue("Para_5", "5"); crpt.SetParameterValue("BranchName", LablinkBusinessConfig.GetBranchName()); crpt.SetParameterValue("sTuNgayDenNgay", Utility.FromToDateTime(dtpFromDate.Text, dtpTodate.Text)); objForm.crptViewer.ReportSource = crpt; objForm.ShowDialog(); Utility.DefaultNow(this); } catch (Exception ex) { Utility.DefaultNow(this); } }
/// <summary> /// thuc hien in bao cao theo kieu thu 3 la in bao cao so luong hang ngay /// </summary> /// <param name="m_dsReport"></param> private void PrintDaily(DataTable m_dsReport) { if (!InvaliData(_dsReport)) { return; } var crpt = new crpt_ThongkesoluongXN(); var objForm = new frmPrintPreview("", crpt, true, true); try { crpt.SetDataSource(m_dsReport); crpt.DataDefinition.FormulaFields["Formula_1"].Text = Strings.Chr(34) + " Nhân viên " .Replace("#$X$#", Strings.Chr(34) + "&Chr(13)&" + Strings.Chr(34)) + Strings.Chr(34); crpt.SetParameterValue("ParentBranchName", LablinkBusinessConfig.GetParentBranchName()); crpt.SetParameterValue("BranchName", LablinkBusinessConfig.GetBranchName()); objForm.crptViewer.ReportSource = crpt; objForm.ShowDialog(); Utility.DefaultNow(this); } catch (Exception ex) { Utility.DefaultNow(this); } }
/// <summary> /// hàm thực hiện in báo cáo số lượng hàng ngày /// Kiểu báo cáo số 2 /// </summary> /// <param name="m_dsReport"></param> private void PrintForCountingEachTest(DataTable m_dsReport) { if (!InvaliData(_dsReport)) { return; } var crpt = new crpt_DailyTestReportDetail(); var objForm = new frmPrintPreview("", crpt, true, true); try { //foreach (DataRow dr in m_dsReport.Rows) //{ // dr["PrintDetail"] = 1; //} //m_dsReport.AcceptChanges(); crpt.SetDataSource(m_dsReport); crpt.DataDefinition.FormulaFields["Formula_1"].Text = Strings.Chr(34) + " Nhân viên " .Replace("#$X$#", Strings.Chr(34) + "&Chr(13)&" + Strings.Chr(34)) + Strings.Chr(34); crpt.SetParameterValue("ParentBranchName", LablinkBusinessConfig.GetParentBranchName()); crpt.SetParameterValue("BranchName", LablinkBusinessConfig.GetBranchName()); crpt.SetParameterValue("TotalTest", GetTotalTest(m_dsReport)); crpt.SetParameterValue("sTuNgayDenNgay", Utility.FromToDateTime(dtpFromDate.Text, dtpTodate.Text)); objForm.crptViewer.ReportSource = crpt; objForm.ShowDialog(); Utility.DefaultNow(this); } catch (Exception ex) { Utility.DefaultNow(this); } }
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)); } }