public FormManHinhChinh() { InitializeComponent(); banan = new BanAn(); chitiethd = new ChiTietHoaDon(); loaita = new LoaiThucAn(); thucan = new ThucAn(); hoadon = new HoaDon(); tkhoadon = new ThongKeHoaDon(); nv = new NhanVien(); }
private void btnThanhToan_Click(object sender, EventArgs e) { int IDBill = hoadon.LayIDHoaDonTheoBan(idBan); if (IDBill != 1) { if (MessageBox.Show("Bạn thật sự muốn thanh toán hóa đơn cho bàn " + idBan, "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK) { float tongtien = float.Parse(txtTongtien.Text); hoadon.CheckOut(IDBill, (int)nudgiamgia.Value, float.Parse(txtTongtien.Text)); banan.ThayDoiTinhTrang((dgvhoadon.Tag as Ban).Id, false, ref error); flpnlBanAn.Controls.Clear(); LoadTable(); HienThiHoaDon((dgvhoadon.Tag as Ban).Id); //In hóa đơn chứa thông tin nhân viên, khách string tenNhanVien = ""; if (IDNguoiDangNhap == 0) { tenNhanVien = "Quản trị viên"; } else { DataTable dtNhanVien = nv.LayNhanVienTheoID(IDNguoiDangNhap).Tables[0]; if (dtNhanVien.Rows[0]["HoNV"] != null) { tenNhanVien += dtNhanVien.Rows[0]["HoNV"].ToString(); } if (dtNhanVien.Rows[0]["TenNV"] != null) { tenNhanVien += " " + dtNhanVien.Rows[0]["TenNV"].ToString(); } } tkhoadon = thongKeHoaDonBuilder.taoIDHoaDon(IDBill) .taoMaNV(IDNguoiDangNhap).taoTenNV(tenNhanVien) .taotenKH("Khách").taoNgayBan(DateTime.Now).taoThanhTien(tongtien).Build(); tkhoadon.ThemThongKeHoaDon(); FormThanhToan formThanhToan = new FormThanhToan(IDBill); formThanhToan.Show(); } } }
void LoadData() { if (FormManHinhChinh.quyentruycap == QuyenTruyCap.Administrator) { tkHoaDon = new ThongKeHoaDonBuilder().Build(); //Quản trị viên có thể xem tất cả các dữ liệu. dgvHoaDon.DataSource = tkHoaDon.LayThongKeHoaDon().Tables[0]; } else { tkHoaDon = new ThongKeHoaDonBuilder().taoMaNV(FormManHinhChinh.IDNguoiDangNhap).Build(); if (FormManHinhChinh.IDNguoiDangNhap != 0) { dgvHoaDon.DataSource = tkHoaDon.LayThongKeHoaDonTheoNhanVien().Tables[0]; } } dgvHoaDon.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.DisplayedCells; }
private void initData() { switch (mode) { case 0: break; case 1: if (ds1 != null) { DetailReport detailRPT = new DetailReport(); detailRPT.DataSource = ds1; this.Text = "Bao cao chi tiet"; this.printingSystem1.ClearContent(); Invalidate(); Update(); detailRPT.PrintingSystem = printingSystem1; detailRPT.CreateDocument(); } break; case 2: if (ds2 != null) { TienVonReport rpt = new TienVonReport(); rpt.DataSource = ds2; this.Text = "Báo cáo tiền vốn"; this.printingSystem1.ClearContent(); Invalidate(); Update(); rpt.PrintingSystem = printingSystem1; rpt.CreateDocument(); } break; case 3: if (ds3 != null) { TonKhoReport rpt = new TonKhoReport(); rpt.DataSource = ds3; this.Text = "Báo cáo tồn kho"; this.printingSystem1.ClearContent(); Invalidate(); Update(); rpt.PrintingSystem = printingSystem1; rpt.CreateDocument(); } break; case 4: if (ds4 != null) { Hoadon rpt = new Hoadon(); rpt.DataSource = ds4; this.Text = "Hóa đơn"; this.printingSystem1.ClearContent(); Invalidate(); Update(); rpt.PrintingSystem = printingSystem1; rpt.CreateDocument(); } break; case 5: if (ds5 != null) { DetailReportDSBH rpt = new DetailReportDSBH(); rpt.DataSource = ds5; this.Text = "Doanh số bán hàng"; this.printingSystem1.ClearContent(); Invalidate(); Update(); rpt.PrintingSystem = printingSystem1; rpt.CreateDocument(); } break; case 6: if (ds6 != null) { ThongKeHoaDon rpt = new ThongKeHoaDon(); rpt.DataSource = ds6; this.Text = "Thống kê hóa đơn xuất"; this.printingSystem1.ClearContent(); Invalidate(); Update(); rpt.PrintingSystem = printingSystem1; rpt.CreateDocument(); } break; case 7: if (ds7 != null) { Hoadonbep rpt = new Hoadonbep(); rpt.DataSource = ds7; this.Text = "Phiếu gọi món"; this.printingSystem1.ClearContent(); Invalidate(); Update(); rpt.PrintingSystem = printingSystem1; rpt.CreateDocument(); } break; case 8: if (ds8 != null) { DetailThongKeVanDe rpt = new DetailThongKeVanDe(); rpt.DataSource = ds8; this.Text = "Thống kê hóa đơn xuất"; this.printingSystem1.ClearContent(); Invalidate(); Update(); rpt.PrintingSystem = printingSystem1; rpt.CreateDocument(); } break; case 9: if (ds7 != null) { XuatKho rpt = new XuatKho(); rpt.DataSource = ds7; this.Text = "Phiếu Xuất Kho"; this.printingSystem1.ClearContent(); Invalidate(); Update(); rpt.PrintingSystem = printingSystem1; rpt.CreateDocument(); } break; default: break; } }
public HttpResponseMessage Hoa_Don_Trong_Khoang_Thang(HttpRequestMessage request, int idShop, ThongKeHoaDon thongKeHoaDon) { IEnumerable <HoaDon> listThongKeTheoSanPhams = null; var toTal = 0; try { listThongKeTheoSanPhams = _thongKeBaoCaoService.Hoa_Don_Trong_Khoang_Thang(thongKeHoaDon.TuNgay, thongKeHoaDon.DenNgay, idShop); toTal = listThongKeTheoSanPhams.ToList().Count; if (toTal > 0) { Message = "Danh sách hóa đơn trong khoảng tháng đó"; } else { throw new DbEntityValidationException("Không tồn tại hóa đơn nào bán trong khoảng tháng đó"); } } catch (DbEntityValidationException ex) { LogException(ex); } return(GetResponseMessage(IsSuccess, Message, toTal, listThongKeTheoSanPhams)); }