Exemplo n.º 1
0
 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()); }
 }
        public ThemLuotThuocDialog(LuotThuoc lt, bool isObserve)
        {
            InitializeComponent();
            this.lt = lt;
            TenThuocLabel.Content = lt.Thuoc;
            this.isObserve        = isObserve;
            if (isObserve)
            {
                AdjustAmountPanel.Visibility = Visibility.Hidden;
            }
            Thuoc thuoc = ThuocDAO.getThuoc(lt.Thuoc);

            DonViLabel.Content  = "Don vi tinh: " + thuoc.DonVi;
            DonGiaLabel.Content = "Don gia: " + thuoc.DonGia;
            CachDungLabel.Text  = "Cach dung: " + thuoc.CachDung;
        }
Exemplo n.º 3
0
        public static int addOrUpdateThuoc(string tenthuoc, string donvi, string cachdung, double dongia)
        {
            Thuoc thuoc = ThuocDAO.getThuoc(tenthuoc);

            if (thuoc == null)
            {
                thuoc = new QuanLyPhongKham.Thuoc();
            }
            thuoc.TenThuoc = tenthuoc;
            thuoc.DonVi    = donvi;
            thuoc.DonGia   = dongia;
            thuoc.CachDung = cachdung;
            int res = ThuocDAO.addOrUpdateThuoc(tenthuoc, thuoc);

            if (res == 1)
            {
                bindingListAllThuoc.Add(thuoc);
                listAllThuoc.Add(thuoc);
            }
            if (res == 0)
            {
                foreach (Thuoc t in bindingListAllThuoc)
                {
                    if (t.TenThuoc.Equals(tenthuoc))
                    {
                        t.DonVi    = donvi;
                        t.DonGia   = dongia;
                        t.CachDung = cachdung;
                    }
                }
                foreach (Thuoc t in listAllThuoc)
                {
                    if (t.TenThuoc.Equals(tenthuoc))
                    {
                        t.DonVi    = donvi;
                        t.DonGia   = dongia;
                        t.CachDung = cachdung;
                    }
                }
            }
            return(res);
        }
Exemplo n.º 4
0
        private void LichSuXemThuocBtn_Click(object sender, RoutedEventArgs e)
        {
            ICollection <LuotThuoc> list = LuotKhamDAO
                                           .getLuotKham((LichSuKhamListView.SelectedItem as LuotKham).ID).LuotThuocs;
            StringBuilder builder = new StringBuilder();

            builder.Append("Ke toa thuoc: ");
            builder.Append(Environment.NewLine);
            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);
            }
            TextDialog dialog = new TextDialog("Toa thuoc", builder.ToString());

            dialog.ShowDialog();
        }