//Lưu phiếu trả kết quả pdf public static void FileLuuPDF(DevExpress.XtraReports.UI.XtraReport datarp, PsRptTraKetQuaSangLoc data) { datarp.DataSource = data; string name = data.MaPhieu.ToString(); string madvcs = data.MaDonVi.ToString(); //Tạo thư mục có tên là mã đơn vị cơ sở string pathpdf = Application.StartupPath + "\\PhieuKetQua\\" + "\\" + madvcs + "\\"; Directory.CreateDirectory(pathpdf); //Đường dẫn file pdf string path = Application.StartupPath + "\\PhieuKetQua\\" + madvcs + @"\" + name + ".pdf"; try { //Lưu file pdf phiếu kết quả theo tên mã phiếu datarp.ExportToPdf(path); Process pdfexport = new Process(); } catch { } }
//Lưu File PDF private void LuuPDF(string MaPhieu, string MaDVCS) { PsRptTraKetQuaSangLoc data = new PsRptTraKetQuaSangLoc(); try { var donvi = BioNet_Bus.GetThongTinDonViCoSo(MaDVCS); string Matiepnhan = BioNet_Bus.GetThongTinMaTiepNhan(MaPhieu, MaDVCS); if (donvi != null) { var kieuTraKQ = donvi.KieuTraKetQua ?? 1; data = BioNet_Bus.GetDuLieuInKetQuaSangLoc(MaPhieu, Matiepnhan, "MaBsi", MaDVCS); if (kieuTraKQ == 1) // Cần sửa chỗ này, cho chọn động loat report theo cấu hình của đơn vị { Reports.rptPhieuTraKetQua datarp = new Reports.rptPhieuTraKetQua(); frmReportEditGeneral.FileLuuPDF(datarp, data); } else if (kieuTraKQ == 2) { Reports.rptPhieuTraKetQua_TheoDonVi datarp = new Reports.rptPhieuTraKetQua_TheoDonVi(); frmReportEditGeneral.FileLuuPDF(datarp, data); } else { Reports.rptPhieuTraKetQua_TheoDonVi2 datarp = new Reports.rptPhieuTraKetQua_TheoDonVi2(); frmReportEditGeneral.FileLuuPDF(datarp, data); } } else { Reports.rptPhieuTraKetQua rp = new Reports.rptPhieuTraKetQua(); frmReportEditGeneral.FileLuuPDF(rp, data); } } catch (Exception ex) { XtraMessageBox.Show("Lỗi phát sinh khi lấy dữ liệu in \r\n Lỗi chi tiết :" + ex.ToString(), "BioNet - Chương trình sàng lọc sơ sinh", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }