/// <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(); }
private KcbPhieuDct CreatePhieuDongChiTra() { KcbPhieuDct objPhieuDct = new KcbPhieuDct(); objPhieuDct.MaLuotkham = Utility.sDbnull(objLuotkham.MaLuotkham); objPhieuDct.IdBenhnhan = Utility.Int32Dbnull(objLuotkham.IdBenhnhan); objPhieuDct.LoaiThanhtoan = 0; objPhieuDct.NguoiTao = globalVariables.UserName; objPhieuDct.NgayTao = globalVariables.SysDate; objPhieuDct.TongTien = Utility.DecimaltoDbnull(txtSoTienGoc.Text); objPhieuDct.BnhanChitra = Utility.DecimaltoDbnull(txtTienBNCT.Text); objPhieuDct.BhytChitra = Utility.DecimaltoDbnull(txtTienBHCT.Text); return(objPhieuDct); }
private KcbPhieuDct CreatePhieuDongChiTra(KcbLuotkham objLuotkham, DataTable m_dtPayment) { KcbPhieuDct objPhieuDct = new KcbPhieuDct(); objPhieuDct.MaPhieuDct = Utility.sDbnull(THU_VIEN_CHUNG.TaomaDongChiTra(globalVariables.SysDate)); objPhieuDct.MaLuotkham = Utility.sDbnull(objLuotkham.MaLuotkham); objPhieuDct.IdBenhnhan = Utility.Int32Dbnull(objLuotkham.IdBenhnhan); objPhieuDct.LoaiThanhtoan = 0; objPhieuDct.NguoiTao = globalVariables.UserName; objPhieuDct.TrangthaiXml = 0; objPhieuDct.NgayTao = globalVariables.SysDate; objPhieuDct.IpMaytao = globalVariables.gv_strIPAddress; objPhieuDct.MatheBhyt = Utility.sDbnull(objLuotkham.MatheBhyt, ""); objPhieuDct.MaKhoaThuchien = Utility.sDbnull(objLuotkham.MaKhoaThuchien, ""); objPhieuDct.TenMaytao = globalVariables.gv_strComputerName; objPhieuDct.TongTien = (decimal)m_dtPayment.Compute("SUM(TT_DCT)", "1=1"); // Utility.DecimaltoDbnull(txtSoTienGoc.Text); objPhieuDct.BnhanChitra = (decimal)m_dtPayment.Compute("SUM(BN_CT)", "1=1"); //Utility.DecimaltoDbnull(txtTienBNCT.Text); objPhieuDct.BhytChitra = (decimal)m_dtPayment.Compute("SUM(BHYT_CT)", "1=1"); //Utility.DecimaltoDbnull(txtTienBHCT.Text); objPhieuDct.TrangthaiXml = 0; return(objPhieuDct); }
/// <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) { } }
private KcbPhieuDct CreatePhieuDongChiTra() { KcbPhieuDct objPhieuDct = new KcbPhieuDct(); objPhieuDct.MaLuotkham = Utility.sDbnull(objLuotkham.MaLuotkham); objPhieuDct.IdBenhnhan = Utility.Int32Dbnull(objLuotkham.IdBenhnhan); objPhieuDct.LoaiThanhtoan = 0; objPhieuDct.NguoiTao = globalVariables.UserName; objPhieuDct.NgayTao = globalVariables.SysDate; objPhieuDct.TongTien = (decimal)m_dtPayment.Compute("SUM(TONGTIEN_GOC)", "1=1");// Utility.DecimaltoDbnull(txtSoTienGoc.Text); objPhieuDct.BnhanChitra = (decimal)m_dtPayment.Compute("SUM(BN_CT)", "1=1"); //Utility.DecimaltoDbnull(txtTienBNCT.Text); objPhieuDct.BhytChitra = (decimal)m_dtPayment.Compute("SUM(BHYT_CT)", "1=1"); //Utility.DecimaltoDbnull(txtTienBHCT.Text); return objPhieuDct; }
public ActionResult UpdatePhieuDCT(KcbPhieuDct objPhieuDct, KcbLuotkham objLuotkham) { try { using (var scope = new TransactionScope()) { using (var sh = new SharedDbConnectionScope()) { //Tạm REM vào ngày 11/05/2015 do phần này tính đúng nếu các lần thanh toán của bệnh nhân cũng tính đúng //decimal PtramBHYT = 0; //SqlQuery sqlQuery = new Select().From(KcbThanhtoanChitiet.Schema) // .Where(KcbThanhtoanChitiet.Columns.IdThanhtoan).In( // new Select(KcbThanhtoan.Columns.IdThanhtoan).From(KcbThanhtoan.Schema).Where( // KcbThanhtoan.Columns.MaLuotkham).IsEqualTo( // objLuotkham.MaLuotkham).And(KcbThanhtoan.Columns.IdBenhnhan).IsEqualTo( // objLuotkham.IdBenhnhan).And(KcbThanhtoan.Columns.KieuThanhtoan).IsEqualTo( // KieuThanhToan.NgoaiTru).And(KcbThanhtoan.Columns.TrangThai).IsEqualTo(0)) // .And(KcbThanhtoanChitiet.Columns.TrangthaiHuy).IsEqualTo(0) // .And(KcbThanhtoanChitiet.Columns.TuTuc).IsEqualTo(0); //KcbThanhtoanChitietCollection objThanhtoanDetailCollection = // sqlQuery.ExecuteAsCollection<KcbThanhtoanChitietCollection>(); //decimal TongTien = // Utility.DecimaltoDbnull(objThanhtoanDetailCollection.Sum(c => c.SoLuong * c.DonGia)); //LayThongtinPtramBHYT(TongTien, objLuotkham, ref PtramBHYT); //if ((objLuotkham.TrangthaiNoitru==0 && Utility.DecimaltoDbnull(objLuotkham.PtramBhyt) != PtramBHYT) // || (objLuotkham.TrangthaiNoitru > 0 && Utility.DecimaltoDbnull(objLuotkham.PtramBhytGoc) != PtramBHYT) // ) //{ // if (objLuotkham.TrangthaiNoitru == 0) // objLuotkham.PtramBhyt = PtramBHYT; // else // objLuotkham.PtramBhyt = PtramBHYT; // new Update(KcbLuotkham.Schema) // .Set(KcbLuotkham.Columns.NgaySua).EqualTo(globalVariables.SysDate) // .Set(KcbLuotkham.Columns.NguoiSua).EqualTo(globalVariables.UserName) // .Set(KcbLuotkham.Columns.PtramBhyt).EqualTo(PtramBHYT) // .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objPhieuDct.MaLuotkham) // .And(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objPhieuDct.IdBenhnhan).Execute(); //} //if (globalVariables.gv_strTuyenBHYT == "TW") //{ // foreach (KcbThanhtoanChitiet objThanhtoanDetail in objThanhtoanDetailCollection) // { // decimal BHCT = Utility.DecimaltoDbnull(objThanhtoanDetail.DonGia * PtramBHYT / 100); // decimal BNCT = Utility.DecimaltoDbnull(objThanhtoanDetail.DonGia - BHCT); // objThanhtoanDetail.BnhanChitra = BNCT; // objThanhtoanDetail.PtramBhyt = PtramBHYT; // objThanhtoanDetail.BhytChitra = BHCT; // } // objThanhtoanDetailCollection.SaveAll(); //} //if (objThanhtoanDetailCollection.Count() > 0) //{ //objPhieuDct.TongTien = objThanhtoanDetailCollection.Sum(c => c.DonGia * c.SoLuong); //objPhieuDct.BnhanChitra = objThanhtoanDetailCollection.Sum(c => c.BnhanChitra * c.SoLuong); //objPhieuDct.BhytChitra = objThanhtoanDetailCollection.Sum(c => c.BhytChitra * c.SoLuong); SqlQuery sqlQuery = new Select().From<KcbPhieuDct>() .Where(KcbPhieuDct.Columns.MaLuotkham) .IsEqualTo(objPhieuDct.MaLuotkham) .And(KcbPhieuDct.Columns.IdBenhnhan).IsEqualTo(objPhieuDct.IdBenhnhan) .And(KcbPhieuDct.Columns.LoaiThanhtoan).IsEqualTo(objPhieuDct.LoaiThanhtoan); if (sqlQuery.GetRecordCount() <= 0) { objPhieuDct.IsNew = true; objPhieuDct.Save(); objLuotkham.TrangthaiNgoaitru = 1; objLuotkham.Locked = 1; objLuotkham.NgayKetthuc = objPhieuDct.NgayTao; new Update(KcbLuotkham.Schema) .Set(KcbLuotkham.Columns.NgaySua).EqualTo(globalVariables.SysDate) .Set(KcbLuotkham.Columns.NguoiSua).EqualTo(globalVariables.UserName) .Set(KcbLuotkham.Columns.Locked).EqualTo(objLuotkham.Locked) .Set(KcbLuotkham.Columns.NgayKetthuc).EqualTo(objLuotkham.NgayKetthuc) .Set(KcbLuotkham.Columns.TrangthaiNgoaitru).EqualTo(Utility.Int32Dbnull(objLuotkham.TrangthaiNgoaitru)) .Set(KcbLuotkham.Columns.LydoKetthuc).EqualTo("In phôi bảo hiểm") .Set(KcbLuotkham.Columns.IpMaysua).EqualTo(objPhieuDct.IpMaysua) .Set(KcbLuotkham.Columns.TenMaysua).EqualTo(objPhieuDct.TenMaysua) .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objPhieuDct.MaLuotkham) .And(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objPhieuDct.IdBenhnhan).Execute(); } else { new Update(KcbPhieuDct.Schema) .Set(KcbPhieuDct.Columns.TongTien).EqualTo(objPhieuDct.TongTien) .Set(KcbPhieuDct.Columns.BnhanChitra).EqualTo(objPhieuDct.BnhanChitra) .Set(KcbPhieuDct.Columns.BhytChitra).EqualTo(objPhieuDct.BhytChitra) .Set(KcbPhieuDct.Columns.NguoiSua).EqualTo(globalVariables.UserName) .Set(KcbPhieuDct.Columns.IpMaysua).EqualTo(objPhieuDct.IpMaysua) .Set(KcbPhieuDct.Columns.TenMaysua).EqualTo(objPhieuDct.TenMaysua) .Where(KcbPhieuDct.Columns.MaLuotkham).IsEqualTo(objPhieuDct.MaLuotkham) .And(KcbPhieuDct.Columns.IdBenhnhan).IsEqualTo(objPhieuDct.IdBenhnhan) .And(KcbPhieuDct.Columns.LoaiThanhtoan).IsEqualTo(Utility.Int32Dbnull(objPhieuDct.LoaiThanhtoan)) .Execute(); } //} } scope.Complete(); return ActionResult.Success; } } catch (Exception exception) { log.Error("Loi trong qua trinh tra tien lai:{0}", exception.ToString()); return ActionResult.Error; } }
public void Insert(string MaPhieuDct,string MaLuotkham,int? IdBenhnhan,decimal? TongTien,decimal? BhytChitra,decimal? BnhanChitra,string NguoiTao,DateTime? NgayTao,DateTime? NgaySua,string NguoiSua,byte? LoaiThanhtoan,string MaKhoaThuchien,string TenLoaithanhtoan,string IpMaytao,string IpMaysua,string TenMaytao,string TenMaysua) { KcbPhieuDct item = new KcbPhieuDct(); item.MaPhieuDct = MaPhieuDct; item.MaLuotkham = MaLuotkham; item.IdBenhnhan = IdBenhnhan; item.TongTien = TongTien; item.BhytChitra = BhytChitra; item.BnhanChitra = BnhanChitra; item.NguoiTao = NguoiTao; item.NgayTao = NgayTao; item.NgaySua = NgaySua; item.NguoiSua = NguoiSua; item.LoaiThanhtoan = LoaiThanhtoan; item.MaKhoaThuchien = MaKhoaThuchien; item.TenLoaithanhtoan = TenLoaithanhtoan; item.IpMaytao = IpMaytao; item.IpMaysua = IpMaysua; item.TenMaytao = TenMaytao; item.TenMaysua = TenMaysua; item.Save(UserName); }
public void Update(long IdPhieuDct,string MaPhieuDct,string MaLuotkham,long? IdBenhnhan,decimal? TongTien,decimal? BhytChitra,decimal? BnhanChitra,byte? LoaiThanhtoan,string MaKhoaThuchien,string TenLoaithanhtoan,long? IdLichsuDoituongKcb,string MatheBhyt,string NguoiTao,DateTime NgayTao,DateTime? NgaySua,string NguoiSua,string IpMaytao,string IpMaysua,string TenMaytao,string TenMaysua) { KcbPhieuDct item = new KcbPhieuDct(); item.MarkOld(); item.IsLoaded = true; item.IdPhieuDct = IdPhieuDct; item.MaPhieuDct = MaPhieuDct; item.MaLuotkham = MaLuotkham; item.IdBenhnhan = IdBenhnhan; item.TongTien = TongTien; item.BhytChitra = BhytChitra; item.BnhanChitra = BnhanChitra; item.LoaiThanhtoan = LoaiThanhtoan; item.MaKhoaThuchien = MaKhoaThuchien; item.TenLoaithanhtoan = TenLoaithanhtoan; item.IdLichsuDoituongKcb = IdLichsuDoituongKcb; item.MatheBhyt = MatheBhyt; item.NguoiTao = NguoiTao; item.NgayTao = NgayTao; item.NgaySua = NgaySua; item.NguoiSua = NguoiSua; item.IpMaytao = IpMaytao; item.IpMaysua = IpMaysua; item.TenMaytao = TenMaytao; item.TenMaysua = TenMaysua; item.Save(UserName); }
public ActionResult UpdatePhieuDCT(KcbPhieuDct objPhieuDct, KcbLuotkham objLuotkham) { try { using (var scope = new TransactionScope()) { using (var sh = new SharedDbConnectionScope()) { SqlQuery sqlQuery = new Select().From<KcbPhieuDct>() .Where(KcbPhieuDct.Columns.MaLuotkham) .IsEqualTo(objPhieuDct.MaLuotkham) .And(KcbPhieuDct.Columns.IdBenhnhan).IsEqualTo(objPhieuDct.IdBenhnhan) .And(KcbPhieuDct.Columns.LoaiThanhtoan).IsEqualTo(objPhieuDct.LoaiThanhtoan); if (sqlQuery.GetRecordCount() <= 0) { objPhieuDct.IsNew = true; objPhieuDct.Save(); objLuotkham.TrangthaiNgoaitru = 1; objLuotkham.Locked = 1; objLuotkham.NgayKetthuc = objPhieuDct.NgayTao; new Update(KcbLuotkham.Schema) .Set(KcbLuotkham.Columns.NgaySua).EqualTo(globalVariables.SysDate) .Set(KcbLuotkham.Columns.NguoiSua).EqualTo(globalVariables.UserName) .Set(KcbLuotkham.Columns.Locked).EqualTo(objLuotkham.Locked) .Set(KcbLuotkham.Columns.NgayKetthuc).EqualTo(objLuotkham.NgayKetthuc) .Set(KcbLuotkham.Columns.TrangthaiNgoaitru).EqualTo(Utility.Int32Dbnull(objLuotkham.TrangthaiNgoaitru)) .Set(KcbLuotkham.Columns.LydoKetthuc).EqualTo("In phôi bảo hiểm") .Set(KcbLuotkham.Columns.IpMaysua).EqualTo(objPhieuDct.IpMaysua) .Set(KcbLuotkham.Columns.TenMaysua).EqualTo(objPhieuDct.TenMaysua) .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objPhieuDct.MaLuotkham) .And(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objPhieuDct.IdBenhnhan).Execute(); } else { new Update(KcbPhieuDct.Schema) .Set(KcbPhieuDct.Columns.TongTien).EqualTo(objPhieuDct.TongTien) .Set(KcbPhieuDct.Columns.BnhanChitra).EqualTo(objPhieuDct.BnhanChitra) .Set(KcbPhieuDct.Columns.BhytChitra).EqualTo(objPhieuDct.BhytChitra) .Set(KcbPhieuDct.Columns.NguoiSua).EqualTo(globalVariables.UserName) .Set(KcbPhieuDct.Columns.IpMaysua).EqualTo(objPhieuDct.IpMaysua) .Set(KcbPhieuDct.Columns.TenMaysua).EqualTo(objPhieuDct.TenMaysua) .Where(KcbPhieuDct.Columns.MaLuotkham).IsEqualTo(objPhieuDct.MaLuotkham) .And(KcbPhieuDct.Columns.IdBenhnhan).IsEqualTo(objPhieuDct.IdBenhnhan) .And(KcbPhieuDct.Columns.LoaiThanhtoan).IsEqualTo(Utility.Int32Dbnull(objPhieuDct.LoaiThanhtoan)) .Execute(); } //} } scope.Complete(); return ActionResult.Success; } } catch (Exception exception) { log.Error("Loi trong qua trinh tra tien lai:{0}", exception.ToString()); return ActionResult.Error; } }
private KcbPhieuDct CreatePhieuDongChiTra() { KcbPhieuDct objPhieuDct = new KcbPhieuDct(); objPhieuDct.MaLuotkham = Utility.sDbnull(objLuotkham.MaLuotkham); objPhieuDct.IdBenhnhan = Utility.Int32Dbnull(objLuotkham.IdBenhnhan); objPhieuDct.LoaiThanhtoan = 0; objPhieuDct.NguoiTao = globalVariables.UserName; objPhieuDct.NgayTao = globalVariables.SysDate; objPhieuDct.TongTien = Utility.DecimaltoDbnull(txtSoTienGoc.Text); objPhieuDct.BnhanChitra = Utility.DecimaltoDbnull(txtTienBNCT.Text); objPhieuDct.BhytChitra = Utility.DecimaltoDbnull(txtTienBHCT.Text); return objPhieuDct; }
public ActionResult UpdatePhieuDCT(KcbPhieuDct objPhieuDct, KcbLuotkham objLuotkham) { try { using (var scope = new TransactionScope()) { using (var sh = new SharedDbConnectionScope()) { decimal PtramBHYT = 0; SqlQuery sqlQuery = new Select().From(KcbThanhtoanChitiet.Schema) .Where(KcbThanhtoanChitiet.Columns.IdThanhtoan).In( new Select(KcbThanhtoan.Columns.IdThanhtoan).From(KcbThanhtoan.Schema).Where( KcbThanhtoan.Columns.MaLuotkham).IsEqualTo( objLuotkham.MaLuotkham).And(KcbThanhtoan.Columns.IdBenhnhan).IsEqualTo( objLuotkham.IdBenhnhan).And(KcbThanhtoan.Columns.KieuThanhtoan).IsEqualTo( KieuThanhToan.NgoaiTru).And(KcbThanhtoan.Columns.TrangThai).IsEqualTo(0)) .And(KcbThanhtoanChitiet.Columns.TrangthaiHuy).IsEqualTo(0) .And(KcbThanhtoanChitiet.Columns.TuTuc).IsEqualTo(0); KcbThanhtoanChitietCollection objThanhtoanDetailCollection = sqlQuery.ExecuteAsCollection<KcbThanhtoanChitietCollection>(); decimal TongTien = Utility.DecimaltoDbnull(objThanhtoanDetailCollection.Sum(c => c.SoLuong * c.DonGia)); LayThongtinPtramBHYT(TongTien, objLuotkham, ref PtramBHYT); if (Utility.DecimaltoDbnull(objLuotkham.PtramBhyt) != PtramBHYT) { objLuotkham.PtramBhyt = PtramBHYT; new Update(KcbLuotkham.Schema) .Set(KcbLuotkham.Columns.NgaySua).EqualTo(globalVariables.SysDate) .Set(KcbLuotkham.Columns.NguoiSua).EqualTo(globalVariables.UserName) .Set(KcbLuotkham.Columns.PtramBhyt).EqualTo(PtramBHYT) .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objPhieuDct.MaLuotkham) .And(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objPhieuDct.IdBenhnhan).Execute(); } if (globalVariables.gv_strTuyenBHYT == "TW") { foreach (KcbThanhtoanChitiet objThanhtoanDetail in objThanhtoanDetailCollection) { decimal BHCT = Utility.DecimaltoDbnull(objThanhtoanDetail.DonGia * PtramBHYT / 100); decimal BNCT = Utility.DecimaltoDbnull(objThanhtoanDetail.DonGia - BHCT); objThanhtoanDetail.BnhanChitra = BNCT; objThanhtoanDetail.PtramBhyt = PtramBHYT; objThanhtoanDetail.BhytChitra = BHCT; } objThanhtoanDetailCollection.SaveAll(); } if (objThanhtoanDetailCollection.Count() > 0) { objPhieuDct.TongTien = objThanhtoanDetailCollection.Sum(c => c.DonGia * c.SoLuong); objPhieuDct.BnhanChitra = objThanhtoanDetailCollection.Sum(c => c.BnhanChitra * c.SoLuong); objPhieuDct.BhytChitra = objThanhtoanDetailCollection.Sum(c => c.BhytChitra * c.SoLuong); sqlQuery = new Select().From<KcbPhieuDct>() .Where(KcbPhieuDct.Columns.MaLuotkham) .IsEqualTo(objPhieuDct.MaLuotkham) .And(KcbPhieuDct.Columns.IdBenhnhan).IsEqualTo(objPhieuDct.IdBenhnhan) .And(KcbPhieuDct.Columns.LoaiThanhtoan).IsEqualTo(objPhieuDct.LoaiThanhtoan); if (sqlQuery.GetRecordCount() <= 0) { objPhieuDct.IsNew = true; objPhieuDct.Save(); //StoredProcedure sp = SPs.BhytThemmoiPhieudct(objPhieuDct.IdPhieuDct, objPhieuDct.MaLuotkham, // objPhieuDct.IdBenhnhan, objPhieuDct.TienGoc, // objPhieuDct.TienBhct, objPhieuDct.TienBnct, // objPhieuDct.NguoiTao, objPhieuDct.NgayTao, objPhieuDct.KieuThanhtoan, globalVariables.MA_KHOA_THIEN); //sp.Execute(); objLuotkham.TrangthaiNgoaitru = 1; objLuotkham.Locked = 1; objLuotkham.NgayKetthuc = objPhieuDct.NgayTao; new Update(KcbLuotkham.Schema) //.Set(KcbLuotkham.Columns.IpMacSua).EqualTo(globalVariables.IpMacAddress) //.Set(KcbLuotkham.Columns.IpMaySua).EqualTo(globalVariables.IpAddress) .Set(KcbLuotkham.Columns.NgaySua).EqualTo(globalVariables.SysDate) .Set(KcbLuotkham.Columns.NguoiSua).EqualTo(globalVariables.UserName) .Set(KcbLuotkham.Columns.Locked).EqualTo(objLuotkham.Locked) .Set(KcbLuotkham.Columns.NgayKetthuc).EqualTo(objLuotkham.NgayKetthuc) .Set(KcbLuotkham.Columns.TrangthaiNgoaitru).EqualTo(Utility.Int32Dbnull(objLuotkham.TrangthaiNgoaitru)) .Set(KcbLuotkham.Columns.LydoKetthuc).EqualTo("In phôi bảo hiểm") .Set(KcbLuotkham.Columns.IpMaysua).EqualTo(objPhieuDct.IpMaysua) .Set(KcbLuotkham.Columns.TenMaysua).EqualTo(objPhieuDct.TenMaysua) .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objPhieuDct.MaLuotkham) .And(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objPhieuDct.IdBenhnhan).Execute(); } else { new Update(KcbPhieuDct.Schema) .Set(KcbPhieuDct.Columns.TongTien).EqualTo(objPhieuDct.TongTien) .Set(KcbPhieuDct.Columns.BnhanChitra).EqualTo(objPhieuDct.BnhanChitra) .Set(KcbPhieuDct.Columns.BhytChitra).EqualTo(objPhieuDct.BhytChitra) .Set(KcbPhieuDct.Columns.NguoiSua).EqualTo(globalVariables.UserName) .Set(KcbPhieuDct.Columns.IpMaysua).EqualTo(objPhieuDct.IpMaysua) .Set(KcbPhieuDct.Columns.TenMaysua).EqualTo(objPhieuDct.TenMaysua) .Where(KcbPhieuDct.Columns.MaLuotkham).IsEqualTo(objPhieuDct.MaLuotkham) .And(KcbPhieuDct.Columns.IdBenhnhan).IsEqualTo(objPhieuDct.IdBenhnhan) .And(KcbPhieuDct.Columns.LoaiThanhtoan).IsEqualTo(Utility.Int32Dbnull(objPhieuDct.LoaiThanhtoan)) .Execute(); } } } scope.Complete(); return ActionResult.Success; } } catch (Exception exception) { log.Error("Loi trong qua trinh tra tien lai:{0}", exception.ToString()); return ActionResult.Error; } }
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 mDtReportPhieuThu = new KCB_THANHTOAN().NoiTruLaythongtinInphoiBHYT(-1, Utility.sDbnull(objLuotkham.MaLuotkham, ""), Utility.Int32Dbnull(objLuotkham.IdBenhnhan, -1), 0); THU_VIEN_CHUNG.CreateXML(mDtReportPhieuThu); //load thông tin của việc lấy dữ liệu vào datatable trong phiếu thanh toán) if (mDtReportPhieuThu.Rows.Count <= 0) { Utility.ShowMsg("Không tìm thấy dữ liệu để in phôi BHYT ", "Thông báo"); return(false); } string ICD_Name = ""; string ICD_Code = ""; if (mDtReportPhieuThu.Rows.Count > 0) { GetChanDoanPhu(Utility.sDbnull(mDtReportPhieuThu.Rows[0]["ma_benhphu"], ""), ref ICD_Name, ref ICD_Code); } //foreach (DataRow dr in m_dtReportPhieuThu.Rows) //{ // dr["chuan_doanphu"] = Utility.sDbnull(dr["chuan_doanphu"]).Trim() == "" // ? ICD_Name // : Utility.sDbnull(dr["chuan_doanphu"]) + ";" + ICD_Name; // //dr[DmucBenh.Columns.MaBenh] = ICD_Code; // // dr["ma_icd"] = ICD_Code; //} // foreach (DataRow drv in mDtReportPhieuThu.Rows) { drv["chuan_doanphu"] = Utility.sDbnull(drv["chuan_doanphu"]).Trim() == "" ? ICD_Name : Utility.sDbnull(drv["chuan_doanphu"]) + ";" + ICD_Name; 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 maLoaidichvu = Utility.sDbnull(drv["id_loaidichvu"], -1); //drv["id_loaidichvu"]-->Được xác định trong câu truy vấn var objService = (from p in globalVariables.gv_dtDmucChung.AsEnumerable() where p[DmucChung.Columns.Loai].Equals("LOAIDICHVUCLS") && p[DmucChung.Columns.Ma].Equals(maLoaidichvu) select p).FirstOrDefault(); // DmucChung objService = THU_VIEN_CHUNG.LaydoituongDmucChung("LOAIDICHVUCLS", maLoaidichvu); if (objService != null) { drv["ten_loaidichvu"] = Utility.sDbnull(objService["ten"].ToString()); drv["STT"] = Utility.sDbnull(objService["stt_hthi"]); } } else if (drv[KcbThanhtoanChitiet.Columns.IdLoaithanhtoan].ToString() == "3" || drv[KcbThanhtoanChitiet.Columns.IdLoaithanhtoan].ToString() == "5") { int drugId = Utility.Int32Dbnull(drv["id_dichvu"], -1); var objDrug = (from p in globalVariables.gv_dtDanhMucThuoc.AsEnumerable() where p[DmucThuoc.Columns.IdThuoc].Equals(drugId) select p).FirstOrDefault(); var objLoaithuoc = (from p in globalVariables.gv_dtLoaiThuoc.AsEnumerable() where objDrug != null && p[DmucLoaithuoc.Columns.IdLoaithuoc].Equals(objDrug["id_loaithuoc"].ToString()) select p).FirstOrDefault(); //DmucThuoc objDrug = DmucThuoc.FetchByID(drugId); // DmucLoaithuoc objLoaithuoc = DmucLoaithuoc.FetchByID(objDrug.IdLoaithuoc); if (objLoaithuoc != null) { if (objDrug != null) { objDrug["kieu_thuocvattu"] = objLoaithuoc["kieu_thuocvattu"]; } } //LDrugType objLDrugType = LDrugType.FetchByID(objDrug.DrugTypeId); if (objDrug != null && objDrug["kieu_thuocvattu"].ToString() == "THUOC") { drv["id_loaidichvu"] = "THUOC"; drv["STT"] = 1; drv["ten_loaidichvu"] = "3.1 Trong danh mục BHYT"; } else { drv["id_loaidichvu"] = "VTTH"; drv["STT"] = 2; drv["ten_loaidichvu"] = "Vật tư tiêu hao"; } } if (drv[KcbThanhtoanChitiet.Columns.IdLoaithanhtoan].ToString() == "9") { drv["id_loaidichvu"] = 1; drv["STT"] = 1; drv["ten_loaidichvu"] = "Chi phí thêm "; } } mDtReportPhieuThu.AcceptChanges(); new INPHIEU_THANHTOAN_NOITRU(objPhieuDct.NgayTao).INPHOI_BHYT( mDtReportPhieuThu, 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); } }