void BCNhapHang_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { ucBaoCaoNhapHang bcnhaphang = new ucBaoCaoNhapHang(); bcnhaphang.bcNHTheoHangHoa.MouseDown += new System.Windows.Input.MouseButtonEventHandler(temp_Click); bcnhaphang.bcNHTheoKho.MouseDown += new System.Windows.Input.MouseButtonEventHandler(temp_Click); bcnhaphang.bcNHTheoNhomHang.MouseDown += new System.Windows.Input.MouseButtonEventHandler(temp_Click); bcnhaphang.bcNHTheoTG.MouseDown += new System.Windows.Input.MouseButtonEventHandler(temp_Click); elementHost_BaoCao.Child = bcnhaphang; }
private void TaoTabpage(ChucNang cn) { string strTenTabpage = string.Empty; switch (cn) { case ChucNang.BanHang: strTenTabpage = "Bán Hàng"; if (!tabControlMain.Contains(tabBanHang)) { tabBanHang = new TabPage(strTenTabpage); ucBanHang _ucBanHang = new ucBanHang(); tabBanHang.Controls.Add(_ucBanHang); _ucBanHang.Dock = DockStyle.Fill; tabControlMain.TabPages.Add(tabBanHang); tabControlMain.SelectedTab = tabBanHang; } else { tabControlMain.SelectedTab = tabBanHang; } break; case ChucNang.KhachHang: strTenTabpage = "Khách Hàng"; if (!tabControlMain.Contains(tabKhachHang)) { tabKhachHang = new TabPage(strTenTabpage); ucKhachHang _ucKhachHang = new ucKhachHang(); tabKhachHang.Controls.Add(_ucKhachHang); _ucKhachHang.Dock = DockStyle.Fill; tabControlMain.TabPages.Add(tabKhachHang); tabControlMain.SelectedTab = tabKhachHang; } else { tabControlMain.SelectedTab = tabKhachHang; } break; case ChucNang.BaoCaoBanHang: strTenTabpage = "Báo Cáo Bán Hàng"; if (!tabControlMain.Contains(tabBaoCaoBanHang)) { tabBaoCaoBanHang = new TabPage(strTenTabpage); ucBaoCaoBanHang _ucBaoCaoBanHang = new ucBaoCaoBanHang(); tabBaoCaoBanHang.Controls.Add(_ucBaoCaoBanHang); _ucBaoCaoBanHang.Dock = DockStyle.Fill; tabControlMain.TabPages.Add(tabBaoCaoBanHang); tabControlMain.SelectedTab = tabBaoCaoBanHang; } else { tabControlMain.SelectedTab = tabBaoCaoBanHang; } break; case ChucNang.NhapHang: strTenTabpage = "Nhập Hàng"; if (!tabControlMain.Contains(tabNhapHang)) { tabNhapHang = new TabPage(strTenTabpage); ucNhapHang _ucNhapHang = new ucNhapHang(); tabNhapHang.Controls.Add(_ucNhapHang); _ucNhapHang.Dock = DockStyle.Fill; tabControlMain.TabPages.Add(tabNhapHang); tabControlMain.SelectedTab = tabNhapHang; } else { tabControlMain.SelectedTab = tabNhapHang; } break; case ChucNang.NhaCungCap: strTenTabpage = "Nhà Cung Cấp"; if (!tabControlMain.Contains(tabNhaCungCap)) { tabNhaCungCap = new TabPage(strTenTabpage); ucNhaCungCap _ucNhaCungCap = new ucNhaCungCap(); tabNhaCungCap.Controls.Add(_ucNhaCungCap); _ucNhaCungCap.Dock = DockStyle.Fill; tabControlMain.TabPages.Add(tabNhaCungCap); tabControlMain.SelectedTab = tabNhaCungCap; } else { tabControlMain.SelectedTab = tabNhaCungCap; } break; case ChucNang.BaoCaoNhapHang: strTenTabpage = "Báo Cáo Nhập Hàng"; if (!tabControlMain.Contains(tabBaoCaoNhapHang)) { tabBaoCaoNhapHang = new TabPage(strTenTabpage); ucBaoCaoNhapHang _ucBaoCaoNhapHang = new ucBaoCaoNhapHang(); tabBaoCaoNhapHang.Controls.Add(_ucBaoCaoNhapHang); _ucBaoCaoNhapHang.Dock = DockStyle.Fill; tabControlMain.TabPages.Add(tabBaoCaoNhapHang); tabControlMain.SelectedTab = tabBaoCaoNhapHang; } else { tabControlMain.SelectedTab = tabBaoCaoNhapHang; } break; case ChucNang.HangHoa: strTenTabpage = "Hàng Hoá"; if (!tabControlMain.Contains(tabPageHangHoa)) { tabPageHangHoa = new TabPage(strTenTabpage); ucHangHoa _ucHangHoa = new ucHangHoa(); tabPageHangHoa.Controls.Add(_ucHangHoa); _ucHangHoa.Dock = DockStyle.Fill; tabControlMain.TabPages.Add(tabPageHangHoa); tabControlMain.SelectedTab = tabPageHangHoa; } else { tabControlMain.SelectedTab = tabPageHangHoa; } break; case ChucNang.TonKho: strTenTabpage = "Tồn Kho"; if (!tabControlMain.Contains(tabTonKho)) { tabTonKho = new TabPage(strTenTabpage); ucTonKho _ucTonKho = new ucTonKho(); tabTonKho.Controls.Add(_ucTonKho); _ucTonKho.Dock = DockStyle.Fill; tabControlMain.TabPages.Add(tabTonKho); tabControlMain.SelectedTab = tabTonKho; } else { tabControlMain.SelectedTab = tabTonKho; } break; case ChucNang.NhanBaoHanh: strTenTabpage = "Bảo Hành"; if (!tabControlMain.Contains(tabNhanBaoHanh)) { tabNhanBaoHanh = new TabPage(strTenTabpage); ucNhanBaoHanh _ucNhanBaoHanh = new ucNhanBaoHanh(); _ucNhanBaoHanh.timSoSerial += BatTabTimSoSerial; tabNhanBaoHanh.Controls.Add(_ucNhanBaoHanh); _ucNhanBaoHanh.Dock = DockStyle.Fill; tabControlMain.TabPages.Add(tabNhanBaoHanh); tabControlMain.SelectedTab = tabNhanBaoHanh; } else { tabControlMain.SelectedTab = tabNhanBaoHanh; } break; case ChucNang.KhoBaoHanh: strTenTabpage = "Kho Bảo Hành"; if (!tabControlMain.Contains(tabKhoBaoHanh)) { tabKhoBaoHanh = new TabPage(strTenTabpage); ucKhoBaoHanh _ucKhoBaoHanh = new ucKhoBaoHanh(); tabKhoBaoHanh.Controls.Add(_ucKhoBaoHanh); _ucKhoBaoHanh.Dock = DockStyle.Fill; tabControlMain.TabPages.Add(tabKhoBaoHanh); tabControlMain.SelectedTab = tabKhoBaoHanh; } else { tabControlMain.SelectedTab = tabKhoBaoHanh; } break; case ChucNang.BaoCaoBaoHanh: strTenTabpage = "Báo Cáo Bảo Hành"; if (!tabControlMain.Contains(tabBaoCaoBaoHanh)) { tabBaoCaoBaoHanh = new TabPage(strTenTabpage); ucBaoCaoBaoHanh _ucBaoCaoBaoHanh = new ucBaoCaoBaoHanh(); tabBaoCaoBaoHanh.Controls.Add(_ucBaoCaoBaoHanh); _ucBaoCaoBaoHanh.Dock = DockStyle.Fill; tabControlMain.TabPages.Add(tabBaoCaoBaoHanh); tabControlMain.SelectedTab = tabBaoCaoBaoHanh; } else { tabControlMain.SelectedTab = tabBaoCaoBaoHanh; } break; case ChucNang.NhanVien: strTenTabpage = "Nhân Viên"; if (!tabControlMain.Contains(tabNhanVien)) { tabNhanVien = new TabPage(strTenTabpage); ucNhanVien _ucNhanVien = new ucNhanVien(); tabNhanVien.Controls.Add(_ucNhanVien); _ucNhanVien.Dock = DockStyle.Fill; tabControlMain.TabPages.Add(tabNhanVien); tabControlMain.SelectedTab = tabNhanVien; } else { tabControlMain.SelectedTab = tabNhanVien; } break; case ChucNang.DoanhThu: strTenTabpage = "Doanh Thu"; if (!tabControlMain.Contains(tabDoanhthu)) { tabDoanhthu = new TabPage(strTenTabpage); ucDoanhThu _ucDoanhThu = new ucDoanhThu(); tabDoanhthu.Controls.Add(_ucDoanhThu); _ucDoanhThu.Dock = DockStyle.Fill; tabControlMain.TabPages.Add(tabDoanhthu); tabControlMain.SelectedTab = tabDoanhthu; } else { tabControlMain.SelectedTab = tabDoanhthu; } break; case ChucNang.LoiNhuan: strTenTabpage = "Lợi Nhuận"; if (!tabControlMain.Contains(tabLoiNhuan)) { tabLoiNhuan = new TabPage(strTenTabpage); ucLoiNhuan _ucLoiNhuan = new ucLoiNhuan(); tabLoiNhuan.Controls.Add(_ucLoiNhuan); _ucLoiNhuan.Dock = DockStyle.Fill; tabControlMain.TabPages.Add(tabLoiNhuan); tabControlMain.SelectedTab = tabLoiNhuan; } else { tabControlMain.SelectedTab = tabLoiNhuan; } break; default: break; } }
private void frmBaoCao_Load(object sender, EventArgs e) { try { this.WindowState = FormWindowState.Maximized; switch (BaoCao) { case "DoanhThu": { //DoanhThu = new string[5]; //DoanhThu[0] = "Báo cáo doanh thu theo thời gian"; //DoanhThu[1] = "Báo cáo doanh thu theo nhân viên"; //DoanhThu[2] = "Báo cáo doanh thu theo nhóm hàng"; //DoanhThu[3] = "Báo cáo doanh thu theo hàng hóa"; //DoanhThu[4] = "Báo cáo lãi lỗ"; //Load_Label(DoanhThu); ucBaoCaoDoanhThu doanhthu = new ucBaoCaoDoanhThu(); doanhthu.bcDTTheoHangHoa.MouseDown += new System.Windows.Input.MouseButtonEventHandler(temp_Click); doanhthu.bcDTTheoNhomHang.MouseDown += new System.Windows.Input.MouseButtonEventHandler(temp_Click); doanhthu.bcDTTheoNV.MouseDown += new System.Windows.Input.MouseButtonEventHandler(temp_Click); doanhthu.bcDTTheoTG.MouseDown += new System.Windows.Input.MouseButtonEventHandler(temp_Click); doanhthu.bcLaiLo.MouseDown += new System.Windows.Input.MouseButtonEventHandler(temp_Click); elementHost_BaoCao.Child = doanhthu; break; } case "CongNo": { ucBaoCaoCongNo bccongn = new ucBaoCaoCongNo(); bccongn.bcCNTheoKH.MouseDown += new System.Windows.Input.MouseButtonEventHandler(temp_Click); bccongn.bcCNTheoNCC.MouseDown += new System.Windows.Input.MouseButtonEventHandler(temp_Click); elementHost_BaoCao.Child = bccongn; break; } case "XuatHang": { ucBaoCaoXuatHang bcxuathang = new ucBaoCaoXuatHang(); bcxuathang.bcXHTheoHangHoa.MouseDown += new System.Windows.Input.MouseButtonEventHandler(temp_Click); bcxuathang.bcXHTheoKho.MouseDown += new System.Windows.Input.MouseButtonEventHandler(temp_Click); bcxuathang.bcXHTheoNhomHang.MouseDown += new System.Windows.Input.MouseButtonEventHandler(temp_Click); bcxuathang.bcXHTheoTG.MouseDown += new System.Windows.Input.MouseButtonEventHandler(temp_Click); elementHost_BaoCao.Child = bcxuathang; break; } case "NhapHang": { ucBaoCaoNhapHang bcnhaphang = new ucBaoCaoNhapHang(); bcnhaphang.bcNHTheoHangHoa.MouseDown += new System.Windows.Input.MouseButtonEventHandler(temp_Click); bcnhaphang.bcNHTheoKho.MouseDown += new System.Windows.Input.MouseButtonEventHandler(temp_Click); bcnhaphang.bcNHTheoNhomHang.MouseDown += new System.Windows.Input.MouseButtonEventHandler(temp_Click); bcnhaphang.bcNHTheoTG.MouseDown += new System.Windows.Input.MouseButtonEventHandler(temp_Click); elementHost_BaoCao.Child = bcnhaphang; break; } case "TonKho": { ucBaoCaoTonKho bctonkho = new ucBaoCaoTonKho(); bctonkho.bcMucTonToiThieuToiDa.MouseDown += new System.Windows.Input.MouseButtonEventHandler(temp_Click); bctonkho.bcTonKhoTheoKho.MouseDown += new System.Windows.Input.MouseButtonEventHandler(temp_Click); bctonkho.bcTonKhoTheoNhomHang.MouseDown += new System.Windows.Input.MouseButtonEventHandler(temp_Click); bctonkho.bcXNTTheoKho.MouseDown += new System.Windows.Input.MouseButtonEventHandler(temp_Click); bctonkho.bcXNTTheoLoaiHang.MouseDown += new System.Windows.Input.MouseButtonEventHandler(temp_Click); bctonkho.bcXNTTheoNhomHang.MouseDown += new System.Windows.Input.MouseButtonEventHandler(temp_Click); bctonkho.bcXNTTheoPhieuXuatHuy.MouseDown += new System.Windows.Input.MouseButtonEventHandler(temp_Click); elementHost_BaoCao.Child = bctonkho; break; } } int Heights = Screen.PrimaryScreen.Bounds.Height; int Widths = Screen.PrimaryScreen.Bounds.Width; this.Location = new Point(0, 0); this.Width = Widths - 4; this.Height = Heights - 64; } catch { } }