//Interface
    protected void Page_Load(object sender, EventArgs e)
    {
        //Event handler for page load event
        if (!Page.IsPostBack)
        {
            //Initialize control values
            Master.ReportTitle = TITLE + " Report";

            DataSet ds = new EnterpriseRGateway().GetClients("", "01", false);
            for (int i = 0; i < ds.Tables["ClientTable"].Rows.Count; i++)
            {
                if (ds.Tables["ClientTable"].Rows[i]["ClientNumber"].ToString().Trim().Substring(0, 1) != "L")
                {
                    ds.Tables["ClientTable"].Rows[i].Delete();
                }
            }
            ds.Tables["ClientTable"].Rows.Add(new object[] { "", "", "", "", "" });
            ds.AcceptChanges();
            DataView dv = new DataView(ds.Tables["ClientTable"], "", "ClientName", DataViewRowState.CurrentRows);
            this.cboClient.DataSource = dv;
            this.cboClient.DataBind();
            if (this.cboClient.Items.Count > 0)
            {
                this.cboClient.SelectedIndex = 0;
            }
            this.txtFrom.Text = this.txtTo.Text = DateTime.Today.ToString("MM/dd/yyyy");
            OnValidateForm(null, EventArgs.Empty);
        }
        Master.ButtonCommand += new CommandEventHandler(OnButtonCommand);
    }
예제 #2
0
    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 = DateTime.Parse(this.txtFrom.Text).ToString("yyyy-MM-dd");
            string _end   = DateTime.Parse(this.txtTo.Text).ToString("yyyy-MM-dd");

            //Initialize control values
            LocalReport report = Master.Viewer.LocalReport;
            report.DisplayName          = TITLE;
            report.EnableExternalImages = true;
            EnterpriseRGateway enterprise = new EnterpriseRGateway();
            DataSet            ds         = enterprise.FillDataset(this.mUSPName, mTBLName, new object[] { _start, _end });
            if (ds.Tables[mTBLName] == null)
            {
                ds.Tables.Add(mTBLName);
            }
            switch (e.CommandName)
            {
            case "Run":
            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=ClientCubeAndWeight.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); }
    }
예제 #3
0
        public DataSet InboundManifestRead(string manifestID)
        {
            //Return a single inbound manifest
            DataSet manifests = new DataSet();

            try {
                DataSet ds = new EnterpriseRGateway().InboundManifestRead(manifestID);
                if (ds != null)
                {
                    manifests.Merge(ds);
                }
            }
            catch (Exception ex) { throw new FaultException <AgentLineHaulFault>(new AgentLineHaulFault(ex.Message), "Service Error"); }
            return(manifests);
        }
예제 #4
0
        public DataSet InboundManifestsView(string clientNumber, string clientDivision, DateTime startPickupDate, DateTime endPickupDate)
        {
            //Get a view of manifests for the specified client and date range
            DataSet manifests = new DataSet();

            try {
                DataSet ds = new EnterpriseRGateway().InboundManifestsView(clientNumber, clientDivision, startPickupDate, endPickupDate);
                if (ds != null)
                {
                    manifests.Merge(ds);
                }
            }
            catch (Exception ex) { throw new FaultException <AgentLineHaulFault>(new AgentLineHaulFault(ex.Message), "Service Error"); }
            return(manifests);
        }
예제 #5
0
    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          = TITLE;
            report.EnableExternalImages = true;
            EnterpriseRGateway enterprise = new EnterpriseRGateway();
            DataSet            ds         = new DataSet(this.mDSName);
            foreach (GridViewRow row in SelectedRows)
            {
                DataKey dataKey = (DataKey)this.grdPickups.DataKeys[row.RowIndex];
                _pickupID = dataKey["PickupID"].ToString();
                _termCode = dataKey["TerminalCode"].ToString();
                DataSet _ds = enterprise.FillDataset(this.mUSPName, mTBLName, new object[] { _termCode, _pickupID });
                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(SOURCE);
                report.LoadReportDefinition(stream);
                report.DataSources.Clear();
                report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName]));

                //Set the report parameters for the report
                ReportParameter puID       = new ReportParameter("PickupID", "0");
                ReportParameter clientName = new ReportParameter("ClientName", _clientName);
                ReportParameter termCode   = new ReportParameter("TerminalCode", "0");
                report.SetParameters(new ReportParameter[] { puID, clientName, termCode });

                //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=DeliveryInfoByPickup.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); }
    }
