public bool InPhoiBHYT(KcbLuotkham objLuotkham, DataTable m_dtPayment,DateTime ngayIn) { try { KcbPhieuDct objPhieuDct = CreatePhieuDongChiTra(objLuotkham, m_dtPayment); objPhieuDct.NgayTao = ngayIn; ActionResult actionResult =new KCB_THANHTOAN().UpdatePhieuDCT(objPhieuDct, objLuotkham); if (actionResult == ActionResult.Success) //Tránh trường hợp in ra phôi mà ko đẩy vào CSDL { DataTable m_dtReportPhieuThu = new KCB_THANHTOAN().LaythongtinInphoiBHYT(-1, Utility.sDbnull(objLuotkham.MaLuotkham, ""), Utility.Int32Dbnull(objLuotkham.IdBenhnhan, -1), 0); THU_VIEN_CHUNG.CreateXML(m_dtReportPhieuThu); ///load thông tin của việc lấy dữ liệu vào datatable trong phiếu thanh toán) if (m_dtReportPhieuThu.Rows.Count <= 0) { Utility.ShowMsg("Không tìm thấy dữ liệu để in phôi BHYT ", "Thông báo"); return false; } // foreach (DataRow drv in m_dtReportPhieuThu.Rows) { if (drv[KcbThanhtoanChitiet.Columns.IdLoaithanhtoan].ToString() == "1"//Chi phí KCB || drv[KcbThanhtoanChitiet.Columns.IdLoaithanhtoan].ToString() == "0"//Phí KCB kèm theo || drv[KcbThanhtoanChitiet.Columns.IdLoaithanhtoan].ToString() == "4"//Buồng giường || drv[KcbThanhtoanChitiet.Columns.IdLoaithanhtoan].ToString() == "8"//Gói dịch vụ ) { drv["ten_loaidichvu"] = string.Empty; drv["STT"] = 1; drv["id_loaidichvu"] = -1; } else if (drv[KcbThanhtoanChitiet.Columns.IdLoaithanhtoan].ToString() == "2") { string ma_loaidichvu = Utility.sDbnull(drv["id_loaidichvu"], -1); //drv["id_loaidichvu"]-->Được xác định trong câu truy vấn DmucChung objService = THU_VIEN_CHUNG.LaydoituongDmucChung("LOAIDICHVUCLS", ma_loaidichvu); if (objService != null) { drv["ten_loaidichvu"] = Utility.sDbnull(objService.Ten); drv["STT"] = Utility.sDbnull(objService.SttHthi); } } else if (drv[KcbThanhtoanChitiet.Columns.IdLoaithanhtoan].ToString() == "3") { int Drug_ID = Utility.Int32Dbnull(drv["id_dichvu"], -1); DmucThuoc objDrug = DmucThuoc.FetchByID(Drug_ID); if (objDrug != null) { //LDrugType objLDrugType = LDrugType.FetchByID(objDrug.DrugTypeId); if (objDrug.KieuThuocvattu == "THUOC") { drv["id_loaidichvu"] = 1; drv["STT"] = 1; drv["ten_loaidichvu"] = "3.1 Trong danh mục BHYT"; } else { drv["id_loaidichvu"] = 2; drv["STT"] = 2; drv["ten_loaidichvu"] = "Vật tư y tế "; } } } if (drv[KcbThanhtoanChitiet.Columns.IdLoaithanhtoan].ToString() == "5") { drv["id_loaidichvu"] = 1; drv["STT"] = 1; drv["ten_loaidichvu"] = "Chi phí thêm "; } } m_dtReportPhieuThu.AcceptChanges(); new INPHIEU_THANHTOAN_NGOAITRU(objPhieuDct.NgayTao).INPHOI_BHYT( m_dtReportPhieuThu, ngayIn, objLuotkham); } return actionResult == ActionResult.Success; } catch(Exception ex) { Utility.ShowMsg("Lỗi khi thực hiện in phôi BHYT\n"+ex.Message); return false; } }