Beispiel #1
0
        private void btn_thanhtoan_Click(object sender, EventArgs e)
        {
            FrmXemBaoCao f     = new FrmXemBaoCao();
            HoaDonBUS    hdBUS = new HoaDonBUS();

            try
            {
                bool ktThanhToan = hdBUS.ThanhToan(hdHienHanh);
                if (ktThanhToan)
                {
                    FrmChinh frmmain = (FrmChinh)this.MdiParent;
                    frmmain.lsNDDTO = new LichSuNguoiDungDTO()
                    {
                        MAND     = frmmain.nvDangNhap.MAND,
                        MANV     = frmmain.nvDangNhap.MANV,
                        THOIGIAN = DateTime.Parse(DateTime.Now.ToString("dd/MM/yyy HH:mm")),
                        SUKIEN   = "Hóa đơn " + hdHienHanh.MAHD + "được thanh toán"
                    };
                    bool ktls = frmmain.lsNDBUS.ThemLichSuNguoiDung(frmmain.lsNDDTO);
                    hdHienHanh = hdBUS.DanhSachHoaDon().Find(o => o.MAHD.Trim() == hdHienHanh.MAHD.Trim());
                    f.XemHoaDon(hdHienHanh);
                    loaddata();
                }
            }
            catch
            {
                MessageBox.Show("Chưa chọn hóa đơn");
            }
            hdHienHanh = null;
            f.Show();
        }
Beispiel #2
0
        private void btn_xuatThongKe_Click(object sender, EventArgs e)
        {
            FrmXemBaoCao f     = new FrmXemBaoCao();
            HoaDonBUS    dhBUS = new HoaDonBUS();

            try
            {
                if (rad_ngay.Checked)
                {
                    radio  = 1;
                    hoadon = dhBUS.DanhSachHoaDon().FindAll(o => o.THOIGIANKETTHUC.ToString("dd/MM/yyyy") == dtp_hoadon.Value.ToString("dd/MM/yyyy"));
                    f.XemThongKe(hoadon);
                }
                if (rad_thang.Checked)
                {
                    radio  = 2;
                    hoadon = dhBUS.DanhSachHoaDon().FindAll(o => o.THOIGIANKETTHUC.ToString("MM/yyyy") == dtp_hoadon.Value.ToString("MM/yyyy"));
                    f.XemThongKe(hoadon);
                }
                if (rad_nam.Checked)
                {
                    radio  = 3;
                    hoadon = dhBUS.DanhSachHoaDon().FindAll(o => o.THOIGIANKETTHUC.ToString("yyyy") == dtp_hoadon.Value.ToString("yyyy"));
                    f.XemThongKe(hoadon);
                }
                if (rad_quy.Checked)
                {
                    radio = 4;
                    kiemtraquy();
                    f.XemThongKe(hoadon);
                }
            }
            catch
            {
                MessageBox.Show("Chưa có dữ liệu trong hệ thống");
            }

            f.ShowDialog();
        }
Beispiel #3
0
        private void kiemtraquy()
        {
            HoaDonBUS dhBUS = new HoaDonBUS();
            DateTime  a     = dtp_hoadon.Value;
            int       kt    = int.Parse(a.ToString("MM"));

            if (kt == 1)
            {
                hoadon = dhBUS.DanhSachHoaDon().FindAll(o => o.THOIGIANKETTHUC.ToString("MM/yyyy") == "01/" + dtp_hoadon.Value.ToString("yyyy") || o.THOIGIANKETTHUC.ToString("MM/yyyy") == "02/" + dtp_hoadon.Value.ToString("yyyy") || o.THOIGIANKETTHUC.ToString("MM/yyyy") == "03/" + dtp_hoadon.Value.ToString("yyyy"));
            }
            if (kt == 2)
            {
                hoadon = dhBUS.DanhSachHoaDon().FindAll(o => o.THOIGIANKETTHUC.ToString("MM/yyyy") == "04/" + dtp_hoadon.Value.ToString("yyyy") || o.THOIGIANKETTHUC.ToString("MM/yyyy") == "05/" + dtp_hoadon.Value.ToString("yyyy") || o.THOIGIANKETTHUC.ToString("MM/yyyy") == "06/" + dtp_hoadon.Value.ToString("yyyy"));
            }
            if (kt == 3)
            {
                hoadon = dhBUS.DanhSachHoaDon().FindAll(o => o.THOIGIANKETTHUC.ToString("MM/yyyy") == "07/" + dtp_hoadon.Value.ToString("yyyy") || o.THOIGIANKETTHUC.ToString("MM/yyyy") == "08/" + dtp_hoadon.Value.ToString("yyyy") || o.THOIGIANKETTHUC.ToString("MM/yyyy") == "09/" + dtp_hoadon.Value.ToString("yyyy"));
            }
            if (kt == 4)
            {
                hoadon = dhBUS.DanhSachHoaDon().FindAll(o => o.THOIGIANKETTHUC.ToString("MM/yyyy") == "10/" + dtp_hoadon.Value.ToString("yyyy") || o.THOIGIANKETTHUC.ToString("MM/yyyy") == "11/" + dtp_hoadon.Value.ToString("yyyy") || o.THOIGIANKETTHUC.ToString("MM/yyyy") == "12/" + dtp_hoadon.Value.ToString("yyyy"));
            }
        }