예제 #6
0
    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   = DateTime.Parse(this.txtFrom.Text).ToString("yyyy-MM-dd");
            string _toDate     = DateTime.Parse(this.txtTo.Text).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          = TITLE;
            report.EnableExternalImages = true;
            EnterpriseRGateway enterprise = new EnterpriseRGateway();
            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); }
    }
예제 #7
0
    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    = DateTime.Parse(this.txtShiftDate.Text).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          = TITLE;
            report.EnableExternalImages = true;
            EnterpriseRGateway enterprise = new EnterpriseRGateway();
            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(SOURCE);
                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);

                DataSet         shifts        = enterprise.GetShifts(_terminal, DateTime.Parse(this.txtShiftDate.Text));
                DataRow         row           = shifts.Tables["ShiftTable"].Select("NUMBER='" + this.cboShift.SelectedValue.ToString() + "'")[0];
                ReportParameter shiftTimeIn   = new ReportParameter("ShiftTimeIn", DateTime.Parse(row["StartTime"].ToString()).ToString("yyyy-MM-dd"));
                ReportParameter shiftTimeOut  = new ReportParameter("ShiftTimeOut", DateTime.Parse(row["EndTime"].ToString()).ToString("yyyy-MM-dd"));
                ReportParameter shiftBreak    = new ReportParameter("ShiftBreak", DateTime.Parse(row["BreakTime"].ToString()).ToString("yyyy-MM-dd"));
                ReportParameter shiftProdTime = new ReportParameter("ProductionTime", string.Concat(Decimal.Truncate((Convert.ToDecimal(row["ProductionTime"]) / 60)), ":", Convert.ToString(Convert.ToDecimal(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); }
    }
예제 #8
0
    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          = TITLE;
            report.EnableExternalImages = true;
            EnterpriseRGateway enterprise = new EnterpriseRGateway();
            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); }
    }
예제 #9
0
    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     = DateTime.Parse(this.txtPickupDate.Text).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          = TITLE;
            report.EnableExternalImages = true;
            EnterpriseRGateway enterprise = new EnterpriseRGateway();
            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(SOURCE);
                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); }
    }
예제 #10
0
    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   = DateTime.Parse(this.txtFrom.Text).ToString("yyyy-MM-dd");
            string _to     = DateTime.Parse(this.txtTo.Text).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          = TITLE;
            report.EnableExternalImages = true;
            EnterpriseRGateway enterprise = new EnterpriseRGateway();
            DataSet            ds         = enterprise.FillDataset(this.mUSPName, mTBLName, new object[] { _from, _to, _zone, _weight, _cube });
            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(SOURCE);
                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("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, 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); }
    }
