void LoadData() { try { decimal BHYT_PTRAM_TRAITUYENNOITRU = Utility.DecimaltoDbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("BHYT_PTRAM_TRAITUYENNOITRU", "0", false), 0m); DataSet ds = new KCB_THAMKHAM().NoitruLayDanhsachVtthGoidichvu((int)objLuotkham.IdBenhnhan, objLuotkham.MaLuotkham); m_dtVTTH = ds.Tables[0]; m_dtGoidichvu = ds.Tables[1]; Utility.SetDataSourceForDataGridEx_Basic(grdGoidichvu, m_dtGoidichvu, false, true, "", "stt_hthi_dichvu,stt_hthi_chitiet,ten_chitietdichvu"); m_dtVTTHChitiet_View = m_dtVTTH.Clone(); foreach (DataRow row in m_dtVTTH.Rows) { row["CHON"] = 0; DataRow[] drview = m_dtVTTHChitiet_View .Select(KcbDonthuocChitiet.Columns.IdThuoc + "=" + Utility.sDbnull(row[KcbDonthuocChitiet.Columns.IdThuoc], "-1") + "AND " + KcbDonthuocChitiet.Columns.DonGia + "=" + Utility.sDbnull(row[KcbDonthuocChitiet.Columns.DonGia], "-1")); if (drview.Length <= 0) { //if (!Utility.Byte2Bool(row[KcbDonthuocChitiet.Columns.TuTuc])) //{ // decimal BHCT = 0m; // if (objLuotkham.TrangthaiNoitru <= 0) // BHCT = Utility.DecimaltoDbnull(row[KcbDonthuocChitiet.Columns.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(row[KcbDonthuocChitiet.Columns.DonGia], 0) * (Utility.DecimaltoDbnull(objLuotkham.PtramBhytGoc, 0) / 100) * (BHYT_PTRAM_TRAITUYENNOITRU / 100); // //decimal num2 = (Utility.DecimaltoDbnull(row[KcbDonthuocChitiet.Columns.DonGia], 0) * Utility.DecimaltoDbnull(this.objLuotkham.PtramBhyt, 0)) / 100M; // decimal num3 = Utility.DecimaltoDbnull(row[KcbDonthuocChitiet.Columns.DonGia], 0) - BHCT; // row[KcbDonthuocChitiet.Columns.BhytChitra] = BHCT; // row[KcbDonthuocChitiet.Columns.BnhanChitra] = num3; //} //else //{ // row[KcbDonthuocChitiet.Columns.PtramBhyt] = 0; // row[KcbDonthuocChitiet.Columns.BhytChitra] = 0; // row[KcbDonthuocChitiet.Columns.BnhanChitra] = Utility.DecimaltoDbnull(row[KcbDonthuocChitiet.Columns.DonGia], 0); //} //row["TT_KHONG_PHUTHU"] = Utility.Int32Dbnull(row[KcbDonthuocChitiet.Columns.SoLuong]) * Utility.DecimaltoDbnull(row[KcbDonthuocChitiet.Columns.DonGia]); //row["TT"] = Utility.Int32Dbnull(row[KcbDonthuocChitiet.Columns.SoLuong]) * (Utility.DecimaltoDbnull(row[KcbDonthuocChitiet.Columns.DonGia]) + Utility.DecimaltoDbnull(row[KcbDonthuocChitiet.Columns.PhuThu])); //row["TT_BHYT"] = Utility.Int32Dbnull(row[KcbDonthuocChitiet.Columns.SoLuong]) * Utility.DecimaltoDbnull(row[KcbDonthuocChitiet.Columns.BhytChitra]); //row["TT_BN"] = Utility.Int32Dbnull(row[KcbDonthuocChitiet.Columns.SoLuong]) * (Utility.DecimaltoDbnull(row[KcbDonthuocChitiet.Columns.BnhanChitra], 0) + Utility.DecimaltoDbnull(row[KcbDonthuocChitiet.Columns.PhuThu], 0)); //row["TT_PHUTHU"] = Utility.Int32Dbnull(row[KcbDonthuocChitiet.Columns.SoLuong]) * Utility.DecimaltoDbnull(row[KcbDonthuocChitiet.Columns.PhuThu], 0); //row["TT_BN_KHONG_PHUTHU"] = Utility.Int32Dbnull(row[KcbDonthuocChitiet.Columns.SoLuong]) * Utility.DecimaltoDbnull(row[KcbDonthuocChitiet.Columns.BnhanChitra], 0); if (Utility.Byte2Bool(row[KcbDonthuocChitiet.Columns.TrongGoi])) { row[KcbDonthuocChitiet.Columns.DonGia] = 0; row[KcbDonthuocChitiet.Columns.BnhanChitra] = 0; row[KcbDonthuocChitiet.Columns.BhytChitra] = 0; row[KcbDonthuocChitiet.Columns.PhuThu] = 0; row["TT_KHONG_PHUTHU"] = Utility.Int32Dbnull(row[KcbDonthuocChitiet.Columns.SoLuong]) * Utility.DecimaltoDbnull(row[KcbDonthuocChitiet.Columns.DonGia]); row["TT"] = Utility.Int32Dbnull(row[KcbDonthuocChitiet.Columns.SoLuong]) * (Utility.DecimaltoDbnull(row[KcbDonthuocChitiet.Columns.DonGia]) + Utility.DecimaltoDbnull(row[KcbDonthuocChitiet.Columns.PhuThu])); row["TT_BHYT"] = Utility.Int32Dbnull(row[KcbDonthuocChitiet.Columns.SoLuong]) * Utility.DecimaltoDbnull(row[KcbDonthuocChitiet.Columns.BhytChitra]); row["TT_BN"] = Utility.Int32Dbnull(row[KcbDonthuocChitiet.Columns.SoLuong]) * (Utility.DecimaltoDbnull(row[KcbDonthuocChitiet.Columns.BnhanChitra], 0) + Utility.DecimaltoDbnull(row[KcbDonthuocChitiet.Columns.PhuThu], 0)); row["TT_PHUTHU"] = Utility.Int32Dbnull(row[KcbDonthuocChitiet.Columns.SoLuong]) * Utility.DecimaltoDbnull(row[KcbDonthuocChitiet.Columns.PhuThu], 0); row["TT_BN_KHONG_PHUTHU"] = Utility.Int32Dbnull(row[KcbDonthuocChitiet.Columns.SoLuong]) * Utility.DecimaltoDbnull(row[KcbDonthuocChitiet.Columns.BnhanChitra], 0); } m_dtVTTHChitiet_View.ImportRow(row); } else { drview[0][KcbDonthuocChitiet.Columns.SoLuong] = Utility.Int32Dbnull(drview[0][KcbDonthuocChitiet.Columns.SoLuong], 0) + Utility.Int32Dbnull(row[KcbDonthuocChitiet.Columns.SoLuong], 0); drview[0]["TT_KHONG_PHUTHU"] = Utility.Int32Dbnull(drview[0][KcbDonthuocChitiet.Columns.SoLuong]) * Utility.DecimaltoDbnull(drview[0][KcbDonthuocChitiet.Columns.DonGia]); drview[0]["TT"] = Utility.Int32Dbnull(drview[0][KcbDonthuocChitiet.Columns.SoLuong]) * (Utility.DecimaltoDbnull(drview[0][KcbDonthuocChitiet.Columns.DonGia]) + Utility.DecimaltoDbnull(drview[0][KcbDonthuocChitiet.Columns.PhuThu])); drview[0]["TT_BHYT"] = Utility.Int32Dbnull(drview[0][KcbDonthuocChitiet.Columns.SoLuong]) * Utility.DecimaltoDbnull(drview[0][KcbDonthuocChitiet.Columns.BhytChitra]); drview[0]["TT_BN"] = Utility.Int32Dbnull(drview[0][KcbDonthuocChitiet.Columns.SoLuong]) * (Utility.DecimaltoDbnull(drview[0][KcbDonthuocChitiet.Columns.BnhanChitra], 0) + Utility.DecimaltoDbnull(drview[0][KcbDonthuocChitiet.Columns.PhuThu], 0)); drview[0]["TT_PHUTHU"] = Utility.Int32Dbnull(drview[0][KcbDonthuocChitiet.Columns.SoLuong]) * Utility.DecimaltoDbnull(drview[0][KcbDonthuocChitiet.Columns.PhuThu], 0); drview[0]["TT_BN_KHONG_PHUTHU"] = Utility.Int32Dbnull(drview[0][KcbDonthuocChitiet.Columns.SoLuong]) * Utility.DecimaltoDbnull(drview[0][KcbDonthuocChitiet.Columns.BnhanChitra], 0); drview[0][KcbDonthuocChitiet.Columns.SttIn] = Math.Min(Utility.Int32Dbnull(row[KcbDonthuocChitiet.Columns.SttIn], 0), Utility.Int32Dbnull(drview[0][KcbDonthuocChitiet.Columns.SttIn], 0)); m_dtVTTHChitiet_View.AcceptChanges(); } } //Old-->Utility.SetDataSourceForDataGridEx Utility.SetDataSourceForDataGridEx_Basic(grdVTTH, m_dtVTTHChitiet_View, false, true, "", KcbDonthuocChitiet.Columns.TrongGoi + "," + KcbDonthuocChitiet.Columns.SttIn); } catch (Exception ex) { Utility.CatchException(ex); } }
public static ActionResult NoitruInphieuChidinhCls(int idBenhnhan, string maLuotkham, int vAssignId, string vAssignCode, string nhomincls, int selectedIndex, bool inTach, ref string mayin) { using (var scope = new TransactionScope()) { using (new SharedDbConnectionScope()) { try { mayin = ""; //KcbChidinhcl.FetchByID(vAssignId); DataTable dt = new KCB_THAMKHAM().KcbThamkhamLaydulieuInphieuCls(idBenhnhan, maLuotkham, vAssignCode, nhomincls).Tables[0]; if (dt == null || dt.Rows.Count <= 0) { // Utility.ShowMsg("Không có dữ liệu in. Mời bạn kiểm tra lại"); return(ActionResult.Error); } // THU_VIEN_CHUNG.CreateXML(dt, "Thamkham_InphieuCLS.XML"); Utility.UpdateLogotoDatatable(ref dt); string reportCode; string khoGiay = "A5"; bool inchung = false; string tieude = "", reportname = ""; if (PropertyLib._MayInProperties.CoGiayInCLS == Papersize.A4) { khoGiay = "A4"; } if (khoGiay == "A5") { if (inTach) //Nếu in riêng mà chọn tất { if (PropertyLib._ThamKhamProperties.ChophepintachCLSKhacPhieu) { switch (selectedIndex) { case 0: reportCode = "thamkham_InphieuchidinhCLS_RIENG_A5"; break; case 1: reportCode = "thamkham_InphieuXetNghiem_A5"; break; case 2: reportCode = "thamkham_InphieuSieuAm_A5"; break; case 3: reportCode = "thamkham_InphieuXQuang_A5"; break; case 5: reportCode = "thamkham_InphieuNoiSoi_A5"; break; case 6: reportCode = "thamkham_InphieuDienTim_A5"; break; default: reportCode = "thamkham_InphieuchidinhCLS_RIENG_A5"; break; } } else { reportCode = "thamkham_InphieuchidinhCLS_RIENG_A5"; } } else { inchung = true; reportCode = "thamkham_InphieuchidinhCLS_A5"; } } else //Khổ giấy A4 if (inTach && selectedIndex == 0) { if (PropertyLib._ThamKhamProperties.ChophepintachCLSKhacPhieu) { switch (selectedIndex) { case 0: reportCode = "thamkham_InphieuchidinhCLS_RIENG_A4"; break; case 1: reportCode = "thamkham_InphieuXetNghiem_A4"; break; case 2: reportCode = "thamkham_InphieuSieuAm_A4"; break; case 3: reportCode = "thamkham_InphieuXQuang_A4"; break; case 5: reportCode = "thamkham_InphieuNoiSoi_A4"; break; case 6: reportCode = "thamkham_InphieuDienTim_A4"; break; default: reportCode = "thamkham_InphieuchidinhCLS_RIENG_A4"; break; } } else { reportCode = "thamkham_InphieuchidinhCLS_RIENG_A4"; } } //Nếu in riêng mà chọn tất-->Gọi báo cáo nhóm theo nhóm in // _reportCode = "thamkham_InphieuchidinhCLS_RIENG_A4"; else { inchung = true; reportCode = "thamkham_InphieuchidinhCLS_A4"; } ReportDocument crpt = Utility.GetReport(reportCode, ref tieude, ref reportname); if (crpt == null) { return(ActionResult.Error); } if (inchung) { List <string> lstNhominCls = (from p in dt.AsEnumerable() where Utility.DoTrim( Utility.sDbnull(p.Field <string>("nhom_in_cls"))) != "" select p.Field <string>("nhom_in_cls") ).Distinct().ToList(); if (lstNhominCls.Count > 1) { string tenphieuchidinh = THU_VIEN_CHUNG.Laygiatrithamsohethong("CLS_TENPHIEU_INCHUNG", "PHIẾU CHỈ ĐỊNH CẬN LÂM SÀNG", true); foreach (DataRow dr in dt.Rows) { dr["ten_nhominphieucls"] = tenphieuchidinh; } } } var objForm = new frmPrintPreview("IN PHIẾU CHỈ ĐỊNH", crpt, true, true) { mv_sReportFileName = Path.GetFileName(reportname), mv_sReportCode = reportCode }; try { crpt.SetDataSource(dt); Utility.SetParameterValue(crpt, "ParentBranchName", globalVariables.ParentBranch_Name); Utility.SetParameterValue(crpt, "BranchName", globalVariables.Branch_Name); Utility.SetParameterValue(crpt, "Address", globalVariables.Branch_Address); Utility.SetParameterValue(crpt, "txtTrinhky", Utility.getTrinhky(objForm.mv_sReportFileName, globalVariables.SysDate)); if (!inTach && selectedIndex == 0) { foreach (DataRow dr in dt.Rows) { dr[VKcbChidinhcl.Columns.TenNhominphieucls] = THU_VIEN_CHUNG.Laygiatrithamsohethong("TIEUDE_PHIEUCHIDNHCLS_INCHUNG", "PHIẾU CHỈ ĐỊNH", true); } } else { Utility.SetParameterValue(crpt, "TitleReport", tieude); } Utility.SetParameterValue(crpt, "CurrentDate", Utility.FormatDateTimeWithLocation(globalVariables.SysDate, globalVariables.gv_strDiadiem)); objForm.crptViewer.ReportSource = crpt; if (Utility.isPrintPreview(PropertyLib._MayInProperties.TenMayInBienlai, PropertyLib._MayInProperties.PreviewInCLS)) { objForm.SetDefaultPrinter(PropertyLib._MayInProperties.TenMayInBienlai, 0); objForm.ShowDialog(); mayin = PropertyLib._MayInProperties.TenMayInBienlai; } else { objForm.addTrinhKy_OnFormLoad(); crpt.PrintOptions.PrinterName = PropertyLib._MayInProperties.TenMayInBienlai; mayin = PropertyLib._MayInProperties.TenMayInBienlai; crpt.PrintToPrinter(1, false, 0, 0); } } catch (Exception ex) { Utility.ShowMsg("Lỗi:" + ex.Message); return(ActionResult.Error); // Utility.DefaultNow(this); } finally { Utility.FreeMemory(crpt); } } catch (Exception ex) { Utility.ShowMsg("Lỗi:" + ex.Message); } finally { GC.Collect(); } } scope.Complete(); return(ActionResult.Success); } }
public void txtMaluotkham_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter && Utility.DoTrim(txtMaluotkham.Text) != "") { var dtPatient = new DataTable(); objLuotkham = null; string _patient_Code = Utility.AutoFullPatientCode(txtMaluotkham.Text); ClearControls(); //dtPatient = new KCB_THAMKHAM().TimkiemBenhnhan(txtMaluotkham.Text, // -1,0, 0); //DataRow[] arrPatients = dtPatient.Select(KcbLuotkham.Columns.MaLuotkham + "='" + _patient_Code + "'"); //if (arrPatients.GetLength(0) <= 0) //{ // if (dtPatient.Rows.Count > 1) // { // var frm = new frm_DSACH_BN_TKIEM(); // frm.MaLuotkham = txtMaluotkham.Text; // frm.dtPatient = dtPatient; // frm.ShowDialog(); // if (!frm.has_Cancel) // { // txtMaluotkham.Text = frm.MaLuotkham; // } // } //} //else //{ // txtMaluotkham.Text = _patient_Code; //} txtMaluotkham.Text = _patient_Code; DataTable dt_Patient = new KCB_THAMKHAM().TimkiemThongtinBenhnhansaukhigoMaBN(txtMaluotkham.Text, -1, globalVariables.MA_KHOA_THIEN); if (dt_Patient != null && dt_Patient.Rows.Count > 0) { txtIdBn.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbDanhsachBenhnhan.Columns.IdBenhnhan], ""); objLuotkham = new Select().From(KcbLuotkham.Schema).Where(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(txtIdBn.Text) .And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(txtMaluotkham.Text) .ExecuteSingle <KcbLuotkham>(); txtTenBN.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbDanhsachBenhnhan.Columns.TenBenhnhan], ""); txttuoi.Text = Utility.sDbnull(dt_Patient.Rows[0]["Tuoi"], ""); txtgioitinh.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbDanhsachBenhnhan.Columns.GioiTinh], ""); txtDiaChi.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbDanhsachBenhnhan.Columns.DiaChi], ""); txtmatheBhyt.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbLuotkham.Columns.MatheBhyt], ""); txtKhoanoitru.Text = Utility.sDbnull(dt_Patient.Rows[0]["ten_khoaphong_noitru"], ""); txtBuong.Text = Utility.sDbnull(dt_Patient.Rows[0][NoitruDmucBuong.Columns.TenBuong], ""); txtGiuong.Text = Utility.sDbnull(dt_Patient.Rows[0][NoitruDmucGiuongbenh.Columns.TenGiuong], ""); txtIdkhoanoitru.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbLuotkham.Columns.IdKhoanoitru], "-1"); txtIdravien.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbLuotkham.Columns.IdRavien], "-1"); txtidBuong.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbLuotkham.Columns.IdBuong], "-1"); txtidgiuong.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbLuotkham.Columns.IdGiuong], "-1"); txtThuocsudung.Text = Utility.sDbnull(dt_Patient.Rows[0]["thuoc_sudung"], ""); txtMaBenhChinh.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbLuotkham.Columns.MabenhChinh], ""); txtChandoan.Text = Utility.sDbnull(dt_Patient.Rows[0]["chan_doan"], ""); txtketquaCls.Text = Utility.sDbnull(dt_Patient.Rows[0]["ketqua_cls"], ""); objPhieuchuyenvien = new Select().From(KcbPhieuchuyenvien.Schema) .Where(KcbPhieuchuyenvien.Columns.IdBenhnhan).IsEqualTo(txtIdBn.Text) .And(KcbPhieuchuyenvien.Columns.MaLuotkham).IsEqualTo(txtMaluotkham.Text) .ExecuteSingle <KcbPhieuchuyenvien>(); if (objPhieuchuyenvien != null) { txtId.Text = objPhieuchuyenvien.IdPhieu.ToString(); txtsochuyenvien.Text = Utility.sDbnull(objPhieuchuyenvien.SoChuyentuyen); txtNoichuyenden.SetId(objPhieuchuyenvien.IdBenhvienChuyenden); txtdauhieucls._Text = objPhieuchuyenvien.DauhieuCls; txtketquaCls.Text = objPhieuchuyenvien.KetquaXnCls; txtChandoan.Text = Utility.sDbnull(objPhieuchuyenvien.ChanDoan, ""); txtMaBenhChinh.Text = Utility.sDbnull(objPhieuchuyenvien.Mabenh, ""); txtThuocsudung.Text = objPhieuchuyenvien.ThuocSudung; txtTrangthainguoibenh._Text = objPhieuchuyenvien.TrangthaiBenhnhan; txtHuongdieutri._Text = objPhieuchuyenvien.HuongDieutri; txtphuongtienvc._Text = objPhieuchuyenvien.PhuongtienChuyen; txtNguoivanchuyen.Text = objPhieuchuyenvien.TenNguoichuyen; cboDoctorAssign.SelectedIndex = Utility.GetSelectedIndex(cboDoctorAssign, Utility.sDbnull(objPhieuchuyenvien.IdBacsiChuyenvien, "-1")); cmdPrint.Enabled = true; cmdHuy.Enabled = true; } else { txtsochuyenvien.Text = Utility.sDbnull(GetmaxSoChuyenVien()); cmdPrint.Enabled = false; cmdHuy.Enabled = false; } m_enAct = objPhieuchuyenvien == null ? action.Insert : action.Update; if (m_enAct == action.Insert) { cmdPrint.Enabled = false; } else { cmdPrint.Enabled = true; } dtNgaychuyenvien.Focus(); } } } catch (Exception ex) { Utility.ShowMsg("Lỗi: " + ex.Message); } finally { AllowTextChanged = true; } }
public static ActionResult NoitruInTachToanBoPhieuCls(int idBenhnhan, string maLuotkham, int vAssignId, string vAssignCode, List <string> listnhomincls, int selectedIndex, bool inTach, DateTime ngayin, ref string mayin) { using (var scope = new TransactionScope()) { using (new SharedDbConnectionScope()) { try { mayin = ""; DataTable dtAll = new KCB_THAMKHAM().KcbThamkhamLaydulieuInphieuCls(idBenhnhan, maLuotkham, vAssignCode, "ALL").Tables[0]; foreach (string nhomcls in listnhomincls.ToList()) { // KcbChidinhcl objAssignInfo = KcbChidinhcl.FetchByID(v_AssignId); DataTable dt = dtAll.Select("nhom_in_cls = '" + nhomcls + "'").CopyToDataTable(); if (dt == null || dt.Rows.Count <= 0) { Utility.ShowMsg("Không có dữ liệu in. Mời bạn kiểm tra lại"); //return; } else { // THU_VIEN_CHUNG.CreateXML(dt, "Thamkham_InTachToanBophieuCLS.XML"); Utility.UpdateLogotoDatatable(ref dt); string manhomcls = nhomcls; string tieude = ""; ReportDocument crpt = Utility.GetReport(manhomcls, ref tieude, ref manhomcls); if (crpt == null) { return(ActionResult.Error); } try { var objForm = new frmPrintPreview("IN PHIẾU CHỈ ĐỊNH", crpt, true, true) { mv_sReportFileName = Path.GetFileName(manhomcls), mv_sReportCode = manhomcls }; crpt.SetDataSource(dt); //crpt.DataDefinition.FormulaFields["Formula_1"].Text = Strings.Chr(34) + " Nhân viên Bác sĩ chỉ định ".Replace("#$X$#", Strings.Chr(34) + "&Chr(13)&" + Strings.Chr(34)) + Strings.Chr(34); Utility.SetParameterValue(crpt, "ParentBranchName", globalVariables.ParentBranch_Name); Utility.SetParameterValue(crpt, "BranchName", globalVariables.Branch_Name); Utility.SetParameterValue(crpt, "sTitleReport", tieude); Utility.SetParameterValue(crpt, "Address", globalVariables.Branch_Address); Utility.SetParameterValue(crpt, "txtTrinhky", Utility.getTrinhky(objForm.mv_sReportFileName, globalVariables.SysDate)); if (!inTach && selectedIndex == 0) { foreach (DataRow dr in dt.Rows) { dr[VKcbChidinhcl.Columns.TenNhominphieucls] = THU_VIEN_CHUNG.Laygiatrithamsohethong("TIEUDE_PHIEUCHIDNHCLS_INCHUNG", "PHIẾU CHỈ ĐỊNH", true); } } else { Utility.SetParameterValue(crpt, "TitleReport", tieude); } Utility.SetParameterValue(crpt, "CurrentDate", Utility.FormatDateTimeWithLocation( ngayin, globalVariables.gv_strDiadiem)); objForm.crptViewer.ReportSource = crpt; if (Utility.isPrintPreview(PropertyLib._MayInProperties.TenMayInBienlai, PropertyLib._MayInProperties.PreviewInCLS)) { objForm.SetDefaultPrinter(PropertyLib._MayInProperties.TenMayInBienlai, 0); objForm.ShowDialog(); mayin = PropertyLib._MayInProperties.TenMayInBienlai; } else { objForm.addTrinhKy_OnFormLoad(); crpt.PrintOptions.PrinterName = PropertyLib._MayInProperties.TenMayInBienlai; mayin = PropertyLib._MayInProperties.TenMayInBienlai; crpt.PrintToPrinter(1, false, 0, 0); } } catch (Exception ex) { Utility.ShowMsg("Lỗi:" + ex.Message); // Utility.DefaultNow(this); } finally { Utility.FreeMemory(crpt); } } } } catch (Exception ex) { Utility.ShowMsg("Lỗi:" + ex.Message); return(ActionResult.Error); } } scope.Complete(); return(ActionResult.Success); } }
public void txtMaluotkham_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter && Utility.DoTrim(txtMaluotkham.Text) != "") { AllowTextChanged = false; var dtPatient = new DataTable(); objLuotkham = null; string _patient_Code = Utility.AutoFullPatientCode(txtMaluotkham.Text); ClearControls(); dtPatient = new KCB_THAMKHAM().TimkiemBenhnhan(txtMaluotkham.Text, -1, 1, 0); DataRow[] arrPatients = dtPatient.Select(KcbLuotkham.Columns.MaLuotkham + "='" + _patient_Code + "'"); if (arrPatients.GetLength(0) <= 0) { if (dtPatient.Rows.Count > 1) { var frm = new frm_DSACH_BN_TKIEM("ALL"); frm.MaLuotkham = txtMaluotkham.Text; frm.dtPatient = dtPatient; frm.ShowDialog(); if (!frm.has_Cancel) { txtMaluotkham.Text = frm.MaLuotkham; } } } else { txtMaluotkham.Text = _patient_Code; } DataTable dt_Patient = new KCB_THAMKHAM().NoitruTimkiemThongtinBenhnhansaukhigoMaBN(txtMaluotkham.Text, -1, "ALL"); if (dt_Patient != null && dt_Patient.Rows.Count > 0) { txtIdBn.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbDanhsachBenhnhan.Columns.IdBenhnhan], ""); objLuotkham = new Select().From(KcbLuotkham.Schema) .Where(KcbLuotkham.Columns.IdBenhnhan) .IsEqualTo(txtIdBn.Text) .And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(txtMaluotkham.Text) .ExecuteSingle <KcbLuotkham>(); dtpNgaynhapvien.Value = objLuotkham.NgayNhapvien.Value; txtTenBN.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbDanhsachBenhnhan.Columns.TenBenhnhan], ""); txttuoi.Text = Utility.sDbnull(dt_Patient.Rows[0]["Tuoi"], ""); txtgioitinh.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbDanhsachBenhnhan.Columns.GioiTinh], ""); txtDiachi.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbDanhsachBenhnhan.Columns.DiaChi], ""); txtmatheBhyt.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbLuotkham.Columns.MatheBhyt], ""); txtKhoanoitru.Text = Utility.sDbnull(dt_Patient.Rows[0]["ten_khoaphong_noitru"], ""); txtBuong.Text = Utility.sDbnull(dt_Patient.Rows[0][NoitruDmucBuong.Columns.TenBuong], ""); txtGiuong.Text = Utility.sDbnull(dt_Patient.Rows[0][NoitruDmucGiuongbenh.Columns.TenGiuong], ""); txtBenhchinh.SetCode(Utility.sDbnull(dt_Patient.Rows[0]["mabenh_chinh"], "")); txtIdkhoanoitru.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbLuotkham.Columns.IdKhoanoitru], "-1"); txtIdravien.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbLuotkham.Columns.IdRavien], "-1"); txtidBuong.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbLuotkham.Columns.IdBuong], "-1"); txtidgiuong.Text = Utility.sDbnull(dt_Patient.Rows[0][KcbLuotkham.Columns.IdGiuong], "-1"); cmdChuyen.Enabled = true; if (objLuotkham.TrangthaiNoitru == 0) { Utility.ShowMsg( "Bệnh nhân chưa vào nội trú nên không thể lập phiếu ra viện. Đề nghị bạn kiểm tra lại"); cmdChuyen.Enabled = false; return; } cmdChuyen.Enabled = objLuotkham != null && objLuotkham.TrangthaiNoitru <= 3; LoadData(); dtpNgayravien.Focus(); } } } catch (Exception) { Utility.ShowMsg("Có lỗi trong quá trình lấy thông tin bệnh nhân"); } finally { AllowTextChanged = true; } }