Beispiel #4
0
        private void loaddata()
        {
            lv_HoaDonChuaThanhToan.Items.Clear();

            LoaiPhongBUS lp = new LoaiPhongBUS();

            cbo_loaiPhong.DataSource    = lp.DanhSachLoaiPhong().FindAll(o => o.TINHTRANG == true);
            cbo_loaiPhong.ValueMember   = "MALOAIPHONG";
            cbo_loaiPhong.DisplayMember = "TENLOAIPHONG";
            cbo_loaiPhong.SelectedIndex = -1;
            khBUS = new KhachHangBUS();
            nvBUS = new NhanVienBUS();

            HoaDonBUS hdBus = new HoaDonBUS();

            lsHoaDonHienHanh = hdBus.DanhSachHoaDon().FindAll(o => o.TINHTRANG == false);
            foreach (HoaDonDTO a in lsHoaDonHienHanh)
            {
                PhongBUS     pBus = new PhongBUS();
                PhongDTO     pDTO = pBus.DanhSachPhong().Find(o => o.MAPHONG == a.MAPHONG);
                ListViewItem item = new ListViewItem(pDTO.TENPHONG);
                item.SubItems.Add(a.MAHD);
                item.SubItems.Add(a.MAPHONG);
                item.SubItems.Add(a.MANV);
                item.SubItems.Add(nvBUS.DanhSachNhanVien().Find(o => o.MANV.Trim() == a.MANV.Trim()).HOTENNV);
                item.SubItems.Add(a.MAKH);
                item.SubItems.Add(khBUS.DanhSachKhachHang().Find(o => o.MAKH.Trim() == a.MAKH.Trim()).TENKH);
                item.SubItems.Add(a.THOIGIANBATDAU.ToString("dd/MM/yyyy HH:mm"));
                item.SubItems.Add(a.THOIGIANKETTHUC.ToString("dd/MM/yyyy HH:mm"));
                item.SubItems.Add(a.TONGTHANHTOAN);
                item.SubItems.Add(a.THOIGIANBATDAU.ToString());
                item.SubItems.Add(a.TINHTRANG?"1":"0");
                item.SubItems.Add(a.GIAPHONG.ToString());
                lv_HoaDonChuaThanhToan.Items.Add(item);
            }

            maHDmoi       = DoAnQLKaraokeBUS.HoaDonBUS.MaHDmoi();
            txt_maHD.Text = maHDmoi;
        }
Beispiel #5
0
 private void btn_timtheoma_Click(object sender, EventArgs e)
 {
     lsHDHienHanh          = hdBus.DanhSachHoaDon().FindAll(o => o.MAHD.Trim() == txt_MAHD.Text.Trim());
     dgv_hoadon.DataSource = lsHDHienHanh;
 }
Beispiel #6
0
 private void loaddata()
 {
     hdBus                 = new HoaDonBUS();
     lsHDHienHanh          = hdBus.DanhSachHoaDon();
     dgv_hoadon.DataSource = lsHDHienHanh;
 }