예제 #11
0
    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 _pickupIDs = "", _vendor = "", _pudate = "", _punum = "", _pickups = "";

            //Initialize control values
            LocalReport report = Master.Viewer.LocalReport;
            report.DisplayName          = TITLE;
            report.EnableExternalImages = true;
            EnterpriseRGateway enterprise = new EnterpriseRGateway();
            DataSet            ds         = new DataSet(this.mDSName);
            foreach (GridViewRow row in SelectedRows)
            {
                DataKey dataKey = (DataKey)this.grdPickups.DataKeys[row.RowIndex];
                _pickupIDs += (_pickupIDs.Length > 0 ? "," : "") + dataKey["PickupID"].ToString();
                _vendor     = dataKey["VendorNumber"].ToString();
                _pudate     = DateTime.Parse(dataKey["PUDate"].ToString()).ToString("MM/dd");
                _punum      = dataKey["PUNumber"].ToString();
                _pickups   += (_pickups.Length > 0 ? ", " : "") + _vendor + "-" + _pudate + "-" + _punum;
                //_pickupIDs += (_pickupIDs.Length > 0 ? "," : "") + dataKey["PickupID"].ToString();  OnExportReport()
            }
            DataSet _ds = enterprise.FillDataset(this.mUSPName, mTBLName, new object[] { _pickupIDs });
            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(SOURCE);
                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 clientName = new ReportParameter("ClientName", _clientName);
                ReportParameter pickups    = new ReportParameter("Pickups", _pickups);
                report.SetParameters(new ReportParameter[] { client, div, clientName, pickups });

                //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=MultiPickupDiscrepancy.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); }
    }
예제 #12
0
    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          = TITLE;
            report.EnableExternalImages = true;
            EnterpriseRGateway enterprise = new EnterpriseRGateway();
            DataSet            ds         = null;
            switch (_type.ToLower())
            {
            case "manifest":                    ds = enterprise.FillDataset(USP_REPORT_MANIFEST, mTBLName, new object[] { _terminalID, _tlNumber }); break;

            case "delivery bill":               ds = enterprise.FillDataset(USP_REPORT_DELIVERY, mTBLName, new object[] { _tlNumber }); break;

            case "delivery bill w/po number":   ds = enterprise.FillDataset(USP_REPORT_DELIVERY_PO, mTBLName, new object[] { _tlNumber }); break;
            }
            if (ds.Tables[mTBLName] == null)
            {
                ds.Tables.Add(mTBLName);
            }
            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[mTBLName])); break;

                case "delivery bill": report.DataSources.Add(new ReportDataSource(REPORT_DS_DELIVERY, ds.Tables[mTBLName])); break;

                case "delivery bill w/po number": report.DataSources.Add(new ReportDataSource(REPORT_DS_DELIVERY_PO, ds.Tables[mTBLName])); 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[mTBLName].Rows.Count > 0)
                    {
                        _clientNumber = ds.Tables[mTBLName].Rows[0].IsNull("Client") ? "" : ds.Tables[mTBLName].Rows[0]["Client"].ToString().Trim();
                        _clientName   = ds.Tables[mTBLName].Rows[0].IsNull("ClientName") ? "" : ds.Tables[mTBLName].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[mTBLName].Rows.Count > 0)
                    {
                        _clientNumber = ds.Tables[mTBLName].Rows[0].IsNull("ClientNumber") ? "" : ds.Tables[mTBLName].Rows[0]["ClientNumber"].ToString().Trim();
                        _clientDiv    = ds.Tables[mTBLName].Rows[0].IsNull("ClientDivision") ? "" : ds.Tables[mTBLName].Rows[0]["ClientDivision"].ToString().Trim();
                        _consNumber   = ds.Tables[mTBLName].Rows[0].IsNull("Consignee") ? "" : ds.Tables[mTBLName].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); break;

                case "delivery bill": streamD = Master.CreateExportRdl(ds, REPORT_DS_DELIVERY); break;

                case "delivery bill w/po number": streamD = Master.CreateExportRdl(ds, REPORT_DS_DELIVERY_PO); break;
                }
                report.LoadReportDefinition(streamD);
                report.DataSources.Clear();
                switch (_type.ToLower())
                {
                case "manifest": report.DataSources.Add(new ReportDataSource(REPORT_DS_MANIFEST, ds.Tables[mTBLName])); break;

                case "delivery bill": report.DataSources.Add(new ReportDataSource(REPORT_DS_DELIVERY, ds.Tables[mTBLName])); break;

                case "delivery bill w/po number": report.DataSources.Add(new ReportDataSource(REPORT_DS_DELIVERY_PO, ds.Tables[mTBLName])); 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[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 "Delivery Window Summary By Client With Early": {
            //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);
            EnterpriseRGateway enterprise = new EnterpriseRGateway();
            DataSet            ds         = enterprise.FillDataset("uspRptDeliveryWindowSummaryByClientWithEarly", "NewTable", new object[] { null, _agent, _start, _end });
            report.DataSources.Clear();
            report.DataSources.Add(new ReportDataSource("DeliveryWindowSumByClientWithEarlyDS", ds.Tables["NewTable"]));
            DataSet _ds = enterprise.FillDataset("uspRptAgentRead", "NewTable", 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 "Delivery Window Summary By Agent With Early": {
            //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);
            EnterpriseRGateway enterprise = new EnterpriseRGateway();
            DataSet            ds         = enterprise.FillDataset("uspRptDeliveryWindowSummaryByAgentWithEarly", "NewTable", new object[] { _client, null, null, null, null, null, null, _start, _end });
            report.DataSources.Clear();
            report.DataSources.Add(new ReportDataSource("DeliveryWindowSummaryByAgentWithEarlyDS", ds.Tables["NewTable"]));
            DataSet _ds = enterprise.FillDataset("uspRptClientRead", "NewTable", new object[] { _client });
            report.DataSources.Add(new ReportDataSource("DataSet1", _ds.Tables["NewTable"]));

            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;
        }
    }
예제 #14
0
    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          = TITLE;
            report.EnableExternalImages = true;
            EnterpriseRGateway enterprise = new EnterpriseRGateway();
            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(SOURCE);
                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); }
    }
