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); } } }