private void KhamBenhBtn_Click(object sender, RoutedEventArgs e) { try { if (DSLuotKhamListView.SelectedIndex == -1) { return; } ThongTinLuotKhamTab.IsEnabled = true; BenhNhan bn = DSLuotKhamListView.SelectedItem as BenhNhan; LuotKham lk = LuotKhamDAO.getLuotKhamBaseOnDateAndPatient(DateTime.Today.ToString("dd/MM/yyyy"), bn.CMND); Bussiness.currentLuotKhamID = -1; BenhComboBox.SelectedItem = lk.Benh; Bussiness.currentLuotKhamID = lk.ID; LuotKhamIDLabel.Content = "ID: " + lk.ID; BenhComboBox.SelectedItem = lk.Benh; if (!lk.Benh.Equals("")) { Benh b = BenhDAO.getBenh(lk.Benh); TrieuChungTxtBlock.Text = b.TrieuChung; } TienKhamTxtBlock.Text = "Tien kham: " + lk.TienKham.ToString(); TienThuocTxtBlock.Text = "Tien thuoc: " + lk.TienThuoc.ToString(); TongChiPhiTxtBlock.Text = "Tong chi phi: " + lk.ChiPhi.ToString(); UserInfoTxtBlock.Text = bn.HoTen; Bussiness.listLuotThuoc.Clear(); foreach (LuotThuoc lt in lk.LuotThuocs) { Bussiness.listLuotThuoc.Add(lt); } ThongTinLuotKhamTab.IsSelected = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void LuotKhamRemoveBtn_Click(object sender, RoutedEventArgs e) { if (DSLuotKhamListView.SelectedIndex == -1) { return; } resetLuotKhamTab(); BenhNhan bn = DSLuotKhamListView.SelectedItem as BenhNhan; LuotKham lk = LuotKhamDAO.getLuotKhamBaseOnDateAndPatient(DateTime.Today.ToString("dd/MM/yyyy"), bn.CMND); Bussiness.removeLuotKham(lk.ID); }
private void HoaDonBtn_Click(object sender, RoutedEventArgs e) { try { if (DSLuotKhamListView.SelectedIndex == -1) { return; } StringBuilder builder = new StringBuilder(); LuotKham lk = LuotKhamDAO .getLuotKhamBaseOnDateAndPatient(DateTime.Today.ToString("dd/MM/yyyy") , (DSLuotKhamListView.SelectedItem as BenhNhan).CMND); builder.Append("-----HOA DON THANH TOAN-----"); builder.Append(Environment.NewLine); builder.Append("Thong tin benh nhan"); builder.Append(Environment.NewLine); BenhNhan bn = BenhNhanDAO.getBenhNhan(lk.BenhNhan); builder.Append(">Ho ten: " + bn.HoTen); builder.Append(Environment.NewLine); builder.Append(">So CMND: " + bn.CMND); builder.Append(Environment.NewLine); builder.Append("Thong tin kham benh:"); builder.Append(Environment.NewLine); builder.Append(">Ten benh: " + lk.Benh); builder.Append(Environment.NewLine); builder.Append("Ke toa thuoc:"); builder.Append(Environment.NewLine); ICollection <LuotThuoc> list = lk.LuotThuocs; foreach (LuotThuoc lt in list) { builder.Append(">"); builder.Append(lt.Thuoc); Thuoc thuoc = ThuocDAO.getThuoc(lt.Thuoc); builder.Append(" - "); builder.Append(lt.SoLuong + " " + thuoc.DonVi); builder.Append(" - "); builder.Append(lt.ChiPhi + "VND"); builder.Append(Environment.NewLine); } builder.Append("---------------------------" + Environment.NewLine); builder.Append("Tien kham: " + lk.TienKham); builder.Append(" + Tien thuoc: " + lk.TienThuoc); builder.Append(Environment.NewLine); builder.Append("Tong chi phi: " + lk.ChiPhi); TextDialog dialog = new TextDialog("Hoa don", builder.ToString()); dialog.ShowDialog(); }catch (Exception ex) { MessageBox.Show(ex.ToString()); } }