/// <summary>
 /// lấy thông tin dữ liệu
 /// </summary>
 private void GetData()
 {
     try
     {
         m_dtData = _THANHTOAN.KcbThanhtoanLaydulieuphanbothanhtoanTheoPttt(v_Payment_Id);
         m_dtData.AcceptChanges();
         grdList.DataSource = m_dtData;
         if (m_dtData != null && m_dtData.Rows.Count > 0)
         {
             if (m_dtData.Select("Tong_tien>0").Length > 0)
             {
                 txtTongtien.Text = Utility.sDbnull(m_dtData.Select("Tong_tien>0")[0]["Tong_tien"], "0");
             }
             else
             {
                 KcbThanhtoan objThanhtoan = KcbThanhtoan.FetchByID(v_Payment_Id);
                 if (objThanhtoan != null)
                 {
                     txtTongtien.Text = Utility.sDbnull(objThanhtoan.BnhanChitra, "0");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Utility.CatchException(ex);
     }
 }
Пример #2
0
        /// <summary>
        /// hàm thực hiện việc hủy thanh toán
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdPrint_Click(object sender, EventArgs e)
        {
            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 phiếu chi ngoại trú nữa");
                return;
            }
            KcbThanhtoan objPayment = KcbThanhtoan.FetchByID(v_Payment_Id);
            //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(string.Format("Ngày thanh toán {0} - Ngày hủy thanh toán {1}. Hệ thống không cho phép bạn hủy thanh toán đã quá {2} ngày. Cần liên hệ quản trị hệ thống để được trợ giúp", objPayment.NgayThanhtoan.ToString("dd/MM/yyyy"), globalVariables.SysDate.ToString("dd/MM/yyyy"), KCB_THANHTOAN_SONGAY_HUYTHANHTOAN.ToString()));
                return;
            }
            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}", v_Payment_Id.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();
                m_blnCancel = _Nhaplydohuythanhtoan.m_blnCancel;
                if (m_blnCancel)
                {
                    return;
                }
                ma_lydohuy = _Nhaplydohuythanhtoan.ma;
            }
            bool HUYTHANHTOAN_HUYBIENLAI = THU_VIEN_CHUNG.Laygiatrithamsohethong("HUYTHANHTOAN_HUYBIENLAI", "1", true) == "1";

            actionResult = _THANHTOAN.HuyThanhtoan(objPayment, objLuotkham, ma_lydohuy, Utility.Int32Dbnull(grdPaymentDetail.CurrentRow.Cells[KcbThanhtoan.Columns.IdHdonLog], -1), HUYTHANHTOAN_HUYBIENLAI);
            int record = -1;

            switch (actionResult)
            {
            case ActionResult.Success:
                ModifyComamd();
                Utility.ShowMsg("Bạn hủy thông tin thanh toán thành công", "Thông báo");
                m_blnCancel = false;
                cmdExit.PerformClick();
                break;

            case ActionResult.ExistedRecord:
                Utility.ShowMsg("Thuốc đã cấp phát cho Bệnh nhân nên cần trả lại thuốc bên Dược mới có thể thực hiện hủy thanh toán", "Thông báo", MessageBoxIcon.Warning);
                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;
            }
        }
Пример #3
0
        /// <summary>
        /// hàm thực hiện việc hủy thanh toán
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdPrint_Click(object sender, EventArgs e)
        {
            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 phiếu chi ngoại trú nữa");
                return;
            }
            KcbThanhtoan objPayment = KcbThanhtoan.FetchByID(v_Payment_Id);

            if (objPayment != null)
            {
                //Kiểm tra ngày hủy
                int KCB_THANHTOAN_SONGAY_HUYPHIEUCHI = Utility.Int32Dbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("KCB_THANHTOAN_SONGAY_HUYPHIEUCHI", "0", true), 0);
                int Chenhlech = (int)Math.Ceiling((globalVariables.SysDate.Date - objPayment.NgayThanhtoan.Date).TotalDays);
                if (Chenhlech > KCB_THANHTOAN_SONGAY_HUYPHIEUCHI)
                {
                    Utility.ShowMsg(string.Format("Ngày lập phiếu chi {0} - Ngày hủy phiếu chi {1}. Hệ thống không cho phép bạn hủy phiếu chi đã quá {2} ngày. Cần liên hệ quản trị hệ thống để được trợ giúp", objPayment.NgayThanhtoan.ToString("dd/MM/yyyy"), globalVariables.SysDate.ToString("dd/MM/yyyy"), KCB_THANHTOAN_SONGAY_HUYPHIEUCHI.ToString()));
                    return;
                }
                if (THU_VIEN_CHUNG.Laygiatrithamsohethong("KCB_THANHTOAN_BATNHAPLYDO_HUYTRALAITIEN", "1", false) == "1")
                {
                    frm_Chondanhmucdungchung _Chondanhmucdungchung = new frm_Chondanhmucdungchung("LYDOHUYTRALAITIEN", "Hủy trả lại tiền Bệnh nhân", "Nhập lý do hủy trả lại tiền trước khi thực hiện...", "Lý do hủy trả lại tiền");
                    _Chondanhmucdungchung.ShowDialog();
                    if (_Chondanhmucdungchung.m_blnCancel)
                    {
                        return;
                    }
                    lydo_huy = _Chondanhmucdungchung.ma;
                }
                ActionResult actionResult = _THANHTOAN.HuyPhieuchi(objPayment, objLuotkham, ma_lydohuy);
                switch (actionResult)
                {
                case ActionResult.Success:
                    Utility.ShowMsg("Bạn xóa phiếu chi thành công", "Thông báo");
                    m_blnCancel = false;
                    cmdExit.PerformClick();
                    break;

                case ActionResult.Error:
                    Utility.ShowMsg("Lỗi trong quá trình hủy phiếu chi", "Thông báo lỗi", MessageBoxIcon.Error);
                    break;
                }
            }
        }