protected void OnButtonCommand(object sender, CommandEventArgs e) { //Event handler for view button clicked try { //Change view to Viewer and reset to clear existing data Master.Viewer.Reset(); //Get parameters for the query string _terminalID = this.cboTerminal.SelectedValue; string _type = this.cboType.SelectedValue; string _tlNumber = this.grdTLs.SelectedRow.Cells[1].Text; string _zone = this.grdTLs.SelectedRow.Cells[2].Text; //Initialize control values LocalReport report = Master.Viewer.LocalReport; report.DisplayName = REPORT_NAME; report.EnableExternalImages = true; EnterpriseGateway enterprise = new EnterpriseGateway(); DataSet ds = null; switch (_type.ToLower()) { case "manifest": ds = enterprise.FillDataset(USP_REPORT_MANIFEST, TBL_REPORT, new object[] { _terminalID, _tlNumber }); break; case "delivery bill": ds = enterprise.FillDataset(USP_REPORT_DELIVERY, TBL_REPORT, new object[] { _tlNumber }); break; case "delivery bill w/po number": ds = enterprise.FillDataset(USP_REPORT_DELIVERY_PO, TBL_REPORT, new object[] { _tlNumber }); break; } if (ds.Tables[TBL_REPORT].Rows.Count >= 0) { switch (e.CommandName) { case "Run": ////Set local report and data source System.IO.Stream stream = null; switch (_type.ToLower()) { case "manifest": stream = Master.GetReportDefinition(REPORT_SRC_MANIFEST); break; case "delivery bill": stream = Master.GetReportDefinition(REPORT_SRC_DELIVERY); break; case "delivery bill w/po number": stream = Master.GetReportDefinition(REPORT_SRC_DELIVERY_PO); break; } report.LoadReportDefinition(stream); report.DataSources.Clear(); switch (_type.ToLower()) { case "manifest": report.DataSources.Add(new ReportDataSource(REPORT_DS_MANIFEST, ds.Tables[TBL_REPORT])); break; case "delivery bill": report.DataSources.Add(new ReportDataSource(REPORT_DS_DELIVERY, ds.Tables[TBL_REPORT])); break; case "delivery bill w/po number": report.DataSources.Add(new ReportDataSource(REPORT_DS_DELIVERY_PO, ds.Tables[TBL_REPORT])); break; } //Set the report parameters for the report ReportParameter terminalID = new ReportParameter("TerminalID", _terminalID); ReportParameter terminal = new ReportParameter("Terminal", this.cboTerminal.SelectedItem.Text); ReportParameter tlNumber = new ReportParameter("TLNumber", _tlNumber); ReportParameter zone = new ReportParameter("Zone", _zone); ReportParameter carrierNumber = null, carrierName = null, carrierAddress1 = null, carrierAddress2 = null, carrierCity = null, carrierState = null, carrierZip = null; ReportParameter clientNumber = null, clientDiv = null, clientName = null; string _clientNumber = "", _clientDiv = "", _clientName = "", _consNumber = ""; string _number = "", _name = "", _addressLine1 = "", _addressLine2 = "", _city = "", _state = "", _zip = ""; string _shipperName = "", _shipperAddressLine1 = "", _shipperAddressLine2 = "", _shipperCity = "", _shipperState = "", _shipperZip = ""; DataSet carriers = null, shippers = null; switch (_type.ToLower()) { case "manifest": if (ds.Tables[TBL_REPORT].Rows.Count > 0) { _clientNumber = ds.Tables[TBL_REPORT].Rows[0].IsNull("Client") ? "" : ds.Tables[TBL_REPORT].Rows[0]["Client"].ToString().Trim(); _clientName = ds.Tables[TBL_REPORT].Rows[0].IsNull("ClientName") ? "" : ds.Tables[TBL_REPORT].Rows[0]["ClientName"].ToString().Trim(); } carriers = enterprise.FillDataset(USP_CARRIERS, TBL_CARRIERS, new object[] { _zone }); if (carriers.Tables[TBL_CARRIERS].Rows.Count > 0) { _number = carriers.Tables[TBL_CARRIERS].Rows[0].IsNull("NUMBER") ? "" : carriers.Tables[TBL_CARRIERS].Rows[0]["NUMBER"].ToString().Trim(); _name = carriers.Tables[TBL_CARRIERS].Rows[0].IsNull("NAME") ? "" : carriers.Tables[TBL_CARRIERS].Rows[0]["NAME"].ToString().Trim(); _addressLine1 = carriers.Tables[TBL_CARRIERS].Rows[0].IsNull("ADDRESS_LINE1") ? "" : carriers.Tables[TBL_CARRIERS].Rows[0]["ADDRESS_LINE1"].ToString().Trim(); _addressLine2 = carriers.Tables[TBL_CARRIERS].Rows[0].IsNull("ADDRESS_LINE2") ? "" : carriers.Tables[TBL_CARRIERS].Rows[0]["ADDRESS_LINE2"].ToString().Trim(); _city = carriers.Tables[TBL_CARRIERS].Rows[0].IsNull("CITY") ? "" : carriers.Tables[TBL_CARRIERS].Rows[0]["CITY"].ToString().Trim(); _state = carriers.Tables[TBL_CARRIERS].Rows[0].IsNull("STATE") ? "" : carriers.Tables[TBL_CARRIERS].Rows[0]["STATE"].ToString().Trim(); _zip = carriers.Tables[TBL_CARRIERS].Rows[0].IsNull("ZIP") ? "" : carriers.Tables[TBL_CARRIERS].Rows[0]["ZIP"].ToString().Trim(); } clientNumber = new ReportParameter("ClientNumber", _clientNumber); clientName = new ReportParameter("ClientName", _clientName); carrierNumber = new ReportParameter("CarrierNumber", _number); carrierName = new ReportParameter("CarrierName", _name); carrierAddress1 = new ReportParameter("CarrierAddress1", _addressLine1); carrierAddress2 = new ReportParameter("CarrierAddress2", _addressLine2); carrierCity = new ReportParameter("CarrierCity", _city); carrierState = new ReportParameter("CarrierState", _state); carrierZip = new ReportParameter("CarrierZip", _zip); report.SetParameters(new ReportParameter[] { terminalID, tlNumber, zone, carrierNumber, carrierName, carrierAddress1, carrierAddress2, carrierCity, clientNumber, clientName, carrierState, carrierZip }); break; case "delivery bill": case "delivery bill w/po number": if (ds.Tables[TBL_REPORT].Rows.Count > 0) { _clientNumber = ds.Tables[TBL_REPORT].Rows[0].IsNull("ClientNumber") ? "" : ds.Tables[TBL_REPORT].Rows[0]["ClientNumber"].ToString().Trim(); _clientDiv = ds.Tables[TBL_REPORT].Rows[0].IsNull("ClientDivision") ? "" : ds.Tables[TBL_REPORT].Rows[0]["ClientDivision"].ToString().Trim(); _consNumber = ds.Tables[TBL_REPORT].Rows[0].IsNull("Consignee") ? "" : ds.Tables[TBL_REPORT].Rows[0]["Consignee"].ToString().Trim(); } carriers = enterprise.FillDataset(USP_CARRIERS, TBL_CARRIERS, new object[] { _zone }); if (carriers.Tables[TBL_CARRIERS].Rows.Count > 0) { _name = carriers.Tables[TBL_CARRIERS].Rows[0].IsNull("NAME") ? "" : carriers.Tables[TBL_CARRIERS].Rows[0]["NAME"].ToString().Trim(); _addressLine1 = carriers.Tables[TBL_CARRIERS].Rows[0].IsNull("ADDRESS_LINE1") ? "" : carriers.Tables[TBL_CARRIERS].Rows[0]["ADDRESS_LINE1"].ToString().Trim(); _addressLine2 = carriers.Tables[TBL_CARRIERS].Rows[0].IsNull("ADDRESS_LINE2") ? "" : carriers.Tables[TBL_CARRIERS].Rows[0]["ADDRESS_LINE2"].ToString().Trim(); _city = carriers.Tables[TBL_CARRIERS].Rows[0].IsNull("CITY") ? "" : carriers.Tables[TBL_CARRIERS].Rows[0]["CITY"].ToString().Trim(); _state = carriers.Tables[TBL_CARRIERS].Rows[0].IsNull("STATE") ? "" : carriers.Tables[TBL_CARRIERS].Rows[0]["STATE"].ToString().Trim(); _zip = carriers.Tables[TBL_CARRIERS].Rows[0].IsNull("ZIP") ? "" : carriers.Tables[TBL_CARRIERS].Rows[0]["ZIP"].ToString().Trim(); } shippers = enterprise.FillDataset(USP_SHIPPERS, TBL_SHIPPERS, new object[] { _terminalID }); if (shippers.Tables[TBL_SHIPPERS].Rows.Count > 0) { _shipperName = shippers.Tables[TBL_SHIPPERS].Rows[0].IsNull("NAME") ? "" : shippers.Tables[TBL_SHIPPERS].Rows[0]["NAME"].ToString().Trim(); _shipperAddressLine1 = shippers.Tables[TBL_SHIPPERS].Rows[0].IsNull("ADDRESS_LINE1") ? "" : shippers.Tables[TBL_SHIPPERS].Rows[0]["ADDRESS_LINE1"].ToString().Trim(); _shipperAddressLine2 = shippers.Tables[TBL_SHIPPERS].Rows[0].IsNull("ADDRESS_LINE2") ? "" : shippers.Tables[TBL_SHIPPERS].Rows[0]["ADDRESS_LINE2"].ToString().Trim(); _shipperCity = shippers.Tables[TBL_SHIPPERS].Rows[0].IsNull("CITY") ? "" : shippers.Tables[TBL_SHIPPERS].Rows[0]["CITY"].ToString().Trim(); _shipperState = shippers.Tables[TBL_SHIPPERS].Rows[0].IsNull("STATE") ? "" : shippers.Tables[TBL_SHIPPERS].Rows[0]["STATE"].ToString().Trim(); _shipperZip = shippers.Tables[TBL_SHIPPERS].Rows[0].IsNull("ZIP") ? "" : shippers.Tables[TBL_SHIPPERS].Rows[0]["ZIP"].ToString().Trim(); } carrierName = new ReportParameter("CarrierName", _name); carrierAddress1 = new ReportParameter("CarrierAddr1", _addressLine1); carrierAddress2 = new ReportParameter("CarrierAddr2", _addressLine2); carrierCity = new ReportParameter("CarrierCity", _city); carrierState = new ReportParameter("CarrierState", _state); carrierZip = new ReportParameter("CarrierZip", _zip); ReportParameter shipName = new ReportParameter("ShipName", _shipperName); ReportParameter shipAddr1 = new ReportParameter("ShipAddr1", _shipperAddressLine1); ReportParameter shipAddr2 = new ReportParameter("ShipAddr2", _shipperAddressLine2); ReportParameter shipCity = new ReportParameter("ShipCity", _shipperCity); ReportParameter shipState = new ReportParameter("ShipState", _shipperState); ReportParameter shipZip = new ReportParameter("ShipZip", _shipperZip); clientNumber = new ReportParameter("ClientNumber", _clientNumber); clientDiv = new ReportParameter("ClientDiv", _clientDiv); ReportParameter consNumber = new ReportParameter("ConsNumber", _consNumber); report.SetParameters(new ReportParameter[] { terminalID, tlNumber, zone, carrierName, carrierAddress1, carrierAddress2, carrierCity, carrierState, carrierZip, shipName, shipAddr1, shipAddr2, shipCity, shipState, shipZip, clientNumber, clientDiv, consNumber }); break; } ////Update report rendering with new data report.Refresh(); if (!Master.Viewer.Enabled) { Master.Viewer.CurrentPage = 1; } break; case "Data": //Set local export report and data source System.IO.Stream streamD = null; switch (_type.ToLower()) { case "manifest": streamD = Master.CreateExportRdl(ds, REPORT_DS_MANIFEST, "RGXSQLR.TSORT"); break; case "delivery bill": streamD = Master.CreateExportRdl(ds, REPORT_DS_DELIVERY, "RGXSQLR.TSORT"); break; case "delivery bill w/po number": streamD = Master.CreateExportRdl(ds, REPORT_DS_DELIVERY_PO, "RGXSQLR.TSORT"); break; } report.LoadReportDefinition(streamD); report.DataSources.Clear(); switch (_type.ToLower()) { case "manifest": report.DataSources.Add(new ReportDataSource(REPORT_DS_MANIFEST, ds.Tables[TBL_REPORT])); break; case "delivery bill": report.DataSources.Add(new ReportDataSource(REPORT_DS_DELIVERY, ds.Tables[TBL_REPORT])); break; case "delivery bill w/po number": report.DataSources.Add(new ReportDataSource(REPORT_DS_DELIVERY_PO, ds.Tables[TBL_REPORT])); break; } report.Refresh(); break; case "Excel": //Create Excel mime-type page Response.ClearHeaders(); Response.Clear(); Response.Charset = ""; Response.AddHeader("Content-Disposition", "inline; filename=DeliveryPaperwork.xls"); Response.ContentType = "application/vnd.ms-excel"; //application/octet-stream"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[TBL_REPORT]; dg.DataBind(); dg.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); break; } } else { Master.Status = "There were no records found."; } } catch (Exception ex) { Master.ReportError(ex); } }
protected void OnButtonCommand(object sender, CommandEventArgs e) { //Event handler for command button clicked try { //Change view to Viewer and reset to clear existing data Master.Viewer.Reset(); //Get parameters for the query string _start = this.ddpArrival.FromDate.ToString("yyyy-MM-dd"); string _end = this.ddpArrival.ToDate.ToString("yyyy-MM-dd"); string _agent = this.cboAgent.SelectedValue != "" ? this.cboAgent.SelectedValue : null; //Initialize control values LocalReport report = Master.Viewer.LocalReport; report.DisplayName = this.mTitle; report.EnableExternalImages = true; EnterpriseGateway enterprise = new EnterpriseGateway(); DataSet ds = enterprise.FillDataset(this.mUSPName, mTBLName, new object[] { _start, _end, _agent }); if (ds.Tables[mTBLName] == null) { ds.Tables.Add(mTBLName); } switch (e.CommandName) { case "Run": //Set local report and data source System.IO.Stream stream = Master.GetReportDefinition(this.mSource); report.LoadReportDefinition(stream); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); //Set the report parameters for the report ReportParameter start = new ReportParameter("StartDate", _start); ReportParameter end = new ReportParameter("EndDate", _end); ReportParameter agent = new ReportParameter("AgentNumber", _agent); report.SetParameters(new ReportParameter[] { start, end, agent }); //Update report rendering with new data report.Refresh(); if (!Master.Viewer.Enabled) { Master.Viewer.CurrentPage = 1; } break; case "Data": //Set local export report and data source report.LoadReportDefinition(Master.CreateExportRdl(ds, this.mDSName)); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); report.Refresh(); break; case "Excel": //Create Excel mime-type page Response.ClearHeaders(); Response.Clear(); Response.Charset = ""; Response.AddHeader("Content-Disposition", "inline; filename=ScanningSummaryByStore.xls"); Response.ContentType = "application/vnd.ms-excel"; //application/octet-stream"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[mTBLName]; dg.DataBind(); dg.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); break; } } catch (Exception ex) { Master.ReportError(ex); } }
protected void OnButtonCommand(object sender, CommandEventArgs e) { //Event handler for command button clicked try { //Change view to Viewer and reset to clear existing data Master.Viewer.Reset(); //Get parameters for the query string _fromDate = this.ddpPickups.FromDate.ToString("yyyy-MM-dd"); string _toDate = this.ddpPickups.ToDate.ToString("yyyy-MM-dd"); string _client = this.dgdClientVendor.ClientNumber; string _div = (this.chkAllDivs.Checked) ? null : this.dgdClientVendor.ClientDivsionNumber; string _clientName = this.dgdClientVendor.ClientName; string _vendor = this.dgdClientVendor.VendorNumber; string _vendorName = this.dgdClientVendor.VendorName; //Initialize control values LocalReport report = Master.Viewer.LocalReport; report.DisplayName = this.mTitle; report.EnableExternalImages = true; EnterpriseGateway enterprise = new EnterpriseGateway(); DataSet ds = new DataSet(); string reportFile = "", reportDS = "", usp = ""; switch (this.cboType.SelectedItem.Text) { case "Over": reportFile = REPORT_SRC_OVER; reportDS = REPORT_DS_OVER; usp = USP_REPORT_OVER; break; case "Short": reportFile = REPORT_SRC_SHORT; reportDS = REPORT_DS_SHORT; usp = USP_REPORT_SHORT; break; } ds = enterprise.FillDataset(usp, mTBLName, new object[] { _fromDate, _toDate, _vendor, _client, _div }); if (ds.Tables[mTBLName] == null) { ds.Tables.Add(mTBLName); } switch (e.CommandName) { case "Run": //Set local report and data source System.IO.Stream stream = Master.GetReportDefinition(reportFile); report.LoadReportDefinition(stream); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(reportDS, ds.Tables[mTBLName])); //Set the report parameters for the report ReportParameter fromDate = new ReportParameter("Startdate", _fromDate); ReportParameter toDate = new ReportParameter("EndDate", _toDate); ReportParameter client = new ReportParameter("ClientNumber", _client + "-" + (_div == null?"All":_div) + " " + _clientName); ReportParameter div = new ReportParameter("DivisionNumber", (_div == null?"All":_div)); ReportParameter clientName = new ReportParameter("ClientName", _clientName); ReportParameter vendor = new ReportParameter("VendorNumber", _vendor + " " + _vendorName); ReportParameter vendorName = new ReportParameter("VendorName", _vendorName); report.SetParameters(new ReportParameter[] { fromDate, toDate, vendor, client, div }); //Update report rendering with new data report.Refresh(); if (!Master.Viewer.Enabled) { Master.Viewer.CurrentPage = 1; } break; case "Data": //Set local export report and data source report.LoadReportDefinition(Master.CreateExportRdl(ds, reportDS)); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(reportDS, ds.Tables[mTBLName])); report.Refresh(); break; case "Excel": //Create Excel mime-type page Response.ClearHeaders(); Response.Clear(); Response.Charset = ""; Response.AddHeader("Content-Disposition", "inline; filename=TimePeriodCartonCompare.xls"); Response.ContentType = "application/vnd.ms-excel"; //application/octet-stream"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[mTBLName]; dg.DataBind(); dg.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); break; } } catch (Exception ex) { Master.ReportError(ex); } }
protected void OnButtonCommand(object sender, CommandEventArgs e) { //Event handler for view button clicked try { //Change view to Viewer and reset to clear existing data Master.Viewer.Reset(); //Get parameters for the query string _start = this.ddpPickups.ToDate.ToString("yyyy-MM-dd"); string _terminal = this.cboTerminal.SelectedValue; int _shift = int.Parse(this.cboShift.SelectedValue); string _header = "Shift Report"; //Initialize control values LocalReport report = Master.Viewer.LocalReport; report.DisplayName = this.mTitle; report.EnableExternalImages = true; EnterpriseGateway enterprise = new EnterpriseGateway(); DataSet ds = new DataSet(this.mDSName); DataSet _ds = enterprise.FillDataset(this.mUSPName, mTBLName, new object[] { _terminal, _start, _shift }); if (_ds.Tables[mTBLName] == null) { _ds.Tables.Add(mTBLName); } string filter = ""; switch (this.cboType.SelectedValue.ToLower()) { case "tsort": filter = "FreightType = 'Tsort'"; _header = "Tsort"; break; case "returns": filter = "FreightType = 'Returns'"; _header = "Return"; break; case "both": filter = null; _header = "Tsort & Return"; break; } DataRow[] rows = _ds.Tables[mTBLName].Select(filter); ds.Merge(rows); if (ds.Tables[mTBLName] == null) { ds.Tables.Add(mTBLName); } switch (e.CommandName) { case "Run": //Set local report and data source System.IO.Stream stream = Master.GetReportDefinition(this.mSource); report.LoadReportDefinition(stream); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); //Set the report parameters for the report ReportParameter terminalID = new ReportParameter("TerminalID", _terminal); ReportParameter start = new ReportParameter("Date", _start); ReportParameter shift = new ReportParameter("ShiftNumber", _shift.ToString()); ReportParameter terminal = new ReportParameter("SortedLocation", this.cboTerminal.SelectedItem.Text); ReportParameter freigthType = new ReportParameter("FreightType", _header); ShiftDataset shiftDS = new ShiftDataset(); shiftDS.Merge(enterprise.GetShifts(_terminal, this.ddpPickups.ToDate)); ShiftDataset.ShiftTableRow row = (ShiftDataset.ShiftTableRow)shiftDS.ShiftTable.Select("NUMBER='" + this.cboShift.SelectedValue.ToString() + "'")[0]; ReportParameter shiftTimeIn = new ReportParameter("ShiftTimeIn", row.StartTime.ToString("yyyy-MM-dd")); ReportParameter shiftTimeOut = new ReportParameter("ShiftTimeOut", row.EndTime.ToString("yyyy-MM-dd")); ReportParameter shiftBreak = new ReportParameter("ShiftBreak", row.BreakTime.ToString("yyyy-MM-dd")); ReportParameter shiftProdTime = new ReportParameter("ProductionTime", string.Concat(Decimal.Truncate((row.ProductionTime / 60)), ":", Convert.ToString(row.ProductionTime % 60))); report.SetParameters(new ReportParameter[] { terminalID, start, shift, terminal, shiftTimeIn, shiftTimeOut, shiftBreak, shiftProdTime, freigthType }); //Update report rendering with new data report.Refresh(); if (!Master.Viewer.Enabled) { Master.Viewer.CurrentPage = 1; } break; case "Data": //Set local export report and data source report.LoadReportDefinition(Master.CreateExportRdl(ds, this.mDSName)); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); report.Refresh(); break; case "Excel": //Create Excel mime-type page Response.ClearHeaders(); Response.Clear(); Response.Charset = ""; Response.AddHeader("Content-Disposition", "inline; filename=Shift.xls"); Response.ContentType = "application/vnd.ms-excel"; //application/octet-stream"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[mTBLName]; dg.DataBind(); dg.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); break; } } catch (Exception ex) { Master.ReportError(ex); } }
protected void OnButtonCommand(object sender, CommandEventArgs e) { //Event handler for command button clicked //Change view to Viewer and reset to clear existing data Master.Viewer.Reset(); //Get parameters for the query string _client = Master.ClientNumber; string _division = Master.Division; string _agentnumber = Master.AgentNumber; string _subagentnumber = Master.SubAgentNumber; string _region = Master.Region; string _district = Master.District; string _store = Master.StoreNumber; string _start = Master.StartDate; string _end = Master.EndDate; //Initialize control values LocalReport report = Master.Viewer.LocalReport; report.DisplayName = REPORT_NAME; report.EnableExternalImages = true; EnterpriseGateway enterprise = new EnterpriseGateway(); DataSet ds = enterprise.FillDataset(USP_REPORT, TBL_REPORT, new object[] { _client, _division, _agentnumber, _subagentnumber, _region, _district, _store, _start, _end }); if (ds.Tables[TBL_REPORT].Rows.Count >= 0) { switch (e.CommandName) { case "Run": //Set local report and data source System.IO.Stream stream = Master.GetReportDefinition(REPORT_SRC); report.LoadReportDefinition(stream); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(REPORT_DS, ds.Tables[TBL_REPORT])); //Set the report parameters for the report ReportParameter clientName = new ReportParameter("ClientName", Master.ClientName); ReportParameter client = new ReportParameter("ClientNumber", _client); ReportParameter division = new ReportParameter("Division", _division); ReportParameter agentnumber = new ReportParameter("AgentParentNumber", _agentnumber); ReportParameter subagentnumber = new ReportParameter("AgentNumber", _subagentnumber); ReportParameter region = new ReportParameter("Region"); if (_region != null) { region.Values.Add(_region); } ReportParameter district = new ReportParameter("District"); if (_district != null) { district.Values.Add(_district); } ReportParameter store = new ReportParameter("StoreNumber"); if (_store != null) { store.Values.Add(_store); } ReportParameter start = new ReportParameter("StartDate", _start); ReportParameter end = new ReportParameter("EndDate", _end); report.SetParameters(new ReportParameter[] { client, division, agentnumber, subagentnumber, region, district, store, start, end, clientName }); //Update report rendering with new data report.Refresh(); if (!Master.Viewer.Enabled) { Master.Viewer.CurrentPage = 1; } break; case "Data": //Set local export report and data source report.LoadReportDefinition(Master.CreateExportRdl(ds, REPORT_DS, "RGXSQLR.TSORT")); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(REPORT_DS, ds.Tables[TBL_REPORT])); report.Refresh(); break; case "Excel": //Create Excel mime-type page Response.ClearHeaders(); Response.Clear(); Response.Charset = ""; Response.AddHeader("Content-Disposition", "inline; filename=ScanningSummaryByAgent.xls"); Response.ContentType = "application/vnd.ms-excel"; //application/octet-stream"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[TBL_REPORT]; dg.DataBind(); dg.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); break; } } else { Master.Status = "There were no records found."; } }
protected void OnButtonCommand(object sender, CommandEventArgs e) { //Event handler for command button clicked try { //Change view to Viewer and reset to clear existing data Master.Viewer.Reset(); //Get parameters for the query string _invoiceNumber = ""; //Initialize control values LocalReport report = Master.Viewer.LocalReport; report.DisplayName = this.mTitle; report.EnableExternalImages = true; DataSet ds = new DataSet(); EnterpriseGateway enterprise = new EnterpriseGateway(); foreach (GridViewRow row in selectedInvoices) { _invoiceNumber = row.Cells[1].Text; DataSet _ds = enterprise.FillDataset(this.mUSPName, this.mTBLName, new object[] { _invoiceNumber }); ds.Merge(_ds); } if (ds.Tables[mTBLName] == null) { ds.Tables.Add(mTBLName); } switch (e.CommandName) { case "Run": //Set local report and data source System.IO.Stream stream = Master.GetReportDefinition(this.mSource); report.LoadReportDefinition(stream); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); //Set the report parameters for the report ReportParameter invoiceNumber = new ReportParameter("InvoiceNumber", _invoiceNumber); report.SetParameters(new ReportParameter[] { invoiceNumber }); //Update report rendering with new data report.Refresh(); if (!Master.Viewer.Enabled) { Master.Viewer.CurrentPage = 1; } break; case "Data": //Set local export report and data source report.LoadReportDefinition(Master.CreateExportRdl(ds, this.mDSName)); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); report.Refresh(); break; case "Excel": //Create Excel mime-type page Response.ClearHeaders(); Response.Clear(); Response.Charset = ""; Response.AddHeader("Content-Disposition", "inline; filename=BNConsumerDirectDDUPerformanceDetail.xls"); Response.ContentType = "application/vnd.ms-excel"; //application/octet-stream"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[mTBLName]; dg.DataBind(); dg.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); break; } } catch (Exception ex) { Master.ReportError(ex); } }
protected void OnButtonCommand(object sender, CommandEventArgs e) { //Event handler for command button clicked try { //Change view to Viewer and reset to clear existing data Master.Viewer.Reset(); //Get parameters for the query string dates = this.cboDateValue.SelectedValue; string _start = dates.Split(':')[0].Trim(); string _end = dates.Split(':')[1].Trim(); int _delivDays = Convert.ToInt32(this.cboDelivDays.Text); string _locType = this.cboLocType.Text; string _vendor = this.cboCustomer.SelectedValue; //Initialize control values LocalReport report = Master.Viewer.LocalReport; report.DisplayName = this.mTitle; report.EnableExternalImages = true; EnterpriseGateway enterprise = new EnterpriseGateway(); DataSet ds = enterprise.FillDataset(this.mUSPName, mTBLName, new object[] { _start, _end, _delivDays, _locType, _vendor }); if (ds.Tables[mTBLName] == null) { ds.Tables.Add(mTBLName); } switch (e.CommandName) { case "Run": //Set local report and data source System.IO.Stream stream = Master.GetReportDefinition(this.mSource); report.LoadReportDefinition(stream); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); //Set the report parameters for the report ReportParameter start = new ReportParameter("StartDate", _start); ReportParameter end = new ReportParameter("EndDate", _end); ReportParameter delivDays = new ReportParameter("DeliveryDays", _delivDays.ToString()); ReportParameter locType = new ReportParameter("LocationType", _locType); report.SetParameters(new ReportParameter[] { start, end, delivDays, locType }); //Update report rendering with new data report.Refresh(); if (!Master.Viewer.Enabled) { Master.Viewer.CurrentPage = 1; } break; case "Data": //Set local export report and data source report.LoadReportDefinition(Master.CreateExportRdl(ds, this.mDSName)); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); report.Refresh(); break; case "Excel": //Create Excel mime-type page Response.ClearHeaders(); Response.Clear(); Response.Charset = ""; Response.AddHeader("Content-Disposition", "inline; filename=BNConsumerDirectCartonDetail.xls"); Response.ContentType = "application/vnd.ms-excel"; //application/octet-stream"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[mTBLName]; dg.DataBind(); dg.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); break; } } catch (Exception ex) { Master.ReportError(ex); } }
protected void OnButtonCommand(object sender, CommandEventArgs e) { //Event handler for command button clicked try { //Change view to Viewer and reset to clear existing data Master.Viewer.Reset(); //Get parameters for the query string _client = Master.ClientNumber; string _division = Master.Division; string _agent = Master.AgentNumber; string _region = Master.Region; string _district = Master.District; string _store = Master.StoreNumber; int _isException = this.chkExceptionsOnly.Checked ? 1 : 0; string _start = Master.StartDate; string _end = Master.EndDate; string _vendor = this.cboVendorLoc.SelectedValue != "" ? this.cboVendor.SelectedValue : null; string _vendorLoc = this.cboVendorLoc.SelectedValue != "" ? this.cboVendorLoc.SelectedValue : null; //Initialize control values LocalReport report = Master.Viewer.LocalReport; report.DisplayName = this.mTitle; report.EnableExternalImages = true; EnterpriseGateway enterprise = new EnterpriseGateway(); DataSet ds = enterprise.FillDataset(this.mUSPName, mTBLName, new object[] { _client, _division, _agent, _region, _district, _store, _start, _end, _isException, _vendor, _vendorLoc }); if (ds.Tables[mTBLName] == null) { ds.Tables.Add(mTBLName); } switch (e.CommandName) { case "Run": //Set local report and data source System.IO.Stream stream = Master.GetReportDefinition(this.mSource); report.LoadReportDefinition(stream); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); //Set the report parameters for the report ReportParameter clientName = new ReportParameter("ClientName", Master.ClientName); ReportParameter client = new ReportParameter("ClientNumber", _client); ReportParameter division = new ReportParameter("Division", _division); ReportParameter agent = new ReportParameter("AgentNumber"); if (_agent != null) { agent.Values.Add(_agent); } ReportParameter region = new ReportParameter("Region"); if (_region != null) { region.Values.Add(_region); } ReportParameter district = new ReportParameter("District"); if (_district != null) { district.Values.Add(_district); } ReportParameter store = new ReportParameter("StoreNumber"); if (_store != null) { store.Values.Add(_store); } ReportParameter start = new ReportParameter("StartDate", _start); ReportParameter end = new ReportParameter("EndDate", _end); ReportParameter isException = new ReportParameter("IsExceptionOnly", _isException.ToString()); ReportParameter vendor = new ReportParameter("VendorCompany"); if (_vendor != null) { vendor.Values.Add(_vendor); } ReportParameter vendorLoc = new ReportParameter("VendorLocation"); if (_vendorLoc != null) { vendorLoc.Values.Add(_vendorLoc); } ReportParameter vendorName = new ReportParameter("VendorName", this.cboVendor.SelectedItem.Text); ReportParameter vendorLocName = new ReportParameter("LocationName", this.cboVendorLoc.SelectedItem.Text); report.SetParameters(new ReportParameter[] { client, division, agent, vendor, vendorLoc, region, district, store, start, end, isException, clientName, vendor, vendorLoc, vendorName, vendorLocName }); //Update report rendering with new data report.Refresh(); if (!Master.Viewer.Enabled) { Master.Viewer.CurrentPage = 1; } break; case "Data": //Set local export report and data source report.LoadReportDefinition(Master.CreateExportRdl(ds, this.mDSName)); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); report.Refresh(); break; case "Excel": //Create Excel mime-type page Response.ClearHeaders(); Response.Clear(); Response.Charset = ""; Response.AddHeader("Content-Disposition", "inline; filename=OnTimeDeliveryDetailByStoreAndVendor.xls"); Response.ContentType = "application/vnd.ms-excel"; //application/octet-stream"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[mTBLName]; dg.DataBind(); dg.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); break; } } catch (Exception ex) { Master.ReportError(ex); } }
protected void OnButtonCommand(object sender, CommandEventArgs e) { //Event handler for command button clicked try { //Change view to Viewer and reset to clear existing data Master.Viewer.Reset(); //Get parameters for the query string _fromDate = this.ddpPickups.FromDate.ToString("yyyy-MM-dd"); string _toDate = this.ddpPickups.ToDate.ToString("yyyy-MM-dd"); string _client = this.dgdClientShipper.ClientNumber; string _div = this.dgdClientShipper.ClientDivsionNumber; string _clientName = this.dgdClientShipper.ClientName; string _shipper = this.dgdClientShipper.ShipperNumber; string _shipperName = this.dgdClientShipper.ShipperName; //Initialize control values LocalReport report = Master.Viewer.LocalReport; report.DisplayName = this.mTitle; report.EnableExternalImages = true; EnterpriseGateway enterprise = new EnterpriseGateway(); DataSet ds = new DataSet(); string reportFile = "", reportDS = ""; if (this.cboFreightType.SelectedValue == "0") { //Tsort- set dataset and report types reportDS = REPORT_DS_TSORT; switch (this.cboViewBy.SelectedItem.Text) { case "State": reportFile = REPORT_SRC_TSORT_STATE; break; case "Zone": reportFile = REPORT_SRC_TSORT_ZONE; break; case "Store": reportFile = REPORT_SRC_TSORT_STORE; break; } ds = enterprise.FillDataset(USP_REPORT_VENDOR, mTBLName, new object[] { _client, _div, _shipper, _fromDate, _toDate }); } else if (this.cboFreightType.SelectedValue == "1") { //Returns- set dataset and report types reportDS = REPORT_DS_RETURNS; switch (this.cboViewBy.SelectedItem.Text) { case "Vendor": reportFile = REPORT_SRC_RETURNS_VENDOR; break; case "Store": reportFile = REPORT_SRC_RETURNS_STORE; break; } ds = enterprise.FillDataset(USP_REPORT_AGENT, mTBLName, new object[] { _client, _div, _shipper, _fromDate, _toDate }); } if (ds.Tables[mTBLName] == null) { ds.Tables.Add(mTBLName); } switch (e.CommandName) { case "Run": //Set local report and data source System.IO.Stream stream = Master.GetReportDefinition(reportFile); report.LoadReportDefinition(stream); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(reportDS, ds.Tables[mTBLName])); //Set the report parameters for the report ReportParameter fromDate = new ReportParameter("StartPUDate", _fromDate); ReportParameter toDate = new ReportParameter("EndPUDate", _toDate); ReportParameter client = new ReportParameter("ClientNumber", _client); ReportParameter div = new ReportParameter("ClientDivision", _div); ReportParameter clientName = new ReportParameter("ClientName", _clientName); ReportParameter shipper = new ReportParameter((this.dgdClientShipper.FreightType == FreightType.Regular ? "VendorNumber" : "AgentNumber"), _shipper); ReportParameter shipperName = new ReportParameter((this.dgdClientShipper.FreightType == FreightType.Regular ? "VendorName" : "AgentName"), _shipperName); report.SetParameters(new ReportParameter[] { client, div, fromDate, toDate, clientName, shipper, shipperName }); //Update report rendering with new data report.Refresh(); if (!Master.Viewer.Enabled) { Master.Viewer.CurrentPage = 1; } break; case "Data": //Set local export report and data source report.LoadReportDefinition(Master.CreateExportRdl(ds, reportDS)); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(reportDS, ds.Tables[mTBLName])); report.Refresh(); break; case "Excel": //Create Excel mime-type page Response.ClearHeaders(); Response.Clear(); Response.Charset = ""; Response.AddHeader("Content-Disposition", "inline; filename=Discrepancy.xls"); Response.ContentType = "application/vnd.ms-excel"; //application/octet-stream"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[mTBLName]; dg.DataBind(); dg.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); break; } } catch (Exception ex) { Master.ReportError(ex); } }
protected void OnButtonCommand(object sender, CommandEventArgs e) { //Event handler for command button clicked try { //Change view to Viewer and reset to clear existing data Master.Viewer.Reset(); //Get parameters for the query string _client = this.cboClient.SelectedValue != "" ? this.cboClient.SelectedValue : null; string _division = this.cboParam.SelectedValue == "Divisions" && this.cboValue.SelectedValue != "" ? this.cboValue.SelectedValue : null; string _agent = this.cboParam.SelectedValue == "Agents" && this.cboValue.SelectedValue != "" ? this.cboValue.SelectedValue : null; string _region = this.cboParam.SelectedValue == "Regions" && this.cboValue.SelectedValue != "" ? this.cboValue.SelectedValue : null; string _district = this.cboParam.SelectedValue == "Districts" && this.cboValue.SelectedValue != "" ? this.cboValue.SelectedValue : null; string _store = this.cboParam.SelectedValue == "Stores" && this.txtStore.Text.Length > 0 ? this.txtStore.Text : null; string _start = this.cboDateValue.SelectedValue.Split(',')[0].Split(':')[0].Trim(); string _end = this.cboDateValue.SelectedValue.Split(',')[0].Split(':')[1].Trim(); string _filter = this.txtFilter.Text; //Initialize control values LocalReport report = Master.Viewer.LocalReport; report.DisplayName = this.mTitle; report.EnableExternalImages = true; EnterpriseGateway enterprise = new EnterpriseGateway(); DataSet ds = enterprise.FillDataset(this.mUSPName, mTBLName, new object[] { _client, _division, _agent, _region, _district, _store, _end, _filter }); if (ds.Tables[mTBLName] == null) { ds.Tables.Add(mTBLName); } switch (e.CommandName) { case "Run": //Set local report and data source System.IO.Stream stream = Master.GetReportDefinition(this.mSource); report.LoadReportDefinition(stream); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); //Set the report parameters for the report ReportParameter clientName = new ReportParameter("ClientName", this.cboClient.SelectedItem.Text); ReportParameter client = new ReportParameter("ClientNumber", _client); ReportParameter division = new ReportParameter("Division", _division); ReportParameter agent = new ReportParameter("AgentNumber", _agent); ReportParameter region = new ReportParameter("Region", _region); ReportParameter district = new ReportParameter("District", _district); ReportParameter store = new ReportParameter("StoreNumber", _store); ReportParameter start = new ReportParameter("StartDate", _start); ReportParameter end = new ReportParameter("EndDate", _end); ReportParameter filter = new ReportParameter("NotOnTimeDeliveriesFilter", _filter); Master.Viewer.LocalReport.SetParameters(new ReportParameter[] { client, division, agent, region, district, store, end, filter }); //Update report rendering with new data report.Refresh(); if (!Master.Viewer.Enabled) { Master.Viewer.CurrentPage = 1; } break; case "Data": //Set local export report and data source report.LoadReportDefinition(Master.CreateExportRdl(ds, this.mDSName)); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); report.Refresh(); break; case "Excel": //Create Excel mime-type page Response.ClearHeaders(); Response.Clear(); Response.Charset = ""; Response.AddHeader("Content-Disposition", "inline; filename=InternalDeliveryWindowByStore.xls"); Response.ContentType = "application/vnd.ms-excel"; //application/octet-stream"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[mTBLName]; dg.DataBind(); dg.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); break; } } catch (Exception ex) { Master.ReportError(ex); } }
protected void OnButtonCommand(object sender, CommandEventArgs e) { //Event handler for command button clicked try { //Change view to Viewer and reset to clear existing data Master.Viewer.Reset(); //Get parameters for the query string _cartonID = this.txtSearchNo.Text; string _client = this.grdClients.SelectedRow.Cells[1].Text; string _div = this.grdClients.SelectedRow.Cells[2].Text; string _clientName = this.grdClients.SelectedRow.Cells[3].Text; string _terminal = this.grdClients.SelectedRow.Cells[4].Text; //Initialize control values LocalReport report = Master.Viewer.LocalReport; report.DisplayName = this.mTitle; report.EnableExternalImages = true; EnterpriseGateway enterprise = new EnterpriseGateway(); DataSet ds = enterprise.FillDataset(((this.cboSearchBy.SelectedValue == "ByCarton") ? USP_REPORT_BYCARTONNUMBER : USP_REPORT_BYLABELSEQNUMBER), mTBLName, new object[] { _cartonID, _terminal, _client }); if (ds.Tables[mTBLName] == null) { ds.Tables.Add(mTBLName); } switch (e.CommandName) { case "Run": //Set local report and data source System.IO.Stream stream = Master.GetReportDefinition(this.mSource); report.LoadReportDefinition(stream); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); //Set the report parameters for the report ReportParameter cartonID = new ReportParameter("SearchNumber", _cartonID); ReportParameter terminal = new ReportParameter("TerminalCode", _terminal); ReportParameter client = new ReportParameter("Client", _client); report.SetParameters(new ReportParameter[] { cartonID, terminal, client }); //Update report rendering with new data report.Refresh(); if (!Master.Viewer.Enabled) { Master.Viewer.CurrentPage = 1; } break; case "Data": //Set local export report and data source report.LoadReportDefinition(Master.CreateExportRdl(ds, this.mDSName)); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); report.Refresh(); break; case "Excel": //Create Excel mime-type page Response.ClearHeaders(); Response.Clear(); Response.Charset = ""; Response.AddHeader("Content-Disposition", "inline; filename=CartonSearch.xls"); Response.ContentType = "application/vnd.ms-excel"; //application/octet-stream"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[mTBLName]; dg.DataBind(); dg.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); break; } } catch (Exception ex) { Master.ReportError(ex); } }
protected void OnViewerDrillthrough(object sender, DrillthroughEventArgs e) { //Event handler for drill through if (!e.Report.IsDrillthroughReport) { return; } //Determine which drillthrough report is requested LocalReport report = (LocalReport)e.Report; report.DisplayName = e.ReportPath; report.EnableExternalImages = true; switch (e.ReportPath) { case "Scanning Summary By Client": { //Get drillthrough parameters string _agent = "", _start = "", _end = ""; for (int i = 0; i < report.OriginalParametersToDrillthrough.Count; i++) { switch (report.OriginalParametersToDrillthrough[i].Name) { case "StartDate": _start = report.OriginalParametersToDrillthrough[i].Values[0]; break; case "EndDate": _end = report.OriginalParametersToDrillthrough[i].Values[0]; break; case "AgentNumber": _agent = report.OriginalParametersToDrillthrough[i].Values[0]; break; } } //Set local report and data source System.IO.Stream stream = Master.GetReportDefinition("/Executive/" + e.ReportPath); report.LoadReportDefinition(stream); EnterpriseGateway enterprise = new EnterpriseGateway(); DataSet ds = enterprise.FillDataset("uspRptScanningSummaryByClient", "NewTable", new object[] { null, _agent, _start, _end }); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource("ScanningSummaryByClientDS", ds.Tables["NewTable"])); DataSet _ds = enterprise.FillDataset("uspRptAgentRead", mTBLName, new object[] { _agent }); report.DataSources.Add(new ReportDataSource("DataSet1", _ds.Tables["NewTable"])); ReportParameter client = new ReportParameter("ClientNumber"); ReportParameter agent = new ReportParameter("AgentNumber", _agent); ReportParameter start = new ReportParameter("StartDate", _start); ReportParameter end = new ReportParameter("EndDate", _end); report.SetParameters(new ReportParameter[] { client, agent, start, end }); report.Refresh(); } break; case "Scanning Summary By Agent": { //Get drillthrough parameters string _client = "", _start = "", _end = ""; for (int i = 0; i < report.OriginalParametersToDrillthrough.Count; i++) { switch (report.OriginalParametersToDrillthrough[i].Name) { case "StartDate": _start = report.OriginalParametersToDrillthrough[i].Values[0]; break; case "EndDate": _end = report.OriginalParametersToDrillthrough[i].Values[0]; break; case "ClientNumber": _client = report.OriginalParametersToDrillthrough[i].Values[0]; break; } } //Set local report and data source System.IO.Stream stream = Master.GetReportDefinition("/Executive/" + e.ReportPath); report.LoadReportDefinition(stream); EnterpriseGateway enterprise = new EnterpriseGateway(); DataSet ds = enterprise.FillDataset(this.mUSPName, mTBLName, new object[] { _client, null, null, null, null, null, null, _start, _end }); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); DataSet _ds = enterprise.FillDataset("uspRptClientRead", mTBLName, new object[] { _client }); report.DataSources.Add(new ReportDataSource("DataSet1", _ds.Tables[mTBLName])); ReportParameter clientName = new ReportParameter("ClientName"); ReportParameter client = new ReportParameter("ClientNumber", _client); ReportParameter division = new ReportParameter("Division"); ReportParameter agentnumber = new ReportParameter("AgentParentNumber"); ReportParameter subagentnumber = new ReportParameter("AgentNumber"); ReportParameter region = new ReportParameter("Region"); ReportParameter district = new ReportParameter("District"); ReportParameter store = new ReportParameter("StoreNumber"); ReportParameter start = new ReportParameter("StartDate", _start); ReportParameter end = new ReportParameter("EndDate", _end); report.SetParameters(new ReportParameter[] { client, division, agentnumber, subagentnumber, region, district, store, start, end, clientName }); report.Refresh(); } break; } }
protected void OnButtonCommand(object sender, CommandEventArgs e) { //Event handler for command button clicked //Change view to Viewer and reset to clear existing data Master.Viewer.Reset(); //Get parameters for the query string dates = this.cboDateValue.SelectedValue; string _start = dates.Split(':')[0].Trim(); string _end = dates.Split(':')[1].Trim(); string type = this.cboType.SelectedValue; string _vendor = this.cboCustomer.SelectedValue; //Initialize control values LocalReport report = Master.Viewer.LocalReport; report.DisplayName = REPORT_NAME; report.EnableExternalImages = true; EnterpriseGateway enterprise = new EnterpriseGateway(); DataSet ds = null; switch (type) { case "DDU": if (this.chkZips.Checked) { ds = enterprise.FillDataset(USP_REPORT_DDU, TBL_REPORT, new object[] { _end, _vendor }); } else { ds = enterprise.FillDataset(USP_REPORT_DDU_SUBSET, TBL_REPORT, new object[] { _end, _vendor }); } break; case "NDC": ds = enterprise.FillDataset(USP_REPORT_NDC, TBL_REPORT, new object[] { _end, _vendor }); break; case "SCF": ds = enterprise.FillDataset(USP_REPORT_SCF, TBL_REPORT, new object[] { _end, _vendor }); break; } if (ds.Tables[TBL_REPORT].Rows.Count >= 0) { switch (e.CommandName) { case "Run": //Set local report and data source System.IO.Stream stream = null; switch (type) { case "DDU": stream = Master.GetReportDefinition(REPORT_SRC_DDU); break; case "NDC": stream = Master.GetReportDefinition(REPORT_SRC_NDC); break; case "SCF": stream = Master.GetReportDefinition(REPORT_SRC_SCF); break; } report.LoadReportDefinition(stream); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(REPORT_DS, ds.Tables[TBL_REPORT])); //Set the report parameters for the report ReportParameter end = new ReportParameter("EndDate", _end); ReportParameter vendor = new ReportParameter("VendorNumber", _vendor); ReportParameter customer = new ReportParameter("Customer", this.cboCustomer.SelectedItem.Text); report.SetParameters(new ReportParameter[] { end, vendor, customer }); //Update report rendering with new data report.Refresh(); if (!Master.Viewer.Enabled) { Master.Viewer.CurrentPage = 1; } break; case "Data": //Set local export report and data source report.LoadReportDefinition(Master.CreateExportRdl(ds, REPORT_DS, "RGXSQLR.TSORT")); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(REPORT_DS, ds.Tables[TBL_REPORT])); report.Refresh(); break; case "Excel": //Create Excel mime-type page Response.ClearHeaders(); Response.Clear(); Response.Charset = ""; Response.AddHeader("Content-Disposition", "inline; filename=BNConsumerDirectWeeklyPerformanceSummary.xls"); Response.ContentType = "application/vnd.ms-excel"; //application/octet-stream"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[TBL_REPORT]; dg.DataBind(); dg.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); break; } } else { Master.Status = "There were no records found."; } }
protected void OnButtonCommand(object sender,CommandEventArgs e) { //Event handler for command button clicked //Change view to Viewer and reset to clear existing data Master.Viewer.Reset(); //Get parameters for the query DateTime _from = Master.FromDate; DateTime _to = Master.ToDate; string _agent = Master.AgentNumber; string _client = Master.ClientNumber; string _clientName = Master.ClientName; string _div = Master.DivisionNumber; //Initialize control values LocalReport report = Master.Viewer.LocalReport; report.DisplayName = REPORT_NAME; report.EnableExternalImages = true; EnterpriseGateway enterprise = new EnterpriseGateway(); DataSet ds = enterprise.FillDataset(USP_REPORT,TBL_REPORT,new object[] { _client,_div,_from.ToString("yyyy-MM-dd"),_to.ToString("yyyy-MM-dd"),(_agent == "All" ? null : _agent) }); if(ds.Tables[TBL_REPORT].Rows.Count >= 0) { switch(e.CommandName) { case "Run": //Set local report and data source System.IO.Stream stream = Master.GetReportDefinition(REPORT_SRC); report.LoadReportDefinition(stream); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(REPORT_DS,ds.Tables[TBL_REPORT])); //Set the report parameters for the report ReportParameter client = new ReportParameter("ClientNumber",_client); ReportParameter div = new ReportParameter("ClientDivision",_div); ReportParameter from = new ReportParameter("StartPUDate",_from.ToString("yyyy-MM-dd")); ReportParameter to = new ReportParameter("EndPUDate",_to.ToString("yyyy-MM-dd")); ReportParameter agent = new ReportParameter("AgentNumber",_agent); ReportParameter clientName = new ReportParameter("ClientName",_clientName); report.SetParameters(new ReportParameter[] { client,div,from,to,agent,clientName }); //Update report rendering with new data report.Refresh(); if(!Master.Viewer.Enabled) Master.Viewer.CurrentPage = 1; break; case "Data": //Set local export report and data source report.LoadReportDefinition(Master.CreateExportRdl(ds,REPORT_DS,"RGXSQLR.TSORT")); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(REPORT_DS,ds.Tables[TBL_REPORT])); report.Refresh(); break; case "Excel": //Create Excel mime-type page Response.ClearHeaders(); Response.Clear(); Response.Charset = ""; Response.AddHeader("Content-Disposition","inline; filename=OnTimeByDayAndWindowException.xls"); Response.ContentType = "application/vnd.ms-excel"; //application/octet-stream"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[TBL_REPORT]; dg.DataBind(); dg.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); break; } } else { Master.Status = "There were no records found."; } }
protected void OnButtonCommand(object sender, CommandEventArgs e) { //Event handler for command button clicked try { //Change view to Viewer and reset to clear existing data Master.Viewer.Reset(); //Get parameters for the query string _clientName = this.dgdClientVendor.ClientName; string _pickupID = "", _termCode = ""; //Initialize control values LocalReport report = Master.Viewer.LocalReport; report.DisplayName = this.mTitle; report.EnableExternalImages = true; EnterpriseGateway enterprise = new EnterpriseGateway(); DataSet ds = new DataSet(this.mDSName); foreach (GridViewRow row in SelectedRows) { DataKey dataKey = (DataKey)this.grdPickups.DataKeys[row.RowIndex]; _pickupID += (_pickupID.Length > 0 ? ", " : "") + dataKey["PickupID"].ToString(); _termCode = dataKey["TerminalCode"].ToString(); DataSet _ds = enterprise.FillDataset(this.mUSPName, mTBLName, new object[] { dataKey["PickupID"].ToString() }); ds.Merge(_ds); } if (ds.Tables[mTBLName] == null) { ds.Tables.Add(mTBLName); } switch (e.CommandName) { case "Run": //Set local report and data source System.IO.Stream stream = Master.GetReportDefinition(this.mSource); report.LoadReportDefinition(stream); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); //Set the report parameters for the report ReportParameter clientName = new ReportParameter("ClientName", _clientName); ReportParameter puID = new ReportParameter("PickupID", _pickupID); ReportParameter termCode = new ReportParameter("TerminalCode", _termCode); report.SetParameters(new ReportParameter[] { puID }); //Update report rendering with new data report.Refresh(); if (!Master.Viewer.Enabled) { Master.Viewer.CurrentPage = 1; } break; case "Data": //Set local export report and data source report.LoadReportDefinition(Master.CreateExportRdl(ds, this.mDSName)); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); report.Refresh(); break; case "Excel": //Create Excel mime-type page Response.ClearHeaders(); Response.Clear(); Response.Charset = ""; Response.AddHeader("Content-Disposition", "inline; filename=ASNTracking.xls"); Response.ContentType = "application/vnd.ms-excel"; //application/octet-stream"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[mTBLName]; dg.DataBind(); dg.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); break; } } catch (Exception ex) { Master.ReportError(ex); } }
protected void OnButtonCommand(object sender, CommandEventArgs e) { //Event handler for command button clicked try { //Change view to Viewer and reset to clear existing data Master.Viewer.Reset(); //Get parameters for the query string _client = this.cboClient.SelectedValue != "" ? this.cboClient.SelectedValue : null; string _vendor = this.cboVendor.SelectedValue != "" ? this.cboVendor.SelectedValue : null; string _numbers = this.txtNumbers.Text.Replace("\r\n", ","); //Initialize control values LocalReport report = Master.Viewer.LocalReport; report.DisplayName = this.mTitle; report.EnableExternalImages = true; EnterpriseGateway enterprise = new EnterpriseGateway(); string sp = this.mUSPName; switch (this.cboBy.SelectedValue.ToLower()) { case "carton": sp = this.mUSPName; break; case "tracking": sp = USP_REPORT_BYTRACKINGNUMBER; break; case "labelsequence": sp = USP_REPORT_BYLABELSEQNUMBER; break; } DataSet ds = enterprise.FillDataset(sp, this.mTBLName, new object[] { _numbers, _client, _vendor }); if (ds.Tables[mTBLName] == null) { ds.Tables.Add(mTBLName); } switch (e.CommandName) { case "Run": //Set local report and data source System.IO.Stream stream = Master.GetReportDefinition(this.mSource); report.LoadReportDefinition(stream); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); //Set the report parameters for the report ReportParameter numbers = new ReportParameter("Text", _numbers); ReportParameter client = new ReportParameter("Client", _client); ReportParameter vendor = new ReportParameter("Vendor", _vendor); report.SetParameters(new ReportParameter[] { numbers, client, vendor }); //Update report rendering with new data report.Refresh(); if (!Master.Viewer.Enabled) { Master.Viewer.CurrentPage = 1; } break; case "Data": //Set local export report and data source report.LoadReportDefinition(Master.CreateExportRdl(ds, this.mDSName)); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); report.Refresh(); break; case "Excel": //Create Excel mime-type page Response.ClearHeaders(); Response.Clear(); Response.Charset = ""; Response.AddHeader("Content-Disposition", "inline; filename=MultiCartonPOD.xls"); Response.ContentType = "application/vnd.ms-excel"; //application/octet-stream"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[mTBLName]; dg.DataBind(); dg.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); break; } } catch (Exception ex) { Master.ReportError(ex); } }
protected void OnButtonCommand(object sender, CommandEventArgs e) { //Event handler for command button clicked try { //Change view to Viewer and reset to clear existing data Master.Viewer.Reset(); //Get parameters for the query string _blNumber = ""; string _terminalCode = this.cboTerminal.SelectedValue; //Initialize control values LocalReport report = Master.Viewer.LocalReport; report.DisplayName = this.mTitle; report.EnableExternalImages = true; EnterpriseGateway enterprise = new EnterpriseGateway(); DataKey dataKey = (DataKey)this.grdFreight.DataKeys[this.grdFreight.SelectedRow.RowIndex]; _blNumber = dataKey["BLNumber"].ToString(); DataSet ds = enterprise.FillDataset(this.mUSPName, mTBLName, new object[] { _blNumber, _terminalCode }); if (ds.Tables[mTBLName] == null) { ds.Tables.Add(mTBLName); } switch (e.CommandName) { case "Run": //Set local report and data source System.IO.Stream stream = Master.GetReportDefinition(this.mSource); report.LoadReportDefinition(stream); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); //Set the report parameters for the report ReportParameter blNumber = new ReportParameter("BLNumber", _blNumber); ReportParameter terminalCode = new ReportParameter("TerminalCode", _terminalCode); report.SetParameters(new ReportParameter[] { blNumber, terminalCode }); //Update report rendering with new data report.Refresh(); if (!Master.Viewer.Enabled) { Master.Viewer.CurrentPage = 1; } break; case "Data": //Set local export report and data source report.LoadReportDefinition(Master.CreateExportRdl(ds, this.mDSName)); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); report.Refresh(); break; case "Excel": //Create Excel mime-type page Response.ClearHeaders(); Response.Clear(); Response.Charset = ""; Response.AddHeader("Content-Disposition", "inline; filename=InductedCartons.xls"); Response.ContentType = "application/vnd.ms-excel"; //application/octet-stream"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[mTBLName]; dg.DataBind(); dg.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); break; } } catch (Exception ex) { Master.ReportError(ex); } }
protected void OnButtonCommand(object sender, CommandEventArgs e) { //Event handler for view button clicked //Change view to Viewer and reset to clear existing data Master.Viewer.Reset(); //Get parameters for the query string _client = this.dgdClientVendorLog.ClientNumber; string _div = this.dgdClientVendorLog.ClientDivsionNumber; string _name = this.dgdClientVendorLog.ClientName; string _manifestID = "", _pickupDate = "", _pickupNum = ""; LocalReport report = Master.Viewer.LocalReport; report.DisplayName = REPORT_NAME; report.EnableExternalImages = true; EnterpriseGateway enterprise = new EnterpriseGateway(); DataSet ds = new DataSet(REPORT_DS); for (int i = 0; i < this.dgdClientVendorLog.VendorLogEntries.VendorLogTable.Rows.Count; i++) { _manifestID = this.dgdClientVendorLog.VendorLogEntries.VendorLogTable[i].ID.ToString(); _pickupDate = this.dgdClientVendorLog.VendorLogEntries.VendorLogTable[i].PickupDate.ToString("MM-dd-yyyy"); _pickupNum = this.dgdClientVendorLog.VendorLogEntries.VendorLogTable[i].PickupNumber.ToString(); DataSet _ds = enterprise.FillDataset(USP_REPORT, TBL_REPORT, new object[] { _manifestID }); _ds.Tables[TBL_REPORT].Columns.Add("ManifestID"); _ds.Tables[TBL_REPORT].Columns.Add("PickupDate"); _ds.Tables[TBL_REPORT].Columns.Add("PickupNumber"); for (int j = 0; j < _ds.Tables[TBL_REPORT].Rows.Count; j++) { _ds.Tables[TBL_REPORT].Rows[j]["ManifestID"] = _manifestID; _ds.Tables[TBL_REPORT].Rows[j]["PickupDate"] = _pickupDate; _ds.Tables[TBL_REPORT].Rows[j]["PickupNumber"] = _pickupNum; } ds.Merge(_ds); } if (ds.Tables[TBL_REPORT].Rows.Count >= 0) { switch (e.CommandName) { case "Run": //Set local report and data source System.IO.Stream stream = Master.GetReportDefinition(REPORT_SRC); report.LoadReportDefinition(stream); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(REPORT_DS, ds.Tables[TBL_REPORT])); //Set the report parameters for the report ReportParameter manifestID = new ReportParameter("ManifestID", ""); ReportParameter client = new ReportParameter("ClientNumber", _client); ReportParameter div = new ReportParameter("ClientDivision", _div); ReportParameter name = new ReportParameter("ClientName", _name); ReportParameter punumber = new ReportParameter("PUNumber", ""); ReportParameter pudate = new ReportParameter("PUDate", ""); report.SetParameters(new ReportParameter[] { manifestID, client, div, name, punumber, pudate }); //Update report rendering with new data report.Refresh(); if (!Master.Viewer.Enabled) { Master.Viewer.CurrentPage = 1; } break; case "Data": //Set local export report and data source report.LoadReportDefinition(Master.CreateExportRdl(ds, REPORT_DS, "RGXSQLR.TSORT")); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(REPORT_DS, ds.Tables[TBL_REPORT])); report.Refresh(); break; case "Excel": //Create Excel mime-type page Response.ClearHeaders(); Response.Clear(); Response.Charset = ""; Response.AddHeader("Content-Disposition", "inline; filename=AuditTrailer.xls"); Response.ContentType = "application/vnd.ms-excel"; //application/octet-stream"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[TBL_REPORT]; dg.DataBind(); dg.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); break; } } else { Master.Status = "There were no records found."; } }
protected void OnButtonCommand(object sender, CommandEventArgs e) { //Event handler for command button clicked try { //Change view to Viewer and reset to clear existing data Master.Viewer.Reset(); //Get parameters for the query string _client = this.dgdClientVendor.ClientNumber; string _div = this.dgdClientVendor.ClientDivsionNumber; string _clientName = this.dgdClientVendor.ClientName; string _vendor = "", _vendorName = "", _pudate = "", _punum = "", _manifests = "", _trailers = ""; //Initialize control values LocalReport report = Master.Viewer.LocalReport; report.DisplayName = this.mTitle; report.EnableExternalImages = true; EnterpriseGateway enterprise = new EnterpriseGateway(); DataSet ds = new DataSet(this.mDSName); DataSet _ds = new DataSet(this.mDSName); foreach (GridViewRow row in SelectedRows) { DataKey dataKey = (DataKey)this.grdPickups.DataKeys[row.RowIndex]; _vendor = dataKey["VendorNumber"].ToString(); _vendorName = dataKey["VendorName"].ToString(); _pudate = DateTime.Parse(dataKey["PUDate"].ToString()).ToString("yyyy-MM-dd"); _punum = dataKey["PUNumber"].ToString(); _manifests = dataKey["ManifestNumbers"].ToString(); _trailers = dataKey["TrailerNumbers"].ToString(); //DataSet _ds = enterprise.FillDataset(this.mUSPName,mTBLName,new object[] { _client,_div,_vendor,_pudate,_punum,_vendorName,_manifests,_trailers }); DataSet __ds = enterprise.FillDataset(this.mUSPName, mTBLName, new object[] { _client, _div, _vendor, _pudate, _punum }); _ds.Merge(__ds); } if (ds.Tables[mTBLName] == null) { ds.Tables.Add(mTBLName); } //Filter for damage code if applicable if (this.cboDamageCode.SelectedItem.Text == EnterpriseGateway.DAMAGEDESCRIPTON_ALL) { ds.Merge(_ds); } else if (this.cboDamageCode.SelectedItem.Text == EnterpriseGateway.DAMAGEDESCRIPTON_ALL_EXCEPT_NC) { DataRow[] rows = _ds.Tables[0].Select("DamageDescription='NON-CONVEYABLE'"); for (int i = 0; i < rows.Length; i++) { rows[i].Delete(); } _ds.AcceptChanges(); ds.Merge(_ds); } else { ds.Merge(_ds.Tables[0].Select("DamageDescription='" + this.cboDamageCode.SelectedItem.Text + "'")); } switch (e.CommandName) { case "Run": //Set local report and data source System.IO.Stream stream = Master.GetReportDefinition(this.mSource); report.LoadReportDefinition(stream); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); //Set the report parameters for the report ReportParameter client = new ReportParameter("ClientNumber", _client); ReportParameter div = new ReportParameter("ClientDivision", _div); ReportParameter vendor = new ReportParameter("VendorNumber"); ReportParameter pudate = new ReportParameter("PUDate"); ReportParameter punum = new ReportParameter("PuNumber"); ReportParameter vendorName = new ReportParameter("VendorName", ""); ReportParameter clientName = new ReportParameter("ClientName", _clientName); ReportParameter manifests = new ReportParameter("Manifest", ""); ReportParameter trailers = new ReportParameter("Trailers", ""); report.SetParameters(new ReportParameter[] { client, div, vendor, pudate, punum, vendorName, clientName, manifests, trailers }); //Update report rendering with new data report.Refresh(); if (!Master.Viewer.Enabled) { Master.Viewer.CurrentPage = 1; } break; case "Data": //Set local export report and data source report.LoadReportDefinition(Master.CreateExportRdl(ds, this.mDSName)); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); report.Refresh(); break; case "Excel": //Create Excel mime-type page Response.ClearHeaders(); Response.Clear(); Response.Charset = ""; Response.AddHeader("Content-Disposition", "inline; filename=DamagedCartons.xls"); Response.ContentType = "application/vnd.ms-excel"; //application/octet-stream"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[mTBLName]; dg.DataBind(); dg.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); break; } } catch (Exception ex) { Master.ReportError(ex); } }
protected void OnButtonCommand(object sender, CommandEventArgs e) { //Event handler for view button clicked try { //Change view to Viewer and reset to clear existing data Master.Viewer.Reset(); //Get parameters for the query string _date = this.ddpPickups.ToDate.ToString("yyyy-MM-dd"); string _terminal = this.cboTerminal.SelectedValue; string _terminalName = this.cboTerminal.SelectedItem.Text; string _rescanStatus = this.cboFilter.SelectedValue; //Initialize control values LocalReport report = Master.Viewer.LocalReport; report.DisplayName = this.mTitle; report.EnableExternalImages = true; EnterpriseGateway enterprise = new EnterpriseGateway(); DataSet ds = enterprise.FillDataset(this.mUSPName, mTBLName, new object[] { _terminal, _date, _rescanStatus }); if (ds.Tables[mTBLName] == null) { ds.Tables.Add(mTBLName); } switch (e.CommandName) { case "Run": //Set local report and data source System.IO.Stream stream = Master.GetReportDefinition(this.mSource); report.LoadReportDefinition(stream); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); //Set the report parameters for the report ReportParameter terminalID = new ReportParameter("TerminalID", _terminal); ReportParameter terminalName = new ReportParameter("Terminal", _terminalName); ReportParameter date = new ReportParameter("ZoneCloseDate", _date); ReportParameter rescanStatus = new ReportParameter("ReScanStatus", _rescanStatus); report.SetParameters(new ReportParameter[] { terminalID, date, rescanStatus, terminalName }); //Update report rendering with new data report.Refresh(); if (!Master.Viewer.Enabled) { Master.Viewer.CurrentPage = 1; } break; case "Data": //Set local export report and data source report.LoadReportDefinition(Master.CreateExportRdl(ds, this.mDSName)); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); report.Refresh(); break; case "Excel": //Create Excel mime-type page Response.ClearHeaders(); Response.Clear(); Response.Charset = ""; Response.AddHeader("Content-Disposition", "inline; filename=SortedBMC.xls"); Response.ContentType = "application/vnd.ms-excel"; //application/octet-stream"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[mTBLName]; dg.DataBind(); dg.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); break; } } catch (Exception ex) { Master.ReportError(ex); } }
protected void OnButtonCommand(object sender, CommandEventArgs e) { //Event handler for command button clicked //Change view to Viewer and reset to clear existing data Master.Viewer.Reset(); //Get parameters for the query string _client = this.dgdClientVendor.ClientNumber; string _div = this.dgdClientVendor.ClientDivsionNumber; string _clientName = this.dgdClientVendor.ClientName; string _vendor = this.dgdClientVendor.VendorNumber; string _vendorName = this.dgdClientVendor.VendorName; string _pudate = "", _punum = ""; //Initialize control values LocalReport report = Master.Viewer.LocalReport; report.DisplayName = REPORT_NAME; report.EnableExternalImages = true; EnterpriseGateway enterprise = new EnterpriseGateway(); DataSet ds = new DataSet(REPORT_DS); foreach (GridViewRow row in SelectedRows) { DataKey dataKey = (DataKey)this.grdPickups.DataKeys[row.RowIndex]; _pudate = DateTime.Parse(dataKey["PUDate"].ToString()).ToString("yyyy-MM-dd"); _punum = dataKey["PUNumber"].ToString(); DataSet _ds = enterprise.FillDataset(USP_REPORT, TBL_REPORT, new object[] { _client, _div, _vendor, _pudate, _punum }); ds.Merge(_ds); } if (ds.Tables[TBL_REPORT].Rows.Count >= 0) { switch (e.CommandName) { case "Run": //Set local report and data source System.IO.Stream stream = Master.GetReportDefinition(REPORT_SRC); report.LoadReportDefinition(stream); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(REPORT_DS, ds.Tables[TBL_REPORT])); //Set the report parameters for the report ReportParameter client = new ReportParameter("ClientNumber", _client); ReportParameter div = new ReportParameter("ClientDivision", _div); ReportParameter clientName = new ReportParameter("ClientName", _clientName); ReportParameter vendor = new ReportParameter("VendorNumber", _vendor); ReportParameter vendorName = new ReportParameter("VendorName", _vendorName); ReportParameter pudate = new ReportParameter("PUDate", "08-02-1961"); ReportParameter punum = new ReportParameter("PUNumber", "0"); report.SetParameters(new ReportParameter[] { client, div, clientName, vendorName, pudate, punum, vendor }); //Update report rendering with new data report.Refresh(); if (!Master.Viewer.Enabled) { Master.Viewer.CurrentPage = 1; } break; case "Data": //Set local export report and data source report.LoadReportDefinition(Master.CreateExportRdl(ds, REPORT_DS, "RGXSQLR.TSORT")); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(REPORT_DS, ds.Tables[TBL_REPORT])); report.Refresh(); break; case "Excel": //Create Excel mime-type page Response.ClearHeaders(); Response.Clear(); Response.Charset = ""; Response.AddHeader("Content-Disposition", "inline; filename=InboundTracking.xls"); Response.ContentType = "application/vnd.ms-excel"; //application/octet-stream"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[TBL_REPORT]; dg.DataBind(); dg.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); break; } } else { Master.Status = "There were no records found."; } }
protected void OnButtonCommand(object sender, CommandEventArgs e) { //Event handler for view button clicked //Change view to Viewer and reset to clear existing data Master.Viewer.Reset(); //Get parameters for the query string _terminal = this.cboTerminal.SelectedValue; string _terminalName = this.cboTerminal.SelectedItem.Text; string _tripNumber = this.grdTrips.SelectedRow.Cells[1].Text.Trim(); //Initialize control values LocalReport report = Master.Viewer.LocalReport; report.DisplayName = REPORT_NAME; report.EnableExternalImages = true; EnterpriseGateway enterprise = new EnterpriseGateway(); DataSet ds = new DataSet(REPORT_DS); DataSet _ds = enterprise.FillDataset(USP_REPORT, TBL_REPORT, new object[] { _terminal, _tripNumber }); if (_ds.Tables[TBL_REPORT].Rows.Count >= 0) { //Filter for over/short if applicable if (this.chkOverShort.Checked) { ds = _ds.Clone(); ds.Merge(_ds.Tables[TBL_REPORT].Select("Match = 0")); } else { ds.Merge(_ds); } } if (ds.Tables[TBL_REPORT].Rows.Count >= 0) { switch (e.CommandName) { case "Run": //Set local report and data source System.IO.Stream stream = Master.GetReportDefinition(this.chkOverShort.Checked ? REPORT_SRC_OVERSHORT : REPORT_SRC); report.LoadReportDefinition(stream); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(REPORT_DS, ds.Tables[TBL_REPORT])); //Set the report parameters for the report ReportParameter terminal = new ReportParameter("TerminalID", _terminal); ReportParameter terminalName = new ReportParameter("TerminalName", _terminalName); ReportParameter tripNumber = new ReportParameter("TripNumber", _tripNumber); report.SetParameters(new ReportParameter[] { terminal, tripNumber, terminalName }); //Update report rendering with new data report.Refresh(); if (!Master.Viewer.Enabled) { Master.Viewer.CurrentPage = 1; } break; case "Data": //Set local export report and data source report.LoadReportDefinition(Master.CreateExportRdl(ds, REPORT_DS, "RGXSQLR.TSORT")); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(REPORT_DS, ds.Tables[TBL_REPORT])); report.Refresh(); break; case "Excel": //Create Excel mime-type page Response.ClearHeaders(); Response.Clear(); Response.Charset = ""; Response.AddHeader("Content-Disposition", "inline; filename=AuditTrailer.xls"); Response.ContentType = "application/vnd.ms-excel"; //application/octet-stream"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[TBL_REPORT]; dg.DataBind(); dg.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); break; } } else { Master.Status = "There were no records found."; } }
protected void OnButtonCommand(object sender, CommandEventArgs e) { //Event handler for command button clicked //Change view to Viewer and reset to clear existing data Master.Viewer.Reset(); //Get parameters for the query string _start = this.ddpSetup.FromDate.ToString("yyyy-MM-dd"); string _end = this.ddpSetup.ToDate.ToString("yyyy-MM-dd"); //Initialize control values LocalReport report = Master.Viewer.LocalReport; report.DisplayName = REPORT_NAME; report.EnableExternalImages = true; EnterpriseGateway enterprise = new EnterpriseGateway(); DataSet ds = enterprise.FillDataset(USP_REPORT, TBL_REPORT, new object[] { _start, _end }); if (ds.Tables[TBL_REPORT].Rows.Count >= 0) { switch (e.CommandName) { case "Run": //Set local report and data source System.IO.Stream stream = Master.GetReportDefinition(REPORT_SRC); report.LoadReportDefinition(stream); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(REPORT_DS, ds.Tables[TBL_REPORT])); //Set the report parameters for the report ReportParameter start = new ReportParameter("StartDate", _start); ReportParameter end = new ReportParameter("EndDate", _end); report.SetParameters(new ReportParameter[] { start, end }); //Update report rendering with new data report.Refresh(); if (!Master.Viewer.Enabled) { Master.Viewer.CurrentPage = 1; } break; case "Data": //Set local export report and data source report.LoadReportDefinition(Master.CreateExportRdl(ds, REPORT_DS, "RGXSQLR.TSORT")); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(REPORT_DS, ds.Tables[TBL_REPORT])); report.Refresh(); break; case "Excel": //Create Excel mime-type page Response.ClearHeaders(); Response.Clear(); Response.Charset = ""; Response.AddHeader("Content-Disposition", "inline; filename=BNConsumerDirectDDUPerformanceDetail.xls"); Response.ContentType = "application/vnd.ms-excel"; //application/octet-stream"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[TBL_REPORT]; dg.DataBind(); dg.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); break; } } else { Master.Status = "There were no records found."; } }
protected void OnButtonCommand(object sender, CommandEventArgs e) { //Event handler for command button clicked try { //Change view to Viewer and reset to clear existing data Master.Viewer.Reset(); //Get parameters for the query string _from = this.ddpDelivery.FromDate.ToString("yyyy-MM-dd"); string _to = this.ddpDelivery.ToDate.ToString("yyyy-MM-dd"); string _client = this.dgdClientAgent.ClientNumber; string _agent = this.chkAllAgents.Checked ? null : this.dgdClientAgent.AgentNumber; string _pctontome = this.txtPctOnTime.Text; //Initialize control values LocalReport report = Master.Viewer.LocalReport; report.DisplayName = this.mTitle; report.EnableExternalImages = true; EnterpriseGateway enterprise = new EnterpriseGateway(); DataSet ds = enterprise.FillDataset(this.mUSPName, mTBLName, new object[] { _from, _to, _client, _agent, _pctontome }); if (ds.Tables[mTBLName] == null) { ds.Tables.Add(mTBLName); } switch (e.CommandName) { case "Run": //Set local report and data source System.IO.Stream stream = Master.GetReportDefinition(this.mSource); report.LoadReportDefinition(stream); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); //Set the report parameters for the report ReportParameter from = new ReportParameter("FromDate", _from); ReportParameter to = new ReportParameter("ToDate", _to); ReportParameter client = new ReportParameter("ClientNumber", _client + "-" + this.dgdClientAgent.ClientName); ReportParameter agent = new ReportParameter("AgentNumber", _agent); ReportParameter pctontome = new ReportParameter("PctOnTime", _pctontome); report.SetParameters(new ReportParameter[] { from, to, client, agent, pctontome }); //Update report rendering with new data report.Refresh(); if (!Master.Viewer.Enabled) { Master.Viewer.CurrentPage = 1; } break; case "Data": //Set local export report and data source report.LoadReportDefinition(Master.CreateExportRdl(ds, this.mDSName)); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); report.Refresh(); break; case "Excel": //Create Excel mime-type page Response.ClearHeaders(); Response.Clear(); Response.Charset = ""; Response.AddHeader("Content-Disposition", "inline; filename=OnTimeCartonByDeliverySummary.xls"); Response.ContentType = "application/vnd.ms-excel"; //application/octet-stream"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[mTBLName]; dg.DataBind(); dg.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); break; } } catch (Exception ex) { Master.ReportError(ex); } }
protected void OnButtonCommand(object sender, CommandEventArgs e) { //Event handler for command button clicked //Change view to Viewer and reset to clear existing data Master.Viewer.Reset(); //Get parameters for the query string _from = this.ddpPickups.FromDate.ToString("yyyy-MM-dd"); string _to = this.ddpPickups.ToDate.ToString("yyyy-MM-dd"); string _zone = this.cboAgent.SelectedValue != "" ? this.cboAgent.SelectedValue : null; string _weight = this.txtWeight.Text; string _cube = this.txtCube.Text; //Initialize control values LocalReport report = Master.Viewer.LocalReport; report.DisplayName = REPORT_NAME; report.EnableExternalImages = true; EnterpriseGateway enterprise = new EnterpriseGateway(); DataSet ds = enterprise.FillDataset(USP_REPORT, TBL_REPORT, new object[] { _from, _to, _zone, _weight, _cube }); if (ds.Tables[TBL_REPORT].Rows.Count >= 0) { switch (e.CommandName) { case "Run": //Set local report and data source System.IO.Stream stream = Master.GetReportDefinition(REPORT_SRC); report.LoadReportDefinition(stream); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(REPORT_DS, ds.Tables[TBL_REPORT])); //Set the report parameters for the report ReportParameter from = new ReportParameter("StartDate", _from); ReportParameter to = new ReportParameter("EndDate", _to); ReportParameter weight = new ReportParameter("OptimalTrailerWeight", _weight); ReportParameter zone = new ReportParameter("MainZone", _zone); report.SetParameters(new ReportParameter[] { from, to, weight, zone }); //Update report rendering with new data report.Refresh(); if (!Master.Viewer.Enabled) { Master.Viewer.CurrentPage = 1; } break; case "Data": //Set local export report and data source report.LoadReportDefinition(Master.CreateExportRdl(ds, REPORT_DS, "RGXSQLR.TSORT")); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(REPORT_DS, ds.Tables[TBL_REPORT])); report.Refresh(); break; case "Excel": //Create Excel mime-type page Response.ClearHeaders(); Response.Clear(); Response.Charset = ""; Response.AddHeader("Content-Disposition", "inline; filename=ScanningSummaryByStore.xls"); Response.ContentType = "application/vnd.ms-excel"; //application/octet-stream"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[TBL_REPORT]; dg.DataBind(); dg.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); break; } } else { Master.Status = "There were no records found."; } }
protected void OnButtonCommand(object sender, CommandEventArgs e) { //Event handler for command button clicked try { //Change view to Viewer and reset to clear existing data Master.Viewer.Reset(); //Get parameters for the query string _puDate = this.ddpPickups.ToDate.ToString("yyyy-MM-dd"); string _client = this.dgdClientVendor.ClientNumber; string _div = this.dgdClientVendor.ClientDivsionNumber; string _clientName = this.dgdClientVendor.ClientName; string _vendor = this.dgdClientVendor.VendorNumber; string _vendorName = this.dgdClientVendor.VendorName; //Initialize control values LocalReport report = Master.Viewer.LocalReport; report.DisplayName = this.mTitle; report.EnableExternalImages = true; EnterpriseGateway enterprise = new EnterpriseGateway(); DataSet ds = enterprise.FillDataset(this.mUSPName, mTBLName, new object[] { _client, _div, _vendor, _puDate }); if (ds.Tables[mTBLName] == null) { ds.Tables.Add(mTBLName); } switch (e.CommandName) { case "Run": //Set local report and data source System.IO.Stream stream = Master.GetReportDefinition(this.mSource); report.LoadReportDefinition(stream); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); //Set the report parameters for the report ReportParameter puDate = new ReportParameter("PUDate", _puDate); ReportParameter client = new ReportParameter("ClientNumber", _client); ReportParameter div = new ReportParameter("ClientDivision", _div); ReportParameter clientName = new ReportParameter("ClientName", _clientName); ReportParameter vendor = new ReportParameter("VendorNumber", _vendor); ReportParameter vendorName = new ReportParameter("VendorName", _vendorName); report.SetParameters(new ReportParameter[] { client, div, vendor, puDate, clientName, vendorName }); //Update report rendering with new data report.Refresh(); if (!Master.Viewer.Enabled) { Master.Viewer.CurrentPage = 1; } break; case "Data": //Set local export report and data source report.LoadReportDefinition(Master.CreateExportRdl(ds, this.mDSName)); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); report.Refresh(); break; case "Excel": //Create Excel mime-type page Response.ClearHeaders(); Response.Clear(); Response.Charset = ""; Response.AddHeader("Content-Disposition", "inline; filename=PickupDateCartonNumberDiscrepancy.xls"); Response.ContentType = "application/vnd.ms-excel"; //application/octet-stream"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[mTBLName]; dg.DataBind(); dg.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); break; } } catch (Exception ex) { Master.ReportError(ex); } }
protected void OnButtonCommand(object sender, CommandEventArgs e) { //Event handler for command button clicked try { //Change view to Viewer and reset to clear existing data Master.Viewer.Reset(); //Get parameters for the query string _type = this.cboType.SelectedValue.ToLower(); string _sort = this.cboSortBy.SelectedValue.ToLower(); string _client = this.dgdClientVendor.ClientNumber; string _div = this.dgdClientVendor.ClientDivsionNumber; string _clientName = this.dgdClientVendor.ClientName; string _vendor = "", _vendorName = "", _pudate = "", _punum = "", _manifests = "", _trailers = ""; //Initialize control values LocalReport report = Master.Viewer.LocalReport; report.DisplayName = this.mTitle; report.EnableExternalImages = true; EnterpriseGateway enterprise = new EnterpriseGateway(); DataSet ds = new DataSet(this.mDSName); foreach (GridViewRow row in SelectedRows) { DataKey dataKey = (DataKey)this.grdPickups.DataKeys[row.RowIndex]; _vendor = dataKey["VendorNumber"].ToString(); _vendorName = dataKey["VendorName"].ToString(); _pudate = DateTime.Parse(dataKey["PUDate"].ToString()).ToString("yyyy-MM-dd"); _punum = dataKey["PUNumber"].ToString(); _manifests = dataKey["ManifestNumbers"].ToString(); _trailers = dataKey["TrailerNumbers"].ToString(); DataSet _ds = enterprise.FillDataset(this.mUSPName, mTBLName, new object[] { _client, _div, _vendor, _pudate, _punum, _vendorName, _manifests, _trailers }); ds.Merge(_ds); } if (ds.Tables[mTBLName] == null) { ds.Tables.Add(mTBLName); } switch (e.CommandName) { case "Run": //Set local report and data source string reportSrc = ""; switch (_type.ToLower()) { case "detail": reportSrc = (_sort == "store") ? REPORT_SRC_DETAILBYSTORE : REPORT_SRC_DETAILBYZONE; break; case "summary": reportSrc = (_sort == "store") ? REPORT_SRC_SUMMARYBYSTORE : REPORT_SRC_SUMMARYBYZONE; break; } System.IO.Stream stream = Master.GetReportDefinition(reportSrc); report.LoadReportDefinition(stream); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); //Set the report parameters for the report ReportParameter client = new ReportParameter("ClientNumber", _client); ReportParameter div = new ReportParameter("ClientDivision", _div); ReportParameter vendor = new ReportParameter("VendorNumber"); ReportParameter pudate = new ReportParameter("PUDate"); ReportParameter punum = new ReportParameter("PUNumber"); ReportParameter clientName = new ReportParameter("ClientName", _clientName); ReportParameter vendorName = new ReportParameter("VendorName", ""); ReportParameter manifests = new ReportParameter("ManifestNumbers", ""); ReportParameter trailers = new ReportParameter("TrailerNumbers", ""); report.SetParameters(new ReportParameter[] { client, div, vendor, pudate, punum, clientName, vendorName, manifests, trailers }); //Update report rendering with new data report.Refresh(); if (!Master.Viewer.Enabled) { Master.Viewer.CurrentPage = 1; } break; case "Data": //Set local export report and data source report.LoadReportDefinition(Master.CreateExportRdl(ds, this.mDSName)); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName])); report.Refresh(); break; case "Excel": //Create Excel mime-type page Response.ClearHeaders(); Response.Clear(); Response.Charset = ""; Response.AddHeader("Content-Disposition", "inline; filename=ClientPickup.xls"); Response.ContentType = "application/vnd.ms-excel"; //application/octet-stream"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[mTBLName]; dg.DataBind(); dg.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); break; } } catch (Exception ex) { Master.ReportError(ex); } }
protected void OnButtonCommand(object sender, CommandEventArgs e) { //Event handler for view button clicked try { //Change view to Viewer and reset to clear existing data Master.Viewer.Reset(); //Get parameters for the query string _from = this.ddpSetup.FromDate.ToString("yyyy-MM-dd"); string _to = this.ddpSetup.ToDate.ToString("yyyy-MM-dd"); string _client = this.cboClient.SelectedValue; string _terminal = this.cboTerminal.SelectedValue == "" ? null : this.cboTerminal.SelectedValue; string _vendor = this.cboVendor.SelectedValue == "" ? null : this.cboVendor.SelectedValue; string _zone = this.cboZone.SelectedValue == "" ? null : this.cboZone.SelectedValue; //Initialize control values LocalReport report = Master.Viewer.LocalReport; report.DisplayName = REPORT_NAME; report.EnableExternalImages = true; EnterpriseGateway enterprise = new EnterpriseGateway(); DataSet ds = enterprise.FillDataset(USP_REPORT, TBL_REPORT, new object[] { _client, _terminal, _vendor, _zone, _from, _to }); if (ds.Tables[TBL_REPORT].Rows.Count >= 0) { switch (e.CommandName) { case "Run": //Set local report and data source System.IO.Stream stream = Master.GetReportDefinition(REPORT_SRC); report.LoadReportDefinition(stream); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(REPORT_DS, ds.Tables[TBL_REPORT])); //Set the report parameters for the report ReportParameter client = new ReportParameter("ClientNumber", _client); ReportParameter terminal = new ReportParameter("TerminalCode", _terminal); ReportParameter vendor = new ReportParameter("VendorNumber", _vendor); ReportParameter zone = new ReportParameter("ZoneCode", _zone); ReportParameter from = new ReportParameter("StartSortDate", _from.ToString()); ReportParameter to = new ReportParameter("EndSortDate", _to.ToString()); report.SetParameters(new ReportParameter[] { client, terminal, vendor, zone, from, to }); //Update report rendering with new data report.Refresh(); if (!Master.Viewer.Enabled) { Master.Viewer.CurrentPage = 1; } break; case "Data": //Set local export report and data source report.LoadReportDefinition(Master.CreateExportRdl(ds, REPORT_DS, "RGXSQLR.TSORT")); report.DataSources.Clear(); report.DataSources.Add(new ReportDataSource(REPORT_DS, ds.Tables[TBL_REPORT])); report.Refresh(); break; case "Excel": //Create Excel mime-type page Response.ClearHeaders(); Response.Clear(); Response.Charset = ""; Response.AddHeader("Content-Disposition", "inline; filename=ClientCube.xls"); Response.ContentType = "application/vnd.ms-excel"; //application/octet-stream"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw); DataGrid dg = new DataGrid(); dg.DataSource = ds.Tables[TBL_REPORT]; dg.DataBind(); dg.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); break; } } else { Master.Status = "There were no records found."; } } catch (Exception ex) { Master.ReportError(ex); } }