private void StartUp_Load(object sender, EventArgs e) { List <Product> data; ReportManager report = new ReportManager(); data = this.database.SelectAllProduct(); DataTable source = report.reportProductWarehouse(data); ProductWarehouseDataGrid.DataSource = source; this.LoadCityMachinesDataGrid(); List <Machine> data2; data2 = this.database.SelectAllMachine(); MachineListAllDataGrid.DataSource = data2; List <Transactions> data3; ReportManager report2 = new ReportManager(); data3 = this.database.SelectAllTransactions(); DataTable subtotals = report2.reportSalesByItem(data3); SalesProductGrid.DataSource = subtotals; treeView1.ExpandAll(); treeView2.ExpandAll(); }
private void CSVSalesByProduct_Click(object sender, EventArgs e) { List <Transactions> data; ReportManager report = new ReportManager(); data = this.database.SelectAllTransactions(); DataTable subtotals = report.reportSalesByItem(data); Export export = new Export(); export.ExportToCSV(subtotals, "SalesProductGrid.csv"); CSVCreatedDialog csvOK = new CSVCreatedDialog(); csvOK.Show(); }
private void ChartSalesByProduct_Load(object sender, EventArgs e) { List<Transactions> data; ReportManager report = new ReportManager(); data = this.database.SelectAllTransactions(); DataTable subtotals = report.reportSalesByItem(data); SalesByProduct.DataSource = subtotals; SalesByProduct.Titles.Add("Net Profit by Product"); string productName = subtotals.Columns[0].ToString(); SalesByProduct.Series["Series 1"].XValueMember = productName; string netProfit = subtotals.Columns[1].ToString(); SalesByProduct.Series["Series 1"].YValueMembers = netProfit; SalesByProduct.DataBind(); }
private void ChartSalesByProduct_Load(object sender, EventArgs e) { List <Transactions> data; ReportManager report = new ReportManager(); data = this.database.SelectAllTransactions(); DataTable subtotals = report.reportSalesByItem(data); SalesByProduct.DataSource = subtotals; SalesByProduct.Titles.Add("Net Profit by Product"); string productName = subtotals.Columns[0].ToString(); SalesByProduct.Series["Series 1"].XValueMember = productName; string netProfit = subtotals.Columns[1].ToString(); SalesByProduct.Series["Series 1"].YValueMembers = netProfit; SalesByProduct.DataBind(); }
//Report TABS ==> load data on tab change private void ReportTabs_SelectedIndexChanged(object sender, EventArgs e) { if (ReportTabs.SelectedTab == SalesProduct) { List <Transactions> data; ReportManager report = new ReportManager(); data = this.database.SelectAllTransactions(); DataTable subtotals = report.reportSalesByItem(data); SalesProductGrid.DataSource = subtotals; } else if (ReportTabs.SelectedTab == InventoryProduct) { List <Product> data; ReportManager report = new ReportManager(); data = this.database.SelectAllProduct(); DataTable subtotals = report.reportInventoryCostItem(data); InventoryProductGrid.DataSource = subtotals; } else if (ReportTabs.SelectedTab == SalesMachine) { List <Transactions> data; ReportManager report = new ReportManager(); data = this.database.SelectAllTransactions(); DataTable subtotals = report.reportSalesByMachine(data); SalesMachineGrid.DataSource = subtotals; } else if (ReportTabs.SelectedTab == ReportsMachineProduct) { List <Transactions> data; List <Machine> machineList; ReportManager report = new ReportManager(); data = this.database.SelectAllTransactions(); machineList = this.database.SelectAllMachine(); DataTable subtotals = report.reportSalesByProductPerMachine(data, machineList); SalesMachineProductGrid.CellBorderStyle = DataGridViewCellBorderStyle.None; SalesMachineProductGrid.DataSource = subtotals; } else if (ReportTabs.SelectedTab == SalesCityMachine) { List <Transactions> data; List <Machine> machineList; List <City> cityList; ReportManager report = new ReportManager(); data = this.database.SelectAllTransactions(); machineList = this.database.SelectAllMachine(); cityList = this.database.SelectAllCity(); DataTable subtotals = report.reportSalesByCity(data, machineList, cityList); SalesCityMachineGrid.DataSource = subtotals; } else if (ReportTabs.SelectedTab == RestockMachine) { List <Machine> machineList; ReportManager report = new ReportManager(); machineList = this.database.SelectAllMachine(); DataTable subtotals = report.reportRestockByMachine(machineList); RestockMachineGrid.DataSource = subtotals; } }
private void StartUp_Load(object sender, EventArgs e) { List<Product> data; ReportManager report = new ReportManager(); data = this.database.SelectAllProduct(); DataTable source = report.reportProductWarehouse(data); ProductWarehouseDataGrid.DataSource = source; this.LoadCityMachinesDataGrid(); List<Machine> data2; data2 = this.database.SelectAllMachine(); MachineListAllDataGrid.DataSource = data2; List<Transactions> data3; ReportManager report2 = new ReportManager(); data3 = this.database.SelectAllTransactions(); DataTable subtotals = report2.reportSalesByItem(data3); SalesProductGrid.DataSource = subtotals; treeView1.ExpandAll(); treeView2.ExpandAll(); }
//Report TABS ==> load data on tab change private void ReportTabs_SelectedIndexChanged(object sender, EventArgs e) { if (ReportTabs.SelectedTab == SalesProduct) { List<Transactions> data; ReportManager report = new ReportManager(); data = this.database.SelectAllTransactions(); DataTable subtotals = report.reportSalesByItem(data); SalesProductGrid.DataSource = subtotals; } else if (ReportTabs.SelectedTab == InventoryProduct) { List<Product> data; ReportManager report = new ReportManager(); data = this.database.SelectAllProduct(); DataTable subtotals = report.reportInventoryCostItem(data); InventoryProductGrid.DataSource = subtotals; } else if (ReportTabs.SelectedTab == SalesMachine) { List<Transactions> data; ReportManager report = new ReportManager(); data = this.database.SelectAllTransactions(); DataTable subtotals = report.reportSalesByMachine(data); SalesMachineGrid.DataSource = subtotals; } else if (ReportTabs.SelectedTab == ReportsMachineProduct) { List<Transactions> data; List<Machine> machineList; ReportManager report = new ReportManager(); data = this.database.SelectAllTransactions(); machineList = this.database.SelectAllMachine(); DataTable subtotals = report.reportSalesByProductPerMachine(data, machineList); SalesMachineProductGrid.CellBorderStyle = DataGridViewCellBorderStyle.None; SalesMachineProductGrid.DataSource = subtotals; } else if (ReportTabs.SelectedTab == SalesCityMachine) { List<Transactions> data; List<Machine> machineList; List<City> cityList; ReportManager report = new ReportManager(); data = this.database.SelectAllTransactions(); machineList = this.database.SelectAllMachine(); cityList = this.database.SelectAllCity(); DataTable subtotals = report.reportSalesByCity(data, machineList, cityList); SalesCityMachineGrid.DataSource = subtotals; } else if (ReportTabs.SelectedTab == RestockMachine) { List<Machine> machineList; ReportManager report = new ReportManager(); machineList = this.database.SelectAllMachine(); DataTable subtotals = report.reportRestockByMachine(machineList); RestockMachineGrid.DataSource = subtotals; } }
private void CSVSalesByProduct_Click(object sender, EventArgs e) { List<Transactions> data; ReportManager report = new ReportManager(); data = this.database.SelectAllTransactions(); DataTable subtotals = report.reportSalesByItem(data); Export export = new Export(); export.ExportToCSV(subtotals, "SalesProductGrid.csv"); CSVCreatedDialog csvOK = new CSVCreatedDialog(); csvOK.Show(); }