Ejemplo n.º 1
0
        private void PhucVu_Load(object sender, EventArgs e)
        {
            //loi chao
            labelChao.Text = DangNhap._manhanvien;

            lbBan.Text = DSBan._ban;

            int ban = int.Parse(lbBan.Text);

            //neu ban chua dat
            if (DSBan.mang[ban - 1, 1] == -1)
            {
                btnLapHoaDonMoi.Visible = true;
                btnGiaiPhongBan.Visible = false;
            }
            else //neu ban da co
            {
                btnLapHoaDonMoi.Visible = false;
                btnGiaiPhongBan.Visible = true;
                //load ds loai
                dataGridView1.DataSource = LoaiMon_BUS.LoadDSLoaiMon();
                //load mon an trong hd vao data3
                dataGridView3.DataSource = CTHD_BUS.LoadCTHDTheoMHD(DSBan.mang[ban - 1, 1]);
                //cap nhat lb MHD
                lbMHD.Text = DSBan.mang[ban - 1, 1].ToString();
                //cap nhat tong tien
                float kq   = 0;
                int   dong = dataGridView3.RowCount;
                for (int i = 0; i < dong; i++)
                {
                    kq += float.Parse(dataGridView3.Rows[i].Cells[1].Value.ToString()) * float.Parse(dataGridView3.Rows[i].Cells[2].Value.ToString());
                }
                txtTongTien.Text = kq.ToString();
            }
        }
Ejemplo n.º 2
0
        private void btnThemMon_Click(object sender, EventArgs e)
        {
            if (txtSoLuong.Text == "")
            {
                MessageBox.Show("Vui lòng nhập số lượng!");
            }
            //Them mon vao cthd
            CTHD_DTO cthd = new CTHD_DTO(int.Parse(lbMHD.Text), lbMon.Text, float.Parse(lbDonGia.Text), int.Parse(txtSoLuong.Text));
            bool     kq   = CTHD_BUS.ThemCTHD(cthd);

            if (kq == false)
            {
                MessageBox.Show("loi!");
            }
            else
            {
                dataGridView3.DataSource = CTHD_BUS.LoadCTHDTheoMHD(int.Parse(lbMHD.Text));
            }
            //hien thi ds
            //cap nhat tong tien
            float tongtien = 0;
            int   dong     = dataGridView3.RowCount;

            for (int i = 0; i < dong; i++)
            {
                tongtien += float.Parse(dataGridView3.Rows[i].Cells[1].Value.ToString()) * float.Parse(dataGridView3.Rows[i].Cells[2].Value.ToString());
            }
            txtTongTien.Text = tongtien.ToString();
        }
