public bool IsBaohiem(TPatientExam objPatientExam) { LObjectType objObjectType = LObjectType.FetchByID(objPatientExam.ObjectTypeId); if (objObjectType.ObjectTypeType == 0) { return(true); } else { return(false); } }
/// <summary> /// hàm thục hiện tính toán thông tin /// </summary> /// <param name="v_decTotalPrice"></param> /// <param name="objPatientExam"></param> /// <param name="PtramBHYT"></param> /// <returns></returns> public decimal LayThongPtramBHYT(decimal v_decTotalPrice, TPatientExam objPatientExam, ref decimal PtramBHYT) { decimal decDiscountTotalMoney = 0; SqlQuery q; if (!string.IsNullOrEmpty(objPatientExam.InsClinicCode) && IsBaohiem(objPatientExam)) { ///thực hiện xem có đúng tuyến không if (objPatientExam.CorrectLine == 1) { if (objPatientExam.InsObjectCodeNumber.ToString() == "1" || objPatientExam.InsObjectCodeNumber.ToString() == "2") { decDiscountTotalMoney = 0; PtramBHYT = 100; log.Info("Benh nhan tuong ung voi muc =" + objPatientExam.InsObjectCodeNumber); } else { switch (globalVariables.gv_BenhVienTuyen) { case "TUYEN1": if (v_decTotalPrice >= objPatientExam.SalaryBasic * 15 / 100) { log.Info(string.Format("Neu ma benh nhan lon hon muc luong co ban={0} thi bat dau tinh gia", BusinessHelper.GetLuongCoBan())); q = new Select().From(LInsuranceObject.Schema) .Where(LInsuranceObject.Columns.ObjectTypeId).IsEqualTo(objPatientExam.ObjectTypeId) .And(LInsuranceObject.Columns.InsObjectCode).IsEqualTo(objPatientExam.InsObjectCode); LInsuranceObject objInsuranceObject = q.ExecuteSingle <LInsuranceObject>(); if (objInsuranceObject != null) { PtramBHYT = Utility.DecimaltoDbnull(objInsuranceObject.Percent, 0); decDiscountTotalMoney = v_decTotalPrice * (100 - Utility.DecimaltoDbnull(objInsuranceObject.Percent, 0)) / 100; log.Info("bat dau chi khau theo doi tuong muc tien =" + decDiscountTotalMoney + " cua benh nhan co ma Patient_Code=" + objPatientExam.PatientCode); } } else { PtramBHYT = 100; decDiscountTotalMoney = 0; log.Info("Benh nhan dc mien phi hoan toan, voi muc chiet khau =0 tuong ung voi Patient_Code=" + objPatientExam.PatientCode); } break; case "TW": log.Info("Lấy thông tin của tuyến trung ương"); log.Info(string.Format("Neu ma benh nhan lon hon muc luong co ban={0} thi bat dau tinh gia", BusinessHelper.GetLuongCoBan())); q = new Select().From(LInsuranceObject.Schema) .Where(LInsuranceObject.Columns.ObjectTypeId).IsEqualTo(objPatientExam.ObjectTypeId) .And(LInsuranceObject.Columns.InsObjectCode).IsEqualTo(objPatientExam.InsObjectCode); LInsuranceObject objInsuranceObjectTW = q.ExecuteSingle <LInsuranceObject>(); if (objInsuranceObjectTW != null) { PtramBHYT = Utility.DecimaltoDbnull(objInsuranceObjectTW.Percent, 0); decDiscountTotalMoney = v_decTotalPrice * (100 - Utility.DecimaltoDbnull(objInsuranceObjectTW.Percent, 0)) / 100; log.Info("bat dau chi khau theo doi tuong muc tien =" + decDiscountTotalMoney + " cua benh nhan co ma Patient_Code=" + objPatientExam.PatientCode); } break; default: if (v_decTotalPrice >= objPatientExam.SalaryBasic * 15 / 100) { log.Info(string.Format("Neu ma benh nhan lon hon muc luong co ban={0} thi bat dau tinh gia", BusinessHelper.GetLuongCoBan())); q = new Select().From(LInsuranceObject.Schema) .Where(LInsuranceObject.Columns.ObjectTypeId).IsEqualTo(objPatientExam.ObjectTypeId) .And(LInsuranceObject.Columns.InsObjectCode).IsEqualTo(objPatientExam.InsObjectCode); LInsuranceObject objInsuranceObject = q.ExecuteSingle <LInsuranceObject>(); if (objInsuranceObject != null) { PtramBHYT = Utility.DecimaltoDbnull(objInsuranceObject.Percent, 0); decDiscountTotalMoney = v_decTotalPrice * (100 - Utility.DecimaltoDbnull(objInsuranceObject.Percent, 0)) / 100; log.Info("bat dau chi khau theo doi tuong muc tien =" + decDiscountTotalMoney + " cua benh nhan co ma Patient_Code=" + objPatientExam.PatientCode); } } else { PtramBHYT = 100; decDiscountTotalMoney = 0; log.Info("Benh nhan dc mien phi hoan toan, voi muc chiet khau =0 tuong ung voi Patient_Code=" + objPatientExam.PatientCode); } break; } } } else { ///Nếu là đối tượng trái tuyến thực hiện lấy % của trái tuyến LObjectType objObjectType = LObjectType.FetchByID(objPatientExam.ObjectTypeId); if (objObjectType != null) { decDiscountTotalMoney = v_decTotalPrice * (100 - Utility.DecimaltoDbnull(objObjectType.DiscountDiscorrectLine)) / 100; PtramBHYT = Utility.DecimaltoDbnull(objObjectType.DiscountDiscorrectLine, 0); } } } else { LObjectType objObjectType = LObjectType.FetchByID(objPatientExam.ObjectTypeId); if (objObjectType != null) { decDiscountTotalMoney = v_decTotalPrice * (100 - Utility.Int32Dbnull(objObjectType.DiscountCorrectLine, 0)) / 100; } ; PtramBHYT = Utility.DecimaltoDbnull(objObjectType.DiscountCorrectLine, 0); } return(decDiscountTotalMoney); }
private void GetData() { string ReasonBy = ""; string sAccountName = THU_VIEN_CHUNG.LayMaDviLamViec(); LayThongTinPaymentDetail(sAccountName); //grdPaymentDetail.DataSource = m_dtPaymentDetail; SqlQuery sqlQuery = new Select().From(TPhieuthu.Schema) .Where(TPhieuthu.Columns.PaymentId).IsEqualTo(Utility.Int32Dbnull(txtPayment_ID.Text)).And( TPhieuthu.Columns.LoaiPhieu).IsEqualTo(status); if (sqlQuery.GetRecordCount() <= 0) { TPayment objPayment = TPayment.FetchByID(Utility.Int32Dbnull(txtPayment_ID.Text, -1)); if (objPayment != null) { dtCreateDate.Value = Convert.ToDateTime(objPayment.PaymentDate); txtPayment_ID.Text = Utility.sDbnull(objPayment.PaymentId, "-1"); txtMA_PTHU.Text = BusinessHelper.GetMaPhieuThu(dtCreateDate.Value, 0); Janus.Windows.GridEX.GridEXColumn gridExColumn = grdPaymentDetail.RootTable.Columns["TONG"]; txtSO_TIEN.Text = Utility.sDbnull(grdPaymentDetail.GetTotal(gridExColumn, Janus.Windows.GridEX.AggregateFunction.Sum)); txtSLUONG_CTU_GOC.Text = "1"; TPatientInfo objPatientInfo = TPatientInfo.FetchByID(objPayment.PatientId); if (objPatientInfo != null) { txtNGUOI_NOP.Text = objPatientInfo.PatientName; label9.Text = "Người nhận"; } if (status == 0) { switch (sAccountName) { case "YHOCHAIQUAN": ReasonBy = BusinessHelper.GetLyDo_PhieuThu(m_dtPaymentDetail); txtLDO_NOP.Text = ReasonBy; break; case "KYDONG": ReasonBy = BusinessHelper.GetLyDo_PhieuThu(m_dtPaymentDetail); txtLDO_NOP.Text = ReasonBy; break; case "DETMAY": LObjectType objectType = LObjectType.FetchByID(v_ObjectType_Id); if (objectType.ObjectTypeType == 0) { txtLDO_NOP.Text = string.Format("Bệnh nhân cùng chi trả :{0} %", (100 - v_DiscountRate)); } else { ReasonBy = BusinessHelper.GetLyDo_PhieuThu(m_dtPaymentDetail); txtLDO_NOP.Text = ReasonBy; } break; default: ReasonBy = BusinessHelper.GetLyDo_PhieuThu(m_dtPaymentDetail); txtLDO_NOP.Text = ReasonBy; break; } } if (status == 1) { ReasonBy = "Trả lại tiền cho bệnh nhân"; txtLDO_NOP.Text = ReasonBy; } } } else { var objPhieuthu = sqlQuery.ExecuteSingle <TPhieuthu>(); if (objPhieuthu != null) { txtSLUONG_CTU_GOC.Text = Utility.sDbnull(objPhieuthu.SluongCtuGoc, 1); txtMA_PTHU.Text = Utility.sDbnull(objPhieuthu.MaPthu, ""); txtNGUOI_NOP.Text = Utility.sDbnull(objPhieuthu.NguoiNop); txtSO_TIEN.Text = Utility.sDbnull(objPhieuthu.SoTien); txtTKHOAN_CO.Text = Utility.sDbnull(objPhieuthu.TkhoanCo, ""); txtTKHOAN_NO.Text = Utility.sDbnull(objPhieuthu.TkhoanNo, ""); txtLDO_NOP.Text = objPhieuthu.LdoNop; dtCreateDate.Value = Convert.ToDateTime(objPhieuthu.NgayThien); } } }