Example #1
0
        private void CargarDatos(DateTime fechaDesde, DateTime fechaHasta)
        {
            IList <ALCSA.Entidades.Parametros.Salidas.Metricas.ResumenProcurador> arrResumenes =
                new ALCSA.Negocio.Gestion.Metricas.Procurador().ListarResumenPorCliente(hdfRutProcurador.Value, fechaDesde, fechaHasta);

            if (arrResumenes.Count > 0)
            {
                ALCSA.FWK.Web.Control.AsignarValor(lblVelocidadTramitacion, arrResumenes[0].VelocidadPromedioTramitacion, 2);
                ALCSA.FWK.Web.Control.AsignarValor(lblVelocidadTermino, arrResumenes[0].VelocidadPromedioTermino, 2);
                ALCSA.FWK.Web.Control.AsignarValor(lblEfectividad, arrResumenes[0].Efectividad, 2);
            }

            gvResumenesPorClientes.DataSource = arrResumenes;
            gvResumenesPorClientes.DataBind();

            CargarDatosTramites(fechaDesde, fechaHasta);
        }
Example #2
0
        private void CargarDetalle(bool exportarExcel)
        {
            IList <ALCSA.Entidades.Parametros.Salidas.Metricas.EstadoProcurador> arrProcuradores = new ALCSA.Negocio.Gestion.Metricas.Procurador().Listar(ddlProcurador.SelectedValue);
            int intTotal = 0;

            foreach (ALCSA.Entidades.Parametros.Salidas.Metricas.EstadoProcurador objDato in arrProcuradores)
            {
                intTotal += objDato.NumeroTotalCobranzas;
            }

            gvDetalle.DataSource = arrProcuradores;
            gvDetalle.DataBind();

            if (!exportarExcel)
            {
                return;
            }

            string strNombreArchivo = string.Format("GestionProcurador_{0:ddMMyyyy_hhmmss_fff}.xls", DateTime.Now);

            using (System.IO.MemoryStream objArchivoMemoria = new ALCSA.Negocio.Documentos.GeneradorExcel().ExportarListaDtoAExcel
                                                              <ALCSA.Entidades.Parametros.Salidas.Metricas.EstadoProcurador>(
                       arrProcuradores,
                       "Gestión",
                       new string[] {
                "NombreProcurador",
                "NumeroTotalCobranzas",
                "NumeroCobranzasVencidas",
                "NumeroCobranzasPorVencer",
                "NumeroCobranzasEnPlazo",
                "NumeroCobranzasTerminadas",
                "PorcentajeAsignado",
                "PorcentajeVencidas",
                "PorcentajePorVencer",
                "PorcentajeEnPlazo",
                "PorcentajeTerminado"
            }))
            {
                new ALCSA.FWK.Web.Sitio().DescargarArchivo(Response, objArchivoMemoria, strNombreArchivo);
            }
        }
        private void CargarDetalle(int pagina, bool exportarExcel)
        {
            IList <ALCSA.Entidades.Parametros.Salidas.Metricas.EstadoProcuradorCobranza> arrCobranzas = new ALCSA.Negocio.Gestion.Metricas.Procurador().ListarCobranzas(hdfRutProcurador.Value);

            if (arrCobranzas.Count > 0)
            {
                lblNombreProcurador.Text = arrCobranzas[0].NombreCliente;
            }

            int    intIndice  = 0;
            string strEtapa   = ddlEtapas.SelectedValue;
            string strTramite = ddlTramites.SelectedValue;
            string strEstado  = hdfEstadoAvance.Value.ToLower();

            while (intIndice < arrCobranzas.Count)
            {
                if ((strEstado != "todos" && arrCobranzas[intIndice].EstadoAvance.ToLower() != strEstado) ||
                    (!string.IsNullOrEmpty(strEtapa) && strEtapa != arrCobranzas[intIndice].Etapa) ||
                    (!string.IsNullOrEmpty(strTramite) && strTramite != arrCobranzas[intIndice].Tramite))
                {
                    arrCobranzas.RemoveAt(intIndice);
                }
                else
                {
                    intIndice++;
                }
            }

            gvDetalle.PageIndex  = pagina;
            gvDetalle.DataSource = arrCobranzas;
            gvDetalle.DataBind();

            if (!exportarExcel)
            {
                return;
            }

            for (intIndice = 0; intIndice < arrCobranzas.Count; intIndice++)
            {
                arrCobranzas[intIndice].NumeroOperacion = string.Format("'{0}", arrCobranzas[intIndice].NumeroOperacion);
            }

            string strNombreArchivo = string.Format("GestionProcuradorCobrazas_{0:ddMMyyyy_hhmmss_fff}.xls", DateTime.Now);

            using (System.IO.MemoryStream objArchivoMemoria = new ALCSA.Negocio.Documentos.GeneradorExcel().ExportarListaDtoAExcel
                                                              <ALCSA.Entidades.Parametros.Salidas.Metricas.EstadoProcuradorCobranza>(
                       arrCobranzas,
                       "Gestión",
                       new string[] {
                "NumeroOperacion",
                "RutDeudor",
                "NombreDeudor",
                "NombreCliente",
                "FechaIngreso",
                "PlazoDias",
                "DiasDesdeIngresoCobranza",
                "DiasRestantes",
                "DiasAtraso",
                "FechaLimite",
                "FechaTermino",
                "Rol",
                "Estado",
                "EstadoAvance",
                "Etapa",
                "Tramite",
                "SubTramite"
            }))
            {
                new ALCSA.FWK.Web.Sitio().DescargarArchivo(Response, objArchivoMemoria, strNombreArchivo);
            }
        }
