示例#1
0
        private void loadChartP05(int indice, string clase)
        {
            try
            {
                int semana = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(DateTime.Today, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Sunday);
                semana = semana - 1;   //semana actual aun no cierra

                FunctionHelper.FncHelper fh = new FunctionHelper.FncHelper();
                DateTime st = fh.GetSaturday(DateTime.Now);

                chartTP05.Series["Series1"].Points.Clear();
                chartTP05.Series["Series2"].Points.Clear();

                string xTipo = "weekly";
                //tipo=0
                String xFilter = "SITE";
                string xClass  = "All";

                if (indice == 1)
                {
                    xClass  = clase;
                    xFilter = "VSM";
                }
                if (indice == 2)
                {
                    xClass  = clase;
                    xFilter = "CELL";
                }

                SQLHelper.DBHelper dBHelper = new SQLHelper.DBHelper();
                string             qry      = "";
                qry = "SELECT TOP 8 * FROM [sta_nivel2] WHERE [sMetric] = 'Utilization' AND [sClass] = '" + xClass + "' AND [sType] = '" + xTipo + "' AND [sFilter] = '" + xFilter +
                      "' AND [sLstWkDay] BETWEEN '" + st.AddDays(-91).ToShortDateString() + "' AND '" + st.ToShortDateString() + "'" +
                      " Order by [sLstWkDay] desc";
                string    qry1     = "select * from (" + qry + ") q1 order by id";
                DataTable dtPareto = dBHelper.QryManager(qry1);
                foreach (DataRow dr1 in dtPareto.Rows)
                {
                    double xActual = Convert.ToDouble(dr1["factual"].ToString());
                    double xGoal   = Convert.ToDouble(dr1["fgoal"].ToString());
                    chartTP05.Series["Series1"].Points.AddXY(dr1["sdesc"].ToString(), xActual);
                    chartTP05.Series["Series2"].Points.AddXY(dr1["sdesc"].ToString(), xGoal);
                }
            }
            catch (Exception ex)
            {
                int    errNum  = -99999999;
                string errDesc = "";
                HttpContext.Current.Items.Add("Exception", ex);

                if (ex is SqlException)
                {
                    // Handle more specific SqlException exception here.
                    SqlException odbcExc = (SqlException)ex;
                    errNum  = odbcExc.Number;
                    errDesc = odbcExc.Message;
                }
                else
                {
                    // Handle generic ones here.
                    errDesc = ex.Message;
                }
                Server.Transfer("~\\CustomErrors\\Errors.aspx?handler=n2_Productivity.aspx&msg=" + errNum + "&errDesc=" + errDesc);
            }
        }
