Пример #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            tt    = 0;
            stt   = 1;
            hdBus = new HoadonBUS();

            HoadonDTO hd = new HoadonDTO();

            load_TenBN();
            load_data(mapkb.Text);
            string tthuoc = hdBus.tienthuoc(hd, mapkb.Text).ToString();

            System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo("en-US");
            decimal value = decimal.Parse(tthuoc, System.Globalization.NumberStyles.AllowThousands);

            tienthuoc.Text = String.Format(culture, "{0:N0}", value);
            tienthuoc.Select(tienthuoc.Text.Length, 0);
            decimal value1 = decimal.Parse(PhieukhambenhDTO.TienKham.ToString(), System.Globalization.NumberStyles.AllowThousands);

            tienkham.Text = String.Format(culture, "{0:N0}", value1);
            tienkham.Select(tienkham.Text.Length, 0);
            string ttien = (float.Parse(tthuoc) + PhieukhambenhDTO.TienKham).ToString();

            tt = float.Parse(tthuoc) + tkham;
            decimal value2 = decimal.Parse(ttien, System.Globalization.NumberStyles.AllowThousands);

            tongtien.Text = String.Format(culture, "{0:N0}", value2);
            tongtien.Select(tongtien.Text.Length, 0);
        }
Пример #2
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     if (mapkb.Text == "")
     {
         MessageBox.Show("Vui lòng chọn phiếu khám bệnh");
     }
     else
     {
         HoadonDTO hd = new HoadonDTO();
         hd.MaHd     = mahd.Text.ToString();
         hd.TongTien = tt;
         hd.MaPkb    = mapkb.Text;
         hd.NgayHd   = DateTime.UtcNow.Date;
         hdBus       = new HoadonBUS();
         bool kq = hdBus.them(hd);
         if (kq == false)
         {
             MessageBox.Show("Lưu hóa đơn thất bại. Vui lòng kiểm tra lại dũ liệu", "Result", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
         }
         else
         {
             MessageBox.Show("Lưu hóa đơn thành công", "Result");
         }
     }
 }
Пример #3
0
        public void LapHoaDon()
        {
            HoadonDTO hd = new HoadonDTO();

            hdbus  = new HoadonBUS();
            pkbbus = new PhieukhambenhBUS();
            pkbbus.tk();
            hd.MaHd     = hdbus.autogenerate_mahd().ToString();
            hd.TongTien = hdbus.tienthuoc(hd, "2") + PhieukhambenhDTO.TienKham;
            hd.MaPkb    = "2";
            hd.NgayHd   = DateTime.UtcNow.Date;
            //Assert.AreEqual(true, hdbus.them(hd));
            Assert.AreEqual(100000, hd.TongTien);
        }
Пример #4
0
        public void Kiemtradoanhthu()
        {
            HoadonDTO hd = new HoadonDTO();

            hdbus = new HoadonBUS();
            List <HoadonDTO> listHoadon   = hdbus.selectByMonth("6", "2020");
            float            tongdoanhthu = 0;

            foreach (HoadonDTO hdls in listHoadon)
            {
                string ngkham;
                ngkham        = String.Format("{0:M/d/yyyy}", hdls.NgayHd);
                tongdoanhthu += float.Parse(hdbus.doanhthu(ngkham).ToString());
            }
            Assert.AreEqual(180000, tongdoanhthu);
        }
Пример #5
0
        public float tienthuoc(HoadonDTO hd, string mapkb)
        {
            float re = hdDAL.tienthuoc(hd, mapkb);

            return(re);
        }
Пример #6
0
        public bool them(HoadonDTO hd)
        {
            bool re = hdDAL.them(hd);

            return(re);
        }