예제 #15
0
    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          = TITLE;
            report.EnableExternalImages = true;
            EnterpriseRGateway enterprise = new EnterpriseRGateway();
            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(SOURCE);
                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); }
    }
예제 #16
0
    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 _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          = TITLE;
            report.EnableExternalImages = true;
            EnterpriseRGateway enterprise = new EnterpriseRGateway();
            DataSet            ds         = new DataSet(this.mDSName);
            DataSet            _ds        = enterprise.FillDataset(this.mUSPName, mTBLName, new object[] { _terminal, _tripNumber });
            if (_ds.Tables[mTBLName].Rows.Count >= 0)
            {
                //Filter for over/short if applicable
                if (this.chkOverShort.Checked)
                {
                    ds = _ds.Clone();
                    ds.Merge(_ds.Tables[mTBLName].Select("Match = 0"));
                }
                else
                {
                    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.chkOverShort.Checked ? REPORT_SRC_OVERSHORT : SOURCE);
                report.LoadReportDefinition(stream);
                report.DataSources.Clear();
                report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName]));

                //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, 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=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[mTBLName];
                dg.DataBind();
                dg.RenderControl(hw);
                Response.Write(sw.ToString());
                Response.End();
                break;
            }
        }
        catch (Exception ex) { Master.ReportError(ex); }
    }
예제 #17
0
    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         = DateTime.Parse(this.txtCloseDate.Text).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          = TITLE;
            report.EnableExternalImages = true;
            EnterpriseRGateway enterprise = new EnterpriseRGateway();
            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(SOURCE);
                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); }
    }
예제 #18
0
    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;
            string _exception = this.cboException.SelectedValue == "" ? null : this.cboException.SelectedValue;
            string _start     = Master.StartDate;
            string _end       = Master.EndDate;

            //Initialize control values
            LocalReport report = Master.Viewer.LocalReport;
            report.DisplayName          = TITLE;
            report.EnableExternalImages = true;
            EnterpriseRGateway enterprise = new EnterpriseRGateway();
            DataSet            ds         = enterprise.FillDataset(this.mUSPName, mTBLName, new object[] { _client, _division, _agent, _region, _district, _store, _start, _end, _exception });
            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(SOURCE);
                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", _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 exception  = new ReportParameter("Exception", _exception);
                report.SetParameters(new ReportParameter[] { client, division, agent, region, district, store, start, end, exception, 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, 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=DeliveryWindowDetailByStore.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); }
    }