示例#2
0
        private void loadChartD01(int tipo, string clase, string filtro)
        {
            try
            {
                chartTD01.Series["Series1"].Points.Clear();
                chartTD01.Series["Series2"].Points.Clear();
                chartTD01.Series["Series3"].Points.Clear();
                chartPD01.Series["Series1"].Points.Clear();
                chartPD01.Series["Series2"].Points.Clear();

                string xTipo = "weekly";
                if (tipo < 2)
                {
                    xTipo = "WEEKLY";
                }
                if (tipo == 2)
                {
                    xTipo = "MONTHLY";
                }
                if (tipo == 3)
                {
                    xTipo = "QUARTERLY";
                }
                if (tipo == 4)
                {
                    xTipo = "YEARLY";
                }

                //string query1 = "select top 8 * from [sta_nivel2] where smetric = 'ottr' and sfilter = '" + filtro + "' and sclass = '" + clase + "' and stype = '" + xTipo + "' order by id desc";
                FunctionHelper.FncHelper fh = new FunctionHelper.FncHelper();
                DateTime st  = fh.GetSaturday(DateTime.Now);
                string   qry = "select TOP 8 * from [sta_nivel2] where smetric = 'ottr' and sfilter = '" + filtro + "' and sclass = '" + clase + "' and stype = '" + xTipo + "'" +
                               " AND [sLstWkDay] BETWEEN '" + st.AddDays(-91).ToShortDateString() + "' AND '" + st.ToShortDateString() + "' Order by [sLstWkDay] desc";
                string             qry1     = "select * from (" + qry + ") q1 order by id";
                SQLHelper.DBHelper dBHelper = new SQLHelper.DBHelper();
                DataTable          dt1      = dBHelper.QryManager(qry1);
                foreach (DataRow dr1 in dt1.Rows)
                {
                    double xActual = Convert.ToDouble(dr1["factual"].ToString());
                    double xGoal   = Convert.ToDouble(dr1["fgoal"].ToString());
                    chartTD01.Series["Series1"].Points.AddXY(dr1["sdesc"].ToString(), xActual);
                    chartTD01.Series["Series2"].Points.AddXY(dr1["sdesc"].ToString(), xGoal);
                    //chartTD01.Series["Series3"].Points.AddXY(dr1["sdesc"].ToString(), "0");
                    chartTD01.Series["Series2"].ToolTip = "#VALY";
                }

                string             query2    = "select top 5 * from [sta_nivel2p] where smetric = 'ottr' and stype = 'causes' order by id desc";
                string             qry2      = "select * from (" + query2 + ") q1 order by fActual desc";
                SQLHelper.DBHelper dBHelper2 = new SQLHelper.DBHelper();
                DataTable          dt2       = dBHelper2.QryManager(qry2);
                foreach (DataRow dr2 in dt2.Rows)
                {
                    double xActual = Convert.ToDouble(dr2["factual"].ToString());
                    double xGoal   = Convert.ToDouble(dr2["fsum"].ToString());
                    chartPD01.Series["Series1"].Points.AddXY(dr2["scause"].ToString(), xActual);
                    chartPD01.Series["Series2"].Points.AddXY(dr2["scause"].ToString(), xGoal);
                    chartPD01.Series["Series2"].ToolTip = "#VALX";
                }
            }
            catch (Exception ex)
            {
                int    errNum  = -99999999;
                string errDesc = "";
                HttpContext.Current.Items.Add("Exception", ex);

                if (ex is SqlException)
                {
                    // Handle more specific SqlException exception here.
                    SqlException odbcExc = (SqlException)ex;
                    errNum  = odbcExc.Number;
                    errDesc = odbcExc.Message;
                }
                else
                {
                    // Handle generic ones here.
                    errDesc = ex.Message;
                }
                Server.Transfer("~\\CustomErrors\\Errors.aspx?handler=n2_Delivery.aspx&msg=" + errNum + "&errDesc=" + errDesc);
            }
        }
