// ----------------------------------------------------------------------------------------------------------- public void cargarDatos() { RisEstudio oEstudio = new RisEstudio(int.Parse(Request["idEstudio"].ToString().Trim())); Label1.Text = "<strong>Nro. de inscripcion: </strong>" + oEstudio.NroOrden.ToString() + "." + oEstudio.Enmienda.ToString() + "." + oEstudio.Anio.ToString(); // Investigadores DataTable dtInvestigadores = new DataTable(); dtInvestigadores = SPs.RisCargarListaInvestigadores(int.Parse(Request["idEstudio"].ToString().Trim())).GetDataSet().Tables[0]; gvListaInvestigadores.DataSource = dtInvestigadores; gvListaInvestigadores.DataBind(); Label5.Text = "<strong>Título de la investigación: </strong>" + oEstudio.TituloInvestigacion.ToString(); Label6.Text = "<strong>Nro. de registro nacional: </strong>" + oEstudio.NroRegistroNacional.ToString(); Label7.Text = "<strong>Tipo de estudio: </strong>" + oEstudio.TipoEstudio.ToString(); Label8.Text = "<strong>Nro. de expediente: </strong>" + oEstudio.NroExpediente.ToString(); Label9.Text = "<strong>Nombre abreviado: </strong>" + oEstudio.NombreAbreviado.ToString(); Label10.Text = "<strong>Drogas en estudio: </strong>" + oEstudio.Drogas.ToString(); // Entidad DataTable dtEntidad = new DataTable(); dtEntidad = SPs.RisCargarListaEntidades(int.Parse(Request["idEstudio"].ToString().Trim())).GetDataSet().Tables[0]; gvListaEntidad.DataSource = dtEntidad; gvListaEntidad.DataBind(); // Consentimientos DataTable dtConsentimientos = new DataTable(); dtConsentimientos = SPs.RisCargarListaConcentimientos(int.Parse(Request["idEstudio"].ToString().Trim())).GetDataSet().Tables[0]; gvListaConsentimiento.DataSource = dtConsentimientos; gvListaConsentimiento.DataBind(); // Enmiendas DataTable dtEnmiendas = new DataTable(); dtEnmiendas = SPs.RisCargarListaEnmiendas(int.Parse(Request["idEstudio"].ToString().Trim())).GetDataSet().Tables[0]; gvListaEnmiendas.DataSource = dtEnmiendas; gvListaEnmiendas.DataBind(); // Institución de referencia Label14.Text = "<strong>Nombre: </strong>" + oEstudio.NombreIntitucionAfiliacion.ToString(); Label15.Text = "<strong>Referente: </strong>" + oEstudio.ReferenteInstitucionAfiliacion.ToString(); Label16.Text = "<strong>Teléfono: </strong>" + oEstudio.TelefonoInstitucionAfiliacion.ToString(); Label17.Text = "<strong>Domicilio: </strong>" + oEstudio.DomicilioInstitucionAfiliacion.ToString(); Label18.Text = "<strong>E-mail: </strong>" + oEstudio.EmailInstitucionAfiliacion.ToString(); // Area temática Label20.Text = oEstudio.IdAreaTematica.ToString(); // Tamaño de la muestra Label22.Text = oEstudio.TamanioMuestra.ToString().Trim(); // Duración (tiempo estimado desde el inicio) Label24.Text = "Años: " + oEstudio.TiempoEstimadoAnios.ToString(); Label25.Text = "Meses: " + oEstudio.TiempoEstimadoMeses.ToString(); // Lugares de realización DataTable dtLugaresDeRealizacion = new DataTable(); dtLugaresDeRealizacion = SPs.RisCargarListaLugaresRealizacion(int.Parse(Request["idEstudio"].ToString().Trim())).GetDataSet().Tables[0]; gvListaLugaresDeRealizacion.DataSource = dtLugaresDeRealizacion; gvListaLugaresDeRealizacion.DataBind(); // Seguro de daños DataTable dtSeguroDanios = new DataTable(); dtSeguroDanios = SPs.RisCargarListaAseguradoras(int.Parse(Request["idEstudio"].ToString().Trim())).GetDataSet().Tables[0]; gvListaAseguradora.DataSource = dtSeguroDanios; gvListaAseguradora.DataBind(); // Comité de ética DataTable dtComiteEtica = new DataTable(); dtComiteEtica = SPs.RisCargarListaComiteEtica(int.Parse(Request["idEstudio"].ToString().Trim())).GetDataSet().Tables[0]; gvListaComiteEtica.DataSource = dtComiteEtica; gvListaComiteEtica.DataBind(); // Informe de la comisión de investigaciones biomédicas en seres humanos (CAIBSH) // Aprobado Label30.Text = "<strong>Fecha Aprobado: </strong>" + oEstudio.FechaAprobadoCAIBSH.ToString(); DataTable dtListaInformeAprobado = new DataTable(); dtListaInformeAprobado = SPs.RisCargarListaInformeAprobado(int.Parse(Request["idEstudio"].ToString().Trim())).GetDataSet().Tables[0]; gvListaInformeAprobado.DataSource = dtListaInformeAprobado; gvListaInformeAprobado.DataBind(); // Rechazado Label31.Text = "<strong>Fecha Rechazado: </strong>" + oEstudio.FechaRechazadoCAIBSH.ToString(); cargarItemsDesaprobadosCAIBSH(); // Observaciones Label34.Text = "<strong>Observaciones: </strong>" + oEstudio.ObservacionesCAIBSH; }
public static DataTable ThuocBaocaotinhhinhkedonthuocTheobacsy(int?IDKHOXUAT, int?iddoituong, string mabschidinh, int?idThuoc, DateTime?FromDate, DateTime?ToDate) { return(SPs.ThuocBaocaotinhhinhkedonthuocTheobacsy(IDKHOXUAT, iddoituong, mabschidinh, idThuoc, FromDate, ToDate).GetDataSet().Tables[0]); }
public static DataTable ThuocBaocaosoluongtonthuoctheokho(string IDKHOLIST, int?IDTHUOC, short?HETHAN) { return(SPs.ThuocBaocaosoluongtonthuoctheokho(IDKHOLIST, IDTHUOC, HETHAN).GetDataSet().Tables[0]); }
public static DataTable getDepartGv(string strDepart) { return(SPs.DepartGvOfTool_Sp(strDepart).GetDataSet().Tables[0]); }
public static DataTable ThuocBaocaotinhhinhBenhnhanlinhthuoc(DateTime?FromDate, DateTime?ToDate, int?IDKHOXUAT, int?iddoituong) { return(SPs.ThuocBaocaotinhhinhBenhnhanlinhthuoc(FromDate, ToDate, IDKHOXUAT, iddoituong).GetDataSet().Tables[0]); }
static PreloadedLists() { try { TestGroupRelation = new Select(TTestgroupList.Schema.Name + ".*", TTestgroupDtl.Columns.TestDataId).From(TTestgroupList.Schema.Name). LeftOuterJoin(TTestgroupDtl.TestGroupIdColumn, TTestgroupList.TestGroupIdColumn). ExecuteDataSet().Tables[0]; TestGroupList = new Select().From(TTestgroupList.Schema.Name).OrderAsc(TTestgroupList.Columns.TestGroupOrder).ExecuteDataSet().Tables[0]; } catch (Exception) { } try { StandardTest = new Select().From(LStandardTest.Schema.Name).Where(LStandardTest.Columns.DataView). IsEqualTo(true).OrderAsc(LStandardTest.Columns.DataSequence).ExecuteDataSet().Tables[0]; } catch (Exception) { } try { UserControlRelation = new Select("*").From(LUserFormControl.Schema.Name).LeftOuterJoin(LFormControl.ControlIdColumn, LUserFormControl.ControlIdColumn). ExecuteDataSet().Tables[0]; } catch { } try { FormControl = new Select().From(LFormControl.Schema.Name).ExecuteDataSet().Tables[0]; } catch { } try { AssemblyReport = new Select().From(LAssemblyReport.Schema.Name).ExecuteDataSet().Tables[0]; } catch { } try { var myDataSet = SPs.SpGetPreloadedLists().GetDataSet(); TestType = myDataSet.Tables[0]; DataControl = myDataSet.Tables[1]; Device = myDataSet.Tables[2]; } catch { } }
/// <summary> /// hàm thực hiện việc xác nhận thông tin /// </summary> /// <param name="objPhieuNhap"></param> /// <returns></returns> public ActionResult HuyXacNhanPhieuXuatKho(TPhieuNhapxuatthuoc objPhieuNhap, ref string errMsg) { HisDuocProperties objHisDuocProperties = PropertyLib._HisDuocProperties; string errorMessage = ""; try { using (var Scope = new TransactionScope()) { using (var dbScope = new SharedDbConnectionScope()) { SqlQuery sqlQuery = new Select().From(TPhieuNhapxuatthuocChitiet.Schema) .Where(TPhieuNhapxuatthuocChitiet.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu); TPhieuNhapxuatthuocChitietCollection objPhieuNhapCtCollection = sqlQuery.ExecuteAsCollection <TPhieuNhapxuatthuocChitietCollection>(); foreach (TPhieuNhapxuatthuocChitiet objPhieuNhapCt in objPhieuNhapCtCollection) { //Kiểm tra ở kho nhập xem thuốc đã sử dụng chưa ActionResult _Kiemtrathuochuyxacnhan = Kiemtrathuochuyxacnhan(objPhieuNhap, objPhieuNhapCt, ref errMsg); if (_Kiemtrathuochuyxacnhan != ActionResult.Success) { return(_Kiemtrathuochuyxacnhan); } //Xóa biến động kho nhập new Delete().From(TBiendongThuoc.Schema) .Where(TBiendongThuoc.IdPhieuColumn).IsEqualTo(objPhieuNhap.IdPhieu) .And(TBiendongThuoc.IdPhieuChitietColumn).IsEqualTo(objPhieuNhapCt.IdPhieuchitiet) .And(TBiendongThuoc.MaLoaiphieuColumn).IsEqualTo((byte)LoaiPhieu.PhieuNhapKho).Execute(); //Xóa biến động kho xuất new Delete().From(TBiendongThuoc.Schema) .Where(TBiendongThuoc.IdPhieuColumn).IsEqualTo(objPhieuNhap.IdPhieu) .And(TBiendongThuoc.IdPhieuChitietColumn).IsEqualTo(objPhieuNhapCt.IdPhieuchitiet) .And(TBiendongThuoc.MaLoaiphieuColumn).IsEqualTo((byte)LoaiPhieu.PhieuXuatkhoTuyenXaHuyen).Execute(); long id_Thuockho_new = -1; new Update(TPhieuNhapxuatthuocChitiet.Schema).Set(TPhieuNhapxuatthuocChitiet.Columns.IdThuockho).EqualTo(-1) .Where(TPhieuNhapxuatthuocChitiet.Columns.IdPhieuchitiet).IsEqualTo(objPhieuNhapCt.IdPhieuchitiet).Execute(); StoredProcedure sp = SPs.ThuocNhapkhoOutput(objPhieuNhapCt.NgayHethan, objPhieuNhapCt.GiaNhap, objPhieuNhapCt.GiaBan, objPhieuNhapCt.SoLuong, Utility.DecimaltoDbnull(objPhieuNhapCt.Vat), objPhieuNhapCt.IdThuoc, objPhieuNhap.IdKhoxuat, objPhieuNhapCt.MaNhacungcap, objPhieuNhapCt.SoLo, objPhieuNhapCt.SoDky, objPhieuNhapCt.SoQdinhthau, objPhieuNhapCt.IdThuockho.Value, id_Thuockho_new, objPhieuNhapCt.NgayNhap, objPhieuNhapCt.GiaBhyt, objPhieuNhapCt.GiaPhuthuDungtuyen, objPhieuNhapCt.GiaPhuthuTraituyen, objPhieuNhapCt.KieuThuocvattu); sp.Execute(); sp = SPs.ThuocXuatkho(objPhieuNhap.IdKhonhap, objPhieuNhapCt.IdThuoc, objPhieuNhapCt.NgayHethan, objPhieuNhapCt.GiaNhap, objPhieuNhapCt.GiaBan, Utility.DecimaltoDbnull(objPhieuNhapCt.Vat), Utility.Int32Dbnull(objPhieuNhapCt.SoLuong), objPhieuNhapCt.IdThuockho, objPhieuNhapCt.MaNhacungcap, objPhieuNhapCt.SoLo, objHisDuocProperties.XoaDulieuKhiThuocDaHet ? 1 : 0, errorMessage); sp.Execute(); } new Update(TPhieuNhapxuatthuoc.Schema) .Set(TPhieuNhapxuatthuoc.Columns.IdNhanvien).EqualTo(null) .Set(TPhieuNhapxuatthuoc.Columns.NguoiXacnhan).EqualTo(null) .Set(TPhieuNhapxuatthuoc.Columns.NgayXacnhan).EqualTo(null) .Set(TPhieuNhapxuatthuoc.Columns.TrangThai).EqualTo(0) .Where(TPhieuNhapxuatthuoc.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu) .And(TPhieuNhapxuatthuoc.LoaiPhieuColumn).IsEqualTo(objPhieuNhap.LoaiPhieu).Execute(); } Scope.Complete(); return(ActionResult.Success); } } catch (Exception ex) { Utility.CatchException("Lỗi khi hủy xác nhận phiếu chuyển kho", ex); return(ActionResult.Error); } }
public void NoitruXoaDinhduong(string lstIdChandoan) { SPs.NoitruXoaDinhduong(lstIdChandoan).Execute(); }
public ActionResult CapnhatDonthuoc(KcbLuotkham objLuotkham, KcbDonthuoc objDonthuoc, KcbDonthuocChitiet[] arrDonthuocChitiet, KcbChandoanKetluan _KcbChandoanKetluan, ref long p_intIdDonthuoc, ref Dictionary <long, long> lstChitietDonthuoc) { try { using (TransactionScope scope = new TransactionScope()) { using (SharedDbConnectionScope sh = new SharedDbConnectionScope()) { log.Trace("4. Bat dau cap nhat don thuoc"); p_intIdDonthuoc = objDonthuoc.IdDonthuoc; SPs.SpKcbCapnhatDonthuoc(objDonthuoc.IdDonthuoc, globalVariables.UserName, globalVariables.SysDate, objDonthuoc.LoidanBacsi, objDonthuoc.NgayTaikham, objDonthuoc.TaiKham, objDonthuoc.IpMaysua, objDonthuoc.TenMaysua).Execute(); log.Trace("4.1 Da cap nhat don thuoc"); if (Utility.Int32Dbnull(objDonthuoc.IdKham) > 0) { SPs.SpKcbCapnhatBacsiKham(objDonthuoc.IdKham, objDonthuoc.IdBacsiChidinh, 0).Execute(); log.Trace("4.2 Da cap nhat BS kham=BS ke don"); } decimal PtramBH = Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0); foreach (KcbDonthuocChitiet objDonthuocChitiet in arrDonthuocChitiet) { objDonthuocChitiet.IdDonthuoc = objDonthuoc.IdDonthuoc; } if (objLuotkham.TrangthaiNoitru <= 0) { CapnhatChandoan(_KcbChandoanKetluan); } log.Trace("4.3 Da cap nhat thong tin chan doan ket luan"); foreach (KcbDonthuocChitiet objDonthuocChitiet in arrDonthuocChitiet) { if (objDonthuocChitiet.IdChitietdonthuoc == -1) { objDonthuocChitiet.IdKham = objDonthuoc.IdKham; objDonthuocChitiet.IsNew = true; objDonthuocChitiet.SluongLinh = 0; objDonthuocChitiet.SluongSua = 0; objDonthuocChitiet.TrangThai = 0; objDonthuocChitiet.IdThanhtoan = -1; objDonthuocChitiet.MaLuotkham = objDonthuoc.MaLuotkham; objDonthuocChitiet.IdBenhnhan = objDonthuoc.IdBenhnhan; objDonthuocChitiet.IdDonthuoc = objDonthuoc.IdDonthuoc; objDonthuocChitiet.CachDung = objDonthuocChitiet.MotaThem; ThemChitiet(objDonthuoc, objDonthuocChitiet, PtramBH, objLuotkham); if (!lstChitietDonthuoc.ContainsKey(objDonthuocChitiet.IdThuockho.Value)) { lstChitietDonthuoc.Add(objDonthuocChitiet.IdThuockho.Value, objDonthuocChitiet.IdChitietdonthuoc); } } else { if (!lstChitietDonthuoc.ContainsKey(objDonthuocChitiet.IdThuockho.Value)) { lstChitietDonthuoc.Add(objDonthuocChitiet.IdThuockho.Value, objDonthuocChitiet.IdChitietdonthuoc); } SPs.SpKcbCapnhatChitietDonthuoc(objDonthuocChitiet.IdChitietdonthuoc, objDonthuocChitiet.SoLuong, objDonthuocChitiet.NgaySua , objDonthuocChitiet.NguoiSua, objDonthuocChitiet.IpMaysua, objDonthuocChitiet.TenMaysua).Execute(); } } log.Trace("4.4 Da cap nhat xong chi tiet don thuoc"); } scope.Complete(); return(ActionResult.Success); } } catch (Exception exception) { log.Error(string.Format("Loi khi cap nhat don thuoc {0}", exception.Message)); return(ActionResult.Error); } }
public ActionResult CapnhatChandoan(KcbChandoanKetluan objKcbChandoanKetluan) { try { if (objKcbChandoanKetluan == null || objKcbChandoanKetluan.IdBenhnhan <= 0 || objKcbChandoanKetluan.IdKham <= 0) { return(ActionResult.Cancel); } using (TransactionScope scope = new TransactionScope()) { using (SharedDbConnectionScope sh = new SharedDbConnectionScope()) { SqlQuery sqlkt = new Select().From(KcbChandoanKetluan.Schema).Where(KcbChandoanKetluan.Columns.IdKham).IsEqualTo(objKcbChandoanKetluan.IdKham); if (objKcbChandoanKetluan.IsNew || sqlkt.GetRecordCount() <= 0) { var sp = SPs.SpKcbThemmoiChandoanKetluan(objKcbChandoanKetluan.IdChandoan, objKcbChandoanKetluan.IdKham, objKcbChandoanKetluan.IdBenhnhan, objKcbChandoanKetluan.MaLuotkham , objKcbChandoanKetluan.IdBacsikham, objKcbChandoanKetluan.NgayChandoan, objKcbChandoanKetluan.NguoiTao, objKcbChandoanKetluan.NgayTao, objKcbChandoanKetluan.IdKhoanoitru , objKcbChandoanKetluan.IdBuonggiuong, objKcbChandoanKetluan.IdBuong, objKcbChandoanKetluan.IdGiuong, objKcbChandoanKetluan.IdPhieudieutri , objKcbChandoanKetluan.Noitru, objKcbChandoanKetluan.IdPhongkham, objKcbChandoanKetluan.TenPhongkham, objKcbChandoanKetluan.Mach , objKcbChandoanKetluan.Nhietdo, objKcbChandoanKetluan.Huyetap, objKcbChandoanKetluan.Nhiptim, objKcbChandoanKetluan.Nhiptho, objKcbChandoanKetluan.Cannang , objKcbChandoanKetluan.Chieucao, objKcbChandoanKetluan.Nhommau, objKcbChandoanKetluan.Ketluan, objKcbChandoanKetluan.ChedoDinhduong, objKcbChandoanKetluan.HuongDieutri, objKcbChandoanKetluan.SongayDieutri , objKcbChandoanKetluan.TrieuchungBandau, objKcbChandoanKetluan.Chandoan, objKcbChandoanKetluan.ChandoanKemtheo, objKcbChandoanKetluan.MabenhChinh, objKcbChandoanKetluan.MabenhPhu, objKcbChandoanKetluan.MotaBenhchinh , objKcbChandoanKetluan.IpMaytao, objKcbChandoanKetluan.TenMaytao, objKcbChandoanKetluan.PhanungSautiemchung, objKcbChandoanKetluan.KPL1 , objKcbChandoanKetluan.KPL2, objKcbChandoanKetluan.KPL3, objKcbChandoanKetluan.KPL4, objKcbChandoanKetluan.KPL5, objKcbChandoanKetluan.KPL6 , objKcbChandoanKetluan.KPL7, objKcbChandoanKetluan.KPL8, objKcbChandoanKetluan.KL1, objKcbChandoanKetluan.KL2, objKcbChandoanKetluan.KL3 , objKcbChandoanKetluan.KetluanNguyennhan, objKcbChandoanKetluan.NhanXet, objKcbChandoanKetluan.ChongchidinhKhac, objKcbChandoanKetluan.SoNgayhen, objKcbChandoanKetluan.ChisoIbm, objKcbChandoanKetluan.ThilucMp, objKcbChandoanKetluan.ThilucMt, objKcbChandoanKetluan.NhanapMp, objKcbChandoanKetluan.NhanapMt); sp.Execute(); objKcbChandoanKetluan.IdChandoan = Utility.Int64Dbnull(sp.OutputValues[0]); } else { SPs.SpKcbCapnhatChandoanKetluan(objKcbChandoanKetluan.IdChandoan , objKcbChandoanKetluan.IdBacsikham, objKcbChandoanKetluan.NgayChandoan, objKcbChandoanKetluan.NguoiSua, objKcbChandoanKetluan.NgaySua, objKcbChandoanKetluan.IdPhieudieutri , objKcbChandoanKetluan.Noitru, objKcbChandoanKetluan.IdPhongkham, objKcbChandoanKetluan.TenPhongkham, objKcbChandoanKetluan.Mach , objKcbChandoanKetluan.Nhietdo, objKcbChandoanKetluan.Huyetap, objKcbChandoanKetluan.Nhiptim, objKcbChandoanKetluan.Nhiptho, objKcbChandoanKetluan.Cannang , objKcbChandoanKetluan.Chieucao, objKcbChandoanKetluan.Nhommau, objKcbChandoanKetluan.Ketluan, objKcbChandoanKetluan.ChedoDinhduong, objKcbChandoanKetluan.HuongDieutri, objKcbChandoanKetluan.SongayDieutri , objKcbChandoanKetluan.TrieuchungBandau, objKcbChandoanKetluan.Chandoan, objKcbChandoanKetluan.ChandoanKemtheo, objKcbChandoanKetluan.MabenhChinh, objKcbChandoanKetluan.MabenhPhu, objKcbChandoanKetluan.MotaBenhchinh , objKcbChandoanKetluan.IpMaytao, objKcbChandoanKetluan.TenMaytao, objKcbChandoanKetluan.PhanungSautiemchung, objKcbChandoanKetluan.KPL1 , objKcbChandoanKetluan.KPL2, objKcbChandoanKetluan.KPL3, objKcbChandoanKetluan.KPL4, objKcbChandoanKetluan.KPL5, objKcbChandoanKetluan.KPL6 , objKcbChandoanKetluan.KPL7, objKcbChandoanKetluan.KPL8, objKcbChandoanKetluan.KL1, objKcbChandoanKetluan.KL2, objKcbChandoanKetluan.KL3 , objKcbChandoanKetluan.KetluanNguyennhan, objKcbChandoanKetluan.NhanXet, objKcbChandoanKetluan.ChongchidinhKhac, objKcbChandoanKetluan.SoNgayhen, objKcbChandoanKetluan.ChisoIbm, objKcbChandoanKetluan.ThilucMp, objKcbChandoanKetluan.ThilucMt, objKcbChandoanKetluan.NhanapMp, objKcbChandoanKetluan.NhanapMt).Execute(); } DataTable dtData = SPs.SpKcbLaydulieuChandoanKetluanTheoluotkham(objKcbChandoanKetluan.IdBenhnhan, objKcbChandoanKetluan.MaLuotkham).GetDataSet().Tables[0]; var query = (from chandoan in dtData.AsEnumerable() let y = Utility.sDbnull(chandoan["Chandoan"]) where (y != "") select y).ToArray(); string cdchinh = string.Join(";", query); var querychandoanphu = (from chandoan in dtData.AsEnumerable() let y = Utility.sDbnull(chandoan["chandoan_kemtheo"]) where (y != "") select y).ToArray(); string cdphu = string.Join(";", querychandoanphu); var querybenhchinh = (from benhchinh in dtData.AsEnumerable() let y = Utility.sDbnull(benhchinh["mabenh_chinh"]) where (y != "") select y).ToArray(); string mabenhchinh = string.Join(";", querybenhchinh); var querybenhphu = (from benhphu in dtData.AsEnumerable() let y = Utility.sDbnull(benhphu["mabenh_phu"]) where (y != "") select y).ToArray(); string mabenhphu = string.Join(";", querybenhphu); SPs.SpKcbCapnhatMabenhChoLuotkham(objKcbChandoanKetluan.IdBenhnhan, objKcbChandoanKetluan.MaLuotkham, mabenhchinh, mabenhphu, cdchinh, globalVariables.SysDate, globalVariables.UserName).Execute(); } scope.Complete(); return(ActionResult.Success); } } catch (Exception exception) { log.Error("Loi trong qua trinh chuyen vien khoi noi tru {0}", exception); return(ActionResult.Error); } }
public ActionResult ThemDonThuoc(KcbLuotkham objLuotkham, KcbDonthuoc objDonthuoc, KcbDonthuocChitiet[] arrDonthuocChitiet, KcbChandoanKetluan _KcbChandoanKetluan, ref long p_intIdDonthuoc, ref Dictionary <long, long> lstChitietDonthuoc) { // Query _Query = KcbDonthuoc.CreateQuery(); try { using (TransactionScope scope = new TransactionScope()) { using (SharedDbConnectionScope sh = new SharedDbConnectionScope()) { if (objLuotkham != null) { log.Trace("4. Bat dau luu thuoc vao CSDL"); if (objDonthuoc.NgayKedon <= Convert.ToDateTime("01/01/1900")) { objDonthuoc.NgayKedon = globalVariables.SysDate; } objDonthuoc.IsNew = true; objDonthuoc.TenDonthuoc = THU_VIEN_CHUNG.TaoTenDonthuoc(objLuotkham.MaLuotkham, Utility.Int32Dbnull( objLuotkham.IdBenhnhan, -1)); var sp = SPs.SpKcbThemmoiDonthuoc(objDonthuoc.IdDonthuoc, objDonthuoc.IdPhieudieutri, objDonthuoc.IdKhoadieutri, objDonthuoc.IdDonthuocthaythe, objDonthuoc.IdKham , objDonthuoc.IdBenhnhan, objDonthuoc.MaLuotkham, objDonthuoc.NgayKedon, objDonthuoc.IdBacsiChidinh, objDonthuoc.TrangThai, objDonthuoc.TthaiTonghop , objDonthuoc.TrangthaiThanhtoan, objDonthuoc.NgayThanhtoan, objDonthuoc.IdGoi, objDonthuoc.TrongGoi, objDonthuoc.NguoiTao, objDonthuoc.NgayTao , objDonthuoc.MotaThem, objDonthuoc.TenDonthuoc, objDonthuoc.MaDoituongKcb, objDonthuoc.Noitru, objDonthuoc.KieuDonthuoc, objDonthuoc.IdPhongkham , objDonthuoc.IdBuongGiuong, objDonthuoc.IdBuongNoitru, objDonthuoc.IdGiuongNoitru, objDonthuoc.LoidanBacsi, objDonthuoc.NgayTaikham , objDonthuoc.TaiKham, objDonthuoc.MaKhoaThuchien, objDonthuoc.NgayCapphat, objDonthuoc.KieuThuocvattu, objDonthuoc.NgayChot , objDonthuoc.IdChot, objDonthuoc.NgayHuychot, objDonthuoc.NguoiHuychot, objDonthuoc.LydoHuychot, objDonthuoc.NgayHuyxacnhan, objDonthuoc.NguoiHuyxacnhan , objDonthuoc.LydoHuyxacnhan, objDonthuoc.NgayXacnhan, objDonthuoc.NguoiXacnhan, objDonthuoc.IdLichsuDoituongKcb, objDonthuoc.MatheBhyt , objDonthuoc.IpMaytao, objDonthuoc.TenMaytao, objDonthuoc.LastActionName); sp.Execute(); objDonthuoc.IdDonthuoc = Utility.Int64Dbnull(sp.OutputValues[0]); log.Trace("4.1 Da luu don thuoc CSDL"); SPs.SpKcbCapnhatBacsiKham(objDonthuoc.IdKham, objDonthuoc.IdBacsiChidinh, 0).Execute(); log.Trace("4.2 Cap nhat bac si kham = BS ke don"); if (!Utility.Byte2Bool(objDonthuoc.Noitru)) { CapnhatChandoan(_KcbChandoanKetluan); } log.Trace("4.3 Da luu chan doan ket luan"); p_intIdDonthuoc = objDonthuoc.IdDonthuoc; decimal PtramBH = Utility.DecimaltoDbnull(objLuotkham.PtramBhyt, 0); bool TUDONGDANHDAU_TRANGTHAISUDUNG = THU_VIEN_CHUNG.Laygiatrithamsohethong("KCB_TIEMCHUNG_TUDONGDANHDAU_TRANGTHAISUDUNG", "0", false) == "1"; foreach (KcbDonthuocChitiet objDonthuocChitiet in arrDonthuocChitiet) { objDonthuocChitiet.IdKham = objDonthuoc.IdKham; objDonthuocChitiet.MaLuotkham = objDonthuoc.MaLuotkham; objDonthuocChitiet.IdBenhnhan = objDonthuoc.IdBenhnhan; objDonthuocChitiet.IdDonthuoc = objDonthuoc.IdDonthuoc; objDonthuocChitiet.NgaySudung = objDonthuoc.NgayKedon; objDonthuocChitiet.DaDung = Utility.Bool2byte(TUDONGDANHDAU_TRANGTHAISUDUNG); ThemChitiet(objDonthuoc, objDonthuocChitiet, PtramBH, objLuotkham); if (!lstChitietDonthuoc.ContainsKey(objDonthuocChitiet.IdThuockho.Value)) { lstChitietDonthuoc.Add(objDonthuocChitiet.IdThuockho.Value, objDonthuocChitiet.IdChitietdonthuoc); } } log.Trace("4.4 Da luu xong chi tiet don thuoc"); } } scope.Complete(); return(ActionResult.Success); } } catch (Exception exception) { log.Error("Loi trong qua trinh luu don thuoc {0}", exception); return(ActionResult.Error); } }
public DataTable LaythongtinchitietdonthuocDeSaoChep(long id_donthuoc) { return(SPs.DonthuocLaythongtinDeSaoChep(id_donthuoc).GetDataSet().Tables[0]); }
private void cargarCombos() { ddlParentesco.DataSource = SPs.SysParentescoTb().GetDataSet().Tables[0]; ddlParentesco.DataBind(); }
private void StartAnalysisFile(string fullpath) { MyLog.Trace(string.Format("------------------Begin Analysing file {0}------------------", fullpath)); var lstLines = new List <string>(); try { if (Utility.Laygiatrithamsohethong("ASTM_SECURITY", "0", false) == "1") { //using (new NetworkConnection(_watcherPathInfo, Utility.CreateCredentials(Utility.Laygiatrithamsohethong("ASTM_UID", "UserName", false), Utility.Laygiatrithamsohethong("ASTM_PWD", "PassWord", false)))) var theNetworkCredential = new NetworkCredential(Utility.Laygiatrithamsohethong("ASTM_UID", "UserName", false), Utility.Laygiatrithamsohethong("ASTM_PWD", "PassWord", false)); var theNetcache = new CredentialCache(); theNetcache.Add(new Uri(Path.GetDirectoryName(fullpath)), "Basic", theNetworkCredential); } using ( new NetworkConnection(Path.GetDirectoryName(fullpath), Utility.CreateCredentials(Utility.Laygiatrithamsohethong("ASTM_UID", "UserName", false), Utility.Laygiatrithamsohethong("ASTM_PWD", "PassWord", false)))) { using (var _reader = new StreamReader(fullpath)) { while (_reader.Peek() > -1) { lstLines.Add(_reader.ReadLine()); } _reader.BaseStream.Flush(); _reader.Close(); } MyLog.Trace(string.Format("Read All lines")); IEnumerable <string> patientinfor = from p in lstLines.AsEnumerable() where p.StartsWith("P") select p; IEnumerable <string> Orderinfor = from p in lstLines.AsEnumerable() where p.StartsWith("O") select p; var lstmachidinh = new List <string>(); foreach (string line in lstLines) { if (line.StartsWith("O")) //Chỉ định { if (!lstmachidinh.Contains(line.Split('|')[2])) { lstmachidinh.Add(line.Split('|')[2]); } } } bool isOK = false; if (patientinfor.Any() && Orderinfor.Any()) { MyLog.Trace(string.Format("File format is valid")); MyLog.Trace(string.Format("Number of AssignCode {0}", lstmachidinh.Count)); var lstKq = new KcbKetquaClCollection(); MyLog.Trace(string.Format("GetData base on PID {0} and AssignCode List {1} ", patientinfor.FirstOrDefault().Split('|')[2], string.Join(",", lstmachidinh.ToArray()))); DataTable dtData = SPs.HisLisLaydulieuCapnhatketquatuLis(patientinfor.FirstOrDefault().Split('|')[2], string.Join(",", lstmachidinh.ToArray())).GetDataSet().Tables[0]; if (dtData != null && dtData.Rows.Count > 0) { using (var scope = new TransactionScope()) { using (var dbscope = new SharedDbConnectionScope()) { MyLog.Trace(string.Format("Number of DataRow:={0}", dtData.Rows.Count)); string ma_chidinh = ""; int idx = 0; foreach (string line in lstLines) { if (line.StartsWith("O")) //Order { ma_chidinh = line.Split('|')[2]; } if (line.StartsWith("R")) //Result { idx++; MyLog.Trace(string.Format("Begin Analysing Line {0}...", idx)); string[] arrValues = line.Split('|'); string ma_xetnghiem = arrValues[2].Replace("^", ""); string ketqua = arrValues[3]; string dvt = arrValues[4]; string ngaytraketqua = arrValues[12]; MyLog.Trace( string.Format( "Line Data-->ma_chidinh={0} ma_xetnghiem={1}, ketqua={2}, DVT={3},ngaytraketqua={4} ", ma_chidinh, ma_xetnghiem, ketqua, dvt, ngaytraketqua)); DataRow[] arrCt = dtData.Select("ma_xetnghiem='" + ma_xetnghiem + "' AND ma_chidinh='" + ma_chidinh + "'"); if (arrCt.Length > 0) { MyLog.Trace( string.Format( "Row Data-->ma_chidinh={0} ma_xetnghiem={1}, id_chidinh={2}, id_chitietchidinh={3},id_chitietdichvu={4} ", arrCt[0]["ma_chidinh"], arrCt[0]["ma_xetnghiem"], arrCt[0]["id_chidinh"], arrCt[0]["id_chitietchidinh"], arrCt[0]["id_chitietdichvu"])); //Nếu không có chi tiết thì update vào cả bảng chỉ định cận lâm sàng chi tiết KcbChidinhclsChitiet objChitiet = KcbChidinhclsChitiet.FetchByID( Utility.Int64Dbnull(arrCt[0]["id_chitietchidinh"])); if (objChitiet != null) { if ( !Utility.Byte2Bool(Utility.ByteDbnull(arrCt[0]["co_chitiet"], 0))) { objChitiet.KetQua = ketqua; } objChitiet.IsNew = false; objChitiet.TrangThai = 4; objChitiet.MarkOld(); objChitiet.Save(); } var kq = new KcbKetquaCl(); kq = new Select().From(KcbKetquaCl.Schema) .Where(KcbKetquaCl.Columns.IdChidinh) .IsEqualTo(Utility.Int64Dbnull(arrCt[0]["id_chidinh"])) .And(KcbKetquaCl.Columns.IdChitietchidinh) .IsEqualTo(Utility.Int64Dbnull(arrCt[0]["id_chitietchidinh"])) .And(KcbKetquaCl.Columns.IdDichvuchitiet) .IsEqualTo(Utility.Int64Dbnull(arrCt[0]["id_chitietdichvu"])) .ExecuteSingle <KcbKetquaCl>(); if (kq == null) { MyLog.Trace( string.Format("ma_xetnghiem={0}-->insert into KcbKetquaCl", ma_xetnghiem)); kq = new KcbKetquaCl(); kq.IsNew = true; } else { MyLog.Trace( string.Format("ma_xetnghiem={0}-->updated from KcbKetquaCl", ma_xetnghiem)); kq.IsNew = false; kq.MarkOld(); } DmucDichvuclsChitiet objDvuchitiet = DmucDichvuclsChitiet.FetchByID( Utility.Int64Dbnull(arrCt[0]["id_chitietdichvu"])); if (objDvuchitiet != null) { kq.TenThongso = objDvuchitiet.TenChitietdichvu; } kq.IdChidinh = Utility.Int64Dbnull(arrCt[0]["id_chidinh"]); kq.IdChitietchidinh = Utility.Int64Dbnull(arrCt[0]["id_chitietchidinh"]); kq.IdDichvu = Utility.Int32Dbnull(arrCt[0]["id_dichvu"]); kq.IdDichvuchitiet = Utility.Int32Dbnull(arrCt[0]["id_chitietdichvu"]); kq.IdBenhnhan = Utility.Int64Dbnull(arrCt[0]["id_benhnhan"]); kq.MaLuotkham = Utility.sDbnull(arrCt[0]["ma_luotkham"]); kq.MaChidinh = Utility.sDbnull(arrCt[0]["ma_chidinh"]); kq.MaBenhpham = Utility.sDbnull(arrCt[0]["ma_chidinh"]); kq.IdLab = -1; kq.IdChitietLab = -1; kq.Barcode = ""; kq.SttIn = 0; kq.KetQua = ketqua; kq.BtNam = ""; kq.BtNu = ""; kq.TenDonvitinh = ""; kq.TenThongso = ""; kq.TenKq = ""; kq.LoaiKq = 0; kq.ChophepHienthi = 1; kq.ChophepIn = 1; kq.MotaThem = ""; kq.NguoiTao = "WIN_SERVICE"; kq.NgayTao = DateTime.Now; kq.NguoiSua = "WIN_SERVICE"; kq.NgaySua = DateTime.Now; kq.TrangThai = 4; kq.NgayXacnhan = DateTime.Now; kq.NguoiXacnhan = "WIN_SERVICE"; kq.NguoiXacnhan = "WIN_SERVICE"; kq.Save(); //lstKq.Add(kq); } else { isOK = false; MyLog.Error( string.Format( "No data found with ma_xetnghiem={0}.Please check again", ma_xetnghiem)); } } } //lstKq.SaveAll(); isOK = true; } scope.Complete(); } } else { isOK = false; MyLog.Error(string.Format("Could not get Data from HIS with PID {0} and AssignCode {1}", patientinfor.FirstOrDefault().Split('|')[3], string.Join(",", lstmachidinh.ToArray()))); } } else //Invalid file structure { isOK = false; MyLog.Error( string.Format( "FileFormat is not valid(No Patient or Order tags found in this file). Pls check result file again!")); } if (isOK) { string newDestinationFolder = Utility.FixedFolder(Utility.Laygiatrithamsohethong("ASTM_BACKUP_FOLDER", @"\\192.168.1.254\Backup", false)); newDestinationFolder += Path.GetFileName(fullpath); string errMsg = Utility.MoveFile(fullpath, newDestinationFolder); if (Utility.DoTrim(errMsg) == "") { MyLog.Trace(string.Format("Move file from {0} to {1} succedded", fullpath, newDestinationFolder)); } else { MyLog.Error(string.Format("Move file from {0} to {1} error-->{2}", fullpath, newDestinationFolder, errMsg)); } } MyLog.Trace(string.Format("------------------Finish Analysing file {0}------------------", fullpath)); } } catch (Exception ex) { MyLog.Error(string.Format("StartAnalysisFile.Exception-->{0}", ex.Message)); } }
public DataTable LayThuoctrongkho(int id_kho, int id_maloaithuoc, string KieuKho) { return(SPs.ThuocTimkiemThuoctrongkho(id_kho, id_maloaithuoc, KieuKho).GetDataSet().Tables[0]); }
public static DataTable KcbThamkhamDulieuTiemchungTheoBenhnhan(long id_benhnhan) { return(SPs.KcbThamkhamDulieuTiemchungTheoBenhnhan(id_benhnhan).GetDataSet().Tables[0]); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataSet ds = SPs.SpSalePurchaseReport("04-01-2017", DateTime.Now.ToShortDateString()).GetDataSet(); DataTable expense = SPs.SpGetExpenseReport(null, "04-01-2017", DateTime.Now.ToShortDateString()).GetDataSet().Tables[0]; DataTable dtPMGTank = SPs.SpTankDetails(getDateTime().ToShortDateString(), 1).GetDataSet().Tables[0]; DataTable dtPMGLastRate = Common.GetLatestRates(1); DataTable dtHSDTank = SPs.SpTankDetails(getDateTime().ToShortDateString(), 2).GetDataSet().Tables[0]; DataTable dtHSDLastRate = Common.GetLatestRates(2); DataTable dtMBORate = Common.GetLatestRates(3); if (dtMBORate.Rows.Count > 0) { lblMBORate.Text = dtMBORate.Rows[0]["AvgPurchaseRate"].ToString(); } if (dtPMGTank.Rows.Count > 0) { if (dtPMGLastRate.Rows.Count > 0) { lblPMGRate.Text = Convert.ToDecimal(dtPMGLastRate.Rows[0]["Rate"]).ToString(); } lblAvailablePMG.Text = Convert.ToInt32(dtPMGTank.Rows[0]["Tank"]).ToString(); lblPMGAmount.Text = Convert.ToString(Convert.ToDecimal(dtPMGLastRate.Rows[0]["Rate"]) * Convert.ToInt32(dtPMGTank.Rows[0]["Tank"])); } if (dtHSDTank.Rows.Count > 0) { if (dtHSDLastRate.Rows.Count > 0) { lblHSDRate.Text = Convert.ToDecimal(dtHSDLastRate.Rows[0]["Rate"]).ToString(); } lblAvailableHSD.Text = Convert.ToInt32(dtHSDTank.Rows[0]["Tank"]).ToString(); lblHSDAmount.Text = Convert.ToString(Convert.ToDecimal(dtHSDLastRate.Rows[0]["Rate"]) * Convert.ToInt32(dtHSDTank.Rows[0]["Tank"])); } DataTable PMGSale = ds.Tables[0]; if (PMGSale.Rows.Count > 0) { txtSoldPMG.Text = Convert.ToString(PMGSale.Rows[0]["PMGtotalQTY"]); txtSoldPMGPrice.Text = Convert.ToString(PMGSale.Rows[0]["PMGtotalPrice"]); } else { txtSoldPMG.Text = "0"; } DataTable HSDSale = ds.Tables[1]; if (HSDSale.Rows.Count > 0) { txtSoldHSD.Text = Convert.ToString(HSDSale.Rows[0]["HSDtotalQTY"]); txtSoldHSDPrice.Text = Convert.ToString(HSDSale.Rows[0]["HSDtotalPrice"]); } else { txtSoldHSD.Text = "0"; } DataTable MbOSales = ds.Tables[2]; if (MbOSales.Rows.Count > 0) { txtSoldMobileOil.Text = Convert.ToString(MbOSales.Rows[0]["MoboiltotalQTY"]); txtSoldMobilOilPrice.Text = Convert.ToString(MbOSales.Rows[0]["MoboilPrice"]); } else { txtSoldMobilOilPrice.Text = "0"; } DataTable PMGPurchases = ds.Tables[3]; if (PMGPurchases.Rows.Count > 0) { txtTotalPurchasedPMG.Text = Convert.ToString(PMGPurchases.Rows[0]["PMGPurchaseQTY"]); txtPurchasedPMGPrice.Text = Convert.ToString(PMGPurchases.Rows[0]["PMGPurchasePrice"]); txtPurchasesPMGExpense.Text = Convert.ToString(PMGPurchases.Rows[0]["PMGOtherExpense"]); } else { txtPurchasedPMGPrice.Text = "0"; } DataTable HSDPurchases = ds.Tables[4]; if (HSDPurchases.Rows.Count > 0) { txtTotalPurchasedHSD.Text = Convert.ToString(HSDPurchases.Rows[0]["HSDPurchaseQTY"]); txtPurchasedHSDPrice.Text = Convert.ToString(HSDPurchases.Rows[0]["HSDPurchasePrice"]); txtPurchasesHSDExpense.Text = Convert.ToString(HSDPurchases.Rows[0]["HSDOtherExpense"]); } else { txtPurchasedHSDPrice.Text = "0"; } DataTable MbOPurchases = ds.Tables[5]; if (MbOPurchases.Rows.Count > 0) { txtPurchaseMobilOil.Text = Convert.ToString(MbOPurchases.Rows[0]["OILPurchaseQTY"]); txtPurchaseMobileOilPrice.Text = Convert.ToString(MbOPurchases.Rows[0]["OILPurchasePrice"]); txtPurchasesMbOExpense.Text = Convert.ToString(MbOPurchases.Rows[0]["OILOtherExpense"]); } else { txtPurchaseMobileOilPrice.Text = "0"; } if (expense.Rows.Count > 0) { lblTotalExpense.Text = Convert.ToString(expense.Rows[0]["TotalExpense"]); } else { lblTotalExpense.Text = "0"; } lblTotalPurchases.Text = Convert.ToString((Convert.ToDouble(PMGPurchases.Rows[0]["PMGPurchasePrice"])) + (Convert.ToDouble(HSDPurchases.Rows[0]["HSDPurchasePrice"])) + (Convert.ToDouble(MbOPurchases.Rows[0]["OILPurchasePrice"])) + (Convert.ToDouble(PMGPurchases.Rows[0]["PMGOtherExpense"])) + (Convert.ToDouble(HSDPurchases.Rows[0]["HSDOtherExpense"])) + (Convert.ToDouble(MbOPurchases.Rows[0]["OILOtherExpense"]))); ltrTotalPurchase.Text = Convert.ToString((Convert.ToDouble(PMGPurchases.Rows[0]["PMGPurchasePrice"])) + (Convert.ToDouble(HSDPurchases.Rows[0]["HSDPurchasePrice"])) + (Convert.ToDouble(MbOPurchases.Rows[0]["OILPurchasePrice"])) + (Convert.ToDouble(PMGPurchases.Rows[0]["PMGOtherExpense"])) + (Convert.ToDouble(HSDPurchases.Rows[0]["HSDOtherExpense"])) + (Convert.ToDouble(MbOPurchases.Rows[0]["OILOtherExpense"]))); lblTotalSales.Text = Convert.ToString((Convert.ToDouble(MbOSales.Rows[0]["MoboilPrice"])) + (Convert.ToDouble(PMGSale.Rows[0]["PMGtotalPrice"]) + (Convert.ToDouble(HSDSale.Rows[0]["HSDtotalPrice"])))); LtrTotalSales.Text = Convert.ToString((Convert.ToDouble(MbOSales.Rows[0]["MoboilPrice"])) + (Convert.ToDouble(PMGSale.Rows[0]["PMGtotalPrice"]) + (Convert.ToDouble(HSDSale.Rows[0]["HSDtotalPrice"])))); lblAvailableMBO.Text = Convert.ToString(Convert.ToDecimal(txtPurchaseMobilOil.Text) - Convert.ToDecimal(txtSoldMobileOil.Text)); lblMBOAmount.Text = Convert.ToString(Convert.ToDecimal(lblAvailableMBO.Text) * Convert.ToDecimal(lblMBORate.Text)); DataTable TotalExpense = ds.Tables[6]; DataTable dtFrwrdAmountHSD = ds.Tables[7]; if (dtFrwrdAmountHSD.Rows.Count > 0) { double Rate = 0; for (int i = 0; i < dtFrwrdAmountHSD.Rows.Count; i++) { Rate += Convert.ToDouble(Convert.ToDecimal(dtFrwrdAmountHSD.Rows[i]["Rate"]) * Convert.ToDecimal(dtFrwrdAmountHSD.Rows[i]["Quantity"])); } txtforwardedHSD.Text = Convert.ToString(dtFrwrdAmountHSD.Rows[0]["TotalfrwdedHSDQty"]); txtforwardedHSDRate.Text = Rate.ToString(); } else { txtforwardedHSD.Text = "0"; txtforwardedHSDRate.Text = "0"; } DataTable dtFrwrdAmountPMG = ds.Tables[8]; if (dtFrwrdAmountPMG.Rows.Count > 0) { double Rate = 0; for (int i = 0; i < dtFrwrdAmountPMG.Rows.Count; i++) { Rate += Convert.ToDouble(Convert.ToDecimal(dtFrwrdAmountPMG.Rows[i]["Rate"]) * Convert.ToDecimal(dtFrwrdAmountPMG.Rows[i]["Quantity"])); } txtforwardedPMG.Text = Convert.ToString(dtFrwrdAmountPMG.Rows[0]["TotalfrwdedPMGQty"]); txtforwardedPMGRate.Text = Rate.ToString(); } else { txtforwardedPMG.Text = "0"; txtforwardedPMGRate.Text = "0"; } DataTable dtCash = Common.GetPreviousCash(); if (dtCash.Rows.Count > 0) { lblTotalPurchases.Text = Convert.ToString(Convert.ToDouble(lblTotalPurchases.Text) + Convert.ToDouble(dtCash.Rows[0]["TotalPurchase"])); lblTotalSales.Text = Convert.ToString(Convert.ToDouble(lblTotalSales.Text) + Convert.ToDouble(dtCash.Rows[0]["TotalSale"])); lblTotalExpense.Text = Convert.ToString(Convert.ToDouble(lblTotalExpense.Text) + Convert.ToDouble(dtCash.Rows[0]["TotalExpense"])); } lblProfit.Text = Convert.ToString(Convert.ToDouble(lblTotalSales.Text) - (Convert.ToDouble(lblTotalPurchases.Text) + Convert.ToDouble(lblTotalExpense.Text))); loadExpenseDetails(); } }
public void XoaChitietDonthuoc(int IdChitietdonthuoc) { SPs.DonthuocXoaChitiet(IdChitietdonthuoc).Execute(); }
public ActionResult XacNhanPhieuHuy_thanhly_thuoc(TPhieuNhapxuatthuoc objPhieuNhap, DateTime ngayxacnhan, ref string errMsg) { HisDuocProperties objHisDuocProperties = PropertyLib._HisDuocProperties; string errorMessage = ""; try { using (var Scope = new TransactionScope()) { using (var dbScope = new SharedDbConnectionScope()) { SqlQuery sqlQuery = new Select().From(TPhieuNhapxuatthuocChitiet.Schema) .Where(TPhieuNhapxuatthuocChitiet.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu); TPhieuNhapxuatthuocChitietCollection objPhieuNhapCtCollection = sqlQuery.ExecuteAsCollection <TPhieuNhapxuatthuocChitietCollection>(); objPhieuNhap.NgayXacnhan = ngayxacnhan; foreach (TPhieuNhapxuatthuocChitiet objPhieuNhapCt in objPhieuNhapCtCollection) { //Kiểm tra đề phòng Kho A-->Xuất kho B. Kho B xác nhận-->Xuất kho C. Kho B hủy xác nhận. Kho C xác nhận dẫn tới việc kho B chưa có thuốc để trừ kho ActionResult _Kiemtrathuocxacnhan = Kiemtrathuocxacnhan(objPhieuNhap, objPhieuNhapCt, ref errMsg); if (_Kiemtrathuocxacnhan != ActionResult.Success) { return(_Kiemtrathuocxacnhan); } long idthuockho = -1; StoredProcedure sp = SPs.ThuocXuatkho(objPhieuNhap.IdKhoxuat, objPhieuNhapCt.IdThuoc, objPhieuNhapCt.NgayHethan, objPhieuNhapCt.GiaNhap, objPhieuNhapCt.GiaBan, Utility.DecimaltoDbnull(objPhieuNhapCt.Vat), Utility.Int32Dbnull(objPhieuNhapCt.SoLuong), objPhieuNhapCt.IdChuyen, objPhieuNhapCt.MaNhacungcap, objPhieuNhapCt.SoLo, objHisDuocProperties.XoaDulieuKhiThuocDaHet ? 1 : 0, errorMessage); sp.Execute(); //Insert dòng kho xuất TBiendongThuoc objXuatNhap = new TBiendongThuoc(); objXuatNhap.IdPhieu = Utility.Int32Dbnull(objPhieuNhapCt.IdPhieu); objXuatNhap.IdPhieuChitiet = Utility.Int32Dbnull(objPhieuNhapCt.IdPhieuchitiet); objXuatNhap.MaPhieu = Utility.sDbnull(objPhieuNhap.MaPhieu); objXuatNhap.DonGia = Utility.DecimaltoDbnull(objPhieuNhapCt.DonGia); objXuatNhap.GiaBan = Utility.DecimaltoDbnull(objPhieuNhapCt.GiaBan); objXuatNhap.GiaNhap = Utility.DecimaltoDbnull(objPhieuNhapCt.GiaNhap); objXuatNhap.SoHoadon = Utility.sDbnull(objPhieuNhap.SoHoadon); objXuatNhap.GiaBhyt = objPhieuNhapCt.GiaBhyt; objXuatNhap.GiaBhytCu = objPhieuNhapCt.GiaBhytCu; objXuatNhap.GiaPhuthuDungtuyen = objPhieuNhapCt.GiaPhuthuDungtuyen; objXuatNhap.GiaPhuthuTraituyen = objPhieuNhapCt.GiaPhuthuTraituyen; objXuatNhap.NgayNhap = objPhieuNhapCt.NgayNhap; objXuatNhap.Noitru = 0; objXuatNhap.QuayThuoc = 0; objXuatNhap.PhuThu = 0; objXuatNhap.DuTru = objPhieuNhap.DuTru; objXuatNhap.SoLuong = Utility.Int32Dbnull(objPhieuNhapCt.SoLuong); objXuatNhap.NgayTao = globalVariables.SysDate; objXuatNhap.NguoiTao = globalVariables.UserName; objXuatNhap.IdThuockho = Utility.Int32Dbnull(objPhieuNhapCt.IdChuyen); objXuatNhap.ThanhTien = Utility.DecimaltoDbnull(objPhieuNhapCt.ThanhTien); objXuatNhap.IdThuoc = Utility.Int32Dbnull(objPhieuNhapCt.IdThuoc); objXuatNhap.Vat = Utility.Int32Dbnull(objPhieuNhap.Vat); objXuatNhap.IdNhanvien = Utility.Int16Dbnull(objPhieuNhap.IdNhanvien); objXuatNhap.IdKho = Utility.Int16Dbnull(objPhieuNhap.IdKhoxuat); objXuatNhap.NgayHethan = objPhieuNhapCt.NgayHethan.Date; objXuatNhap.MaNhacungcap = objPhieuNhapCt.MaNhacungcap; objXuatNhap.SoChungtuKemtheo = objPhieuNhap.SoChungtuKemtheo; objXuatNhap.SoDky = objPhieuNhapCt.SoDky; objXuatNhap.SoQdinhthau = objPhieuNhapCt.SoQdinhthau; objXuatNhap.SoLo = objPhieuNhapCt.SoLo; objXuatNhap.MaLoaiphieu = objPhieuNhap.LoaiPhieu; objXuatNhap.TenLoaiphieu = objPhieuNhap.TenLoaiphieu; objXuatNhap.NgayBiendong = objPhieuNhap.NgayXacnhan; objXuatNhap.NgayHoadon = objPhieuNhap.NgayHoadon; objXuatNhap.KieuThuocvattu = objPhieuNhapCt.KieuThuocvattu; objXuatNhap.IsNew = true; objXuatNhap.Save(); } new Update(TPhieuNhapxuatthuoc.Schema) .Set(TPhieuNhapxuatthuoc.Columns.NguoiSua).EqualTo(globalVariables.UserName) .Set(TPhieuNhapxuatthuoc.Columns.NgaySua).EqualTo(globalVariables.SysDate) .Set(TPhieuNhapxuatthuoc.Columns.NguoiXacnhan).EqualTo(globalVariables.UserName) .Set(TPhieuNhapxuatthuoc.Columns.NgayXacnhan).EqualTo(ngayxacnhan) .Set(TPhieuNhapxuatthuoc.Columns.TrangThai).EqualTo(1) .Where(TPhieuNhapxuatthuoc.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu) .And(TPhieuNhapxuatthuoc.LoaiPhieuColumn).IsEqualTo(objPhieuNhap.LoaiPhieu).Execute(); } Scope.Complete(); return(ActionResult.Success); } } catch (Exception ex) { Utility.CatchException("Lỗi khi xác nhận phiếu ", ex); return(ActionResult.Error); } }
public void NoitruXoachandoan(string lstIdChandoan) { SPs.NoitruXoachandoan(lstIdChandoan).Execute(); }
public static DataTable getToolApply(string strName) { return(SPs.GetToolApply_Sp(strName).GetDataSet().Tables[0]); }
public void XoaChitietDonthuoc(string lstIdChitietDonthuoc) { SPs.DonthuocXoaChitietNew(lstIdChitietDonthuoc).Execute(); }
/// <summary> /// hàm thực hiện việc xác nhận thông tin /// </summary> /// <param name="objPhieuNhap"></param> /// <returns></returns> public ActionResult XacNhanPhieuTraThuocVeKho(TPhieuNhapxuatthuoc objPhieuNhap, DateTime _ngayxacnhan) { string errorMessage = ""; try { using (var Scope = new TransactionScope()) { using (var dbScope = new SharedDbConnectionScope()) { HisDuocProperties objHisDuocProperties = PropertyLib._HisDuocProperties; SqlQuery sqlQuery = new Select().From(TPhieuNhapxuatthuocChitiet.Schema) .Where(TPhieuNhapxuatthuocChitiet.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu); TPhieuNhapxuatthuocChitietCollection objPhieuNhapCtCollection = sqlQuery.ExecuteAsCollection <TPhieuNhapxuatthuocChitietCollection>(); foreach (TPhieuNhapxuatthuocChitiet objPhieuNhapCt in objPhieuNhapCtCollection) { //Insert dòng kho nhập TBiendongThuoc objXuatNhap = new TBiendongThuoc(); objXuatNhap.IdPhieu = Utility.Int32Dbnull(objPhieuNhapCt.IdPhieu); objXuatNhap.IdPhieuChitiet = Utility.Int32Dbnull(objPhieuNhapCt.IdPhieuchitiet); objXuatNhap.MaPhieu = Utility.sDbnull(objPhieuNhap.MaPhieu); objXuatNhap.DonGia = Utility.DecimaltoDbnull(objPhieuNhapCt.DonGia); objXuatNhap.GiaNhap = Utility.DecimaltoDbnull(objPhieuNhapCt.GiaNhap); objXuatNhap.GiaBan = Utility.DecimaltoDbnull(objPhieuNhapCt.GiaBan); objXuatNhap.SoHoadon = Utility.sDbnull(objPhieuNhap.SoHoadon); objXuatNhap.PhuThu = 0; objXuatNhap.SoLuong = Utility.Int32Dbnull(objPhieuNhapCt.SoLuong); objXuatNhap.NgayTao = globalVariables.SysDate; objXuatNhap.NguoiTao = globalVariables.UserName; objXuatNhap.ThanhTien = Utility.DecimaltoDbnull(objPhieuNhapCt.ThanhTien); objXuatNhap.IdThuoc = Utility.Int32Dbnull(objPhieuNhapCt.IdThuoc); objXuatNhap.Vat = Utility.Int32Dbnull(objPhieuNhap.Vat); objXuatNhap.SoDky = objPhieuNhapCt.SoDky; objXuatNhap.SoQdinhthau = objPhieuNhapCt.SoQdinhthau; objXuatNhap.SoLo = objPhieuNhapCt.SoLo; objXuatNhap.IdNhanvien = Utility.Int16Dbnull(objPhieuNhap.IdNhanvien); objXuatNhap.IdKho = Utility.Int16Dbnull(objPhieuNhap.IdKhonhap); objXuatNhap.NgayHethan = objPhieuNhapCt.NgayHethan.Date; //objXuatNhap.IdNhaCcap = Utility.Int32Dbnull(objPhieuNhap.IdNhaCcap); objXuatNhap.MaNhacungcap = objPhieuNhap.MaNhacungcap; objXuatNhap.MaLoaiphieu = (byte)LoaiPhieu.PhieuNhapTraKhoLe; objXuatNhap.TenLoaiphieu = Utility.TenLoaiPhieu(LoaiPhieu.PhieuNhapTraKhoLe); objXuatNhap.IdKhoaLinh = objPhieuNhap.IdKhoalinh; objXuatNhap.NgayBiendong = _ngayxacnhan; objXuatNhap.IsNew = true; objXuatNhap.Save(); //Insert dòng của kho xuất objXuatNhap = new TBiendongThuoc(); objXuatNhap.IdPhieu = Utility.Int32Dbnull(objPhieuNhapCt.IdPhieu); objXuatNhap.IdPhieuChitiet = Utility.Int32Dbnull(objPhieuNhapCt.IdPhieuchitiet); objXuatNhap.MaPhieu = Utility.sDbnull(objPhieuNhap.MaPhieu); objXuatNhap.DonGia = Utility.DecimaltoDbnull(objPhieuNhapCt.DonGia); objXuatNhap.GiaNhap = Utility.DecimaltoDbnull(objPhieuNhapCt.GiaNhap); objXuatNhap.GiaBan = Utility.DecimaltoDbnull(objPhieuNhapCt.GiaBan); objXuatNhap.SoHoadon = Utility.sDbnull(objPhieuNhap.SoHoadon); objXuatNhap.PhuThu = 0; objXuatNhap.SoLuong = Utility.Int32Dbnull(objPhieuNhapCt.SoLuong); objXuatNhap.NgayTao = globalVariables.SysDate; objXuatNhap.NguoiTao = globalVariables.UserName; objXuatNhap.ThanhTien = Utility.DecimaltoDbnull(objPhieuNhapCt.ThanhTien); objXuatNhap.IdThuoc = Utility.Int32Dbnull(objPhieuNhapCt.IdThuoc); objXuatNhap.Vat = Utility.Int32Dbnull(objPhieuNhap.Vat); objXuatNhap.SoDky = objPhieuNhapCt.SoDky; objXuatNhap.SoQdinhthau = objPhieuNhapCt.SoQdinhthau; objXuatNhap.SoLo = objPhieuNhapCt.SoLo; objXuatNhap.IdNhanvien = Utility.Int16Dbnull(objPhieuNhap.IdNhanvien); objXuatNhap.IdKho = Utility.Int16Dbnull(objPhieuNhap.IdKhoxuat); objXuatNhap.NgayHethan = objPhieuNhapCt.NgayHethan.Date; //objXuatNhap.IdNhaCcap = Utility.Int32Dbnull(objPhieuNhap.IdNhaCcap); objXuatNhap.MaNhacungcap = objPhieuNhap.MaNhacungcap; objXuatNhap.MaLoaiphieu = (byte)LoaiPhieu.PhieuXuatKho; objXuatNhap.TenLoaiphieu = Utility.TenLoaiPhieu(LoaiPhieu.PhieuXuatKho); objXuatNhap.IdKhoaLinh = objPhieuNhap.IdKhoalinh; objXuatNhap.NgayBiendong = _ngayxacnhan; objXuatNhap.IsNew = true; objXuatNhap.Save(); int id_thuockho = -1; StoredProcedure sp = SPs.ThuocNhapkhoOutput(objPhieuNhapCt.NgayHethan, objPhieuNhapCt.GiaNhap, objPhieuNhapCt.GiaBan, objPhieuNhapCt.SoLuong, Utility.DecimaltoDbnull(objPhieuNhapCt.Vat), objPhieuNhapCt.IdThuoc, objPhieuNhap.IdKhonhap, objPhieuNhapCt.MaNhacungcap, objPhieuNhapCt.SoLo, objPhieuNhapCt.SoDky, objPhieuNhapCt.SoQdinhthau, -1, id_thuockho, _ngayxacnhan, objPhieuNhapCt.GiaBhyt, objPhieuNhapCt.GiaPhuthuDungtuyen, objPhieuNhapCt.GiaPhuthuTraituyen, objPhieuNhapCt.KieuThuocvattu); sp.Execute(); sp = SPs.ThuocXuatkho(objPhieuNhap.IdKhoxuat, objPhieuNhapCt.IdThuoc, objPhieuNhapCt.NgayHethan, objPhieuNhapCt.GiaNhap, objPhieuNhapCt.GiaBan, Utility.DecimaltoDbnull(objPhieuNhapCt.Vat), Utility.Int32Dbnull(objXuatNhap.SoLuong), objPhieuNhapCt.IdThuockho, objPhieuNhapCt.MaNhacungcap, objPhieuNhapCt.SoLo, objHisDuocProperties.XoaDulieuKhiThuocDaHet ? 1 : 0, errorMessage); sp.Execute(); errorMessage = Utility.sDbnull(sp.OutputValues[0]); } new Update(TPhieuNhapxuatthuoc.Schema) .Set(TPhieuNhapxuatthuoc.Columns.IdNhanvien).EqualTo(globalVariables.gv_intIDNhanvien) .Set(TPhieuNhapxuatthuoc.Columns.NguoiXacnhan).EqualTo(globalVariables.UserName) .Set(TPhieuNhapxuatthuoc.Columns.NgayXacnhan).EqualTo(globalVariables.SysDate) .Set(TPhieuNhapxuatthuoc.Columns.TrangThai).EqualTo(1) .Where(TPhieuNhapxuatthuoc.Columns.IdPhieu).IsEqualTo(objPhieuNhap.IdPhieu).Execute(); } Scope.Complete(); return(ActionResult.Success); } } catch (Exception exception) { log.Error("Loi trong qua trinh xac nhan don thuoc :{0}", exception); log.Error("Loi ban ra tu sp :{0}", errorMessage); return(ActionResult.Error); } }
public DataTable LaythongtinDonthuoc_In(int id_donthuoc) { return(SPs.DonthuocLaythongtinDein(id_donthuoc).GetDataSet().Tables[0]); }
public static DataTable ThuocBaocaotinhhinhPhatthuocbenhnhan(DateTime?FromDate, DateTime?ToDate, int?IDKHOXUAT, int?iddoituong, int?Kieuthongke) { return(SPs.ThuocBaocaotinhhinhPhatthuocbenhnhan(FromDate, ToDate, IDKHOXUAT, iddoituong, Kieuthongke).GetDataSet().Tables[0]); }
public DataTable Laythongtinchitietdonthuoc(int id_donthuoc) { return(SPs.DonthuocLaythongtinDexem(id_donthuoc).GetDataSet().Tables[0]); }
public static DataTable ThuocBaocaothuochethan(int?IDThuoc, int?IDKHO, int?CanhBaoTruoc, int?NhomThuoc) { return(SPs.ThuocBaocaothuochethan(IDThuoc, IDKHO, CanhBaoTruoc, NhomThuoc).GetDataSet().Tables[0]); }
public DataTable LayThuoctrongkhokedon(int id_kho, string KieuThuocVT, string ma_doituong_kcb, int Dungtuyen, string MaKHOATHIEN) { return(SPs.DonthuocLaythongtinThuoctrongkhoKedon(id_kho, KieuThuocVT, ma_doituong_kcb, Dungtuyen, MaKHOATHIEN).GetDataSet().Tables[0]); }
public static DataTable ThuocBaocaothuoctheonhacungcap(DateTime?FromDate, DateTime?ToDate, int?IDKHO, string ma_nhacungcap) { return(SPs.ThuocBaocaothuoctheonhacungcap(FromDate, ToDate, IDKHO, ma_nhacungcap).GetDataSet().Tables[0]); }
private void PrintData() { try { string pFromBarcode = dtpDatePrintFrom.Value.ToString("yyMMdd") + txtFromBarcode.Text.Trim().PadLeft(4, '0') + ".NB"; string pToDate = dtpDatePrintFrom.Value.ToString("yyMMdd") + txtToBarcode.Text.Trim().PadLeft(4, '0') + ".NB"; dt = new DataTable(); dt.Columns.Add("Barcode"); dt.Columns.Add("Patient_ID"); dt.Columns.Add("Patient_Name"); dt.Columns.Add("AllResult"); dt.Columns.Add("AllResult2"); dt.Columns.Add("Test_Date"); dtRawResult = SPs.GtvtBaoCaoLuuNoBarCode(Utility.sDbnull(pFromBarcode), Utility.sDbnull(pToDate), Utility.Int16Dbnull(cboTestType.SelectedValue)). GetDataSet().Tables[0]; bool forVd = SysPara.BarcodeType.ToUpper() == "VIETDUC"; //Xử lý các giá trị bình thường //Utilities.ProcessNormalResult(ref dtRawResult, "Test_Result", "Normal_Level", "+", // "+", "-", "flag", forVd); lablinkhelper.Utilities.ProcessNormalResult(ref dtRawResult, "Test_Result", "Normal_Level", "", "", "", "flag", forVd); var patientResult = new StringBuilder(); var patientResult2 = new StringBuilder(); if (dtRawResult.Rows.Count > 0) { dtRawResult.Rows.InsertAt(dtRawResult.NewRow(), 0); dtRawResult.Rows[0]["Patient_ID"] = Utility.sDbnull(dtRawResult.Rows[1]["Patient_ID"]); //dtRawResult.Rows[0]["Patient_Name"] = Utility.sDbnull(dtRawResult.Rows[1]["Patient_Name"]); dtRawResult.Rows.Add(dtRawResult.NewRow()); for (int i = 1; i <= dtRawResult.Rows.Count - 1; i++) { if (Utility.sDbnull(dtRawResult.Rows[i]["Patient_ID"]) != Utility.sDbnull(dtRawResult.Rows[i - 1]["Patient_ID"])) { //patientResult.Remove(patientResult.Length - 2, 1); var newdr = dt.NewRow(); newdr["Patient_ID"] = Utility.sDbnull(dtRawResult.Rows[i - 1]["Patient_ID"]); newdr["Barcode"] = Utility.sDbnull(dtRawResult.Rows[i - 1]["Barcode"]); newdr["Patient_Name"] = Utility.sDbnull(dtRawResult.Rows[i - 1]["Patient_Name"]); if (dtRawResult.Rows[i - 1]["Test_Date"] != null) { newdr["Test_Date"] = ((DateTime)dtRawResult.Rows[i - 1]["Test_Date"]).ToString("dd/MM/yyyy"); } newdr["AllResult2"] = patientResult2.ToString(); newdr["AllResult"] = patientResult.ToString(); dt.Rows.Add(newdr); patientResult2 = new StringBuilder(); patientResult = new StringBuilder(); } if ((Utility.sDbnull(dtRawResult.Rows[i]["TestType_Name"]) != Utility.sDbnull(dtRawResult.Rows[i - 1]["TestType_Name"])) | (Utility.sDbnull(dtRawResult.Rows[i]["Patient_ID"]) != Utility.sDbnull(dtRawResult.Rows[i - 1]["Patient_ID"]))) { patientResult2.Append(dtRawResult.Rows[i]["TestType_Name"] + ":"); patientResult.Append("</p>"); patientResult.Append(string.Format("<b>{0}</b>: ", Utility.sDbnull(dtRawResult.Rows[i]["TestType_Name"]).ToUpper ())); } string value, value2; if (Utility.sDbnull(dtRawResult.Rows[i]["flag"]).Trim() == "+") { value2 = string.Format("{0} ,{1} , {2}; ", Utility.sDbnull(dtRawResult.Rows[i]["Para_Name"]), Utility.sDbnull(dtRawResult.Rows[i]["flag"]), dtRawResult.Rows[i]["Test_result"]); value = string.Format("<font color=\"red\"><b>{0}({1}) {2};</b></font> ", Utility.sDbnull(dtRawResult.Rows[i]["Para_Name"]), Utility.sDbnull(dtRawResult.Rows[i]["flag"]), dtRawResult.Rows[i]["Test_result"]); } else if (Utility.sDbnull(dtRawResult.Rows[i]["flag"]).Trim() == "-") { value2 = string.Format("{0}, {1}, {2}; ", Utility.sDbnull(dtRawResult.Rows[i]["Para_Name"]), Utility.sDbnull(dtRawResult.Rows[i]["flag"]), dtRawResult.Rows[i]["Test_result"]); value = string.Format("{0}({1}) {2}; ", Utility.sDbnull(dtRawResult.Rows[i]["Para_Name"]), Utility.sDbnull(dtRawResult.Rows[i]["flag"]), dtRawResult.Rows[i]["Test_result"]); } else { value2 = string.Format( Utility.sDbnull(dtRawResult.Rows[i]["Test_result"]).Trim() != "" ? "{0} {1};" : "{0}       ", Utility.sDbnull(dtRawResult.Rows[i]["Para_Name"]), dtRawResult.Rows[i]["Test_result"]); value = string.Format( Utility.sDbnull(dtRawResult.Rows[i]["Test_result"]).Trim() != "" ? "{0} {1};" : "<i>{0}      </i> ", Utility.sDbnull(dtRawResult.Rows[i]["Para_Name"]), dtRawResult.Rows[i]["Test_result"]); } patientResult.Append(value); patientResult2.Append(value2); } } // int testTypeID = Utility.Int32Dbnull(Utilities.GetPropertyValue(cboTestType, "SelectedValue"), -1); //dt = new DataTable(); //dt.Columns.Add("Patient_ID"); //dt.Columns.Add("Barcode"); //dt.Columns.Add("Test_Date"); //dt.Columns.Add("AllResult"); //dtRawResult = // SPs.GtvtBaoCaoLuuNoBarCode(Utility.sDbnull(pFromBarcode), // Utility.sDbnull(pToDate), // Utility.Int16Dbnull(cboTestType.SelectedValue)). // GetDataSet().Tables[0]; //var patientResult = new StringBuilder(); //dtRawResult.Rows.InsertAt(dtRawResult.NewRow(), 0); //dtRawResult.Rows[0]["Patient_ID"] = dtRawResult.Rows[1]["Patient_ID"]; //dtRawResult.Rows.Add(dtRawResult.NewRow()); //for (int i = 1; i <= dtRawResult.Rows.Count - 1; i++) //{ // if (Utility.sDbnull(dtRawResult.Rows[i]["Patient_ID"]) != // Utility.sDbnull(dtRawResult.Rows[i - 1]["Patient_ID"])) // { // var newdr = dt.NewRow(); // newdr["Patient_ID"] = dtRawResult.Rows[i - 1]["Patient_ID"]; // newdr["Barcode"] = dtRawResult.Rows[i - 1]["Barcode"]; // newdr["Test_Date"] = dtRawResult.Rows[i - 1]["Test_Date"]; // newdr["AllResult"] = patientResult.ToString(); // dt.Rows.Add(newdr); // patientResult = new StringBuilder(); // } // string value; // value = string.Format( // Utility.sDbnull(dtRawResult.Rows[i]["Test_result"]).Trim() != "" // ? "{0} {1}; " // : "{0} ", // Utility.sDbnull(dtRawResult.Rows[i]["Para_Name"]), // dtRawResult.Rows[i]["Test_result"]); // patientResult.Append(value); //} } catch (Exception ex) { Utility.ShowMsg("Lỗi" + ex, "Thông báo", MessageBoxIcon.Warning); } }