예제 #19
0
    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 _client = this.grdClients.SelectedRow.Cells[1].Text;
            string _div = this.grdClients.SelectedRow.Cells[2].Text;
            string _name = this.grdClients.SelectedRow.Cells[3].Text;
            string _manifestID = "", _pickupDate = "", _pickupNum = "";

            LocalReport report = Master.Viewer.LocalReport;
            report.DisplayName          = TITLE;
            report.EnableExternalImages = true;
            EnterpriseRGateway enterprise = new EnterpriseRGateway();
            DataSet            ds         = new DataSet(this.mDSName);
            foreach (GridViewRow row in selectedRows)
            {
                DataKey dataKey = (DataKey)this.grdVendorLog.DataKeys[row.RowIndex];
                _manifestID = dataKey["ID"].ToString();
                _pickupDate = DateTime.Parse(dataKey["PickupDate"].ToString()).ToString("MM-dd-yyyy");
                _pickupNum  = dataKey["PickupNumber"].ToString();
                DataSet _ds = enterprise.FillDataset(this.mUSPName, mTBLName, new object[] { _manifestID });
                _ds.Tables[mTBLName].Columns.Add("ManifestID");
                _ds.Tables[mTBLName].Columns.Add("PickupDate");
                _ds.Tables[mTBLName].Columns.Add("PickupNumber");
                for (int j = 0; j < _ds.Tables[mTBLName].Rows.Count; j++)
                {
                    _ds.Tables[mTBLName].Rows[j]["ManifestID"]   = _manifestID;
                    _ds.Tables[mTBLName].Rows[j]["PickupDate"]   = _pickupDate;
                    _ds.Tables[mTBLName].Rows[j]["PickupNumber"] = _pickupNum;
                }
                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(SOURCE);
                report.LoadReportDefinition(stream);
                report.DataSources.Clear();
                report.DataSources.Add(new ReportDataSource(this.mDSName, ds.Tables[mTBLName]));

                //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, 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=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[mTBLName];
                dg.DataBind();
                dg.RenderControl(hw);
                Response.Write(sw.ToString());
                Response.End();
                break;
            }
        }
        catch (Exception ex) { Master.ReportError(ex); }
    }
예제 #20
0
    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();
            Session["PacSunDS"] = null;

            //Get parameters for the query
            string _start = DateTime.Parse(this.txtFrom.Text).ToString("yyyy-MM-dd");
            string _end   = DateTime.Parse(this.txtTo.Text).ToString("yyyy-MM-dd");
            string _flag  = this.cboFilter.SelectedValue;

            //Initialize control values
            LocalReport report = Master.Viewer.LocalReport;
            report.DisplayName          = TITLE;
            report.EnableExternalImages = true;
            EnterpriseRGateway enterprise = new EnterpriseRGateway();
            DataSet            ds         = enterprise.FillDataset((_flag == "0"?this.mUSPName:USP_REPORT_OSD), mTBLName, new object[] { _start, _end });
            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(SOURCE);
                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("FromDate", _start);
                ReportParameter end   = new ReportParameter("ToDate", _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, 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=PacSunDelivery.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); }
    }