Ejemplo n.º 3
0
 private void rd_luu_Click(object sender, EventArgs e)
 {
     if (dgv_thuoc.Rows.Count > 0)
     {
         int now  = dgv_danhsachck.CurrentCell.RowIndex;
         int k    = int.Parse(dgv_thuoc.Rows[now].Cells[0].Value.ToString());
         int MaBN = int.Parse(PHIEUKHAMBENH_BUS.LoadChoKham().Rows[k - 1][0].ToString());
         int MaBE = HAMPHU_BUS.FMaBenh(txt_dudoan.Text);
         PHIEUKHAMBENH_DTO PKB = new PHIEUKHAMBENH_DTO(MaBN, MaBE, txt_trieuchung.Text);
         PHIEUKHAMBENH_BUS.ThemPhieuKhamBenh(PKB);
         foreach (DataGridViewRow row in dgv_thuoc.Rows)
         {
             if (row.Cells[1].Value != null)
             {
                 int MaTH = HAMPHU_BUS.FMaThuoc(row.Cells[1].Value.ToString());
                 int MaDV = HAMPHU_BUS.FMaDonVi(row.Cells[2].Value.ToString());
                 int MaCD = HAMPHU_BUS.FMaCachDung(row.Cells[4].Value.ToString());
                 int MaPK = HAMPHU_BUS.FMaPhieuKham(MaBN, MaBE);
                 CT_PHIEUKHAMBENH_DTO CTPKB = new CT_PHIEUKHAMBENH_DTO(MaPK, MaTH, MaDV, int.Parse(row.Cells[3].Value.ToString()), MaCD);
                 CT_PHIEUKHAMBENH_BUS.ThemChiTiet(CTPKB);
             }
         }
         HOADON_BUS.TaoHoaDon(MaBN);
         CTHD_BUS.TaoCTHoaDon(MaBN);
         int n = dgv_danhsachck.Rows.Count;
         for (int i = 1; i < n; i++)
         {
             dgv_danhsachck.Rows.RemoveAt(0);
         }
         LoadData();
         dgv_danhsachck_SelectionChanged(sender, e);
         luu = 1;
         rd_luu_MouseLeave(sender, e);
         timer1.Start();
         timer1.Enabled         = true;
         lbl_thongbao.ForeColor = Color.Red;
         lbl_thongbao.Text      = "Lưu thành công";
         timer1_Tick(sender, e);
     }
     else
     {
         if (txt_trieuchung.Text == "" || txt_dudoan.Text == "")
         {
             DevComponents.DotNetBar.MessageBoxEx.Show("Bạn chưa nhập đầy đủ thông tin của một phiếu khám bệnh!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             if (txt_trieuchung.Text == "")
             {
                 txt_trieuchung.Focus();
             }
             else
             {
                 txt_dudoan.Focus();
             }
         }
         else
         {
             DevComponents.DotNetBar.MessageBoxEx.Show("Bạn chưa nhập chi tiết phiếu khám bệnh!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             txt_thuoc.Focus();
         }
     }
 }
Ejemplo n.º 4
0
        public void LoadDataThuoc(int MaHD)
        {
            int n = dgv_thuoc.Rows.Count;

            for (int i = 1; i < n; i++)
            {
                dgv_thuoc.Rows.RemoveAt(0);
            }
            //load benh nhan da kham
            int chiso = 1;

            foreach (DataRow row in CTHD_BUS.XuatCTHoaDon(MaHD).Rows)
            {
                ThemHangThuoc(chiso, row[0].ToString(), row[1].ToString(), row[2].ToString());
                chiso++;
            }
        }
Ejemplo n.º 5
0
        private void btnXacNhan_Click(object sender, RoutedEventArgs e)
        {
            XacNhan = false;
            frmXacNhanThanhToan frmXacNhanThanhToan = new frmXacNhanThanhToan();

            frmXacNhanThanhToan.Sender_TenPhim_CaChieu_NgayChieu_TenPhongChieu(TenPhim, CaChieu, NgayChieu, TenPhongChieu);
            frmXacNhanThanhToan.Sender_ListMaGhe(ListMaGhe);
            frmXacNhanThanhToan.Sender_frmThanhToan(this);
            frmXacNhanThanhToan.ShowDialog();

            if (XacNhan == true)
            {
                DataTable DT_HoaDon      = VeBUS.LoadDSHoaDon();
                int       soluong_hoadon = DT_HoaDon.Rows.Count;
                string    SoHD           = "HD" + (soluong_hoadon + 1).ToString();
                DateTime  Ngay_Gio_HD    = DateTime.Now;

                DataTable DT_GetMALC = DatVeBUS.DatVe_GetMALC(MaPhim, NgayChieu, MaCC);
                object[]  a          = new object[1];
                a    = DT_GetMALC.Rows[0].ItemArray;
                MaLC = a[0].ToString();


                VeDTO hd = new VeDTO(SoHD, Ngay_Gio_HD, MaKH, MaLC, "0");
                //VeDTO hd = new VeDTO(SoHD, Ngay_Gio_HD, "KH1", MaLC, "0");
                VeBUS.Them(hd);

                //string date = NgayChieu.Day.ToString() + '/' + NgayChieu.Month.ToString() + '/' + NgayChieu.Year.ToString();
                for (int i = 0; i < ListMaGhe.Count; i++)
                {
                    CTVE_DTO ctve = new CTVE_DTO(SoHD, ListMaGhe[i], NgayChieu, "0");
                    CTHD_BUS.Them(ctve);
                }

                GridThanhToan.Children.Clear();
                GridThanhToan.Children.Add(new frmDatVe());
            }
        }