public static void LoadThamSoHeThong() { globalVariables.LUONGCOBAN = Utility.DecimaltoDbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("BHYT_LUONGCOBAN", "83000", false), 83000); globalVariables.gv_strNoiDKKCBBD = THU_VIEN_CHUNG.Laygiatrithamsohethong("BHYT_NOIDANGKY_KCBBD", "016", false); globalVariables.gv_strDiadiem = THU_VIEN_CHUNG.Laygiatrithamsohethong("DIA_DIEM", "Hà Nội", false); globalVariables.gv_strNoicapBHYT = THU_VIEN_CHUNG.Laygiatrithamsohethong("BHYT_NOICAP_BHYT", "01", false); globalVariables.gv_intChophepchongiathuoc = Utility.Int32Dbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("CHONGIATHUOC", "0", false), 0); globalVariables.gv_blnApdungChedoDuyetBHYT = THU_VIEN_CHUNG.Laygiatrithamsohethong("BHYT_TUDONGDUYET", "1", false) == "1"; globalVariables.gv_GiathuoctheoGiatrongKho = THU_VIEN_CHUNG.Laygiatrithamsohethong("GIATHUOCKHO", "1", false) == "1"; globalVariables.ChophepNhapkhoLe = Utility.Int32Dbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("ChophepNhapkhoLe", "0", false)); globalVariables.gv_strTuyenBHYT = THU_VIEN_CHUNG.Laygiatrithamsohethong("BHYT_TUYEN", "TW", false); globalVariables.TrongGio = THU_VIEN_CHUNG.Laygiatrithamsohethong("KCB_TRONGGIO", "0:00-23:59", false); globalVariables.TrongNgay = THU_VIEN_CHUNG.Laygiatrithamsohethong("KCB_TRONGNGAY", "2,3,4,5,6,7,CN", false); globalVariables.gv_intKT_TT_ChuyenCLS_DV = Utility.Int32Dbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("KT_TT_ChuyenCLS_DV", "0", false), 0); globalVariables.gv_strBHYT_MAQUYENLOI_UUTIEN = THU_VIEN_CHUNG.Laygiatrithamsohethong("BHYT_MAQUYENLOI_UUTIEN", "", false); globalVariables.gv_intKT_TT_ChuyenCLS_BHYT = Utility.Int32Dbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("KT_TT_ChuyenCLS_BHYT", "0", false), 0); globalVariables.gv_strICD_BENH_AN_NGOAI_TRU = THU_VIEN_CHUNG.Laygiatrithamsohethong("KCB_ICD_BENH_AN_NGOAI_TRU", "", false); globalVariables.gv_intSO_BENH_AN_BATDAU = Utility.Int32Dbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("KCB_SO_BENH_AN", "-1", false), -1); globalVariables.gv_strMA_BHYT_KT = THU_VIEN_CHUNG.Laygiatrithamsohethong("MA_BHYT_KT", "", false); globalVariables.gv_strMaQuyenLoiHuongBHYT100Phantram = THU_VIEN_CHUNG.Laygiatrithamsohethong("BHYT_MAQUYENLOI_HUONG100PHANTRAM", "1,2", false); globalVariables.gv_intCHARACTERCASING = Utility.Int32Dbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("KCB_CHARACTERCASING", "0", false), 0); globalVariables.gv_intKIEMTRAMATHEBHYT = Utility.Int32Dbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("BHYT_KIEMTRAMATHE", "0", false), 0); globalVariables.gv_intBHYT_TUDONGCHECKTRAITUYEN = Utility.Int32Dbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("BHYT_TUDONGCHECKTRAITUYEN", "0", false), 0); globalVariables.gv_strBOTENDIACHINH = THU_VIEN_CHUNG.Laygiatrithamsohethong("BOTENDIACHINH", "", false); }
public static ActionResult ChuyenPhong(long idKham, string lydoChuyen, DmucDichvukcb objDichvuKcb) { try { ActionResult actionResult = ActionResult.Success; using (var scope = new TransactionScope()) { using (var dbScope = new SharedDbConnectionScope()) { int sttkham = THU_VIEN_CHUNG.LaySothutuKCB(objDichvuKcb.IdPhongkham); new Update(KcbDangkyKcb.Schema) .Set(KcbDangkyKcb.Columns.IdPhongkham).EqualTo(objDichvuKcb.IdPhongkham) .Set(KcbDangkyKcb.Columns.IdBacsikham).EqualTo(-1) .Set(KcbDangkyKcb.Columns.SttKham).EqualTo(sttkham) .Set(KcbDangkyKcb.Columns.IdDichvuKcb).EqualTo(objDichvuKcb.IdDichvukcb) .Set(KcbDangkyKcb.Columns.IdKieukham).EqualTo(objDichvuKcb.IdKieukham) .Set(KcbDangkyKcb.Columns.TenDichvuKcb).EqualTo(objDichvuKcb.TenDichvukcb.ToUpper()) .Set(KcbDangkyKcb.Columns.NgayDangky).EqualTo(globalVariables.SysDate) .Set(KcbDangkyKcb.Columns.NguoiChuyen).EqualTo(globalVariables.UserName) .Set(KcbDangkyKcb.Columns.NgayChuyen).EqualTo(globalVariables.SysDate) .Set(KcbDangkyKcb.Columns.LydoChuyen).EqualTo(lydoChuyen) .Set(KcbDangkyKcb.Columns.TrangthaiChuyen).EqualTo(1) .Where(KcbDangkyKcb.Columns.IdKham).IsEqualTo(idKham) .Execute(); } scope.Complete(); return(ActionResult.Success); } } catch (Exception ex) { Utility.ShowMsg("Lỗi khi chuyển đối tượng:\n" + ex.Message); return(ActionResult.Exception); } }
public static void TinhPhanTramBHYT(NoitruPhanbuonggiuong objNoitruPhanbuonggiuong, KcbLuotkham objLuotkham, decimal PtramBHYT) { try { decimal BHYT_PTRAM_TRAITUYENNOITRU = Utility.DecimaltoDbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("BHYT_PTRAM_TRAITUYENNOITRU", "0", false), 0m); if (Utility.Int32Dbnull(objNoitruPhanbuonggiuong.TrongGoi, 0) == 1) { objNoitruPhanbuonggiuong.BhytChitra = 0;// Utility.DecimaltoDbnull(objNoitruPhanbuonggiuong.DonGia, 0) * PtramBHYT / 100; objNoitruPhanbuonggiuong.BnhanChitra = 0; } else//Ngoài gói { if (objNoitruPhanbuonggiuong.TuTuc == 1) { objNoitruPhanbuonggiuong.BhytChitra = 0; objNoitruPhanbuonggiuong.BnhanChitra = Utility.DecimaltoDbnull(objNoitruPhanbuonggiuong.DonGia, 0); } else { decimal BHCT = 0m; if (objLuotkham.DungTuyen == 1) { BHCT = Utility.DecimaltoDbnull(objNoitruPhanbuonggiuong.DonGia, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhytGoc, 0) / 100); } else { if (objLuotkham.TrangthaiNoitru <= 0) { BHCT = Utility.DecimaltoDbnull(objNoitruPhanbuonggiuong.DonGia, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0) / 100); } else//Nội trú cần tính=đơn giá * % đầu thẻ * % tuyến { BHCT = Utility.DecimaltoDbnull(objNoitruPhanbuonggiuong.DonGia, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhytGoc, 0) / 100) * (BHYT_PTRAM_TRAITUYENNOITRU / 100); } } objNoitruPhanbuonggiuong.BhytChitra = BHCT;// Utility.DecimaltoDbnull(objNoitruPhanbuonggiuong.DonGia, 0) * PtramBHYT / 100; objNoitruPhanbuonggiuong.BnhanChitra = Utility.DecimaltoDbnull(objNoitruPhanbuonggiuong.DonGia, 0) - BHCT; } } //if (Utility.Int32Dbnull(objNoitruPhanbuonggiuong.TuTuc) == 1 && Utility.Int32Dbnull(objNoitruPhanbuonggiuong.TrongGoi) == 1) //{ // objNoitruPhanbuonggiuong.BnhanChitra = 0; // objNoitruPhanbuonggiuong.BhytChitra = 0; //} } catch (Exception) { // throw; } }
/// <summary> /// hàm thực hiện việc tính phần trăm của khám bệnh /// </summary> /// <param name="objPatientExam"></param> public static void TinhPtramBHYTForKham(KcbLuotkham objPatientExam) { SqlQuery sqlQuery = new Select().From(KcbDangkyKcb.Schema) .Where(KcbDangkyKcb.Columns.MaLuotkham).IsEqualTo(objPatientExam.MaLuotkham) .And(KcbDangkyKcb.Columns.IdBenhnhan).IsEqualTo(objPatientExam.IdBenhnhan); KcbDangkyKcbCollection objRegExamCollection = sqlQuery.ExecuteAsCollection <KcbDangkyKcbCollection>(); foreach (KcbDangkyKcb objRegExam in objRegExamCollection) { // decimal PtramBHYT = Utility.DecimaltoDbnull(objPatientExam.PtramBhyt, 0); THU_VIEN_CHUNG.TinhToanKhamPtramBHYT(objPatientExam, objRegExam); new Update(KcbDangkyKcb.Schema) .Set(KcbDangkyKcb.Columns.BhytChitra).EqualTo(objRegExam.BhytChitra) .Set(KcbDangkyKcb.Columns.BnhanChitra).EqualTo(objRegExam.BnhanChitra) .Set(KcbDangkyKcb.Columns.PhuThu).EqualTo(objRegExam.PhuThu) .Where(KcbDangkyKcb.Columns.IdKham).IsEqualTo(objRegExam.IdKham).Execute(); } }
private static ActionResult CapnhatChiphiThuoc(KcbLuotkham objLuotkham) { using (var Scope = new TransactionScope()) { THUOC_GIATHEO_KHOAKCB = THU_VIEN_CHUNG.Laygiatrithamsohethong("THUOC_GIATHEO_KHOAKCB", "0", true) == "1"; SqlQuery sqlQuery; sqlQuery = new Select().From(KcbDonthuocChitiet.Schema) .Where(KcbDonthuocChitiet.Columns.IdDonthuoc).In( new Select(KcbDonthuoc.Columns.IdDonthuoc).From(KcbDonthuoc.Schema).Where( KcbDonthuoc.Columns.MaLuotkham). IsEqualTo(objLuotkham.MaLuotkham).And(KcbDonthuoc.Columns.IdBenhnhan). IsEqualTo(objLuotkham.IdBenhnhan)); var objChitietDonthuocCollection = sqlQuery.ExecuteAsCollection <KcbDonthuocChitietCollection>(); bool ApdunggiathuocDoituong = THU_VIEN_CHUNG.Laygiatrithamsohethong("APDUNG_GIATHUOC_DOITUONG", "0", true) == "1"; DmucDoituongkcb _DmucDoituongkcb = new Select().From(DmucDoituongkcb.Schema).Where(DmucDoituongkcb.Columns.MaDoituongKcb).IsEqualTo(objLuotkham.MaDoituongKcb).ExecuteSingle <DmucDoituongkcb>(); if (_DmucDoituongkcb == null) { return(ActionResult.Success); } foreach (KcbDonthuocChitiet objChitietDonthuoc in objChitietDonthuocCollection) { if (Utility.Int16Dbnull(objChitietDonthuoc.TrangthaiThanhtoan, 0) == 0) { DmucThuoc _DmucThuoc = DmucThuoc.FetchByID(objChitietDonthuoc.IdThuoc); decimal PtramBHYT = Utility.DecimaltoDbnull(objLuotkham.PtramBhyt); if (ApdunggiathuocDoituong || Utility.Byte2Bool(_DmucDoituongkcb.GiathuocQuanhe.Value)) // globalVariables.gv_GiathuoctheoGiatrongKho) { //Giá theo quan he--> QheDoituongThuoc _item = THU_VIEN_CHUNG.LayQheDoituongThuoc(objLuotkham.MaDoituongKcb, objChitietDonthuoc.IdThuoc, objLuotkham.MaKhoaThuchien, CLS_GIATHEO_KHOAKCB); if (_item != null) { objChitietDonthuoc.DonGia = Utility.DecimaltoDbnull(_item.DonGia); objChitietDonthuoc.PhuThu = (Utility.isTrue(objLuotkham.DungTuyen.Value) ? Utility.DecimaltoDbnull(_item.PhuthuDungtuyen) : Utility.DecimaltoDbnull(_item.PhuthuTraituyen)); objChitietDonthuoc.TuTuc = 0; objChitietDonthuoc.PtramBhyt = Utility.DecimaltoDbnull(PtramBHYT); } else { _item = THU_VIEN_CHUNG.LayQheDoituongThuoc("DV", objChitietDonthuoc.IdThuoc, objLuotkham.MaKhoaThuchien, THUOC_GIATHEO_KHOAKCB); if (_item != null) { objChitietDonthuoc.DonGia = Utility.DecimaltoDbnull(_item.DonGia); objChitietDonthuoc.PhuThu = (Utility.isTrue(objLuotkham.DungTuyen.Value) ? Utility.DecimaltoDbnull(_item.PhuthuDungtuyen) : Utility.DecimaltoDbnull(_item.PhuthuTraituyen)); objChitietDonthuoc.TuTuc = 1; objChitietDonthuoc.PtramBhyt = 0; } } } else //Giá theo kho--> { TThuockho objTK = TThuockho.FetchByID(objChitietDonthuoc.IdThuockho); if (objTK != null) { objChitietDonthuoc.DonGia = objLuotkham.IdLoaidoituongKcb == 0 ? Utility.DecimaltoDbnull(objTK.GiaBhyt.Value, objChitietDonthuoc.DonGia) : objTK.GiaBan; } if (objLuotkham.IdLoaidoituongKcb == 1)//Đối tượng dịch vụ-->ko cần phải đánh dấu tự túc { objChitietDonthuoc.TuTuc = 0; } if (Utility.Int32Dbnull(objChitietDonthuoc.TuTuc, 0) == 1) { objChitietDonthuoc.BhytChitra = 0; objChitietDonthuoc.BnhanChitra = Utility.DecimaltoDbnull(objChitietDonthuoc.DonGia, 0); objChitietDonthuoc.PtramBhyt = 0; } else { objChitietDonthuoc.BhytChitra = Utility.DecimaltoDbnull(objChitietDonthuoc.DonGia) * Utility.DecimaltoDbnull(PtramBHYT) / 100; objChitietDonthuoc.BnhanChitra = Utility.DecimaltoDbnull(objChitietDonthuoc.DonGia, 0) - Utility.DecimaltoDbnull(objChitietDonthuoc.BhytChitra, 0); objChitietDonthuoc.PtramBhyt = Utility.DecimaltoDbnull(PtramBHYT); } } if (_DmucThuoc != null && Utility.Int32Dbnull(_DmucThuoc.TuTuc, 0) == 1) { objChitietDonthuoc.TuTuc = 1; //Ke ca co trong bang quan he } if (objLuotkham.IdLoaidoituongKcb == 1) //Đối tượng dịch vụ-->ko cần phải đánh dấu tự túc { objChitietDonthuoc.TuTuc = 0; } if (Utility.Int32Dbnull(objChitietDonthuoc.TuTuc, 0) == 1) { objChitietDonthuoc.BhytChitra = 0; objChitietDonthuoc.BnhanChitra = Utility.DecimaltoDbnull(objChitietDonthuoc.DonGia, 0); objChitietDonthuoc.PtramBhyt = 0; } else { objChitietDonthuoc.BhytChitra = Utility.DecimaltoDbnull(objChitietDonthuoc.DonGia) * Utility.DecimaltoDbnull(PtramBHYT) / 100; objChitietDonthuoc.BnhanChitra = Utility.DecimaltoDbnull(objChitietDonthuoc.DonGia, 0) - Utility.DecimaltoDbnull(objChitietDonthuoc.BhytChitra, 0); objChitietDonthuoc.PtramBhyt = Utility.DecimaltoDbnull(PtramBHYT); } } else { return(ActionResult.Cancel); } } objChitietDonthuocCollection.SaveAll(); Scope.Complete(); return(ActionResult.Success); } }
/// <summary> /// Lấy toàn bộ dữ liệu CLS giống phần chỉ định CLS sau đó tính giá dựa trên dữ liệu lấy được đó. Thay vì select lại từ các bảng quan hệ /// </summary> /// <param name="objLuotkham"></param> /// <returns></returns> private static ActionResult CapnhatChiphiCLS(KcbLuotkham objLuotkham) { using (var Scope = new TransactionScope()) { DataTable m_dtServiceDetail = new KCB_CHIDINH_CANLAMSANG().LaydanhsachCLS_chidinh(objLuotkham.MaDoituongKcb, objLuotkham.TrangthaiNoitru, Utility.ByteDbnull(objLuotkham.GiayBhyt, 0), -1, Utility.Int32Dbnull(objLuotkham.DungTuyen.Value, 0), objLuotkham.MaKhoaThuchien, "-GOI,-TIEN");//Ko lấy dữ liệu liên quan đến gói dịch vụ+tiền phí phụ thêm SqlQuery sqlQuery = new Select().From(KcbChidinhclsChitiet.Schema) .Where(KcbChidinhclsChitiet.Columns.IdChidinh).In( new Select(KcbChidinhcl.Columns.IdChidinh).From(KcbChidinhcl.Schema) .Where(KcbChidinhcl.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham) .And(KcbChidinhcl.Columns.IdBenhnhan).IsEqualTo(objLuotkham.IdBenhnhan) ); var objAssignDetailCollection = sqlQuery.ExecuteAsCollection <KcbChidinhclsChitietCollection>(); foreach (KcbChidinhclsChitiet objAssignDetail in objAssignDetailCollection) { if (objAssignDetail.TrangthaiThanhtoan == 0)//Chưa thanh toán { DataRow[] arrDr = m_dtServiceDetail.Select(KcbChidinhclsChitiet.Columns.IdChitietdichvu + "=" + Utility.Int32Dbnull(objAssignDetail.IdChitietdichvu, -1)); if (arrDr.Length > 0) { objAssignDetail.IdDoituongKcb = objLuotkham.IdDoituongKcb; objAssignDetail.PtramBhyt = objLuotkham.PtramBhyt; objAssignDetail.DonGia = Utility.DecimaltoDbnull(arrDr[0][KcbChidinhclsChitiet.Columns.DonGia], 0); objAssignDetail.GiaDanhmuc = Utility.DecimaltoDbnull(arrDr[0][KcbChidinhclsChitiet.Columns.DonGia], 0); objAssignDetail.TuTuc = Utility.ByteDbnull(arrDr[0][KcbChidinhclsChitiet.Columns.TuTuc], 0); objAssignDetail.PhuThu = Utility.DecimaltoDbnull(arrDr[0][KcbChidinhclsChitiet.Columns.PhuThu], 0); objAssignDetail.NguoiSua = globalVariables.UserName; objAssignDetail.NgaySua = DateTime.Now; TinhCLS.GB_TinhPhtramBHYT(objAssignDetail, objLuotkham, Utility.DecimaltoDbnull(objLuotkham.PtramBhyt)); } else //Rất khó nhảy vào nhánh này trừ phi lỗi dữ liệu đặc biệt nào đó { CLS_GIATHEO_KHOAKCB = THU_VIEN_CHUNG.Laygiatrithamsohethong("CLS_GIATHEO_KHOAKCB", "0", true) == "1"; QheDoituongDichvucl _Items = THU_VIEN_CHUNG.LayQheDoituongCLS(objLuotkham.MaDoituongKcb, objAssignDetail.IdChitietdichvu, objLuotkham.MaKhoaThuchien, CLS_GIATHEO_KHOAKCB); if (_Items != null) { objAssignDetail.DonGia = Utility.DecimaltoDbnull(_Items.DonGia); objAssignDetail.PhuThu = (Utility.isTrue(objLuotkham.DungTuyen) ? Utility.DecimaltoDbnull(_Items.PhuthuDungtuyen) : Utility.DecimaltoDbnull(_Items.PhuthuTraituyen)); objAssignDetail.TuTuc = 0; objAssignDetail.IdDoituongKcb = objLuotkham.IdDoituongKcb; objAssignDetail.PtramBhyt = objLuotkham.PtramBhyt; } else { _Items = THU_VIEN_CHUNG.LayQheDoituongCLS("DV", objAssignDetail.IdChitietdichvu, objLuotkham.MaKhoaThuchien, CLS_GIATHEO_KHOAKCB); if (_Items != null) { objAssignDetail.DonGia = Utility.DecimaltoDbnull(_Items.DonGia); objAssignDetail.PhuThu = (Utility.isTrue(objLuotkham.DungTuyen) ? Utility.DecimaltoDbnull(_Items.PhuthuDungtuyen) : Utility.DecimaltoDbnull(_Items.PhuthuTraituyen)); objAssignDetail.TuTuc = 1; objAssignDetail.IdDoituongKcb = objLuotkham.IdDoituongKcb; objAssignDetail.PtramBhyt = 0; } } DmucDichvuclsChitiet _DmucDichvuclsChitiet = DmucDichvuclsChitiet.FetchByID(objAssignDetail.IdChitietdichvu); if (_DmucDichvuclsChitiet != null && Utility.Int32Dbnull(_DmucDichvuclsChitiet.TuTuc, 0) == 1) { objAssignDetail.TuTuc = 1; //Ke ca co trong bang quan he } if (objLuotkham.IdLoaidoituongKcb == 1) //Đối tượng dịch vụ-->ko cần phải đánh dấu tự túc { objAssignDetail.TuTuc = 0; } objAssignDetail.NguoiSua = globalVariables.UserName; objAssignDetail.NgaySua = DateTime.Now; decimal PtramBHYT = Utility.DecimaltoDbnull(objLuotkham.PtramBhyt); TinhCLS.GB_TinhPhtramBHYT(objAssignDetail, objLuotkham, PtramBHYT); } } else//Đã thanh toán-->Ko đổi { return(ActionResult.Cancel); } } objAssignDetailCollection.SaveAll(); Scope.Complete(); return(ActionResult.Success); } }
private static ActionResult CapnhatChiphiCLS_old(KcbLuotkham objLuotkham) { using (var Scope = new TransactionScope()) { CLS_GIATHEO_KHOAKCB = THU_VIEN_CHUNG.Laygiatrithamsohethong("CLS_GIATHEO_KHOAKCB", "0", true) == "1"; SqlQuery sqlQuery = new Select().From(KcbChidinhclsChitiet.Schema) .Where(KcbChidinhclsChitiet.Columns.IdChidinh).In( new Select(KcbChidinhcl.Columns.IdChidinh).From(KcbChidinhcl.Schema) .Where(KcbChidinhcl.Columns.MaLuotkham).IsEqualTo(objLuotkham.MaLuotkham) .And(KcbChidinhcl.Columns.IdBenhnhan).IsEqualTo(objLuotkham.IdBenhnhan) ); var objAssignDetailCollection = sqlQuery.ExecuteAsCollection <KcbChidinhclsChitietCollection>(); foreach (KcbChidinhclsChitiet objAssignDetail in objAssignDetailCollection) { if (objAssignDetail.TrangthaiThanhtoan == 0) { QheDoituongDichvucl _Items = THU_VIEN_CHUNG.LayQheDoituongCLS(objLuotkham.MaDoituongKcb, objAssignDetail.IdChitietdichvu, objLuotkham.MaKhoaThuchien, CLS_GIATHEO_KHOAKCB); if (_Items != null) { objAssignDetail.DonGia = Utility.DecimaltoDbnull(_Items.DonGia); objAssignDetail.PhuThu = (Utility.isTrue(objLuotkham.DungTuyen) ? Utility.DecimaltoDbnull(_Items.PhuthuDungtuyen) : Utility.DecimaltoDbnull(_Items.PhuthuTraituyen)); objAssignDetail.TuTuc = 0; objAssignDetail.IdDoituongKcb = objLuotkham.IdDoituongKcb; objAssignDetail.PtramBhyt = objLuotkham.PtramBhyt; } else { _Items = THU_VIEN_CHUNG.LayQheDoituongCLS("DV", objAssignDetail.IdChitietdichvu, objLuotkham.MaKhoaThuchien, CLS_GIATHEO_KHOAKCB); if (_Items != null) { objAssignDetail.DonGia = Utility.DecimaltoDbnull(_Items.DonGia); objAssignDetail.PhuThu = (Utility.isTrue(objLuotkham.DungTuyen) ? Utility.DecimaltoDbnull(_Items.PhuthuDungtuyen) : Utility.DecimaltoDbnull(_Items.PhuthuTraituyen)); objAssignDetail.TuTuc = 1; objAssignDetail.IdDoituongKcb = objLuotkham.IdDoituongKcb; objAssignDetail.PtramBhyt = 0; } } DmucDichvuclsChitiet _DmucDichvuclsChitiet = DmucDichvuclsChitiet.FetchByID(objAssignDetail.IdChitietdichvu); if (_DmucDichvuclsChitiet != null && Utility.Int32Dbnull(_DmucDichvuclsChitiet.TuTuc, 0) == 1) { objAssignDetail.TuTuc = 1; //Ke ca co trong bang quan he } if (objLuotkham.IdLoaidoituongKcb == 1) //Đối tượng dịch vụ-->ko cần phải đánh dấu tự túc { objAssignDetail.TuTuc = 0; } objAssignDetail.NguoiSua = globalVariables.UserName; objAssignDetail.NgaySua = DateTime.Now; decimal PtramBHYT = Utility.DecimaltoDbnull(objLuotkham.PtramBhyt); TinhCLS.GB_TinhPhtramBHYT(objAssignDetail, objLuotkham, PtramBHYT); } else { return(ActionResult.Cancel); } } objAssignDetailCollection.SaveAll(); Scope.Complete(); return(ActionResult.Success); } }
/// <summary> /// hàm thực hienj việc tính phâm trăm bảo hiểm /// </summary> /// <param name="objChidinhChitiet"></param> /// <param name="PTramBHYT"></param> public static void GB_TinhPhtramBHYT(KcbChidinhclsChitiet objChidinhChitiet, KcbLuotkham objLuotkham, bool noitru, decimal PTramBHYT) { byte trangthaiBhyt = 1; decimal bhytPtramTraituyennoitru = Utility.DecimaltoDbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("BHYT_PTRAM_TRAITUYENNOITRU", "0", false), 0m); bool bExistPtramBHYT = false; if (objLuotkham.IdLoaidoituongKcb != null && !THU_VIEN_CHUNG.IsBaoHiem(objLuotkham.IdLoaidoituongKcb.Value))//Đối tượng DV { trangthaiBhyt = (byte)0; objChidinhChitiet.TuTuc = 0; } else { trangthaiBhyt = (byte)(globalVariables.gv_blnApdungChedoDuyetBHYT ? 0 : 1); } if (Utility.Int32Dbnull(objChidinhChitiet.TrangthaiHuy, -1) == -1) { objChidinhChitiet.TrangthaiHuy = 0; } //DataTable dtDichvu = SPs.SpKcbLaydoituongDichvuChitiet(objChidinhChitiet.IdChitietdichvu).GetDataSet().Tables[0]; //if (dtDichvu != null && dtDichvu.Rows.Count>0) //{ // objChidinhChitiet.GiaDanhmuc = Utility.DecimaltoDbnull(dtDichvu.Rows[0]["Don_Gia"]); //} objChidinhChitiet.GiaDanhmuc = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0); objChidinhChitiet.PtramBhyt = PTramBHYT; objChidinhChitiet.PtramBhytGoc = objLuotkham.PtramBhytGoc; objChidinhChitiet.LoaiChietkhau = 0; objChidinhChitiet.TrangthaiBhyt = trangthaiBhyt; objChidinhChitiet.IdLoaichidinh = 0;//Chưa hiểu trường này-->Cần xem lại if (Utility.Int32Dbnull(objChidinhChitiet.TuTuc, 0) == 1) { objChidinhChitiet.BhytChitra = 0; objChidinhChitiet.BnhanChitra = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0); objChidinhChitiet.PtramBhyt = 0; } else { //Mục tính BHYT đặc biệt để dành sử dụng trong tương lai PtramBHYTDacBiet(objChidinhChitiet, objLuotkham, 2, ref bExistPtramBHYT); if (bExistPtramBHYT) { objChidinhChitiet.BhytChitra = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia) * Utility.DecimaltoDbnull(objChidinhChitiet.PtramBhyt) / 100; objChidinhChitiet.BnhanChitra = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) - Utility.DecimaltoDbnull(objChidinhChitiet.BhytChitra); } else//99% rơi vào nhánh này { PTramBHYT = Utility.DecimaltoDbnull(objLuotkham.PtramBhyt); decimal BHCT = 0m; if (objLuotkham.DungTuyen == 1)//BHYT đúng tuyến rơi vào nhánh này dù nội trú ngay ngoại trú { BHCT = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0) / 100); } else//DV và BHYT trái tuyến { if (objLuotkham.TrangthaiNoitru <= 0 || !noitru)//Đối tượng ngoại trú hoặc Chỉ định ngoại trú-->Lấy phần trăm ngoại trú { BHCT = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0) / 100); } else//Nội trú cần tính=đơn giá * % đầu thẻ * % tuyến if (objChidinhChitiet.DonGia != null) { BHCT = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia.Value, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhytGoc, 0) / 100) * (bhytPtramTraituyennoitru / 100); } } decimal bnct = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) - BHCT; objChidinhChitiet.BhytChitra = BHCT; objChidinhChitiet.BnhanChitra = bnct; } } }
public static bool CapnhatTrangthaiTutuc(KcbDangkyKcb objDoituong, KcbLuotkham objLuotkham, bool noitru, byte tu_tuc, decimal PTramBHYT) { try { byte TrangthaiBhyt = 1; decimal BHYT_PTRAM_TRAITUYENNOITRU = Utility.DecimaltoDbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("BHYT_PTRAM_TRAITUYENNOITRU", "0", false), 0m); bool b_ExistPtramBHYT = false; objDoituong.TuTuc = tu_tuc; if (!THU_VIEN_CHUNG.IsBaoHiem(objLuotkham.IdLoaidoituongKcb.Value))//Đối tượng DV { TrangthaiBhyt = (byte)0; objDoituong.TuTuc = 0; } else { TrangthaiBhyt = (byte)(globalVariables.gv_blnApdungChedoDuyetBHYT ? 0 : 1); } if (Utility.Int32Dbnull(objDoituong.TrangthaiHuy, -1) == -1) { objDoituong.TrangthaiHuy = 0; } objDoituong.PtramBhyt = PTramBHYT; objDoituong.PtramBhytGoc = objLuotkham.PtramBhytGoc; // objChidinhChitiet.LoaiChietkhau = 0; // objChidinhChitiet.TrangthaiBhyt = TrangthaiBhyt; //objChidinhChitiet.IdLoaichidinh = 0;//Chưa hiểu trường này-->Cần xem lại if (Utility.Int32Dbnull(objDoituong.TuTuc, 0) == 1) { objDoituong.BhytChitra = 0; objDoituong.BnhanChitra = Utility.DecimaltoDbnull(objDoituong.DonGia, 0); objDoituong.PtramBhyt = 0; } else { if (b_ExistPtramBHYT) { objDoituong.BhytChitra = Utility.DecimaltoDbnull(objDoituong.DonGia) * Utility.DecimaltoDbnull(objDoituong.PtramBhyt) / 100; objDoituong.BnhanChitra = Utility.DecimaltoDbnull(objDoituong.DonGia, 0) - Utility.DecimaltoDbnull(objDoituong.BhytChitra); } else//99% rơi vào nhánh này { PTramBHYT = Utility.DecimaltoDbnull(objLuotkham.PtramBhyt); decimal BHCT = 0m; if (objLuotkham.DungTuyen == 1)//BHYT đúng tuyến rơi vào nhánh này dù nội trú ngay ngoại trú { BHCT = Utility.DecimaltoDbnull(objDoituong.DonGia, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0) / 100); } else//DV và BHYT trái tuyến { if (objLuotkham.TrangthaiNoitru <= 0 || !noitru)//Đối tượng ngoại trú hoặc Chỉ định ngoại trú-->Lấy phần trăm ngoại trú { BHCT = Utility.DecimaltoDbnull(objDoituong.DonGia, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0) / 100); } else//Nội trú cần tính=đơn giá * % đầu thẻ * % tuyến { BHCT = Utility.DecimaltoDbnull(objDoituong.DonGia, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhytGoc, 0) / 100) * (BHYT_PTRAM_TRAITUYENNOITRU / 100); } } decimal BNCT = Utility.DecimaltoDbnull(objDoituong.DonGia, 0) - BHCT; objDoituong.BhytChitra = BHCT; objDoituong.BnhanChitra = BNCT; } } objDoituong.MarkOld(); objDoituong.IsNew = false; objDoituong.Save(); return(true); } catch (Exception ex) { Utility.CatchException(ex); return(false); } }
public static bool CapnhatTrangthaiTutuc(KcbChidinhclsChitiet objChidinhChitiet, KcbLuotkham objLuotkham, bool noitru, byte tu_tuc, decimal PTramBHYT) { try { byte TrangthaiBhyt = 1; decimal BHYT_PTRAM_TRAITUYENNOITRU = Utility.DecimaltoDbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("BHYT_PTRAM_TRAITUYENNOITRU", "0", false), 0m); bool b_ExistPtramBHYT = false; objChidinhChitiet.TuTuc = tu_tuc; if (!THU_VIEN_CHUNG.IsBaoHiem(objLuotkham.IdLoaidoituongKcb.Value))//Đối tượng DV { TrangthaiBhyt = (byte)0; objChidinhChitiet.TuTuc = 0; } else { TrangthaiBhyt = (byte)(globalVariables.gv_blnApdungChedoDuyetBHYT ? 0 : 1); } if (Utility.Int32Dbnull(objChidinhChitiet.TrangthaiHuy, -1) == -1) { objChidinhChitiet.TrangthaiHuy = 0; } DmucDichvuclsChitiet obServiceDetail = DmucDichvuclsChitiet.FetchByID(Utility.Int32Dbnull(objChidinhChitiet.IdChitietdichvu)); QheDoituongDichvucl objqhedoituong = new QheDoituongDichvucl(); if (obServiceDetail != null) { if (Utility.Int32Dbnull(objChidinhChitiet.TuTuc, 0) == 1) { objqhedoituong = LayGiaTheoDoiTuong("DV", objChidinhChitiet.IdChitietdichvu, objLuotkham.MaKhoaThuchien); } else { objqhedoituong = LayGiaTheoDoiTuong(objLuotkham.MaDoituongKcb, objChidinhChitiet.IdChitietdichvu, objLuotkham.MaKhoaThuchien); } // objChidinhChitiet.GiaDanhmuc = Utility.DecimaltoDbnull(obServiceDetail.DonGia); if (objqhedoituong != null) { objChidinhChitiet.GiaDanhmuc = Utility.DecimaltoDbnull(objqhedoituong.DonGia, 0); objChidinhChitiet.DonGia = Utility.DecimaltoDbnull(objqhedoituong.DonGia, 0); objChidinhChitiet.MadoituongGia = Utility.sDbnull(objqhedoituong.MaDoituongKcb); } } objChidinhChitiet.PtramBhyt = PTramBHYT; objChidinhChitiet.PtramBhytGoc = objLuotkham.PtramBhytGoc; // objChidinhChitiet.LoaiChietkhau = 0; // objChidinhChitiet.TrangthaiBhyt = TrangthaiBhyt; //objChidinhChitiet.IdLoaichidinh = 0;//Chưa hiểu trường này-->Cần xem lại if (Utility.Int32Dbnull(objChidinhChitiet.TuTuc, 0) == 1) { objChidinhChitiet.BhytChitra = 0; if (objqhedoituong != null) { objChidinhChitiet.BnhanChitra = Utility.DecimaltoDbnull(objqhedoituong.DonGia, 0); } objChidinhChitiet.PtramBhyt = 0; } else { //Mục tính BHYT đặc biệt để dành sử dụng trong tương lai PtramBHYTDacBiet(objChidinhChitiet, objLuotkham, 2, ref b_ExistPtramBHYT); if (b_ExistPtramBHYT) { objChidinhChitiet.BhytChitra = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia) * Utility.DecimaltoDbnull(objChidinhChitiet.PtramBhyt) / 100; objChidinhChitiet.BnhanChitra = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) - Utility.DecimaltoDbnull(objChidinhChitiet.BhytChitra); } else//99% rơi vào nhánh này { PTramBHYT = Utility.DecimaltoDbnull(objLuotkham.PtramBhyt); decimal BHCT = 0m; if (objLuotkham.DungTuyen == 1)//BHYT đúng tuyến rơi vào nhánh này dù nội trú ngay ngoại trú { BHCT = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0) / 100); } else//DV và BHYT trái tuyến { if (objLuotkham.TrangthaiNoitru <= 0 || !noitru)//Đối tượng ngoại trú hoặc Chỉ định ngoại trú-->Lấy phần trăm ngoại trú { BHCT = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0) / 100); } else//Nội trú cần tính=đơn giá * % đầu thẻ * % tuyến { BHCT = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia.Value, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhytGoc, 0) / 100) * (BHYT_PTRAM_TRAITUYENNOITRU / 100); } } decimal BNCT = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) - BHCT; objChidinhChitiet.BhytChitra = BHCT; objChidinhChitiet.BnhanChitra = BNCT; } } objChidinhChitiet.MarkOld(); objChidinhChitiet.IsNew = false; objChidinhChitiet.Save(); return(true); } catch (Exception ex) { Utility.CatchException(ex); return(false); } }
public static void GB_TinhPhtramBHYT(KcbChidinhclsChitiet objChidinhChitiet, KcbLichsuDoituongKcb objLichsu, bool noitru, decimal PTramBHYT) { byte TrangthaiBhyt = 1; decimal BHYT_PTRAM_TRAITUYENNOITRU = Utility.DecimaltoDbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("BHYT_PTRAM_TRAITUYENNOITRU", "0", false), 0m); bool b_ExistPtramBHYT = false; if (!THU_VIEN_CHUNG.IsBaoHiem(objLichsu.IdLoaidoituongKcb.Value))//Đối tượng DV { TrangthaiBhyt = (byte)0; objChidinhChitiet.TuTuc = 0; } else { TrangthaiBhyt = (byte)(globalVariables.gv_blnApdungChedoDuyetBHYT ? 0 : 1); } if (Utility.Int32Dbnull(objChidinhChitiet.TrangthaiHuy, -1) == -1) { objChidinhChitiet.TrangthaiHuy = 0; } DmucDichvuclsChitiet obServiceDetail = DmucDichvuclsChitiet.FetchByID(Utility.Int32Dbnull(objChidinhChitiet.IdChitietdichvu)); if (obServiceDetail != null) { objChidinhChitiet.GiaDanhmuc = Utility.DecimaltoDbnull(obServiceDetail.DonGia); } objChidinhChitiet.PtramBhyt = PTramBHYT; objChidinhChitiet.PtramBhytGoc = objLichsu.PtramBhytGoc; objChidinhChitiet.LoaiChietkhau = 0; objChidinhChitiet.TrangthaiBhyt = TrangthaiBhyt; objChidinhChitiet.IdLoaichidinh = 0;//Chưa hiểu trường này-->Cần xem lại if (Utility.Int32Dbnull(objChidinhChitiet.TuTuc, 0) == 1) { objChidinhChitiet.BhytChitra = 0; objChidinhChitiet.BnhanChitra = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0); objChidinhChitiet.PtramBhyt = 0; } else { //Mục tính BHYT đặc biệt để dành sử dụng trong tương lai PtramBHYTDacBiet(objChidinhChitiet, objLichsu, 2, ref b_ExistPtramBHYT); if (b_ExistPtramBHYT) { objChidinhChitiet.BhytChitra = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia) * Utility.DecimaltoDbnull(objChidinhChitiet.PtramBhyt) / 100; objChidinhChitiet.BnhanChitra = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) - Utility.DecimaltoDbnull(objChidinhChitiet.BhytChitra); } else//99% rơi vào nhánh này { PTramBHYT = Utility.DecimaltoDbnull(objLichsu.PtramBhyt); decimal BHCT = 0m; if (objLichsu.DungTuyen == 1)//BHYT đúng tuyến rơi vào nhánh này dù nội trú ngay ngoại trú { BHCT = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) * (Utility.DecimaltoDbnull(objLichsu.PtramBhyt, 0) / 100); } else//DV và BHYT trái tuyến { if (objLichsu.TrangthaiNoitru <= 0 || !noitru)//Đối tượng ngoại trú hoặc Chỉ định ngoại trú-->Lấy phần trăm ngoại trú { BHCT = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) * (Utility.DecimaltoDbnull(objLichsu.PtramBhyt, 0) / 100); } else//Nội trú cần tính=đơn giá * % đầu thẻ * % tuyến { BHCT = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia.Value, 0) * (Utility.DecimaltoDbnull(objLichsu.PtramBhytGoc, 0) / 100) * (BHYT_PTRAM_TRAITUYENNOITRU / 100); } } decimal BNCT = Utility.DecimaltoDbnull(objChidinhChitiet.DonGia, 0) - BHCT; objChidinhChitiet.BhytChitra = BHCT; objChidinhChitiet.BnhanChitra = BNCT; } } }
/// <summary> /// hàm thực hienj việc tính phâm trăm bảo hiểm /// </summary> /// <param name="objAssignDetail"></param> /// <param name="PTramBHYT"></param> public static void GB_TinhPhtramBHYT(KcbChidinhclsChitiet objAssignDetail, KcbLuotkham objLuotkham, decimal PTramBHYT) { byte TrangthaiBhyt = 1; decimal BHYT_PTRAM_TRAITUYENNOITRU = Utility.DecimaltoDbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("BHYT_PTRAM_TRAITUYENNOITRU", "0", false), 0m); bool b_ExistPtramBHYT = false; if (!THU_VIEN_CHUNG.IsBaoHiem(objLuotkham.IdLoaidoituongKcb.Value))//(objLuotkham.MaDoituongKcb == "DV")//Tự túc { TrangthaiBhyt = (byte)0; objAssignDetail.TuTuc = 0; } else { TrangthaiBhyt = (byte)(globalVariables.gv_blnApdungChedoDuyetBHYT ? 0 : 1); } if (Utility.Int32Dbnull(objAssignDetail.TrangthaiHuy, -1) == -1) { objAssignDetail.TrangthaiHuy = 0; } DmucDichvuclsChitiet obServiceDetail = DmucDichvuclsChitiet.FetchByID(Utility.Int32Dbnull(objAssignDetail.IdChitietchidinh)); if (obServiceDetail != null) { objAssignDetail.GiaDanhmuc = Utility.DecimaltoDbnull(obServiceDetail.DonGia); } objAssignDetail.PtramBhyt = PTramBHYT; objAssignDetail.PtramBhytGoc = objLuotkham.PtramBhytGoc; objAssignDetail.LoaiChietkhau = 0; objAssignDetail.TrangthaiBhyt = TrangthaiBhyt; objAssignDetail.IdLoaichidinh = 0; if (Utility.Int32Dbnull(objAssignDetail.TuTuc, 0) == 1) { objAssignDetail.BhytChitra = 0; objAssignDetail.BnhanChitra = Utility.DecimaltoDbnull(objAssignDetail.DonGia, 0); objAssignDetail.PtramBhyt = 0; } else { PtramBHYTDacBiet(objAssignDetail, objLuotkham, 2, ref b_ExistPtramBHYT); if (b_ExistPtramBHYT) { objAssignDetail.BhytChitra = Utility.DecimaltoDbnull(objAssignDetail.DonGia) * Utility.DecimaltoDbnull(objAssignDetail.PtramBhyt) / 100; objAssignDetail.BnhanChitra = Utility.DecimaltoDbnull(objAssignDetail.DonGia, 0) - Utility.DecimaltoDbnull(objAssignDetail.BhytChitra); } else { PTramBHYT = Utility.DecimaltoDbnull(objLuotkham.PtramBhyt); decimal BHCT = 0m; if (objLuotkham.DungTuyen == 1) { BHCT = Utility.DecimaltoDbnull(objAssignDetail.DonGia, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0) / 100); } else { if (objLuotkham.TrangthaiNoitru <= 0) { BHCT = Utility.DecimaltoDbnull(objAssignDetail.DonGia, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0) / 100); } else//Nội trú cần tính=đơn giá * % đầu thẻ * % tuyến { BHCT = Utility.DecimaltoDbnull(objAssignDetail.DonGia.Value, 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhytGoc, 0) / 100) * (BHYT_PTRAM_TRAITUYENNOITRU / 100); } } decimal BNCT = Utility.DecimaltoDbnull(objAssignDetail.DonGia, 0) - BHCT; objAssignDetail.BhytChitra = BHCT; objAssignDetail.BnhanChitra = BNCT; //objAssignDetail.BhytChitra = Utility.DecimaltoDbnull(objAssignDetail.DonGia) * // Utility.DecimaltoDbnull(PTramBHYT) / 100; } } }
public static void GetTrongNgayTrongGio() { globalVariables.TrongGio = THU_VIEN_CHUNG.Laygiatrithamsohethong("KCB_TRONGGIO", "0:00-23:59", false); globalVariables.TrongNgay = THU_VIEN_CHUNG.Laygiatrithamsohethong("KCB_TRONGNGAY", "2,3,4,5,6,7,CN", false); }