예제 #21
0
    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      = Master.FromDate.ToString("yyyy-MM-dd");
            string _end        = Master.ToDate.ToString("yyyy-MM-dd");
            string _client     = Master.ClientNumber;
            string _vendor     = Master.VendorNumber;
            string _vendorLoc  = Master.VendorLocationNumber;
            string _agent      = Master.AgentNumber;
            string _agentLoc   = Master.AgentLocationNumber;
            string _cutoffTime = DateTime.Now.ToString("yyyy-MM-dd");

            //Initialize control values
            LocalReport report = Master.Viewer.LocalReport;
            report.DisplayName          = TITLE;
            report.EnableExternalImages = true;
            EnterpriseRGateway enterprise = new EnterpriseRGateway();
            DataSet            ds         = enterprise.FillDataset(this.mUSPName, mTBLName, new object[] { _start, _end, _agentLoc, _agent, _client, _vendorLoc, _vendor, _cutoffTime });
            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(SOURCE);
                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 client = new ReportParameter("ClientNumber"); if (_client != null)
                {
                    client.Values.Add(Master.ClientNumber + "- " + Master.ClientName);
                }
                ReportParameter vendor = new ReportParameter("VendorParentNumber"); if (_vendor != null)
                {
                    vendor.Values.Add(Master.VendorName);
                }
                ReportParameter vendorLoc = new ReportParameter("VendorNumber"); if (_vendorLoc != null)
                {
                    vendorLoc.Values.Add(Master.VendorName);
                }
                ReportParameter agent = new ReportParameter("AgentParentNumber"); if (_agent != null)
                {
                    agent.Values.Add(Master.AgentName);
                }
                ReportParameter agentLoc = new ReportParameter("AgentNumber"); if (_agentLoc != null)
                {
                    agentLoc.Values.Add(Master.AgentName);
                }
                ReportParameter cutoffTime = new ReportParameter("CutOFFTime", _cutoffTime);
                report.SetParameters(new ReportParameter[] { start, end, agent, agentLoc, client, vendor, vendorLoc, cutoffTime });

                //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); }
    }
예제 #22
0
    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 = DateTime.Parse(this.txtFrom.Text).ToString("yyyy-MM-dd");
            string _toDate = DateTime.Parse(this.txtTo.Text).ToString("yyyy-MM-dd");
            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 _shipper = "", _shipperName = "";

            //Initialize control values
            LocalReport report = Master.Viewer.LocalReport;
            report.DisplayName          = TITLE;
            report.EnableExternalImages = true;
            EnterpriseRGateway enterprise = new EnterpriseRGateway();
            DataSet            ds = new DataSet();
            string             usp = "", reportDS = "", reportFile = "";
            if (this.ddlFreightType.SelectedValue.ToLower() == "tsort")
            {
                usp      = USP_REPORT_VENDOR;
                reportDS = REPORT_DS_TSORT;
                switch (this.cboViewBy.SelectedItem.Text.ToLower())
                {
                case "state": reportFile = REPORT_SRC_TSORT_STATE; break;

                case "zone": reportFile = REPORT_SRC_TSORT_ZONE; break;

                case "store": reportFile = REPORT_SRC_TSORT_STORE; break;
                }
            }
            else if (this.ddlFreightType.SelectedValue.ToLower() == "returns")
            {
                usp      = USP_REPORT_AGENT;
                reportDS = REPORT_DS_RETURNS;
                switch (this.cboViewBy.SelectedItem.Text.ToLower())
                {
                case "vendor": reportFile = REPORT_SRC_RETURNS_VENDOR; break;

                case "store": reportFile = REPORT_SRC_RETURNS_STORE; break;
                }
            }
            foreach (GridViewRow row in selectedShippers)
            {
                string __shipper = row.Cells[1].Text;
                _shipper = _shipper.Length == 0 ? __shipper : _shipper + ", " + __shipper;
                DataSet _ds = enterprise.FillDataset(usp, mTBLName, new object[] { _client, _div, __shipper, _fromDate, _toDate });
                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(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.ddlShipper.SelectedValue == "0" ? "VendorNumber" : "AgentNumber", _shipper);
                ReportParameter shipperName = new ReportParameter(this.ddlShipper.SelectedValue == "0" ? "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); }
    }
예제 #23
0
    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          = TITLE;
            report.EnableExternalImages = true;
            EnterpriseRGateway enterprise = new EnterpriseRGateway();
            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 == EnterpriseRGateway.DAMAGEDESCRIPTON_ALL)
            {
                ds.Merge(_ds);
            }
            else if (this.cboDamageCode.SelectedItem.Text == EnterpriseRGateway.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(SOURCE);
                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); }
    }