Example #4
0
        private void CargarDatosTramites(DateTime fechaDesde, DateTime fechaHasta)
        {
            // ------------------------------------------------------------------------
            IList <ALCSA.Entidades.Parametros.Salidas.Metricas.TramiteCobranzaTerminada> arrTramites =
                new ALCSA.Negocio.Gestion.Metricas.Procurador().ListarTramitesCobranzasTerminadas(hdfRutProcurador.Value, fechaDesde, fechaHasta);
            // ------------------------------------------------------------------------
            var arrColumnas = (from x in arrTramites
                               // where x.EsTramiteTermino
                               orderby x.Tramite
                               select x.Tramite).Distinct <string>();

            var arrClientes = (from x in arrTramites
                               orderby x.NombreCliente
                               select x.NombreCliente).Distinct <string>();
            // ------------------------------------------------------------------------
            DataTable             objTabla = new DataTable();
            List <List <string> > arrIdentificadores = new List <List <string> >();
            int intIndice = 0, intIndiceUno = 0;

            // ------------------------------------------------------------------------
            // COLUMNAS
            objTabla.Columns.Add(new DataColumn("Nombre Cliente", typeof(string)));
            foreach (var objColumna in arrColumnas)
            {
                objTabla.Columns.Add(new DataColumn(objColumna, typeof(int)));
            }
            // ------------------------------------------------------------------------
            // FILAS
            foreach (var strCliente in arrClientes)
            {
                DataRow       objFila      = objTabla.NewRow();
                List <string> arrDatosFila = new List <string>();
                intIndice          = 0;
                objFila[intIndice] = strCliente;
                foreach (var objColumna in arrColumnas)
                {
                    intIndice++;
                    int[] arrIdsCobranzas = (from x in arrTramites
                                             where x.NombreCliente == strCliente &&
                                             x.Tramite == objColumna
                                             select x.IdCobranza).ToArray <int>();

                    objFila[intIndice] = arrIdsCobranzas.Length;
                    arrDatosFila.Add(string.Join(",", arrIdsCobranzas));
                }
                objTabla.Rows.Add(objFila);
                arrIdentificadores.Add(arrDatosFila);
            }
            // ------------------------------------------------------------------------
            // ULTIMA FILA (TOTAL)
            if (objTabla.Rows.Count > 0)
            {
                DataRow       objFilaTotal = objTabla.NewRow();
                List <string> arrDatosFila = new List <string>();
                intIndice = 0;
                objFilaTotal[intIndice] = "Total";
                foreach (var objColumna in arrColumnas)
                {
                    intIndice++;
                    int[] arrIdsCobranzas = (from x in arrTramites
                                             where x.Tramite == objColumna
                                             select x.IdCobranza).ToArray <int>();

                    objFilaTotal[intIndice] = arrIdsCobranzas.Length;
                    arrDatosFila.Add(string.Join(",", arrIdsCobranzas));
                }
                objTabla.Rows.Add(objFilaTotal);
                arrIdentificadores.Add(arrDatosFila);
            }
            // ------------------------------------------------------------------------
            gvResumenesTramites.DataSource = objTabla;
            gvResumenesTramites.DataBind();
            // ------------------------------------------------------------------------
            intIndice = 0;
            foreach (GridViewRow objFila in gvResumenesTramites.Rows)
            {
                intIndiceUno = 1;
                foreach (var objColumna in arrColumnas)
                {
                    if (arrIdentificadores[intIndice][intIndiceUno - 1].Length > 0)
                    {
                        objFila.Cells[intIndiceUno].CssClass += string.Format(" detalle-cobranzas-termino {0}", arrIdentificadores[intIndice][intIndiceUno - 1]);
                    }
                    intIndiceUno++;
                }
                intIndice++;
            }
            // ------------------------------------------------------------------------
        }