Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DBConn oConn          = new DBConn();
            Web    oWeb           = new Web();
            string pCodMonitor    = oWeb.GetData("codmonitor");
            string pCodUsuario    = oWeb.GetData("codusuario");
            string pAuthenCodUser = oWeb.GetData("authuser");
            string indexToken     = oWeb.GetData("indexToken");

            string pCodPage     = string.Empty;
            string pOrderPage   = oWeb.GetData("order");
            string pCodCliente  = string.Empty;
            string pTipoUsuario = string.Empty;
            string sIdFecha     = string.Empty;
            int    maxdt        = (new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).AddDays(-1)).Day;

            firtDay.InnerText = "01-" + DateTime.Now.ToString("MM-yyyy");
            lastDay.InnerText = maxdt.ToString() + "-" + DateTime.Now.ToString("MM-yyyy");

            if (!string.IsNullOrEmpty(pAuthenCodUser))
            {
                AuthenticUser(pAuthenCodUser);
            }

            oWeb.ValidaUserPanel();

            if (oConn.Open())
            {
                if (!IsPostBack)
                {
                    cAptMonitorPages oAptMonitorPages = new cAptMonitorPages(ref oConn);
                    oAptMonitorPages.CodMonitor = pCodMonitor;
                    oAptMonitorPages.OrderPage  = pOrderPage;
                    DataTable dtMPage = oAptMonitorPages.Get();

                    if (dtMPage != null)
                    {
                        if (dtMPage.Rows.Count > 0)
                        {
                            pCodPage         = dtMPage.Rows[0]["cod_page"].ToString();
                            pTipoUsuario     = dtMPage.Rows[0]["tipo_usuario"].ToString();
                            lblSubTitle.Text = dtMPage.Rows[0]["nom_page"].ToString();
                        }
                    }
                    dtMPage = null;

                    oCmbTipoConsulta.Value = pTipoUsuario;
                }

                cIndejecucion oIndejecucion = new cIndejecucion(ref oConn);
                DataTable     tblEjecucion  = oIndejecucion.Get();
                if (tblEjecucion != null)
                {
                    if (tblEjecucion.Rows.Count > 0)
                    {
                        sIdFecha = tblEjecucion.Rows[0]["idfecha"].ToString();
                    }
                    tblEjecucion.Dispose();
                }
                tblEjecucion = null;

                DateTime idFechaMesAnterior = new DateTime(Int32.Parse(sIdFecha.Substring(0, 4)), Int32.Parse(sIdFecha.Substring(4, 2)), Int32.Parse(sIdFecha.Substring(6, 2)), Int32.Parse(sIdFecha.Substring(8, 2)), Int32.Parse(sIdFecha.Substring(10, 2)), 0);
                idFechaMesAnterior = idFechaMesAnterior.AddMonths(-1);

                cAptPagesKpi oAptPagesKpi = new cAptPagesKpi(ref oConn);
                oAptPagesKpi.CodCliente = pCodUsuario;
                oAptPagesKpi.CodPage    = pCodPage;
                DataTable dtKPIs = oAptPagesKpi.Get();
                if (dtKPIs != null)
                {
                    HtmlTableCell oCell;
                    foreach (DataRow oRow in dtKPIs.Rows)
                    {
                        string iDato    = "0";
                        string sKeyTipo = string.Empty;
                        oCell    = new HtmlTableCell();
                        oCell.ID = "tdCell_" + oRow["identificador_kpi"].ToString();
                        oCell.Controls.Add(new LiteralControl("<div align=\"center\" class=\"tbTit\">" + oRow["nombrekpi"].ToString() + "</div>"));
                        HeaderId.Controls.Add(oCell);
                    }
                }
                dtKPIs = null;

                cAnalista oAnalista;
                DataTable tblAnalista = null;

                switch (pTipoUsuario)
                {
                case "A":
                    oAnalista            = new cAnalista(ref oConn);
                    oAnalista.CodMonitor = pCodMonitor;
                    oAnalista.CodPage    = pCodPage;
                    tblAnalista          = oAnalista.GetBySecLevelSoc();

                    break;

                case "G":
                    oAnalista            = new cAnalista(ref oConn);
                    oAnalista.CodMonitor = pCodMonitor;
                    oAnalista.CodPage    = pCodPage;
                    tblAnalista          = oAnalista.GetBySecLevelHol();

                    break;

                case "P":
                    cAplicador oAplicador = new cAplicador(ref oConn);
                    oAplicador.CodMonitor = pCodMonitor;
                    oAplicador.CodPage    = pCodPage;
                    tblAnalista           = oAplicador.Get();

                    break;

                case "R":
                    cCobrador oCobrador = new cCobrador(ref oConn);
                    oCobrador.CodMonitor = pCodMonitor;
                    oCobrador.CodPage    = pCodPage;
                    tblAnalista          = oCobrador.Get();

                    break;

                case "D":
                    cDigitador oDigitador = new cDigitador(ref oConn);
                    oDigitador.CodMonitor = pCodMonitor;
                    oDigitador.CodPage    = pCodPage;
                    tblAnalista           = oDigitador.Get();

                    break;
                }


                if (tblAnalista != null)
                {
                    HtmlTableRow  oTbRow;
                    HtmlTableCell oCell;
                    foreach (DataRow oRow in tblAnalista.Rows)
                    {
                        oTbRow    = new HtmlTableRow();
                        oTbRow.ID = oRow["nKey_Cliente"].ToString() + "row";

                        oCell = new HtmlTableCell();
                        oCell.Attributes.Add("class", "clPanel");
                        cAppLogoCliente oAppLogoCliente = new cAppLogoCliente(ref oConn);
                        oAppLogoCliente.NKey_cliente = oRow["nKey_Cliente"].ToString();
                        //oAppLogoCliente.Tipo = "C";
                        DataTable dtlogo = oAppLogoCliente.Get();
                        if (dtlogo != null)
                        {
                            if (dtlogo.Rows.Count > 0)
                            {
                                Image oImage = new Image();
                                oImage.CssClass = "imgLogoPanel";
                                oImage.ImageUrl = "images/logos/" + dtlogo.Rows[0]["logo_cliente"].ToString();
                                oCell.Controls.Add(oImage);
                            }
                        }
                        oTbRow.Controls.Add(oCell);

                        oCell = new HtmlTableCell();
                        oCell.Attributes.Add("class", "clPanel");
                        oCell.Controls.Add(new LiteralControl("<div class=\"tbTitRow\">" + oRow["nombre_analista"].ToString() + "</div>"));
                        oTbRow.Controls.Add(oCell);


                        oAptPagesKpi = new cAptPagesKpi(ref oConn);
                        //oAptPagesKpi.CodCliente = oRow["nKey_Cliente"].ToString();
                        oAptPagesKpi.CodPage = pCodPage;
                        dtKPIs = oAptPagesKpi.Get();

                        if (dtKPIs != null)
                        {
                            foreach (DataRow oRowKPIs in dtKPIs.Rows)
                            {
                                cIndresultado oIndResultado = new cIndresultado(ref oConn);
                                oIndResultado.Tipo       = oCmbTipoConsulta.Value;
                                oIndResultado.KeyCliente = oRow["nKey_Cliente"].ToString();
                                oIndResultado.KeyTipo    = oRow["nKey_Analista"].ToString();
                                oIndResultado.Indicador  = oRowKPIs["identificador_kpi"].ToString();
                                oIndResultado.IdFecha    = sIdFecha;
                                DataTable tblColumn1 = oIndResultado.Get();
                                if (tblColumn1 != null)
                                {
                                    if (tblColumn1.Rows.Count > 0)
                                    {
                                        string iDato    = (!string.IsNullOrEmpty(tblColumn1.Rows[0]["valor"].ToString()) ? tblColumn1.Rows[0]["valor"].ToString() : "0");
                                        string sKeyTipo = tblColumn1.Rows[0]["nkey_tipo"].ToString();

                                        cIndumbral oIndumbral = new cIndumbral(ref oConn);
                                        oIndumbral.KeyCliente = oRow["nKey_Cliente"].ToString();
                                        oIndumbral.Indicador  = oRowKPIs["identificador_kpi"].ToString();
                                        oIndumbral.KeyTipo    = sKeyTipo;
                                        DataTable tblColumn2 = oIndumbral.Get();
                                        if (tblColumn2 != null)
                                        {
                                            if (tblColumn2.Rows.Count > 0)
                                            {
                                                StringBuilder sNAvance = new StringBuilder();
                                                sNAvance.Append("<div class=\"").Append(oWeb.getColorNumAvance(double.Parse(iDato), tblColumn2));
                                                sNAvance.Append("\">").Append(String.Format("{0:0}", double.Parse(iDato))).Append("</div>");

                                                oCell = new HtmlTableCell();
                                                oCell.Attributes.Add("align", "center");
                                                oCell.Attributes.Add("class", "clDtPanel");
                                                oCell.Controls.Add(new LiteralControl(sNAvance.ToString()));
                                                oTbRow.Controls.Add(oCell);
                                            }
                                        }
                                        tblColumn2 = null;
                                    }
                                    else
                                    {
                                        oCell = new HtmlTableCell();
                                        oCell.Attributes.Add("align", "center");
                                        oCell.Attributes.Add("class", "clDtPanel");
                                        //oCell.Controls.Add(new LiteralControl(""));
                                        oTbRow.Controls.Add(oCell);
                                    }
                                }
                            }
                        }
                        idTblSegNiv.Controls.Add(oTbRow);
                    }
                }
            }
            oConn.Close();
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DBConn oConn          = new DBConn();
            Web    oWeb           = new Web();
            string pCodMonitor    = oWeb.GetData("codmonitor");
            string pCodUsuario    = oWeb.GetData("codusuario");
            string pAuthenCodUser = oWeb.GetData("authuser");
            string indexToken     = oWeb.GetData("indexToken");

            string pCodPage     = string.Empty;
            string pOrderPage   = oWeb.GetData("order");
            string pCodCliente  = string.Empty;
            string pTipoUsuario = string.Empty;
            string sIdFecha     = string.Empty;
            int    maxdt        = (new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).AddDays(-1)).Day;

            firtDay.InnerText = "01-" + DateTime.Now.ToString("MM-yyyy");
            lastDay.InnerText = maxdt.ToString() + "-" + DateTime.Now.ToString("MM-yyyy");

            if (!string.IsNullOrEmpty(pAuthenCodUser))
            {
                AuthenticUser(pAuthenCodUser);
            }

            oWeb.ValidaUserPanel();

            if (!IsPostBack)
            {
                if (oConn.Open())
                {
                    cAptMonitorPages oAptMonitorPages = new cAptMonitorPages(ref oConn);
                    oAptMonitorPages.CodMonitor = pCodMonitor;
                    oAptMonitorPages.OrderPage  = pOrderPage;
                    DataTable dtMPage = oAptMonitorPages.Get();

                    if (dtMPage != null)
                    {
                        if (dtMPage.Rows.Count > 0)
                        {
                            pCodPage     = dtMPage.Rows[0]["cod_page"].ToString();
                            pTipoUsuario = dtMPage.Rows[0]["tipo_usuario"].ToString();
                            if (!string.IsNullOrEmpty(dtMPage.Rows[0]["cod_cliente"].ToString()))
                            {
                                pCodCliente = dtMPage.Rows[0]["cod_cliente"].ToString();
                            }
                            else if (!string.IsNullOrEmpty(dtMPage.Rows[0]["cod_holding"].ToString()))
                            {
                                pCodCliente  = dtMPage.Rows[0]["cod_holding"].ToString();
                                pTipoUsuario = "H";
                            }
                            else
                            {
                                cCliente  oCliente  = new cCliente(ref oConn);
                                DataTable dtCliente = oCliente.Get();
                                if (!string.IsNullOrEmpty(indexToken))
                                {
                                    pCodCliente = dtCliente.Rows[Convert.ToInt32(Session[indexToken].ToString())]["nkey_cliente"].ToString();
                                }
                                else
                                {
                                    pCodCliente = dtCliente.Rows[Convert.ToInt32(Session["indexcliente"].ToString())]["nkey_cliente"].ToString();
                                }
                                dtCliente = null;
                            }
                        }
                    }
                    dtMPage = null;

                    oCmbTipoConsulta.Value = pTipoUsuario;
                    oCmbCliente.Value      = pCodCliente;
                    if (!string.IsNullOrEmpty(oCmbCliente.Value))
                    {
                        cAppLogoCliente oAppLogoCliente = new cAppLogoCliente(ref oConn);
                        oAppLogoCliente.NKey_cliente = pCodCliente;
                        oAppLogoCliente.Tipo         = (pTipoUsuario == "H" ? pTipoUsuario : "C");
                        DataTable dtlogo = oAppLogoCliente.Get();
                        if (dtlogo != null)
                        {
                            if (dtlogo.Rows.Count > 0)
                            {
                                imglogo.ImageUrl = "images/logos/" + dtlogo.Rows[0]["logo_cliente"].ToString();
                            }
                        }
                    }
                    else
                    {
                        imglogo.Visible = false;
                    }
                }
                oConn.Close();
            }

            if (oConn.Open())
            {
                cIndejecucion oIndejecucion = new cIndejecucion(ref oConn);
                DataTable     tblEjecucion  = oIndejecucion.Get();
                if (tblEjecucion != null)
                {
                    if (tblEjecucion.Rows.Count > 0)
                    {
                        sIdFecha = tblEjecucion.Rows[0]["idfecha"].ToString();
                    }
                    tblEjecucion.Dispose();
                }
                tblEjecucion = null;

                DateTime idFechaMesAnterior = new DateTime(Int32.Parse(sIdFecha.Substring(0, 4)), Int32.Parse(sIdFecha.Substring(4, 2)), Int32.Parse(sIdFecha.Substring(6, 2)), Int32.Parse(sIdFecha.Substring(8, 2)), Int32.Parse(sIdFecha.Substring(10, 2)), 0);
                idFechaMesAnterior = idFechaMesAnterior.AddMonths(-1);

                cAptPagesKpi oAptPagesKpi = new cAptPagesKpi(ref oConn);
                oAptPagesKpi.CodCliente = pCodUsuario;
                oAptPagesKpi.CodPage    = pCodPage;
                DataTable dtKPIs = oAptPagesKpi.Get();
                if (dtKPIs != null)
                {
                    cIndresultado oIndResultado = new cIndresultado(ref oConn);
                    DataTable     tblColumn1    = null;
                    cIndumbral    oIndumbral    = null;
                    HtmlTableCell oCell;

                    HtmlTableCell      oCelldataColumn;
                    HtmlGenericControl dynDiv;

                    HtmlTableCell      oCelldataAceptacion;
                    HtmlGenericControl oDivAceptacion;

                    HtmlTableCell      oCellSLA;
                    HtmlGenericControl oDivSLA;

                    HtmlTableCell      oCellMesAnterior;
                    HtmlGenericControl oDivImg;
                    Image oImage;

                    foreach (DataRow oRow in dtKPIs.Rows)
                    {
                        string iDato    = "0";
                        string sKeyTipo = string.Empty;

                        oCell    = new HtmlTableCell();
                        oCell.ID = "tdCell_" + oRow["identificador_kpi"].ToString();
                        oCell.Controls.Add(new LiteralControl("<div align=\"center\" class=\"tbTit\">" + oRow["nombrekpi"].ToString() + "</div>"));
                        HeaderId.Controls.Add(oCell);

                        oCelldataColumn    = new HtmlTableCell();
                        oCelldataColumn.ID = "tdCell_dataColumn" + oRow["identificador_kpi"].ToString();
                        oCelldataColumn.Attributes.Add("class", "clDtPanel");

                        dynDiv    = new HtmlGenericControl("div");
                        dynDiv.ID = "divControl_" + oRow["identificador_kpi"].ToString();

                        oIndResultado.Tipo       = oCmbTipoConsulta.Value;
                        oIndResultado.KeyCliente = oCmbCliente.Value;
                        oIndResultado.IdFecha    = sIdFecha;
                        oIndResultado.Indicador  = oRow["identificador_kpi"].ToString();
                        tblColumn1 = oIndResultado.Get();
                        if (tblColumn1 != null)
                        {
                            if (tblColumn1.Rows.Count > 0)
                            {
                                iDato            = (!string.IsNullOrEmpty(tblColumn1.Rows[0]["valor"].ToString()) ? tblColumn1.Rows[0]["valor"].ToString() : "0");
                                sKeyTipo         = tblColumn1.Rows[0]["nkey_tipo"].ToString();
                                dynDiv.InnerText = String.Format("{0:0}", double.Parse(iDato));
                                //oColumn1.InnerText = String.Format("{0:0}", double.Parse(iDato));
                            }
                            tblColumn1.Dispose();
                        }
                        tblColumn1 = null;

                        oCellMesAnterior    = new HtmlTableCell();
                        oCellMesAnterior.ID = "tdCell_mesanterior" + oRow["identificador_kpi"].ToString();
                        oCellMesAnterior.Attributes.Add("class", "clDtPanel");

                        /*******************************************************/
                        /***************** Mes Anterior ************************/
                        /*******************************************************/
                        oIndResultado.IdFecha = idFechaMesAnterior.ToString("yyyyMMddHHmm");
                        tblColumn1            = oIndResultado.GetMesAnterior();
                        if (tblColumn1 != null)
                        {
                            if (tblColumn1.Rows.Count > 0)
                            {
                                oDivImg = new HtmlGenericControl("div");
                                oDivImg.Attributes.Add("class", "tbDat");

                                oImage          = new Image();
                                oImage.ImageUrl = oWeb.getColorArrowCalidad(double.Parse(iDato), double.Parse(tblColumn1.Rows[0]["valor"].ToString()));

                                oDivImg.Controls.Add(oImage);
                                oCellMesAnterior.Controls.Add(oDivImg);
                                //oColumnMesAnt1.ImageUrl = oWeb.getColorArrowCalidad(double.Parse(iDato), double.Parse(tblColumn1.Rows[0]["valor"].ToString()));
                            }
                            tblColumn1.Dispose();
                        }
                        tblColumn1 = null;

                        oCelldataAceptacion    = new HtmlTableCell();
                        oCelldataAceptacion.ID = "tdCell_aceptacion" + oRow["identificador_kpi"].ToString();
                        oCelldataAceptacion.Attributes.Add("class", "clDtPanel");

                        oDivAceptacion    = new HtmlGenericControl("div");
                        oDivAceptacion.ID = "divAceptacion_" + oRow["identificador_kpi"].ToString();
                        oDivAceptacion.Attributes.Add("class", "tbDat");

                        oCellSLA    = new HtmlTableCell();
                        oCellSLA.ID = "tdCell_SLA" + oRow["identificador_kpi"].ToString();
                        oCellSLA.Attributes.Add("class", "clDtPanel");

                        oDivSLA    = new HtmlGenericControl("div");
                        oDivSLA.ID = "divSLA_" + oRow["identificador_kpi"].ToString();
                        oDivSLA.Attributes.Add("class", "tbDat");

                        oIndumbral            = new cIndumbral(ref oConn);
                        oIndumbral.KeyCliente = oCmbCliente.Value;
                        oIndumbral.Tipo       = oCmbTipoConsulta.Value;
                        oIndumbral.Indicador  = oRow["identificador_kpi"].ToString();
                        oIndumbral.KeyTipo    = sKeyTipo;
                        tblColumn1            = oIndumbral.Get();
                        if (tblColumn1 != null)
                        {
                            if (tblColumn1.Rows.Count > 0)
                            {
                                oDivAceptacion.InnerText = tblColumn1.Rows[0]["criterio_aceptacion"].ToString() + tblColumn1.Rows[0]["unidad"].ToString();
                                oCelldataAceptacion.Controls.Add(oDivAceptacion);
                                //oCAceptacion1.InnerHtml = tblColumn1.Rows[0]["criterio_aceptacion"].ToString() + tblColumn1.Rows[0]["unidad"].ToString();

                                oDivSLA.InnerText = tblColumn1.Rows[0]["sla"].ToString();
                                oCellSLA.Controls.Add(oDivSLA);
                                //oSLA1.InnerHtml = tblColumn1.Rows[0]["sla"].ToString();

                                dynDiv.Attributes.Add("class", oWeb.getColorNumAvance(double.Parse(iDato), tblColumn1));
                                oCelldataColumn.Controls.Add(dynDiv);
                                //oColumn1.Attributes.Add("class", oWeb.getColorNumAvance(double.Parse(iDato), tblColumn1));
                            }
                            tblColumn1.Dispose();
                        }
                        tblColumn1 = null;

                        dataColumn.Controls.Add(oCelldataColumn);
                        dataAceptacion.Controls.Add(oCelldataAceptacion);
                        dataSLA.Controls.Add(oCellSLA);
                        dataMesAnterior.Controls.Add(oCellMesAnterior);
                    }
                }
                dtKPIs = null;

                oConn.Close();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            DBConn        oConn = new DBConn();
            Web           oWeb  = new Web();
            StringBuilder sNAvance;
            string        pCodMonitor    = oWeb.GetData("codmonitor");
            string        pCodUsuario    = oWeb.GetData("codusuario");
            string        pAuthenCodUser = oWeb.GetData("authuser");
            string        indexToken     = oWeb.GetData("indexToken");

            string pCodPage      = string.Empty;
            string pOrderPage    = oWeb.GetData("order");
            string pCodCliente   = string.Empty;
            string pTipoConsulta = string.Empty;
            string pTipoCliente  = string.Empty;
            string sIdFecha      = string.Empty;
            string iDato         = "0";
            string sKeyTipo      = string.Empty;

            if (!string.IsNullOrEmpty(pAuthenCodUser))
            {
                AuthenticUser(pAuthenCodUser);
            }

            oWeb.ValidaUserPanel();

            int maxdt = (new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).AddDays(-1)).Day;

            firtDay.InnerText = "01-" + DateTime.Now.ToString("MM-yyyy");
            lastDay.InnerText = maxdt.ToString() + "-" + DateTime.Now.ToString("MM-yyyy");

            if (!IsPostBack)
            {
                if (oConn.Open())
                {
                    cAptMonitorPages oAptMonitorPages = new cAptMonitorPages(ref oConn);
                    oAptMonitorPages.CodMonitor = pCodMonitor;
                    oAptMonitorPages.OrderPage  = pOrderPage;
                    DataTable dtMPage = oAptMonitorPages.Get();

                    if (dtMPage != null)
                    {
                        if (dtMPage.Rows.Count > 0)
                        {
                            pCodPage      = dtMPage.Rows[0]["cod_page"].ToString();
                            pTipoConsulta = dtMPage.Rows[0]["tipo_usuario"].ToString();
                            if (!string.IsNullOrEmpty(dtMPage.Rows[0]["cod_cliente"].ToString()))
                            {
                                pCodCliente  = dtMPage.Rows[0]["cod_cliente"].ToString();
                                pTipoCliente = "C";
                            }
                            else if (!string.IsNullOrEmpty(dtMPage.Rows[0]["cod_holding"].ToString()))
                            {
                                pCodCliente  = dtMPage.Rows[0]["cod_holding"].ToString();
                                pTipoCliente = "H";
                            }
                            else
                            {
                                cCliente  oCliente  = new cCliente(ref oConn);
                                DataTable dtCliente = oCliente.Get();
                                if (!string.IsNullOrEmpty(indexToken))
                                {
                                    pCodCliente = dtCliente.Rows[Convert.ToInt32(Session[indexToken].ToString())]["nkey_cliente"].ToString();
                                }
                                else
                                {
                                    pCodCliente = dtCliente.Rows[Convert.ToInt32(Session["indexcliente"].ToString())]["nkey_cliente"].ToString();
                                }
                                dtCliente = null;
                            }
                        }
                    }
                    dtMPage = null;

                    oCmbTipoConsulta.Value = pTipoConsulta;
                    oCmbCliente.Value      = pCodCliente;

                    if (oCmbTipoConsulta.Value == "S")
                    {
                        pie.Attributes.Add("class", "tdPieManagers");
                        lblSubTitle.Text = "Medición de Managers";
                    }
                    else
                    {
                        pie.Attributes.Add("class", "tdPieEjecutivos");
                        lblSubTitle.Text = "Medición de Ejecutivos";
                    }

                    if (!string.IsNullOrEmpty(oCmbCliente.Value))
                    {
                        cAppLogoCliente oAppLogoCliente = new cAppLogoCliente(ref oConn);
                        oAppLogoCliente.NKey_cliente = pCodCliente;
                        oAppLogoCliente.Tipo         = (pTipoCliente == "H" ? pTipoCliente : "C");
                        DataTable dtlogo = oAppLogoCliente.Get();
                        if (dtlogo != null)
                        {
                            if (dtlogo.Rows.Count > 0)
                            {
                                imglogo.ImageUrl = "images/logos/" + dtlogo.Rows[0]["logo_cliente"].ToString();
                            }
                        }
                    }
                    else
                    {
                        imglogo.Visible = false;
                    }
                }
                oConn.Close();
            }

            if (oConn.Open())
            {
                if (!IsPostBack)
                {
                    cCliente oCliente = new cCliente(ref oConn);
                    oCliente.NKey_cliente = oCmbCliente.Value;
                    DataTable tblCliente = oCliente.Get();
                    if (!string.IsNullOrEmpty(oCliente.Error))
                    {
                        Response.Write(oCliente.Query);
                        Response.End();
                    }
                    if (tblCliente != null)
                    {
                        if (tblCliente.Rows.Count > 0)
                        {
                            hddNCod.Value = tblCliente.Rows[0]["ncod"].ToString();
                        }
                    }
                    tblCliente.Dispose();
                    tblCliente = null;
                }
                cIndejecucion oIndejecucion = new cIndejecucion(ref oConn);
                DataTable     tblEjecucion  = oIndejecucion.Get();
                if (tblEjecucion != null)
                {
                    if (tblEjecucion.Rows.Count > 0)
                    {
                        sIdFecha = tblEjecucion.Rows[0]["idfecha"].ToString();
                    }
                    tblEjecucion.Dispose();
                }
                tblEjecucion = null;

                DateTime idFechaMesAnterior = new DateTime(Int32.Parse(sIdFecha.Substring(0, 4)), Int32.Parse(sIdFecha.Substring(4, 2)), Int32.Parse(sIdFecha.Substring(6, 2)), Int32.Parse(sIdFecha.Substring(8, 2)), Int32.Parse(sIdFecha.Substring(10, 2)), 0);
                idFechaMesAnterior = idFechaMesAnterior.AddMonths(-1);

                HtmlTableCell htmlTblCell;
                cAnalista     oAnalista = new cAnalista(ref oConn);
                oAnalista.NCod         = hddNCod.Value;
                oAnalista.TipoAnalista = oCmbTipoConsulta.Value;
                DataTable tblAnalista = oAnalista.Get();
                if (tblAnalista != null)
                {
                    foreach (DataRow oRow in tblAnalista.Rows)
                    {
                        htmlTblCell = new HtmlTableCell();
                        htmlTblCell.Controls.Add(new LiteralControl("<div class=\"tbTit\">" + oRow["snombre"].ToString() + "</div>"));
                        trCabecera.Controls.Add(htmlTblCell);
                    }
                }
                tblAnalista.Dispose();
                tblAnalista = null;
                DataTable tblColumn2;

                HtmlGenericControl oDivImg;
                DataTable          tblColumn1;
                cIndresultado      oIndResultado;
                cIndumbral         oIndumbral;

                cAptPagesKpi oAptPagesKpi = new cAptPagesKpi(ref oConn);
                oAptPagesKpi.CodCliente = pCodUsuario;
                oAptPagesKpi.CodPage    = pCodPage;
                DataTable dtKPIs = oAptPagesKpi.Get();
                if (dtKPIs != null)
                {
                    foreach (DataRow oRowKpi in dtKPIs.Rows)
                    {
                        iDato    = string.Empty;
                        sKeyTipo = string.Empty;
                        HtmlTableCell HtmlTablecell;

                        HtmlTablecell = new HtmlTableCell();
                        StringBuilder sNomKpi = new StringBuilder();
                        sNomKpi.Append("<td class=\"clPanel\"><div class=\"tbTTitRow\">");
                        sNomKpi.Append(oRowKpi["nombrekpi"].ToString());
                        sNomKpi.Append("</div></td>");
                        HtmlTablecell.Controls.Add(new LiteralControl(sNomKpi.ToString()));
                        HtmlTableRow htmlTblRowKpi = new HtmlTableRow();
                        htmlTblRowKpi.ID = oRowKpi["cod_kpi"].ToString() + "_KPI";
                        htmlTblRowKpi.Controls.Add(HtmlTablecell);
                        tbl.Controls.Add(htmlTblRowKpi);

                        HtmlTablecell = new HtmlTableCell();
                        StringBuilder sCriterioAceptacion = new StringBuilder();
                        sCriterioAceptacion.Append("<td class=\"clPanel\"><div class=\"tbTitRow\">Criterio Aceptación</div></td>");
                        HtmlTablecell.Controls.Add(new LiteralControl(sCriterioAceptacion.ToString()));
                        HtmlTableRow htmlTblRowCriAcep = new HtmlTableRow();
                        htmlTblRowCriAcep.ID = oRowKpi["cod_kpi"].ToString() + "_CriAcept";
                        htmlTblRowCriAcep.Controls.Add(HtmlTablecell);
                        tbl.Controls.Add(htmlTblRowCriAcep);

                        HtmlTablecell = new HtmlTableCell();
                        StringBuilder sCriterioSLA = new StringBuilder();
                        sCriterioSLA.Append("<td class=\"clPanel\"><div class=\"tbTitRow\">SLA</div></td>");
                        HtmlTablecell.Controls.Add(new LiteralControl(sCriterioSLA.ToString()));
                        HtmlTableRow htmlTblRowSLA = new HtmlTableRow();
                        htmlTblRowSLA.ID = oRowKpi["cod_kpi"].ToString() + "_SLA";
                        htmlTblRowSLA.Controls.Add(HtmlTablecell);
                        tbl.Controls.Add(htmlTblRowSLA);

                        HtmlTablecell = new HtmlTableCell();
                        StringBuilder sCriterioMesAnte = new StringBuilder();
                        sCriterioMesAnte.Append("<td class=\"clPanel\"><div class=\"tbTitRow\">Mes Anterior</div></td>");
                        HtmlTablecell.Controls.Add(new LiteralControl(sCriterioMesAnte.ToString()));
                        HtmlTableRow htmlTblRowMesAnt = new HtmlTableRow();
                        htmlTblRowMesAnt.ID = oRowKpi["cod_kpi"].ToString() + "_MesAnt";
                        htmlTblRowMesAnt.Controls.Add(HtmlTablecell);
                        tbl.Controls.Add(htmlTblRowMesAnt);

                        HtmlTableRow htmlTblRow = new HtmlTableRow();
                        htmlTblRow.ID = oRowKpi["cod_kpi"].ToString() + "row";
                        HtmlTablecell = new HtmlTableCell();
                        HtmlTablecell.Controls.Add(new LiteralControl("<td colspan=\"20\" style=\"height: 10px; \"></td>"));
                        htmlTblRow.Controls.Add(HtmlTablecell);
                        tbl.Controls.Add(htmlTblRow);

                        oAnalista              = new cAnalista(ref oConn);
                        oAnalista.NCod         = hddNCod.Value;
                        oAnalista.TipoAnalista = oCmbTipoConsulta.Value;
                        tblAnalista            = oAnalista.Get();

                        if (tblAnalista != null)
                        {
                            foreach (DataRow oRow in tblAnalista.Rows)
                            {
                                oIndResultado            = new cIndresultado(ref oConn);
                                oIndResultado.Tipo       = oCmbTipoConsulta.Value;
                                oIndResultado.KeyCliente = oCmbCliente.Value;
                                oIndResultado.KeyTipo    = oRow["nKey_Analista"].ToString();
                                oIndResultado.Indicador  = oRowKpi["identificador_kpi"].ToString();
                                oIndResultado.IdFecha    = sIdFecha;
                                tblColumn1 = oIndResultado.Get();
                                if (tblColumn1 != null)
                                {
                                    if (tblColumn1.Rows.Count > 0)
                                    {
                                        iDato    = (!string.IsNullOrEmpty(tblColumn1.Rows[0]["valor"].ToString()) ? tblColumn1.Rows[0]["valor"].ToString() : "0");
                                        sKeyTipo = tblColumn1.Rows[0]["nkey_tipo"].ToString();

                                        oIndumbral            = new cIndumbral(ref oConn);
                                        oIndumbral.KeyCliente = oCmbCliente.Value;
                                        oIndumbral.Indicador  = oRowKpi["identificador_kpi"].ToString();
                                        oIndumbral.KeyTipo    = sKeyTipo;
                                        tblColumn2            = oIndumbral.Get();
                                        if (tblColumn2 != null)
                                        {
                                            if (tblColumn2.Rows.Count > 0)
                                            {
                                                sNAvance = new StringBuilder();
                                                sNAvance.Append("<div class=\"").Append(oWeb.getColorNumAvance(double.Parse(iDato), tblColumn2));
                                                sNAvance.Append("\">").Append(String.Format("{0:0}", double.Parse(iDato))).Append("</div>");

                                                htmlTblCell = new HtmlTableCell();
                                                htmlTblCell.Attributes.Add("align", "center");
                                                htmlTblCell.Attributes.Add("class", "clDtPanel");
                                                htmlTblCell.Controls.Add(new LiteralControl(sNAvance.ToString()));
                                                htmlTblRowKpi.Controls.Add(htmlTblCell);

                                                htmlTblCell = new HtmlTableCell();
                                                htmlTblCell.Attributes.Add("class", "clDtPanel");
                                                htmlTblCell.Controls.Add(new LiteralControl("<div class=\"tbDat\">" + tblColumn2.Rows[0]["criterio_aceptacion"].ToString() + " " + tblColumn2.Rows[0]["unidad"].ToString() + "</div>"));
                                                htmlTblRowCriAcep.Controls.Add(htmlTblCell);

                                                htmlTblCell = new HtmlTableCell();
                                                htmlTblCell.Attributes.Add("class", "clDtPanel");
                                                htmlTblCell.Controls.Add(new LiteralControl("<div class=\"tbDat\">" + tblColumn2.Rows[0]["sla"].ToString() + "</div>"));
                                                htmlTblRowSLA.Controls.Add(htmlTblCell);
                                            }
                                            tblColumn2.Dispose();
                                        }
                                        tblColumn2 = null;
                                    }
                                    tblColumn1.Dispose();
                                }
                                tblColumn1            = null;
                                oIndResultado.IdFecha = idFechaMesAnterior.ToString("yyyyMMddHHmm");
                                tblColumn1            = oIndResultado.GetMesAnterior();
                                if (tblColumn1 != null)
                                {
                                    if (tblColumn1.Rows.Count > 0)
                                    {
                                        htmlTblCell = new HtmlTableCell();
                                        htmlTblCell.Attributes.Add("class", "clDtPanel");

                                        oDivImg = new HtmlGenericControl("div");
                                        oDivImg.Attributes.Add("class", "tbDat");

                                        oDivImg.Controls.Add(new LiteralControl("<img src=\"" + oWeb.getColorArrowCalidad(double.Parse(iDato), double.Parse(tblColumn1.Rows[0]["valor"].ToString())) + "\" border=\"0\">"));

                                        htmlTblCell.Controls.Add(oDivImg);
                                        htmlTblRowMesAnt.Controls.Add(htmlTblCell);
                                    }
                                    tblColumn1.Dispose();
                                }
                                tblColumn1 = null;
                            }
                            oIndResultado = null;
                        }
                    }
                    tblAnalista = null;
                }
                dtKPIs = null;
            }
            oConn.Close();
        }