private void btnTonnesToCustomer_Click(object sender, EventArgs e) { DateTime startDate = dteTTCStartDate.SelectedDate.Value.Date; DateTime endDate = dteTTCEndDate.SelectedDate.Value.Date.Add(new TimeSpan(23, 59, 59)); IEnumerable <int> businessTypeIDs = chkTTCBusinessType.AllBusinessTypesSelected ? null : chkTTCBusinessType.SelectedBusinessTypeIDs; Facade.IKPI facKPI = new Facade.KPI(); DataSet dsSource = facKPI.TonnesToCustomer(businessTypeIDs, startDate, endDate); CsvExport.Export( dsSource.Tables[0], "TonnesToCustomer.csv", new CsvExport.ColumnMappings { { "Customer", "Customer" }, { "TotalTonnes", "Total Tonnes" }, { "Loads", "Loads" }, { "Drops", "Drops" }, { "AverageLoadSize", "Average Load Size" }, { "AverageDropSize", "Average Drop Size" }, { "RouteRate", "Route Rate" }, { "AdditionalCollsCost", "Additional Collections Cost" }, { "AdditionalDropsCost", "Additional Drops Cost" }, { "FuelSurcharge", "Fuel Surcharge" }, { "Demurrage", "Demurrage" }, { "BankHoliday", "Bank Holiday" }, { "TotalCost", "Total Cost" }, { "TotalCostPerTonne", "Total Cost Per Tonne" }, }); }
private void btnViewReport_Click(object sender, EventArgs e) { btnViewReport.DisableServerSideValidation(); if (Page.IsValid) { //Get Dates for report DateTime startDate = dteStartDate.SelectedDate.Value.Subtract(dteStartDate.SelectedDate.Value.TimeOfDay); DateTime endDate = dteEndDate.SelectedDate.Value.Subtract(dteEndDate.SelectedDate.Value.TimeOfDay).Add(new TimeSpan(23, 59, 59)); //Get data for the report Facade.IKPI facKPI = new Facade.KPI(); DataSet ds = facKPI.GetRevenuePerformanceForPeriod(startDate, endDate); Session[Orchestrator.Globals.Constants.ReportTypeSessionVariable] = eReportType.RevenuePerformanceAnalysis; Session[Orchestrator.Globals.Constants.ReportDataSessionTableVariable] = ds; Session[Orchestrator.Globals.Constants.ReportDataSessionSortVariable] = String.Empty; Session[Orchestrator.Globals.Constants.ReportDataMemberSessionVariable] = "Table"; NameValueCollection nvc = new NameValueCollection(); nvc.Add("StartDate", dteStartDate.SelectedDate.Value.ToString("dd/MM/yy")); nvc.Add("EndDate", dteEndDate.SelectedDate.Value.ToString("dd/MM/yy")); nvc.Add("ShowNumberOfJobs", chkShowNumberOfJobs.Checked.ToString()); Session[Orchestrator.Globals.Constants.ReportParamsSessionVariable] = nvc; reportViewer1.Visible = true; } }
private void btnViewReport_Click(object sender, EventArgs e) { btnViewReport.DisableServerSideValidation(); if (Page.IsValid) { // Retrieve the values to report on int driverId = Convert.ToInt32(cboDriver.SelectedValue); DateTime startDate = dteStartDate.SelectedDate.Value.Subtract(dteStartDate.SelectedDate.Value.TimeOfDay); DateTime endDate = dteEndDate.SelectedDate.Value.Subtract(dteEndDate.SelectedDate.Value.TimeOfDay).Add(new TimeSpan(23, 59, 59)); // Get the data needed to run the report Facade.IKPI facKPI = new Facade.KPI(); DataSet ds = facKPI.GetDriverPerformanceForPeriod(driverId, startDate, endDate); Session[Orchestrator.Globals.Constants.ReportTypeSessionVariable] = eReportType.DriverPerformanceAnalysisPeriod; Session[Orchestrator.Globals.Constants.ReportDataSessionTableVariable] = ds; Session[Orchestrator.Globals.Constants.ReportDataSessionSortVariable] = String.Empty; Session[Orchestrator.Globals.Constants.ReportDataMemberSessionVariable] = "Table"; NameValueCollection nvc = new NameValueCollection(); nvc.Add("ReportTitle", "KPI Performance (Period)"); nvc.Add("Driver", cboDriver.Text); nvc.Add("StartDate", startDate.ToString("dd/MM/yy")); nvc.Add("EndDate", endDate.ToString("dd/MM/yy")); Session[Orchestrator.Globals.Constants.ReportParamsSessionVariable] = nvc; reportViewer1.Visible = true; } }
private void btnCapacityUsage_Click(object sender, EventArgs e) { DateTime startDate = dteCUStartDate.SelectedDate.Value.Date; DateTime endDate = dteCUEndDate.SelectedDate.Value.Date.Add(new TimeSpan(23, 59, 59)); Facade.IKPI facKPI = new Facade.KPI(); DataSet dsSource = facKPI.CapacityUsage(startDate, endDate); CsvExport.Export( dsSource.Tables[0], "CapacityUsage.csv", new CsvExport.ColumnMappings { { "OrganisationName", "Client" }, { "NumberOfLoads", "Number of Loads" }, { "CapacityUsage", "Weight Percentage of Capacity", this.PercentageFormatter }, }); }
private void btnCollectionPerformance_Click(object sender, EventArgs e) { DateTime startDate = dteCPStartDate.SelectedDate.Value.Date; DateTime endDate = dteCPEndDate.SelectedDate.Value.Date.Add(new TimeSpan(23, 59, 59)); Facade.IKPI facKPI = new Facade.KPI(); DataSet dsSource = facKPI.CollectDropPerformance(startDate, endDate, eInstructionType.Load); CsvExport.Export( dsSource.Tables[0], "CollectionPerformance.csv", new CsvExport.ColumnMappings { { "MemberName", "Member" }, { "TargetOnTimeProportion", "Target On-Time", this.PercentageFormatter }, { "OnTimeProportion", "Actual On-Time", this.PercentageFormatter }, }); }
private void btnOutstandingPods_Click(object sender, EventArgs e) { DateTime startDate = dtePODStartDate.SelectedDate.Value.Date; DateTime endDate = dtePODEndDate.SelectedDate.Value.Date.Add(new TimeSpan(23, 59, 59)); bool isDetailReport = rblPODReportType.SelectedIndex == 1; Facade.IKPI facKPI = new Facade.KPI(); if (isDetailReport) { DataSet dsSource = facKPI.OutstandingPODDetail(startDate, endDate); CsvExport.Export( dsSource.Tables[0], "OutstandingPODDetail.csv", new CsvExport.ColumnMappings { { "Client", "Client" }, { "Member", "Member" }, { "OrderID", "Order ID" }, { "BusinessType", "Business Type" }, { "DeliveryOrderNumber", "Docket Number" }, { "CustomerOrderNumber", "Load Number" }, { "DateTimeDelivered", "Date Delivered", this.DateFormatter }, { "DeliveredInDateRange", "In Date Range?", (dr, col) => dr.Field <bool>(col) ? "Yes" : "No" }, }); } else { DataSet dsSource = facKPI.OutstandingPODSummary(startDate, endDate); CsvExport.Export( dsSource.Tables[0], "OutstandingPODSummary.csv", new CsvExport.ColumnMappings { { "Client", "Client" }, { "Member", "Member" }, { "BusinessType", "Business Type" }, { "CountDeliveredInDateRange", "In Date Range" }, { "CountDeliveredPriorToDateRange", "Prior To Date Range" }, }); } }
private void btnOrderRefusals_Click(object sender, EventArgs e) { DateTime startDate = dteORStartDate.SelectedDate.Value.Date; DateTime endDate = dteOREndDate.SelectedDate.Value.Date.Add(new TimeSpan(23, 59, 59)); Facade.IKPI facKPI = new Facade.KPI(); DataSet dsSource = facKPI.OrderRefusals(startDate, endDate); CsvExport.Export( dsSource.Tables[0], "OrderRefusals.csv", new CsvExport.ColumnMappings { { "Total", "Total" }, { "Haulier", "Haulier" }, { "Premier", "Premier" }, { "Customer", "Customer" }, { "Other", "Other" }, }); }
private void btnViewReport_Click(object sender, EventArgs e) { btnViewReport.DisableServerSideValidation(); if (Page.IsValid) { // Retrieve the values to report on int[] resources = new int[m_drivers.Count]; for (int driverIndex = 0; driverIndex < m_drivers.Count; driverIndex++) { resources[driverIndex] = m_drivers[driverIndex].ResourceId; } DateTime startDate = dteStartDate.SelectedDate.Value.Subtract(dteStartDate.SelectedDate.Value.TimeOfDay); DateTime endDate = dteEndDate.SelectedDate.Value.Subtract(dteEndDate.SelectedDate.Value.TimeOfDay).Add(new TimeSpan(23, 59, 59)); // Get the data needed to run the report Facade.IKPI facKPI = new Facade.KPI(); eKPITrendPeriod selectedPeriod = (eKPITrendPeriod)Enum.Parse(typeof(eKPITrendPeriod), cboTrendPeriod.SelectedValue.Replace(" ", "")); DataSet ds = facKPI.GetDriverPerformanceTrend(resources, startDate, endDate, selectedPeriod); Session[Orchestrator.Globals.Constants.ReportTypeSessionVariable] = eReportType.DriverPerformanceAnalysisTrend; Session[Orchestrator.Globals.Constants.ReportDataSessionTableVariable] = ds; Session[Orchestrator.Globals.Constants.ReportDataSessionSortVariable] = String.Empty; Session[Orchestrator.Globals.Constants.ReportDataMemberSessionVariable] = "Table"; NameValueCollection nvc = new NameValueCollection(); nvc.Add("ReportTitle", "KPI Performance (Trend)"); nvc.Add("NumberOfDrivers", m_drivers.Count.ToString()); nvc.Add("TrendSplit", selectedPeriod.ToString()); nvc.Add("StartDate", dteStartDate.SelectedDate.Value.ToString("dd/MM/yy")); nvc.Add("EndDate", dteEndDate.SelectedDate.Value.ToString("dd/MM/yy")); Session[Orchestrator.Globals.Constants.ReportParamsSessionVariable] = nvc; reportViewer1.Visible = true; } }