public void InBienlai(bool IsTongHop, int _Payment_ID, KcbLuotkham objLuotkham) { try { ActionResult actionResult = new KCB_THANHTOAN().Capnhattrangthaithanhtoan(_Payment_ID); if (actionResult == ActionResult.Success) { switch (objLuotkham.MaDoituongKcb) { case "DV": Inbienlai_Dichvu(_Payment_ID, IsTongHop); break; case "BHYT": Inbienlai_BHYT(_Payment_ID, IsTongHop); break; default: Inbienlai_Dichvu(_Payment_ID, IsTongHop); break; } } } catch (Exception ex) { Utility.ShowMsg(string.Format("Lỗi trong quá trình in phiếu dịch vụ ={0}", ex.ToString())); } finally { } }
private void cmdLuuThongTin_Click(object sender, EventArgs e) { try { if (!KTRA_DULIEU()) { return; } ActionResult actionResult = new KCB_THANHTOAN().UPDATE_SOBIENLAI(get_HoadonLog()); switch (actionResult) { case ActionResult.Success: m_blnCancel = false; Utility.ShowMsg("Đã sửa biên lai thành công"); Close(); break; case ActionResult.Error: Utility.ShowMsg("Sửa biên lai không thành công."); break; } } catch (Exception ex) { Utility.CatchException("Có lỗi khi sửa biên lai", ex); } }
public void InBienlaiQuaythuoc(bool IsTongHop, int _Payment_ID) { try { ActionResult actionResult = new KCB_THANHTOAN().Capnhattrangthaithanhtoan(_Payment_ID); if (actionResult == ActionResult.Success) { Inbienlai_quaythuoc(_Payment_ID, IsTongHop); } } catch (Exception ex) { Utility.ShowMsg(string.Format("Lỗi trong quá trình in phiếu dịch vụ ={0}", ex.ToString())); } finally { } }
void cmdChotDanhSach_Click(object sender, EventArgs e) { ActionResult actionResult = ActionResult.UNKNOW; if (radoChotMoi.Checked) { if (Utility.AcceptQuestion("Bạn có chắc chắn muốn chốt các bản ghi thanh toán còn sót lại hay không?", "Xác nhận chốt thanh toán", true)) actionResult = new KCB_THANHTOAN().Chotbaocao(dtpNgayChot.Value, dtpNgayThanhToan.Value); } else { if (Utility.AcceptQuestion("Bạn có chắc chắn muốn chốt các bản ghi thanh toán còn sót lại hay không?", "Xác nhận chốt thanh toán", true)) actionResult = new KCB_THANHTOAN().ChotVetbaocao(dtpNgayChot.Value, dtpNgayThanhToan.Value); } switch (actionResult) { case ActionResult.Success: Utility.ShowMsg("Đã chốt thanh toán thành công"); break; case ActionResult.Error: Utility.ShowMsg("Có lỗi trong quá trình chốt thanh toán"); break; } }
/// <summary> /// hà thực hiện vieecin in phiếu đống chi trả cho bệnh nhân /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmdInPhieu_DongChiTra_Click(object sender, EventArgs e) { try { if (objLuotkham != null) { KcbPhieuDct objPhieuDct = CreatePhieuDongChiTra(); ActionResult actionResult = new KCB_THANHTOAN().UpdatePhieuDCT(objPhieuDct, objLuotkham); switch (actionResult) { case ActionResult.Success: InPhieuDCT(objLuotkham); break; case ActionResult.Error: Utility.ShowMsg("Lỗi trong quá trình cập nhập thông tin đồng chi trả", "Thông báo lỗi", MessageBoxIcon.Error); break; } } } catch (Exception exception) { } }
/// <summary> /// hàm thực hiện việc in phiếu bảo hiểm cho bệnh nhân /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmdPrintAll_Click(object sender, EventArgs e) { KcbPhieuDct objPhieuDct = CreatePhieuDongChiTra(); ActionResult actionResult = new KCB_THANHTOAN().UpdatePhieuDCT(objPhieuDct, objLuotkham); LAOKHO_INPHIEU_BAOHIEM(); }
void Thanhtoan() { try { Utility.SetMsg(lblMsg, "", false); if (grdRegExam.RowCount <= 0) { Utility.ShowMsg("Chọn phòng khám để thanh toán,Mời bạn xem lại", "Thông báo", MessageBoxIcon.Warning); return; } int IdKham = Utility.Int32Dbnull(grdRegExam.GetValue(KcbDangkyKcb.Columns.IdKham)); SqlQuery sqlQuery = new Select().From(KcbDangkyKcb.Schema) .Where(KcbDangkyKcb.Columns.IdKham).IsEqualTo(IdKham) .And(KcbDangkyKcb.Columns.TrangthaiThanhtoan).IsEqualTo(1); if (sqlQuery.GetRecordCount() > 0) { Utility.ShowMsg("Bản ghi này đã thanh toán,Mời bạn xem lại", "Thông báo", MessageBoxIcon.Warning); return; } if (PropertyLib._KCBProperties.Hoitruockhithanhtoan) if (!Utility.AcceptQuestion("Bạn có muốn thực hiện việc thanh toán khám bệnh cho bệnh nhân không ?", "Thông báo", true)) return; int Payment_Id = -1; KcbLuotkham objLuotkham = CreatePatientExam(); KcbThanhtoan objPayment = CreatePayment(); List<int> lstRegID = new List<int>(); ActionResult actionResult = new KCB_THANHTOAN().Payment4SelectedItems(objPayment, objLuotkham, CreatePaymmentDetail(ref lstRegID), ref Payment_Id, -1, false); switch (actionResult) { case ActionResult.Success: foreach (DataRow _row in m_dataDataRegExam.Rows) { if (lstRegID.Contains(Utility.Int32Dbnull(_row[KcbDangkyKcb.Columns.IdKham], -1))) { _row["ten_trangthai_thanhtoan"] = "Đã thanh toán"; _row[KcbDangkyKcb.Columns.IdThanhtoan] = Payment_Id; _row[KcbDangkyKcb.Columns.TrangthaiThanhtoan] = 1; } } m_dataDataRegExam.AcceptChanges(); Payment_Id = Utility.Int32Dbnull(objPayment.IdThanhtoan); if (PropertyLib._MayInProperties.TudonginhoadonSaukhiThanhtoan) { if (PropertyLib._MayInProperties.Kieuinhoadon == 1 || PropertyLib._MayInProperties.Kieuinhoadon == 3) InHoadon(Payment_Id); if (PropertyLib._MayInProperties.Kieuinhoadon == 2 || PropertyLib._MayInProperties.Kieuinhoadon == 3) new INPHIEU_THANHTOAN_NGOAITRU().InBienlai(false, Payment_Id, objLuotkham); } Utility.SetMsg(lblMsg, "Thanh toán thành công", false); break; case ActionResult.Error: Utility.SetMsg(lblMsg, "Lỗi khi thanh toán", true); break; } } catch { } finally { ModifyButtonCommandRegExam(); } }
void cmdInphoiBHYT_Click(object sender, EventArgs e) { DataTable m_dtPayment = new KCB_THANHTOAN().LaythongtinCacLanthanhtoan(objLuotkham.MaLuotkham, Utility.Int32Dbnull( objLuotkham.IdBenhnhan), 0,objLuotkham.TrangthaiNoitru,0, globalVariables.MA_KHOA_THIEN); if(objLuotkham.MabenhChinh != null) { new INPHIEU_THANHTOAN_NGOAITRU().InPhoiBHYT(objLuotkham, m_dtPayment, dtPaymentDate.Value); } else { Utility.ShowMsg("Bệnh nhân chưa có mã ICD10 để in phôi BHYT.\n Quay lại phòng bác sỹ để nhập mã ICD10"); return; } }
public void InPhieuchi(long payment_ID) { string LyDoIn = "0"; try { DataTable dtPatientPayment = new KCB_THANHTOAN().KcbThanhtoanLaythongtinphieuchi(payment_ID); THU_VIEN_CHUNG.CreateXML(dtPatientPayment, "thanhtoan_phieuchi.xml"); dtPatientPayment.Rows[0]["sotien_bangchu"] = new MoneyByLetter().sMoneyToLetter(Utility.sDbnull(dtPatientPayment.Rows[0]["SO_TIEN"])); string tieude = "", reportname = ""; ReportDocument report = Utility.GetReport("thanhtoan_phieuchi", ref tieude, ref reportname); if (report == null) return; var objForm = new frmPrintPreview("", report, true, true); objForm.mv_sReportFileName = Path.GetFileName(reportname); objForm.mv_sReportCode = "thanhtoan_phieuchi"; report.SetDataSource(dtPatientPayment); Utility.SetParameterValue(report,"NGUOIIN", Utility.sDbnull(globalVariables.gv_strTenNhanvien, "")); Utility.SetParameterValue(report,"ParentBranchName", globalVariables.ParentBranch_Name); Utility.SetParameterValue(report,"BranchName", globalVariables.Branch_Name); Utility.SetParameterValue(report,"DateTime", Utility.FormatDateTime(globalVariables.SysDate)); Utility.SetParameterValue(report,"sCurrentDate", Utility.FormatDateTimeWithLocation(globalVariables.SysDate, globalVariables.gv_strDiadiem)); Utility.SetParameterValue(report, "sTitleReport", tieude); //Utility.SetParameterValue(report,"CharacterMoney", new MoneyByLetter().sMoneyToLetter(TONG_TIEN.ToString())); objForm.crptViewer.ReportSource = report; if (Utility.isPrintPreview(PropertyLib._MayInProperties.TenMayInHoadon, PropertyLib._MayInProperties.PreviewInHoadon)) { objForm.SetDefaultPrinter(PropertyLib._MayInProperties.TenMayInHoadon, 1); objForm.ShowDialog(); } else { objForm.addTrinhKy_OnFormLoad(); report.PrintOptions.PrinterName = PropertyLib._MayInProperties.TenMayInHoadon; report.PrintToPrinter(1, false, 0, 0); } } catch (Exception ex1) { Utility.ShowMsg("Lỗi khi thực hiện in hóa đơn mẫu. Liên hệ IT để được trợ giúp-->" + ex1.Message); } }
void InHoadon(int _Payment_ID) { try { KcbThanhtoan objPayment = new Select().From(KcbThanhtoan.Schema).Where(KcbThanhtoan.IdThanhtoanColumn).IsEqualTo(_Payment_ID).ExecuteSingle<KcbThanhtoan>(); if (objPayment == null) { Utility.ShowMsg("Không lấy được thông tin hóa đơn thanh toán", "Thông báo lỗi", MessageBoxIcon.Information); return; } decimal TONG_TIEN = Utility.Int32Dbnull(objPayment.TongTien, -1); ActionResult actionResult = new KCB_THANHTOAN().UpdateDataPhieuThu(CreatePhieuThu(_Payment_ID, TONG_TIEN)); switch (actionResult) { case ActionResult.Success: new INPHIEU_THANHTOAN_NGOAITRU().IN_HOADON(_Payment_ID); break; case ActionResult.Error: Utility.ShowMsg("Lỗi trong quá trình in hóa đơn", "Thông báo lỗi", MessageBoxIcon.Information); break; } } catch (Exception ex) { Utility.ShowMsg("Lỗi trong quá trình in hóa đơn\n" + ex.Message, "Thông báo lỗi"); } }
private void Inbienlai_BHYT(int payment_id, bool IsTongHop) { try { KcbThanhtoan objPayment = KcbThanhtoan.FetchByID(payment_id); if (IsTongHop) objPayment.IdThanhtoan = -1; ///lấy thông tin vào phiếu thu DataTable m_dtReportPhieuThu = new KCB_THANHTOAN().LaythongtininbienlaiDichvu(objPayment); THU_VIEN_CHUNG.Sapxepthutuin(ref m_dtReportPhieuThu, true); m_dtReportPhieuThu.DefaultView.Sort = "stt_in ,stt_hthi_dichvu,stt_hthi_chitiet,ten_chitietdichvu"; if (m_dtReportPhieuThu.Rows.Count <= 0) { Utility.ShowMsg("Không tìm thấy bản ghi ", "Thông báo"); return; } ///hàm thực hiện xử lý thôgn tin của phiếu dịch vụ INPHIEU_BIENLAI_BHYT(m_dtReportPhieuThu, globalVariables.SysDate, PropertyLib._MayInProperties.CoGiayInBienlai == Papersize.A5 ? "A5" : "A4"); } catch { } }
public void IN_HOADON(int payment_ID) { string LyDoIn = "0"; try { DataTable dtPatientPayment = new KCB_THANHTOAN().Laythongtinhoadondo(payment_ID); dtPatientPayment.Rows[0]["sotien_bangchu"] = new MoneyByLetter().sMoneyToLetter(Utility.sDbnull(dtPatientPayment.Rows[0]["TONG_TIEN"])); string tieude = "", reportname = ""; ReportDocument report = Utility.GetReport("thanhtoan_Hoadondo", ref tieude, ref reportname); if (report == null) return; var objForm = new frmPrintPreview("", report, true, true); //objForm.AutoClose = true; objForm.mv_sReportFileName = Path.GetFileName(reportname); objForm.mv_sReportCode = "thanhtoan_Hoadondo"; report.SetDataSource(dtPatientPayment); Utility.SetParameterValue(report,"NGUOIIN", Utility.sDbnull(globalVariables.gv_strTenNhanvien, "")); Utility.SetParameterValue(report,"ParentBranchName", globalVariables.ParentBranch_Name); Utility.SetParameterValue(report,"BranchName", globalVariables.Branch_Name); Utility.SetParameterValue(report,"DateTime", Utility.FormatDateTime(globalVariables.SysDate)); Utility.SetParameterValue(report,"CurrentDate", Utility.FormatDateTimeWithLocation(globalVariables.SysDate,globalVariables.gv_strDiadiem)); Utility.SetParameterValue(report, "sTitleReport", tieude); Utility.SetParameterValue(report, "txtTrinhky", Utility.getTrinhky(objForm.mv_sReportFileName,globalVariables.SysDate)); objForm.crptViewer.ReportSource = report; if (Utility.isPrintPreview(PropertyLib._MayInProperties.TenMayInHoadon, PropertyLib._MayInProperties.PreviewInHoadon)) { objForm.SetDefaultPrinter(PropertyLib._MayInProperties.TenMayInHoadon, 1); objForm.ShowDialog(); } else { objForm.addTrinhKy_OnFormLoad(); report.PrintOptions.PrinterName = PropertyLib._MayInProperties.TenMayInHoadon; report.PrintToPrinter(1, false, 0, 0); } } catch (Exception ex1) { Utility.CatchException(ex1); } }
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; } }
public void InphieuDCT_Benhnhan(KcbLuotkham objLuotkham, DataTable dtDataPayment) { try { if (objLuotkham != null) { ActionResult actionResult = ActionResult.Success; if (PropertyLib._ThanhtoanProperties.TaodulieuDCTkhiInphieuDCT) { KcbPhieuDct objPhieuDct = CreatePhieuDongChiTra(objLuotkham, dtDataPayment); actionResult = new KCB_THANHTOAN().UpdatePhieuDCT(objPhieuDct, objLuotkham); } switch (actionResult) { case ActionResult.Success: DataTable dtData = SPs.BhytLaydulieuinphieudct(objLuotkham.MaLuotkham, Utility.Int32Dbnull(objLuotkham.IdBenhnhan)).GetDataSet().Tables[ 0]; if (dtData.Rows.Count <= 0) { Utility.ShowMsg("Không tìm thấy thông tin phiếu đồng chi trả. Bạn cần kiểm tra xem đã in phôi BHYT chưa?", "Thông báo", MessageBoxIcon.Warning); return; } if(Utility.DecimaltoDbnull( dtData.Compute("SUM(so_tien)","1=1"),0)>0) new VNS.HIS.Classes.INPHIEU_THANHTOAN_NGOAITRU(). INPHIEU_DONGCHITRA(dtData, globalVariables.SysDate, "PHIẾU THU ĐỒNG CHI TRẢ"); else Utility.ShowMsg("Bệnh nhân này đã được BHYT chi trả 100% nên không cần in phiếu đồng chi trả", "Thông báo lỗi", MessageBoxIcon.Error); break; case ActionResult.Error: Utility.ShowMsg("Lỗi trong quá trình cập nhập thông tin đồng chi trả", "Thông báo lỗi", MessageBoxIcon.Error); break; } } } catch (Exception exception) { } }
void InHoadon() { try { int _Payment_ID = Utility.Int32Dbnull(grdPayment.GetValue(KcbThanhtoan.Columns.IdThanhtoan), -1); decimal TONG_TIEN = Utility.Int32Dbnull(grdPayment.CurrentRow.Cells["BN_CT"].Value, -1); ActionResult actionResult = new KCB_THANHTOAN().Capnhattrangthaithanhtoan(_Payment_ID); switch (actionResult) { case ActionResult.Success: new INPHIEU_THANHTOAN_NGOAITRU().IN_HOADON(_Payment_ID); break; case ActionResult.Error: Utility.ShowMsg("Lỗi trong quá trình in hóa đơn", "Thông báo lỗi", MessageBoxIcon.Warning); break; } } catch (Exception ex) { Utility.ShowMsg("Lỗi trong quá trình in hóa đơn\n" + ex.Message, "Thông báo lỗi"); } }
private void HuyThanhtoan() { try { string ma_lydohuy = ""; if (!Utility.isValidGrid(grdRegExam)) return; if (objLuotkham == null) { objLuotkham = CreatePatientExam(); } if (objLuotkham == null) { Utility.ShowMsg("Không lấy được thông tin bệnh nhân dựa vào dữ liệu trên lưới danh sách bệnh nhân. Liên hệ 0915 150148 để được hỗ trợ"); return; } if (Utility.Int32Dbnull( objLuotkham.TrangthaiNoitru,0) >= Utility.Int32Dbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("KCB_THANHTOAN_CHAN_THANHTOANNGOAITRU", "2", false), 2)) { Utility.ShowMsg("Bệnh nhân này đã ở trạng thái nội trú nên hệ thống không cho phép hủy thanh toán ngoại trú nữa"); return; } //if (PropertyLib._ThanhtoanProperties.Hoitruockhihuythanhtoan) // if (!Utility.AcceptQuestion("Bạn có muốn thực hiện việc hủy thanh toán cho dịch vụ KCB đang chọn không ?", // "Thông báo", true)) // return; int v_Payment_ID = Utility.Int32Dbnull(grdRegExam.CurrentRow.Cells["Id_thanhtoan"].Value, -1); if (v_Payment_ID != -1) { List<int> lstRegID = GetIDKham(); if (PropertyLib._ThanhtoanProperties.Hienthihuythanhtoan) { frm_HuyThanhtoan frm = new frm_HuyThanhtoan(); frm.objLuotkham = objLuotkham; frm.v_Payment_Id = v_Payment_ID; frm.Chuathanhtoan = 0; frm.ShowCancel = true; frm.ShowDialog(); if (!frm.m_blnCancel) { foreach (DataRow _row in m_dataDataRegExam.Rows) { if (lstRegID.Contains(Utility.Int32Dbnull(_row[KcbDangkyKcb.Columns.IdKham], -1))) { _row["ten_trangthai_thanhtoan"] = "Chưa thanh toán"; _row[KcbDangkyKcb.Columns.IdThanhtoan] = -1; _row[KcbDangkyKcb.Columns.TrangthaiThanhtoan] = 0; } } } } else { if (THU_VIEN_CHUNG.Laygiatrithamsohethong("KCB_THANHTOAN_BATNHAPLYDO_HUYTHANHTOAN", "1", false) == "1") { frm_Chondanhmucdungchung _Nhaplydohuythanhtoan = new frm_Chondanhmucdungchung("LYDOHUYTHANHTOAN", "Hủy thanh toán tiền Bệnh nhân", "Nhập lý do hủy thanh toán trước khi thực hiện...", "Lý do hủy thanh toán"); _Nhaplydohuythanhtoan.ShowDialog(); if (_Nhaplydohuythanhtoan.m_blnCancel) return; ma_lydohuy = _Nhaplydohuythanhtoan.ma; } bool HUYTHANHTOAN_HUYBIENLAI = THU_VIEN_CHUNG.Laygiatrithamsohethong("HUYTHANHTOAN_HUYBIENLAI", "1", true) == "1"; ActionResult actionResult = new KCB_THANHTOAN().HuyThanhtoan(v_Payment_ID, objLuotkham, ma_lydohuy, Utility.Int32Dbnull(grdRegExam.CurrentRow.Cells[KcbThanhtoan.Columns.IdHdonLog], -1), HUYTHANHTOAN_HUYBIENLAI); switch (actionResult) { case ActionResult.Success: foreach (DataRow _row in m_dataDataRegExam.Rows) { if (lstRegID.Contains(Utility.Int32Dbnull(_row[KcbDangkyKcb.Columns.IdKham], -1))) { _row["ten_trangthai_thanhtoan"] = "Chưa thanh toán"; _row[KcbDangkyKcb.Columns.IdThanhtoan] = -1; _row[KcbDangkyKcb.Columns.TrangthaiThanhtoan] = 0; } } break; case ActionResult.ExistedRecord: break; case ActionResult.Error: Utility.ShowMsg("Lỗi trong quá trình hủy thông tin thanh toán", "Thông báo", MessageBoxIcon.Error); break; case ActionResult.UNKNOW: Utility.ShowMsg("Lỗi không xác định", "Thông báo", MessageBoxIcon.Error); break; case ActionResult.Cancel: break; } } } } catch (Exception ex) { Utility.ShowMsg("Lỗi khi hủy thanh toán", "Thông báo", MessageBoxIcon.Error); } finally { ModifyButtonCommandRegExam(); } }
void Inbienlai_quaythuoc(int payment_id, bool IsTongHop) { try { KcbThanhtoan objPayment = KcbThanhtoan.FetchByID(payment_id); if (IsTongHop) objPayment.IdThanhtoan = -1; ///lấy thông tin vào phiếu thu DataTable m_dtReportPhieuThu = new KCB_THANHTOAN().LaythongtininbienlaiDichvu(objPayment); THU_VIEN_CHUNG.Sapxepthutuin(ref m_dtReportPhieuThu, false); m_dtReportPhieuThu.DefaultView.Sort = "stt_in ,stt_hthi_dichvu,stt_hthi_chitiet,ten_chitietdichvu"; THU_VIEN_CHUNG.CreateXML(m_dtReportPhieuThu, Application.StartupPath + @"\Xml4Reports\Thanhtoan_InBienLai_DV.XML"); if (m_dtReportPhieuThu.Rows.Count <= 0) { Utility.ShowMsg("Không tìm thấy dữ liệu in phiếu (KCB_THANHTOAN_LAYTHONGTIN_INPHIEU_DICHVU)", "Thông báo"); return; } INBIENLAI_QUAYTHUOC(m_dtReportPhieuThu, globalVariables.SysDate, PropertyLib._MayInProperties.CoGiayInBienlai == Papersize.A4 ? "A4" : "A5"); } catch { } }
void Thanhtoan(bool askbeforepayment) { try { if (!Utility.isValidGrid(grdRegExam)) return; int IdKham = Utility.Int32Dbnull(grdRegExam.GetValue(KcbDangkyKcb.Columns.IdKham)); SqlQuery sqlQuery = new Select().From(KcbDangkyKcb.Schema) .Where(KcbDangkyKcb.Columns.IdKham).IsEqualTo(IdKham) .And(KcbDangkyKcb.Columns.TrangthaiThanhtoan).IsEqualTo(1); if (sqlQuery.GetRecordCount() > 0) { Utility.ShowMsg("Bản ghi này đã thanh toán. Mời bạn xem lại", "Thông báo", MessageBoxIcon.Information); return; } if (PropertyLib._KCBProperties.Hoitruockhithanhtoan) if (askbeforepayment) if (!Utility.AcceptQuestion("Bạn có muốn thực hiện việc thanh toán khám bệnh cho bệnh nhân không ?", "Thông báo", true)) return; int Payment_Id = -1; if (objLuotkham == null) objLuotkham = CreatePatientExam(); if (Utility.Int32Dbnull(objLuotkham.TrangthaiNoitru, 0) >= Utility.Int32Dbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("KCB_THANHTOAN_CHAN_THANHTOANNGOAITRU", "2", false), 2)) { Utility.ShowMsg("Bệnh nhân này đã ở trạng thái nội trú nên hệ thống không cho phép hủy thanh toán ngoại trú nữa"); return; } KcbThanhtoan objPayment = CreatePayment(); List<int> lstRegID = new List<int>(); decimal TTBN_Chitrathucsu = 0; ActionResult actionResult = new KCB_THANHTOAN().Payment4SelectedItems(objPayment, objLuotkham, CreatePaymmentDetail(ref lstRegID).ToList<KcbThanhtoanChitiet>(), ref Payment_Id, -1, false, ref TTBN_Chitrathucsu); switch (actionResult) { case ActionResult.Success: if (objPayment.IdThanhtoan != Payment_Id) { Payment_Id = Utility.Int32Dbnull(objPayment.IdThanhtoan); } foreach (DataRow _row in m_dataDataRegExam.Rows) { if (lstRegID.Contains(Utility.Int32Dbnull(_row[KcbDangkyKcb.Columns.IdKham], -1))) { _row["ten_trangthai_thanhtoan"] = "Đã thanh toán"; _row[KcbDangkyKcb.Columns.IdThanhtoan] = Payment_Id; _row[KcbDangkyKcb.Columns.TrangthaiThanhtoan] = 1; } } m_dataDataRegExam.AcceptChanges(); Payment_Id = Utility.Int32Dbnull(objPayment.IdThanhtoan); if (PropertyLib._MayInProperties.TudonginhoadonSaukhiThanhtoan && TTBN_Chitrathucsu>0) { int KCB_THANHTOAN_KIEUINHOADON = Utility.Int32Dbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("KCB_THANHTOAN_KIEUINHOADON", "1", false)); if (KCB_THANHTOAN_KIEUINHOADON == 1 || KCB_THANHTOAN_KIEUINHOADON == 3) InHoadon(Payment_Id); if (KCB_THANHTOAN_KIEUINHOADON == 2 || KCB_THANHTOAN_KIEUINHOADON == 3) new INPHIEU_THANHTOAN_NGOAITRU().InBienlai(false, Payment_Id, objLuotkham); } break; case ActionResult.Error: Utility.ShowMsg("Lỗi trong quá trình lưu thông tin ", "Thông báo"); break; } } catch { } finally { ModifyButtonCommandRegExam(); } }
private void cmdPrint_Click(object sender, EventArgs e) { bool hasError = false; try { if (!ValidData()) return; try { using (var Scope = new TransactionScope()) { using (var dbScope = new SharedDbConnectionScope()) { if (Utility.Int32Dbnull(grdList.GetValue(HoadonLog.Columns.IdHdonLog)) > 0) new Update(HoadonLog.Schema).Set(HoadonLog.Columns.TrangThai).EqualTo(1).Where( HoadonLog.Columns.IdHdonLog).IsEqualTo(Utility.Int32Dbnull(grdList.GetValue(HoadonLog.Columns.IdHdonLog))). Execute(); HoadonLog obj = new HoadonLog(); obj.IdThanhtoan = payment_ID; obj.TongTien = Utility.DecimaltoDbnull(grdList.GetValue(HoadonLog.Columns.TongTien)); obj.IdBenhnhan = Utility.Int32Dbnull(grdList.GetValue(HoadonLog.Columns.IdBenhnhan)); obj.MaLuotkham = Utility.sDbnull(grdList.GetValue(HoadonLog.Columns.MaLuotkham)); obj.MauHoadon = txtMauHD.Text; obj.KiHieu = txtKiHieu.Text; obj.IdCapphat = Utility.Int32Dbnull(grdHoaDonCapPhat.GetValue(HoadonLog.Columns.IdCapphat)); obj.MaQuyen = txtMaQuyen.Text; obj.Serie = txtSerie.Text; obj.MaNhanvien = globalVariables.UserName; obj.MaLydo = Utility.sDbnull(cboLy_Do.SelectedValue); obj.NgayIn =globalVariables.SysDate; obj.TrangThai = 0; obj.IsNew = true; obj.Save(); new Update(HoadonCapphat.Schema).Set(HoadonCapphat.Columns.SerieHientai).EqualTo(txtSerie.Text). Set(HoadonCapphat.Columns.TrangThai).EqualTo(1). Where(HoadonCapphat.Columns.IdCapphat).IsEqualTo(Utility.Int32Dbnull(grdHoaDonCapPhat.GetValue(HoadonCapphat.Columns.IdCapphat))). Execute(); } Scope.Complete(); } } catch (Exception ex1) { Utility.ShowMsg("Lỗi khi thực hiện in hóa đơn mẫu. Liên hệ VNS để được trợ giúp-->"+ex1.Message); hasError = true; } if (!hasError) { ActionResult actionResult = new KCB_THANHTOAN().Capnhattrangthaithanhtoan(payment_ID); switch (actionResult) { case ActionResult.Success: new INPHIEU_THANHTOAN_NGOAITRU().IN_HOADON(payment_ID); break; case ActionResult.Error: Utility.ShowMsg("Lỗi trong quá trình in hóa đơn", "Thông báo lỗi", MessageBoxIcon.Warning); break; } } //DataRow dr = dtList.NewRow(); //ProcessData(ref dr); //dtList.Rows.InsertAt(dr, 0); //dtList.AcceptChanges(); } catch (Exception ex) { Utility.ShowMsg(ex.Message); } Close(); }