private void cmdKhamUuTien_Click(object sender, EventArgs e) { Utility.WaitNow(this); UIAction._EnableControl(cmdKhamUuTien, false, ""); bool RestoreStatus = true; try { loaisoqms = "SOKHAM"; if (Reprint) { KcbQm objQms = new Select().From(KcbQm.Schema) .Where(KcbQm.Columns.SoQms).IsEqualTo(Utility.Int32Dbnull(txtSoKhamUuTien.Text, 0)) .And(KcbQm.Columns.LoaiQms).IsEqualTo(0) .And(KcbQm.Columns.MaKhoakcb).IsEqualTo(_QMSProperties.MaKhoaKhamBenh) .And(KcbQm.Columns.MaDoituongKcb).IsEqualTo("ALL") .ExecuteSingle <KcbQm>(); if (objQms == null) { Utility.ShowMsg("Số QMS bạn muốn in lại chưa được tạo hoặc không tồn tại. Đề nghị bạn nhập số khác"); RestoreStatus = false; txtSoKhamUuTien.SelectAll(); txtSoKhamUuTien.Focus(); return; } this.InPhieuKham(_QMSProperties.TenKhoaKhamBenh, this.cmdKhamUuTien, Utility.sDbnull(objQms.SoQms), _QMSProperties.Souutien); return; } int soluong = 1; if (chkLaythemsouutien.Checked) { soluong = (int)nmrLaythemsoUutien.Value; } for (int i = 1; i <= soluong; i++) { this.LaySokham(1, txtSoKhamUuTien, Utility.sDbnull(_QMSProperties.MaKhoaKhamBenh), _QMSProperties.madoituonguutien, 0, 1); if (_QMSProperties.PrintStatus) { this.InPhieuKham(_QMSProperties.TenKhoaKhamBenh, this.cmdKhamUuTien, Utility.sDbnull(txtSoKhamUuTien.Text), _QMSProperties.Souutien); } } Utility.DefaultNow(this); } catch (Exception ex) { Utility.CatchException(ex); } finally { if (RestoreStatus) { Reprint = false; txtSoKhamUuTien.BackColor = cmdKhamUuTien.BackColor; txtSoKhamUuTien.ReadOnly = true; // cmdKhamUuTien.Text = cmdKhamUuTien.Tag.ToString(); mnuReprint.Checked = false; } UIAction._EnableControl(cmdKhamUuTien, true, ""); } }
private void InPhieuKham(string tenkhoa, Button button, string sokham, string tensoQMS) { try { string val = tensoQMS; Utility.WaitNow(this); UIAction._EnableControl(button, false, ""); DataTable dataTable = new DataTable(); Utility.AddColumToDataTable(ref dataTable, "So_Kham", typeof(string)); DataRow row = dataTable.NewRow(); row["So_Kham"] = Utility.sDbnull(sokham); dataTable.Rows.Add(row); CRPT_SOKHAM crpt_sokham = new CRPT_SOKHAM(); crpt_sokham.SetDataSource(dataTable); crpt_sokham.SetParameterValue("TEN_BENH_VIEN", _QMSProperties.TenBenhVien); string str2 = NgayIn(DateTime.Now); crpt_sokham.SetParameterValue("PrintDate", str2); if (loaisoqms == "SOKHAM") { crpt_sokham.SetParameterValue("TenKhoa", Utility.sDbnull(tenkhoa)); } else { crpt_sokham.SetParameterValue("TenKhoa", Utility.sDbnull(_QMSProperties.TenKhoaKhamBenhKhac)); } crpt_sokham.SetParameterValue("LoaiDoiTuong", val); if (loaisoqms == "SOKHAM") { crpt_sokham.SetParameterValue("NoiChokham", _QMSProperties.QuaySokham); } else { crpt_sokham.SetParameterValue("NoiChokham", _QMSProperties.QuaySokhac); } if (!string.IsNullOrEmpty(_QMSProperties.PrinterName)) { crpt_sokham.PrintOptions.PrinterName = Utility.sDbnull(_QMSProperties.PrinterName); } crpt_sokham.PrintToPrinter(1, false, 0, 0); UIAction._EnableControl(button, true, ""); button.Focus(); } catch (Exception ex) { Utility.ShowMsg("Lỗi khi in số khám\n" + ex.Message); } finally { UIAction._EnableControl(button, true, ""); Utility.DefaultNow(this); } }
private void InPhieuKham(string tenkhoa, Button button, string sokham, int isUuTien) { try { string val = "BỆNH NHÂN THƯỜNG"; if (ma_KhoaKcb == "KKB") { val = (isUuTien == 0) ? "BỆNH NHÂN THƯỜNG" : "BỆNH NHÂN ƯU TIÊN"; } UIAction._EnableControl(button, false, ""); DataTable dataTable = new DataTable(); Utility.AddColumToDataTable(ref dataTable, "So_Kham", typeof(string)); DataRow row = dataTable.NewRow(); row["So_Kham"] = Utility.sDbnull(sokham); dataTable.Rows.Add(row); CRPT_SOKHAM crpt_sokham = new CRPT_SOKHAM(); crpt_sokham.SetDataSource(dataTable); crpt_sokham.SetParameterValue("TEN_BENH_VIEN", _QMSProperties.TenBenhVien); string str2 = NgayIn(DateTime.Now); crpt_sokham.SetParameterValue("PrintDate", str2); crpt_sokham.SetParameterValue("TenKhoa", Utility.sDbnull(tenkhoa)); crpt_sokham.SetParameterValue("LoaiDoiTuong", val); if (!string.IsNullOrEmpty(_QMSProperties.PrinterName)) { crpt_sokham.PrintOptions.PrinterName = Utility.sDbnull(_QMSProperties.PrinterName); } crpt_sokham.PrintToPrinter(1, false, 0, 0); UIAction._EnableControl(button, true, ""); button.Focus(); } catch (Exception ex) { Utility.ShowMsg("Lỗi khi in số khám\n" + ex.Message); } finally { UIAction._EnableControl(button, true, ""); } }
void cmdGetQMS_Click(object sender, EventArgs e) { UIAction._EnableControl(cmdGetQMS, false, ""); bool RestoreStatus = true; try { int LaysoUutien = chkSoUutien.IsChecked ? 1 : SoUutien; if (Reprint) { KcbQm objQms = new Select().From(KcbQm.Schema) .Where(KcbQm.Columns.SttKham).IsEqualTo(Utility.Int32Dbnull(lblQMSNumber.Text, 0)) .And(KcbQm.Columns.LoaiQms).IsEqualTo(LaysoUutien) .And(KcbQm.Columns.IdDichvukcb).IsEqualTo(id_dichvukcb) .ExecuteSingle <KcbQm>(); if (objQms == null) { Utility.ShowMsg("Số thứ tự khám bạn muốn in lại chưa được tạo hoặc không tồn tại. Đề nghị bạn nhập số khác"); RestoreStatus = false; lblQMSNumber.SelectAll(); lblQMSNumber.Focus(); return; } this.InPhieuKham(_QMSProperties.TenKhoaKhamBenh, this.cmdGetQMS, Utility.sDbnull(objQms.SoQms), LaysoUutien); return; } int soluong = 1; if (chkMore.Checked) { soluong = (int)nmrMore.Value; } for (int i = 1; i <= soluong; i++) { string qmsNumber = ""; this.LaySokham(1, lblQMSNumber, Utility.sDbnull(ma_KhoaKcb), ma_doituong_kcb, LaysoUutien, ref qmsNumber); if (_QMSProperties.PrintStatus) { this.InPhieuKham(_QMSProperties.TenKhoaKhamBenh, this.cmdGetQMS, qmsNumber, LaysoUutien); } } if (_QMSProperties.SleepTime > 10) { Thread.Sleep(_QMSProperties.SleepTime); } } catch (Exception ex) { Utility.CatchException(ex); } finally { if (RestoreStatus) { Reprint = false; lblQMSNumber.BackColor = cmdGetQMS.BackColor; lblQMSNumber.ReadOnly = true; mnuReprint.Checked = false; if (Utility.DoTrim(tenhienthi) != "") { cmdGetQMS.Text = tenhienthi; } } UIAction._EnableControl(cmdGetQMS, true, ""); } }