示例#3
0
        //Labor Productivity Charts
        private void loadChartP01(int indice, string clase, string sFilter, int mcView)
        {
            try
            {
                //Week range, from current week - 13 to current week
                int yr     = DateTime.Now.Year;
                int semana = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(DateTime.Today, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Sunday);
                FunctionHelper.FncHelper fh = new FunctionHelper.FncHelper();
                DateTime st      = fh.GetSaturday(DateTime.Now);
                string   dtFrom  = st.AddDays(-91).ToShortDateString();
                string   dtTo    = st.ToShortDateString();
                string   dtFrom2 = st.AddDays(-300).ToShortDateString();
                string   mnth    = st.AddDays(-7).ToString("MMM", CultureInfo.InvariantCulture);

                if (semana == 53 || semana == 1)
                {
                    semana = 52;
                    yr     = yr - 1;
                }
                else
                {
                    semana = semana - 1;
                }

                WebChartControl1.Series[0].Points.Clear();
                WebChartControl1.Series[1].Points.Clear();
                WebChartControl1.Series[2].Points.Clear();
                WebChartControl1.Series[3].Points.Clear();
                WebChartControl1.SeriesSorting = SortingMode.None;
                WebChartControl1.SeriesTemplate.SeriesPointsSorting = SortingMode.None;

                WebChartControl2.Series[0].Points.Clear();
                WebChartControl2.SeriesSorting = SortingMode.None;
                WebChartControl2.SeriesTemplate.SeriesPointsSorting = SortingMode.None;

                string qry = "", qry2 = "", qryBaseline = "";
                string colName = "";
                string xClass = "", prefix = "";
                string sTblName = "", cTblName = "", aTblName = "", mTblName = "", aaTblName = "", acTblName = "", amTblName = "", smTbl = "", cmTbl = "", amTbl = "", mmTbl = "", asmTbl = "", acmTbl = "", aamTbl = "", ammTbl = "", vTblName = "", avTblName = "", vmTbl = "", vmmTbl = "";
                string qryOrder = "", fBy = "";

                switch (indice)
                {
                case 1:
                    fBy = "VSM";
                    break;

                case 2:
                    fBy = "Area";
                    break;

                case 3:
                    fBy = "Cell";
                    break;

                case 4:
                    fBy = "MRP";
                    break;

                default:
                    clase = "All";
                    fBy   = "Site";
                    break;
                }

                //Selects filter according to user's selection, dafult filter is by week
                if (sFilter == "Week")
                {
                    sTblName = "[vw_ottr_by_site_wkly] WHERE [TO_sLstWkDay] BETWEEN '" + dtFrom + "' AND '" + dtTo + "'";
                    cTblName = "[vw_ottr_by_cell_wkly] WHERE [TO_sLstWkDay] BETWEEN '" + dtFrom + "' AND '" + dtTo + "' AND";
                    aTblName = "[vw_ottr_by_area_wkly] WHERE [TO_sLstWkDay] BETWEEN '" + dtFrom + "' AND '" + dtTo + "' AND";
                    mTblName = "[vw_ottr_by_mrp_wkly] WHERE [TO_sLstWkDay] BETWEEN '" + dtFrom + "' AND '" + dtTo + "' AND";
                    vTblName = "[vw_ottr_by_vsm_wkly] WHERE [TO_sLstWkDay] BETWEEN '" + dtFrom + "' AND '" + dtTo + "' AND";
                    //qryBaseline = "SELECT [fGoal] FROM [sta_nivel2] WHERE [sMetric] = 'OTTR' AND [sClass] = 'All' AND [sType] = 'Weekly' AND [sDesc] = [TO_Wk] AND [sLstWkDay] BETWEEN '" + dtFrom + "' AND '" + dtTo + "'";
                    qryBaseline = "SELECT [fGoal] FROM [sta_nivel2] WHERE [sMetric] = 'OTTR' AND [sClass] = '" + clase + "' AND [sFilter] = '" + fBy + "' AND [sType] = 'Weekly' AND [sDesc] = [TO_Wk] AND [sLstWkDay] BETWEEN '" + dtFrom + "' AND '" + dtTo + "'";
                    qryOrder    = "[TO_Wk]";
                    colName     = "TO_Wk";
                    prefix      = "Wk";

                    aaTblName = "[vw_ottr_by_area_wkly] WHERE [TO_Yr] = " + yr + " AND [TO_Wk] = " + semana;
                    acTblName = "[vw_ottr_by_cell_wkly] WHERE [TO_Yr] = " + yr + " AND [TO_Wk] = " + semana;
                    amTblName = "[vw_ottr_by_mrp_wkly] WHERE [TO_Yr] = " + yr + " AND [TO_Wk] = " + semana;
                    avTblName = "[vw_ottr_by_vsm_wkly] WHERE [TO_Yr] = " + yr + " AND [TO_Wk] = " + semana;

                    smTbl = "[vw_ottr_misses_by_site_wkly] WHERE [TO_Yr] = " + yr + " AND [TO_Wk] = " + semana;
                    cmTbl = "[vw_ottr_misses_by_cell_wkly] WHERE [TO_Yr] = " + yr + " AND [TO_Wk] = " + semana;
                    amTbl = "[vw_ottr_misses_by_area_wkly] WHERE [TO_Yr] = " + yr + " AND [TO_Wk] = " + semana;
                    mmTbl = "[vw_ottr_misses_by_mrp_wkly] WHERE [TO_Yr] = " + yr + " AND [TO_Wk] = " + semana;
                    vmTbl = "[vw_ottr_misses_by_vsm_wkly] WHERE [TO_Yr] = " + yr + " AND [TO_Wk] = " + semana;

                    asmTbl = "SELECT TO_DlyCode, TO_CodeCat, SUM(Qty) as Qty, TO_Yr, TO_Wk FROM " + smTbl + " Group By TO_DlyCode,TO_CodeCat,TO_Yr,TO_Wk";
                    acmTbl = "SELECT TO_DlyCode, TO_CodeCat, SUM(Qty) as Qty, TO_Yr, TO_Wk FROM " + cmTbl + " Group By TO_DlyCode,TO_CodeCat,TO_Yr,TO_Wk";
                    aamTbl = "SELECT TO_DlyCode, TO_CodeCat, SUM(Qty) as Qty, TO_Yr, TO_Wk FROM " + amTbl + " Group By TO_DlyCode,TO_CodeCat,TO_Yr,TO_Wk";
                    ammTbl = "SELECT TO_DlyCode, TO_CodeCat, SUM(Qty) as Qty, TO_Yr, TO_Wk FROM " + mmTbl + " Group By TO_DlyCode,TO_CodeCat,TO_Yr,TO_Wk";
                    vmmTbl = "SELECT TO_DlyCode, TO_CodeCat, SUM(Qty) as Qty, TO_Yr, TO_Wk FROM " + vmTbl + " Group By TO_DlyCode,TO_CodeCat,TO_Yr,TO_Wk";
                }

                if (sFilter == "Month")
                {
                    sTblName = "[vw_ottr_by_site_mntly] WHERE [TO_sLstWkDay] BETWEEN '" + dtFrom2 + "' AND '" + dtTo + "'";
                    cTblName = "[vw_ottr_by_cell_mntly] WHERE [TO_sLstWkDay] BETWEEN '" + dtFrom2 + "' AND '" + dtTo + "' AND";
                    aTblName = "[vw_ottr_by_area_mntly] WHERE [TO_sLstWkDay] BETWEEN '" + dtFrom2 + "' AND '" + dtTo + "' AND";
                    mTblName = "[vw_ottr_by_mrp_mntly] WHERE [TO_sLstWkDay] BETWEEN '" + dtFrom2 + "' AND '" + dtTo + "' AND";
                    vTblName = "[vw_ottr_by_vsm_mntly] WHERE [TO_sLstWkDay] BETWEEN '" + dtFrom + "' AND '" + dtTo + "' AND";
                    //qryBaseline = "SELECT [fGoal] FROM [sta_nivel2] WHERE [sMetric] = 'OTTR' AND [sClass] = 'All' AND [sType] = 'Monthly' AND " +
                    //                "[sDesc] = [TO_Month] AND [sLstWkDay] BETWEEN '" + dtFrom2 + "' AND '" + dtTo + "'";
                    qryBaseline = "SELECT [fGoal] FROM [sta_nivel2] WHERE [sMetric] = 'OTTR' AND [sClass] = '" + clase + "' AND [sFilter] = '" + fBy + "' AND [sType] = 'Monthly' AND " +
                                  "[sDesc] = [TO_Month] AND [sLstWkDay] BETWEEN '" + dtFrom2 + "' AND '" + dtTo + "'";
                    qryOrder = "[TO_sLstWkDay]";
                    colName  = "TO_Month";

                    aaTblName = "[vw_ottr_by_area_mntly] WHERE [TO_Yr] = " + yr + " AND [TO_Month] = '" + mnth + "'";
                    acTblName = "[vw_ottr_by_cell_mntly] WHERE [TO_Yr] = " + yr + " AND [TO_Month] = '" + mnth + "'";
                    amTblName = "[vw_ottr_by_mrp_mntly] WHERE [TO_Yr] = " + yr + " AND [TO_Month] = '" + mnth + "'";
                    avTblName = "[vw_ottr_by_vsm_mntly] WHERE [TO_Yr] = " + yr + " AND [TO_Month] = '" + mnth + "'";

                    smTbl = "[vw_ottr_misses_by_site_mntly] WHERE [TO_Yr] = " + yr + " AND [TO_Month] = '" + mnth + "'";
                    cmTbl = "[vw_ottr_misses_by_cell_mntly] WHERE [TO_Yr] = " + yr + " AND [TO_Month] = '" + mnth + "'";
                    amTbl = "[vw_ottr_misses_by_area_mntly] WHERE [TO_Yr] = " + yr + " AND [TO_Month] = '" + mnth + "'";
                    mmTbl = "[vw_ottr_misses_by_mrp_mntly] WHERE [TO_Yr] = " + yr + " AND [TO_Month] = '" + mnth + "'";
                    vmTbl = "[vw_ottr_misses_by_vsm_mntly] WHERE [TO_Yr] = " + yr + " AND [TO_Wk] = " + semana;

                    asmTbl = "SELECT TO_DlyCode, TO_CodeCat, SUM(Qty) as Qty, TO_Yr, TO_Month FROM " + smTbl + " Group By TO_DlyCode,TO_CodeCat,TO_Yr, TO_Month";
                    acmTbl = "SELECT TO_DlyCode, TO_CodeCat, SUM(Qty) as Qty, TO_Yr, TO_Month FROM " + cmTbl + " Group By TO_DlyCode,TO_CodeCat,TO_Yr, TO_Month";
                    aamTbl = "SELECT TO_DlyCode, TO_CodeCat, SUM(Qty) as Qty, TO_Yr, TO_Month FROM " + amTbl + " Group By TO_DlyCode,TO_CodeCat,TO_Yr, TO_Month";
                    ammTbl = "SELECT TO_DlyCode, TO_CodeCat, SUM(Qty) as Qty, TO_Yr, TO_Month FROM " + mmTbl + " Group By TO_DlyCode,TO_CodeCat,TO_Yr, TO_Month";
                    vmmTbl = "SELECT TO_DlyCode, TO_CodeCat, SUM(Qty) as Qty, TO_Yr, TO_Month FROM " + vmTbl + " Group By TO_DlyCode,TO_CodeCat,TO_Yr, TO_Month";
                }

                if (sFilter == "Year")
                {
                    sTblName = "[vw_ottr_by_site_yrly] WHERE [TO_Yr] BETWEEN " + (yr - 1) + " AND " + yr;
                    cTblName = "[vw_ottr_by_cell_yrly] WHERE [TO_Yr] BETWEEN " + (yr - 1) + " AND " + yr + " AND ";
                    aTblName = "[vw_ottr_by_area_yrly] WHERE [TO_Yr] BETWEEN " + (yr - 1) + " AND " + yr + " AND ";
                    mTblName = "[vw_ottr_by_mrp_yrly] WHERE [TO_Yr] BETWEEN " + (yr - 1) + " AND " + yr + " AND ";
                    vTblName = "[vw_ottr_by_vsm_yrly] WHERE [TO_Yr] BETWEEN " + (yr - 1) + " AND " + yr + " AND ";
                    //qryBaseline = "SELECT [fGoal] FROM [sta_nivel2] WHERE [sMetric] = 'OTTR' AND [sClass] = 'All' AND [sType] = 'Yearly' AND " +
                    //                "[sDesc] = [TO_Yr] AND [sDesc] BETWEEN '" + (yr - 1) + "' AND '" + yr + "'";
                    qryBaseline = "SELECT [fGoal] FROM [sta_nivel2] WHERE [sMetric] = 'OTTR' AND [sClass] = '" + clase + "' AND [sFilter] = '" + fBy + "' AND [sType] = 'Yearly' AND " +
                                  "[sDesc] = [TO_Yr] AND [sDesc] BETWEEN '" + (yr - 1) + "' AND '" + yr + "'";
                    qryOrder = "[TO_sLstWkDay]";
                    colName  = "TO_Yr";

                    aaTblName = "[vw_ottr_by_area_yrly] WHERE [TO_Yr] = " + yr;
                    acTblName = "[vw_ottr_by_cell_yrly] WHERE [TO_Yr] = " + yr;
                    amTblName = "[vw_ottr_by_mrp_yrly] WHERE [TO_Yr] = " + yr;
                    avTblName = "[vw_ottr_by_vsm_yrly] WHERE [TO_Yr] = " + yr;

                    smTbl = "[vw_ottr_misses_by_site_yrly] WHERE [TO_Yr] = " + yr;
                    cmTbl = "[vw_ottr_misses_by_cell_yrly] WHERE [TO_Yr] = " + yr;
                    amTbl = "[vw_ottr_misses_by_area_yrly] WHERE [TO_Yr] = " + yr;
                    mmTbl = "[vw_ottr_misses_by_mrp_yrly] WHERE [TO_Yr] = " + yr;
                    vmTbl = "[vw_ottr_misses_by_vsm_yrly] WHERE [TO_Yr] = " + yr;

                    asmTbl = "SELECT TO_DlyCode, TO_CodeCat, SUM(Qty) as Qty, TO_Yr FROM " + smTbl + " Group By TO_DlyCode,TO_CodeCat,TO_Yr";
                    acmTbl = "SELECT TO_DlyCode, TO_CodeCat, SUM(Qty) as Qty, TO_Yr FROM " + cmTbl + " Group By TO_DlyCode,TO_CodeCat,TO_Yr";
                    aamTbl = "SELECT TO_DlyCode, TO_CodeCat, SUM(Qty) as Qty, TO_Yr FROM " + amTbl + " Group By TO_DlyCode,TO_CodeCat,TO_Yr";
                    ammTbl = "SELECT TO_DlyCode, TO_CodeCat, SUM(Qty) as Qty, TO_Yr FROM " + mmTbl + " Group By TO_DlyCode,TO_CodeCat,TO_Yr";
                    vmmTbl = "SELECT TO_DlyCode, TO_CodeCat, SUM(Qty) as Qty, TO_Yr FROM " + vmTbl + " Group By TO_DlyCode,TO_CodeCat,TO_Yr";
                }

                if (mcView == 0)
                {
                    //Validates filter level by site/area/cell, default filter is by site
                    switch (indice)
                    {
                    case 1:
                        xClass = clase;
                        qry    = "SELECT *, [AOP] = ISNULL((" + qryBaseline + "),0) FROM " + vTblName + " [TO_Group] = '" + xClass + "' Order by [TO_Yr], " + qryOrder + ", [TO_Group]";
                        qry2   = "SELECT * FROM " + amTbl + " AND [TO_rArea] = '" + xClass + "' Order by [TO_Yr], [TO_rArea], [Qty] desc";
                        break;

                    case 2:
                        xClass = clase;
                        qry    = "SELECT *, [AOP] = ISNULL((" + qryBaseline + "),0) FROM " + aTblName + " [TO_rArea] = '" + xClass + "' Order by [TO_Yr], " + qryOrder + ", [TO_rArea]";
                        qry2   = "SELECT * FROM " + amTbl + " AND [TO_rArea] = '" + xClass + "' Order by [TO_Yr], [TO_rArea], [Qty] desc";
                        break;

                    case 3:
                        xClass = clase;
                        qry    = "SELECT *, [AOP] = ISNULL((" + qryBaseline + "),0) FROM " + cTblName + " [TO_Cell] = '" + xClass + "' Order by [TO_Yr], " + qryOrder + ", [TO_Cell]";
                        qry2   = "SELECT * FROM " + cmTbl + " AND [TO_Cell] = '" + xClass + "' Order by [TO_Yr], [TO_Cell], [Qty] desc";
                        break;

                    case 4:
                        xClass = clase;
                        qry    = "SELECT *, [AOP] = ISNULL((" + qryBaseline + "),0) FROM " + mTblName + " [TO_MRP] = '" + xClass + "' Order by [TO_Yr], " + qryOrder + ", [TO_MRP]";
                        qry2   = "SELECT * FROM " + mmTbl + " AND [TO_MRP] = '" + xClass + "' Order by [TO_Yr], [TO_MRP], [Qty] desc";
                        break;

                    default:
                        qry  = "SELECT *, [AOP] = ISNULL((" + qryBaseline + "),0) FROM " + sTblName + " Order by [TO_Yr], " + qryOrder;
                        qry2 = "SELECT * FROM " + smTbl + " Order by [TO_Yr], [Qty] desc";
                        break;
                    }
                }
                else
                {
                    prefix = "";
                    if (mcView == 1)
                    {
                        qry     = "SELECT * FROM " + avTblName + " Order by [TO_Yr], [TO_Group]";
                        qry2    = aamTbl + " Order by [TO_Yr], [Qty] desc";
                        colName = "TO_Group";
                    }


                    if (mcView == 2)
                    {
                        qry     = "SELECT * FROM " + aaTblName + " Order by [TO_Yr], [TO_rArea]";
                        qry2    = aamTbl + " Order by [TO_Yr], [Qty] desc";
                        colName = "TO_rArea";
                    }

                    if (mcView == 3)
                    {
                        qry     = "SELECT * FROM " + acTblName + " Order by [TO_Yr], [TO_Cell]";
                        qry2    = acmTbl + " Order by [TO_Yr], [Qty] desc";
                        colName = "TO_Cell";
                    }

                    if (mcView == 4)
                    {
                        qry     = "SELECT * FROM " + amTblName + " Order by [TO_Yr], [TO_MRP]";
                        qry2    = ammTbl + " Order by [TO_Yr], [Qty] desc";
                        colName = "TO_MRP";
                    }
                }

                //Connection object, retrieves sql data
                SQLHelper.DBHelper dBHelper  = new SQLHelper.DBHelper();
                DataTable          dtPareto  = dBHelper.QryManager(qry);
                DataTable          dtPatero2 = dBHelper.QryManager(qry2);

                if (mcView == 0)
                {
                    foreach (DataRow dr1 in dtPareto.Rows)
                    {
                        double xHit    = Convert.ToDouble(dr1["HIT"].ToString());
                        double xTotHrs = Convert.ToDouble(dr1["TotalOrdrs"].ToString());
                        double perc    = (xHit / xTotHrs);
                        double xGoal   = Convert.ToDouble(dr1["AOP"].ToString()) / 100;

                        WebChartControl1.Series[0].Points.Add(new SeriesPoint(prefix + dr1[colName].ToString(), xHit));
                        WebChartControl1.Series[1].Points.Add(new SeriesPoint(prefix + dr1[colName].ToString(), xTotHrs));
                        WebChartControl1.Series[2].Points.Add(new SeriesPoint(prefix + dr1[colName].ToString(), perc));
                        WebChartControl1.Series[3].Points.Add(new SeriesPoint(prefix + dr1[colName].ToString(), xGoal));

                        WebChartControl1.Series[0].Label.ResolveOverlappingMode = ResolveOverlappingMode.Default;
                        WebChartControl1.Series[1].Label.ResolveOverlappingMode = ResolveOverlappingMode.Default;
                        WebChartControl1.Series[2].Label.ResolveOverlappingMode = ResolveOverlappingMode.Default;
                        WebChartControl1.Series[3].Label.ResolveOverlappingMode = ResolveOverlappingMode.Default;
                    }

                    foreach (DataRow dr1 in dtPatero2.Rows)
                    {
                        double xHit = Convert.ToDouble(dr1["Qty"].ToString());
                        WebChartControl2.Series[0].Points.Add(new SeriesPoint(dr1["TO_DlyCode"].ToString(), xHit));
                        WebChartControl2.Series[0].Label.ResolveOverlappingMode = ResolveOverlappingMode.Default;
                    }
                }
                else
                {
                    foreach (DataRow dr1 in dtPareto.Rows)
                    {
                        double xHit    = Convert.ToDouble(dr1["HIT"].ToString());
                        double xTotHrs = Convert.ToDouble(dr1["TotalOrdrs"].ToString());
                        double perc    = (xHit / xTotHrs);
                        double xGoal   = 1;

                        WebChartControl1.Series[0].Points.Add(new SeriesPoint(dr1[colName].ToString(), xHit));
                        WebChartControl1.Series[1].Points.Add(new SeriesPoint(dr1[colName].ToString(), xTotHrs));
                        WebChartControl1.Series[2].Points.Add(new SeriesPoint(dr1[colName].ToString(), perc));
                        WebChartControl1.Series[3].Points.Add(new SeriesPoint(dr1[colName].ToString(), xGoal));

                        WebChartControl1.Series[0].Label.ResolveOverlappingMode = ResolveOverlappingMode.Default;
                        WebChartControl1.Series[1].Label.ResolveOverlappingMode = ResolveOverlappingMode.Default;
                        WebChartControl1.Series[2].Label.ResolveOverlappingMode = ResolveOverlappingMode.Default;
                        WebChartControl1.Series[3].Label.ResolveOverlappingMode = ResolveOverlappingMode.Default;
                    }

                    foreach (DataRow dr1 in dtPatero2.Rows)
                    {
                        double xHit = Convert.ToDouble(dr1["Qty"].ToString());
                        WebChartControl2.Series[0].Points.Add(new SeriesPoint(dr1["TO_DlyCode"].ToString(), xHit));
                        WebChartControl2.Series[0].Label.ResolveOverlappingMode = ResolveOverlappingMode.Default;
                    }
                }
            }
            catch (Exception ex)
            {
                int    errNum  = -99999999;
                string errDesc = "";
                //HttpContext.Current.Items.Add("Exception", ex);
                HttpContext.Current.Session.Add("Exception", ex);

                if (ex is SqlException)
                {
                    // Handle more specific SqlException exception here.
                    SqlException odbcExc = (SqlException)ex;
                    errNum  = odbcExc.Number;
                    errDesc = odbcExc.Message;
                }
                else
                {
                    // Handle generic ones here.
                    errDesc = ex.Message;
                }
                //Server.Transfer("~\\CustomErrors\\Errors.aspx?handler=OTTR.aspx&msg=" + errNum + "&errDesc=" + errDesc, true);
                Response.Redirect("~\\CustomErrors\\Errors.aspx?handler=OTTR.aspx&msg=" + errNum + "&errDesc=" + errDesc);
            }
        }