void ShowPaymentDetail(int v_Payment_ID) { if (objLuotkham == null) { objLuotkham = Utility.getKcbLuotkham(Utility.Int64Dbnull(txtPatient_ID.Text), Utility.DoTrim(txtPatient_Code.Text)); } if (objLuotkham != null) { frm_HuyThanhtoan frm = new frm_HuyThanhtoan(); frm.objLuotkham = objLuotkham; frm.v_Payment_Id = v_Payment_ID; frm.Chuathanhtoan = Chuathanhtoan; frm.txtSoTienCanNop.Text = txtSoTienCanNop.Text; frm.TotalPayment = grdPayment.GetDataRows().Length; frm.ShowCancel = false; frm.ShowDialog(); } }
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(); } }
private void HuyThanhtoan() { ma_lydohuy = ""; if (!Utility.isValidGrid(grdPayment)) return; if (grdPayment.CurrentRow != null) { if (objLuotkham == null) { objLuotkham = Utility.getKcbLuotkham(Utility.Int64Dbnull(txtPatient_ID.Text), Utility.DoTrim(txtPatient_Code.Text)); } if (THU_VIEN_CHUNG.Laygiatrithamsohethong("NOITRU_TUDONGHOANUNG_KHITHANHTOANNOITRU", "0", false) == "0") { NoitruTamung objTamung = new Select().From(NoitruTamung.Schema).Where(NoitruTamung.Columns.IdBenhnhan).IsEqualTo(objLuotkham.IdBenhnhan) .And(NoitruTamung.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham) .And(NoitruTamung.Columns.TrangThai).IsEqualTo(0) .And(NoitruTamung.Columns.KieuTamung).IsEqualTo(1) .And(NoitruTamung.Columns.Noitru).IsEqualTo(1) .ExecuteSingle<NoitruTamung>(); if (objTamung != null) { Utility.ShowMsg("Bạn cần thực hiện thao tác hủy hoàn ứng tiền cho bệnh nhân trước khi thực hiện hủy thanh toán nội trú"); return ; } } v_Payment_ID = Utility.Int32Dbnull(grdPayment.CurrentRow.Cells[KcbThanhtoan.Columns.IdThanhtoan].Value, -1); KcbThanhtoan objPayment = KcbThanhtoan.FetchByID(v_Payment_ID); if (objPayment != null) { //Kiểm tra ngày hủy int SONGAY_HUYTHANHTOAN =Utility.Int32Dbnull( THU_VIEN_CHUNG.Laygiatrithamsohethong("SONGAY_HUYTHANHTOAN", "0", true),0); int Chenhlech = (int)Math.Ceiling((globalVariables.SysDate.Date - objPayment.NgayThanhtoan.Date).TotalDays); if (Chenhlech > SONGAY_HUYTHANHTOAN) { Utility.ShowMsg("Hệ thống không cho phép bạn hủy thanh toán đã quá ngày. Cần liên hệ quản trị hệ thống để được trợ giúp"); return; } if (PropertyLib._ThanhtoanProperties.Hienthihuythanhtoan) { frm_HuyThanhtoan frm = new frm_HuyThanhtoan(); frm.objLuotkham = objLuotkham; frm.v_Payment_Id = Utility.Int32Dbnull(objPayment.IdThanhtoan, -1); frm.Chuathanhtoan = Chuathanhtoan; frm.TotalPayment = grdPayment.GetDataRows().Length; frm.txtSoTienCanNop.Text = txtSoTienCanNop.Text; frm.ShowCancel = true; frm.ShowDialog(); if (!frm.m_blnCancel) { getData(); } } else { if (PropertyLib._ThanhtoanProperties.Hoitruockhihuythanhtoan) if (!Utility.AcceptQuestion(string.Format("Bạn có muốn hủy lần thanh toán với Mã thanh toán {0}", objPayment.IdThanhtoan.ToString()), "Thông báo", true)) { return; } 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; } int IdHdonLog = Utility.Int32Dbnull(grdPayment.CurrentRow.Cells[HoadonLog.Columns.IdHdonLog].Value, -1); bool HUYTHANHTOAN_HUYBIENLAI = THU_VIEN_CHUNG.Laygiatrithamsohethong("HUYTHANHTOAN_HUYBIENLAI", "1", true) == "1"; ActionResult actionResult = _THANHTOAN.HuyThanhtoan( objPayment , objLuotkham, ma_lydohuy, IdHdonLog, HUYTHANHTOAN_HUYBIENLAI); switch (actionResult) { case ActionResult.Success: getData(); 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; } } } } }
/// <summary> /// hàm thực hiện việc gọi phiếu thu /// </summary> private void CallPhieuThu() { if (grdPayment.CurrentRow != null) { v_Payment_ID = Utility.Int32Dbnull(grdPayment.GetValue(KcbThanhtoan.Columns.IdThanhtoan), -1); KcbThanhtoan objPayment = KcbThanhtoan.FetchByID(v_Payment_ID); if (objLuotkham == null) { objLuotkham = Utility.getKcbLuotkham(Utility.Int64Dbnull(txtPatient_ID.Text), Utility.DoTrim(txtPatient_Code.Text)); } if (objPayment != null) { if (objLuotkham != null) { frm_HuyThanhtoan frm = new frm_HuyThanhtoan(); frm.objLuotkham = objLuotkham; frm.v_Payment_Id = Utility.Int32Dbnull(objPayment.IdThanhtoan, -1); frm.Chuathanhtoan = Chuathanhtoan; frm.TotalPayment = grdPayment.GetDataRows().Length; frm.txtSoTienCanNop.Text = txtSoTienCanNop.Text; frm.ShowCancel = false; frm.ShowDialog(); } } } }
void ShowPaymentDetail(int v_Payment_ID) { if (objLuotkham == null) { objLuotkham = CreatePatientExam(); } if (objLuotkham != null) { frm_HuyThanhtoan frm = new frm_HuyThanhtoan(); frm.objLuotkham = objLuotkham; frm.v_Payment_Id = v_Payment_ID; frm.Chuathanhtoan = Chuathanhtoan; frm.txtSoTienCanNop.Text = txtSoTienCanNop.Text; frm.TotalPayment = grdPayment.GetDataRows().Length; frm.ShowCancel = false; frm.ShowDialog(); } }
private void HuyThanhtoan() { ma_lydohuy = ""; if (!Utility.isValidGrid(grdPayment)) return; if (grdPayment.CurrentRow != null) { if (objLuotkham == null) { objLuotkham = Utility.getKcbLuotkham(Utility.Int64Dbnull(txtPatient_ID.Text), Utility.DoTrim(txtPatient_Code.Text)); } v_Payment_ID = Utility.Int32Dbnull(grdPayment.CurrentRow.Cells[KcbThanhtoan.Columns.IdThanhtoan].Value, -1); KcbThanhtoan objPayment = KcbThanhtoan.FetchByID(v_Payment_ID); if (objPayment != null) { //Kiểm tra ngày hủy int SONGAY_HUYTHANHTOAN =Utility.Int32Dbnull( THU_VIEN_CHUNG.Laygiatrithamsohethong("SONGAY_HUYTHANHTOAN", "0", true),0); int Chenhlech = (int)Math.Ceiling((globalVariables.SysDate.Date - objPayment.NgayThanhtoan.Date).TotalDays); if (Chenhlech > SONGAY_HUYTHANHTOAN) { Utility.ShowMsg("Hệ thống không cho phép bạn hủy thanh toán đã quá ngày. Cần liên hệ quản trị hệ thống để được trợ giúp"); return; } if (PropertyLib._ThanhtoanProperties.Hienthihuythanhtoan) { frm_HuyThanhtoan frm = new frm_HuyThanhtoan(); frm.objLuotkham = objLuotkham; frm.v_Payment_Id = Utility.Int32Dbnull(objPayment.IdThanhtoan, -1); frm.Chuathanhtoan = Chuathanhtoan; frm.TotalPayment = grdPayment.GetDataRows().Length; frm.txtSoTienCanNop.Text = txtSoTienCanNop.Text; frm.ShowCancel = true; frm.ShowDialog(); if (!frm.m_blnCancel) { getData(); } } 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; } int IdHdonLog = Utility.Int32Dbnull(grdPayment.CurrentRow.Cells[HoadonLog.Columns.IdHdonLog].Value, -1); bool HUYTHANHTOAN_HUYBIENLAI = THU_VIEN_CHUNG.Laygiatrithamsohethong("HUYTHANHTOAN_HUYBIENLAI", "1", true) == "1"; ActionResult actionResult = _THANHTOAN.HuyThanhtoan(Utility.Int32Dbnull(objPayment.IdThanhtoan, -1), objLuotkham, ma_lydohuy, IdHdonLog, HUYTHANHTOAN_HUYBIENLAI); switch (actionResult) { case ActionResult.Success: getData(); 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; } } } } }
/// <summary> /// hàm thực hiện việc gọi phiếu thu /// </summary> private void CallPhieuThu() { if (grdPayment.CurrentRow != null) { v_Payment_ID = Utility.Int32Dbnull(grdPayment.GetValue(KcbThanhtoan.Columns.IdThanhtoan), -1); KcbThanhtoan objPayment = KcbThanhtoan.FetchByID(v_Payment_ID); if (objLuotkham == null) { objLuotkham = CreatePatientExam(); } if (objPayment != null) { if (objLuotkham != null) { frm_HuyThanhtoan frm = new frm_HuyThanhtoan(); frm.objLuotkham = objLuotkham; frm.v_Payment_Id = Utility.Int32Dbnull(objPayment.IdThanhtoan, -1); frm.Chuathanhtoan = Chuathanhtoan; frm.ShowCancel = false; frm.ShowDialog(); } } } }
private void HuyPhieuThu() { ma_lydohuy = ""; if (!Utility.isValidGrid(grdPayment)) return; if (grdPayment.CurrentRow != null) { if (objLuotkham == null) { objLuotkham = CreatePatientExam(); } v_Payment_ID = Utility.Int32Dbnull(grdPayment.CurrentRow.Cells["Id_thanhtoan"].Value, -1); KcbThanhtoan objPayment = KcbThanhtoan.FetchByID(v_Payment_ID); if (objPayment != null) { if (PropertyLib._ThanhtoanProperties.Hienthihuythanhtoan) { frm_HuyThanhtoan frm = new frm_HuyThanhtoan(); frm.objLuotkham = objLuotkham; frm.v_Payment_Id = Utility.Int32Dbnull(objPayment.IdThanhtoan, -1); frm.Chuathanhtoan = Chuathanhtoan; frm.ShowCancel = true; frm.ShowDialog(); if (!frm.m_blnCancel) { getData(); } } else { if (PropertyLib._ThanhtoanProperties.Nhaplydohuythanhtoan) { frm_Nhaplydohuythanhtoan _Nhaplydohuythanhtoan = new frm_Nhaplydohuythanhtoan(); _Nhaplydohuythanhtoan.ShowDialog(); if (_Nhaplydohuythanhtoan.m_blnCancel) return; ma_lydohuy = _Nhaplydohuythanhtoan.ma_lydohuy; } ActionResult actionResult = _THANHTOAN.HuyThanhtoan(Utility.Int32Dbnull(objPayment.IdThanhtoan, -1), objLuotkham, ma_lydohuy); switch (actionResult) { case ActionResult.Success: getData(); 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; } } } } }
private void HuyThanhtoan() { ma_lydohuy = ""; if (!Utility.isValidGrid(grdPayment)) return; if (grdPayment.CurrentRow != null) { if (objLuotkham == null) { objLuotkham = CreatePatientExam(); } if (objLuotkham.TrangthaiNoitru >= 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; } v_Payment_ID = Utility.Int32Dbnull(grdPayment.CurrentRow.Cells[KcbThanhtoan.Columns.IdThanhtoan].Value, -1); KcbThanhtoan objPayment = KcbThanhtoan.FetchByID(v_Payment_ID); if (objPayment != null) { //Kiểm tra ngày hủy int KCB_THANHTOAN_SONGAY_HUYTHANHTOAN =Utility.Int32Dbnull( THU_VIEN_CHUNG.Laygiatrithamsohethong("KCB_THANHTOAN_SONGAY_HUYTHANHTOAN", "0", true),0); int Chenhlech = (int)Math.Ceiling((globalVariables.SysDate.Date - objPayment.NgayThanhtoan.Date).TotalDays); if (Chenhlech > KCB_THANHTOAN_SONGAY_HUYTHANHTOAN) { Utility.ShowMsg("Hệ thống không cho phép bạn hủy thanh toán đã quá ngày. Cần liên hệ quản trị hệ thống để được trợ giúp"); return; } if (Utility.Byte2Bool( objPayment.TrangthaiChot)) { Utility.ShowMsg("Thanh toán đang chọn đã được chốt nên bạn không thể hủy thanh toán. Mời bạn xem lại!"); return; } if (PropertyLib._ThanhtoanProperties.Hienthihuythanhtoan) { frm_HuyThanhtoan frm = new frm_HuyThanhtoan(); frm.objLuotkham = objLuotkham; frm.v_Payment_Id = Utility.Int32Dbnull(objPayment.IdThanhtoan, -1); frm.Chuathanhtoan = Chuathanhtoan; frm.TotalPayment = grdPayment.GetDataRows().Length; frm.txtSoTienCanNop.Text = txtSoTienCanNop.Text; frm.ShowCancel = true; frm.ShowDialog(); if (!frm.m_blnCancel) { getData(); } } else { if (PropertyLib._ThanhtoanProperties.Hoitruockhihuythanhtoan) if (!Utility.AcceptQuestion(string.Format("Bạn có muốn hủy lần thanh toán với Mã thanh toán {0}", objPayment.IdThanhtoan.ToString()), "Thông báo", true)) { return; } 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; lydo_huy = _Nhaplydohuythanhtoan.ten; } int IdHdonLog = Utility.Int32Dbnull(grdPayment.CurrentRow.Cells[HoadonLog.Columns.IdHdonLog].Value, -1); bool HUYTHANHTOAN_HUYBIENLAI = THU_VIEN_CHUNG.Laygiatrithamsohethong("HUYTHANHTOAN_HUYBIENLAI", "1", true) == "1"; ActionResult actionResult = _THANHTOAN.HuyThanhtoan(objPayment, objLuotkham, lydo_huy, IdHdonLog, HUYTHANHTOAN_HUYBIENLAI); switch (actionResult) { case ActionResult.Success: getData(); 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; } } } } }