コード例 #1
0
        public dynamic ConsultarDetallePresupuestoPrograma(long id)
        {
            PresupuestoProgramRequest request = new PresupuestoProgramRequest();

            request.IdPresupuesto = id;
            return(_dataModelRepository.ConsultarDetallePresupuestoPrograma(request));
        }
コード例 #2
0
        public IActionResult ConultarInforme(long id)
        {
            PresupuestoProgramRequest request = new PresupuestoProgramRequest();

            request.IdPresupuesto = id;
            var nombre = _dataModelRepository.GenerarInforme(request);

            var stream = new FileStream(@nombre, FileMode.Open);

            return(File(stream, "application/octet-stream", nombre));
        }
コード例 #3
0
 public dynamic ConsultarPresupuestoPrograma(PresupuestoProgramRequest request)
 {
     return(_dataModelRepository.ConsultarListaPresupuestoByProgram(request));
 }
コード例 #4
0
 public dynamic ConsultarListaPresupuestoByProgram(PresupuestoProgramRequest request)
 {
     return(PresupuestoOperations.ConsultarPresupuestosByProgram(_factory, _connectionDB, request));
 }
コード例 #5
0
 public dynamic ConsultarDetallePresupuestoPrograma(PresupuestoProgramRequest request)
 {
     return(PresupuestoOperations.ConsultarDetallePresupuestosByProgramas(_factory, _connectionDB, request));
 }
コード例 #6
0
        public static dynamic GenerarVersionamiento(IContextFactory factory, IOptions <ConnectionDB> connection, PresupuestoProgramRequest request)
        {
            PresupuestoByProgramResponse retorno = new PresupuestoByProgramResponse();

            using (Aldeas_Context db = factory.Create(connection))
            {
                var cobertura = false;
                var Actual    = false;

                var tieneCobertura = from pro in db.TbProgramas
                                     join pre in db.TbPresupuestoAnio on pro.id equals pre.idPrograma
                                     join tpro in db.TbTipoPrograma on pro.id_tipo_programa equals tpro.id
                                     where pre.id == request.IdPresupuesto
                                     select new
                {
                    tpro.cobertura,
                    pre.actual,
                };

                if (tieneCobertura.Any())
                {
                    cobertura = tieneCobertura.First().cobertura;
                    Actual    = tieneCobertura.First().actual;
                }

                /// Si no es el actual no se deja actualizar o consultar.
                if (!Actual)
                {
                    return(new JsonResult(new { message = "Unauthorized" })
                    {
                        StatusCode = StatusCodes.Status401Unauthorized
                    });
                }

                //Copiamos 01 Presupuesto Anio, Copiamos  02 Presupuesto coberturas, Copiamos 03 Presupuesto Programas


                var resultado = PresupuestoAnioOperations.Copiar(factory, connection, request.IdPresupuesto);

                if (resultado == 0)
                {
                    return(new JsonResult(new { message = "Versionamiento No exitoso" })
                    {
                        StatusCode = StatusCodes.Status400BadRequest
                    });
                }
                else
                {
                    return(new JsonResult(new { message = "Versionamiento exitoso" })
                    {
                        StatusCode = StatusCodes.Status200OK
                    });
                }
            }
        }
コード例 #7
0
        public static dynamic ConsultarDetallePresupuestosByProgramasExport(IContextFactory factory, IOptions <ConnectionDB> connection, PresupuestoProgramRequest request)
        {
            Presupuestodetalle retorno = new Presupuestodetalle();

            using (Aldeas_Context db = factory.Create(connection))
            {
                var data = from pro in db.TbProgramas

                           join pre in db.TbPresupuestos on pro.id equals pre.idPrograma
                           join panio in db.TbPresupuestoAnio on pre.idPresupuestoAnio equals panio.id
                           join tpro in db.TbTipoPrograma on pro.id_tipo_programa equals tpro.id
                           join prep in db.TbPresupuestosProgramas on pre.id equals prep.idPresupuesto
                           join cec in db.TbProgramasCecos on prep.idProgramaCecos equals cec.id
                           join cargo in db.TbCargos on pre.id equals cargo.id
                           join puc in db.TbPucs on prep.idRubroPucs equals puc.id
                           join rubro in db.TbRubros on puc.idRubro equals rubro.id
                           where panio.id == request.IdPresupuesto
                           select new PresupuestoProgramResponse
                {
                    id                   = prep.id,
                    idPresupuesto        = pre.id,
                    Programa             = pro.Nombre,
                    Anio                 = pre.Anio,
                    ClasificacionGasto   = tpro.cobertura == true? "OPERACIONAL" : "ADMINISTRATIVO",
                    CentroCosto          = cec.CodigoCeco,
                    NombreCentroCosto    = cec.Nombre,
                    SubCentroCosto       = cec.SubCentro,
                    NombreSubCentroCosto = cec.NombreSubCentro,
                    NombreRubro          = rubro.Nombre,
                    esNomina             = rubro.esNomina,
                    EsPptp               = rubro.EsPptp,
                    CuentaSIIGO          = puc.CuentaSIIGO,
                    NombreCuenta         = puc.DescripcionCuenta,
                    CuentaCotable        = puc.CuentaNAV,
                    Facility             = cec.FacilityNav,
                    DetalleGasto         = prep.DetalleGasto,
                    NotaIngles           = prep.NotaIngles,
                    NoCasa               = prep.NoCasa,
                    NoKids               = prep.NoKids,
                    NumeroIdentificacion = prep.NumeroIdentificacion,
                    Nombre               = prep.Nombre,
                    Asignacion           = prep.Asignacion,
                    Cargo                = cargo.cargo,
                    Enero                = prep.Enero,
                    Febrero              = prep.Febrero,
                    Marzo                = prep.Marzo,
                    Abril                = prep.Abril,
                    Mayo                 = prep.Mayo,
                    Junio                = prep.Junio,
                    Julio                = prep.Julio,
                    Agosto               = prep.Agosto,
                    Septiembre           = prep.Septiembre,
                    Octubre              = prep.Octubre,
                    Noviembre            = prep.Noviembre,
                    Diciembre            = prep.Diciembre,
                    Total                = prep.Total
                };
                if (data.Any())
                {
                    retorno.DetallePresupuesto = data.ToList();
                }
                else
                {
                    retorno.DetallePresupuesto = new List <PresupuestoProgramResponse>();
                }
            }

            return(retorno);
        }
コード例 #8
0
        public static dynamic ConsultarDetallePresupuestosByProgramas(IContextFactory factory, IOptions <ConnectionDB> connection, PresupuestoProgramRequest request)
        {
            PresupuestodetalleView retorno = new PresupuestodetalleView();

            using (Aldeas_Context db = factory.Create(connection))
            {
                var data = from pro in db.ViewPresupuestos


                           where pro.idPresupuesto == request.IdPresupuesto
                           select pro;

                if (data.Any())
                {
                    retorno.DetallePresupuesto = data.ToList();
                }
                else
                {
                    retorno.DetallePresupuesto = new List <View_DbPresupuesto>();
                }
            }

            return(retorno);
        }
コード例 #9
0
        public static dynamic ConsultarPresupuestosByProgram(IContextFactory factory, IOptions <ConnectionDB> connection, PresupuestoProgramRequest request)
        {
            PresupuestoByProgramResponse retorno = new PresupuestoByProgramResponse();

            using (Aldeas_Context db = factory.Create(connection))
            {
                var data = from pre in db.TbPresupuestos
                           join ceco in db.TbProgramasCecos on pre.idPrograma equals ceco.idPrograma
                           join panio in db.TbPresupuestoAnio on pre.idPresupuestoAnio equals panio.id
                           join finan in db.TbFinanciadores on ceco.idFinanciador equals finan.id
                           where pre.idPrograma == request.IdPresupuesto && panio.actual == true
                           select new ResponsePresupuesto
                {
                    idPrograma               = pre.idPrograma,
                    Anio                     = pre.Anio,
                    CoberturaAnual           = pre.CoberturaAnual,
                    CoberturaMensual         = pre.CoberturaMensual,
                    CoberturasCasas          = pre.CoberturasCasas,
                    CoberturaMensualEsperada = pre.CoberturaMensualEsperada,
                    id          = pre.id,
                    Financiador = finan.nombre
                };
                if (data.Any())
                {
                    retorno.presupuesto = data.ToList();
                }

                var programa = from pro in db.TbProgramas
                               join Tprograma in db.TbTipoPrograma on pro.id_tipo_programa equals Tprograma.id
                               where pro.id == request.IdPresupuesto
                               select new Program
                {
                    Cobertura = Tprograma.cobertura
                };
                if (programa.Any())
                {
                    retorno.programa = programa.First();
                }
            }

            return(retorno);
        }
コード例 #10
0
 public dynamic GenerarInforme(PresupuestoProgramRequest request)
 {
     return(InformesOperations.GenerarInforme(_factory, _connectionDB, request));
 }
コード例 #11
0
 public dynamic GenerarVersionamiento(PresupuestoProgramRequest request)
 {
     return(GestionPresupuestoOperations.GenerarVersionamiento(_factory, _connectionDB, request));
 }
コード例 #12
0
 public dynamic Versionar(PresupuestoProgramRequest request)
 {
     return(_dataRepository.GenerarVersionamiento(request));
 }
コード例 #13
0
        public static dynamic GenerarInforme(IContextFactory factory, IOptions <ConnectionDB> connection, PresupuestoProgramRequest request)
        {
            Presupuestodetalle retorno      = PresupuestoOperations.ConsultarDetallePresupuestosByProgramasExport(factory, connection, request);
            string             retornoFinal = "";

            try
            {
                string[] files = Directory.GetFiles("Informes/");
                foreach (string file in files)
                {
                    File.Delete(file);
                }

                #region Nomina
                Workbook  workbook  = new Workbook();
                Worksheet worksheet = new Worksheet("Informes Nomina");
                workbook.Worksheets.Add(worksheet);

                for (int j = 0; j < 100; j++)
                {
                    worksheet.Cells[j, 0] = new ExcelLibrary.SpreadSheet.Cell("");
                }


                worksheet.Cells[0, 0]  = new ExcelLibrary.SpreadSheet.Cell("[Informe general nomina Programas]");
                worksheet.Cells[0, 4]  = new ExcelLibrary.SpreadSheet.Cell(string.Format("INFORME REALIZADO EL : [{0}]", DateTime.Now), ExcelLibrary.SpreadSheet.CellFormat.Date);
                worksheet.Cells[0, 11] = new ExcelLibrary.SpreadSheet.Cell("NOMINA");
                //for (int i = 0; i < retorno.DetallePresupuesto.Count; i++)
                int i   = 0;
                int row = i + 2;

                worksheet.Cells[row, 0] = new ExcelLibrary.SpreadSheet.Cell("Nombre Rubro");
                worksheet.Cells[row, 1] = new ExcelLibrary.SpreadSheet.Cell("Clasificacion Gasto");


                worksheet.Cells[row, 2] = new ExcelLibrary.SpreadSheet.Cell("PROGRAMA");
                worksheet.Cells[row, 3] = new ExcelLibrary.SpreadSheet.Cell("AÑO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheet.Cells[row, 4] = new ExcelLibrary.SpreadSheet.Cell("CENTRO COSTO");
                worksheet.Cells[row, 5] = new ExcelLibrary.SpreadSheet.Cell("NOMBRE CENTRO COSTO");
                worksheet.Cells[row, 6] = new ExcelLibrary.SpreadSheet.Cell("SUB CENTRO COSTO");
                worksheet.Cells[row, 7] = new ExcelLibrary.SpreadSheet.Cell("NOMBRE SUB CENTRO COSTO");


                worksheet.Cells[row, 8]  = new ExcelLibrary.SpreadSheet.Cell("NUMERO IDENTIFICACION", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheet.Cells[row, 9]  = new ExcelLibrary.SpreadSheet.Cell("NOMBRE");
                worksheet.Cells[row, 10] = new ExcelLibrary.SpreadSheet.Cell("% ASIGNACION", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheet.Cells[row, 11] = new ExcelLibrary.SpreadSheet.Cell("CARGO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheet.Cells[row, 12] = new ExcelLibrary.SpreadSheet.Cell("NOMBRE CUENTA");
                worksheet.Cells[row, 13] = new ExcelLibrary.SpreadSheet.Cell("CUENTA SIIGO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheet.Cells[row, 14] = new ExcelLibrary.SpreadSheet.Cell("ENERO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheet.Cells[row, 15] = new ExcelLibrary.SpreadSheet.Cell("FEBRERO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheet.Cells[row, 16] = new ExcelLibrary.SpreadSheet.Cell("MARZO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheet.Cells[row, 17] = new ExcelLibrary.SpreadSheet.Cell("ABRIL", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheet.Cells[row, 18] = new ExcelLibrary.SpreadSheet.Cell("MAYO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheet.Cells[row, 19] = new ExcelLibrary.SpreadSheet.Cell("JUNIO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheet.Cells[row, 20] = new ExcelLibrary.SpreadSheet.Cell("JULIO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheet.Cells[row, 21] = new ExcelLibrary.SpreadSheet.Cell("AGOSTO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheet.Cells[row, 22] = new ExcelLibrary.SpreadSheet.Cell("SEPTIEMBRE", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheet.Cells[row, 23] = new ExcelLibrary.SpreadSheet.Cell("OCTUBRE", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheet.Cells[row, 24] = new ExcelLibrary.SpreadSheet.Cell("NOVIEMBRE", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheet.Cells[row, 25] = new ExcelLibrary.SpreadSheet.Cell("DICIEMBRE", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheet.Cells[row, 26] = new ExcelLibrary.SpreadSheet.Cell("TOTAL", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheet.Cells[row, 27] = new ExcelLibrary.SpreadSheet.Cell("DETALLE GASTO");
                worksheet.Cells[row, 28] = new ExcelLibrary.SpreadSheet.Cell("FACILITY");
                worksheet.Cells[row, 29] = new ExcelLibrary.SpreadSheet.Cell("CUENTA CONTABLE");


                foreach (var data in retorno.DetallePresupuesto.Where(x => x.esNomina == true))
                {
                    row = i + 3;
                    worksheet.Cells[row, 0] = new ExcelLibrary.SpreadSheet.Cell(data.NombreRubro);
                    worksheet.Cells[row, 1] = new ExcelLibrary.SpreadSheet.Cell(data.ClasificacionGasto);


                    worksheet.Cells[row, 2] = new ExcelLibrary.SpreadSheet.Cell(data.Programa);
                    worksheet.Cells[row, 3] = new ExcelLibrary.SpreadSheet.Cell(data.Anio, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheet.Cells[row, 4] = new ExcelLibrary.SpreadSheet.Cell(data.CentroCosto);
                    worksheet.Cells[row, 5] = new ExcelLibrary.SpreadSheet.Cell(data.NombreCentroCosto);
                    worksheet.Cells[row, 6] = new ExcelLibrary.SpreadSheet.Cell(data.SubCentroCosto);
                    worksheet.Cells[row, 7] = new ExcelLibrary.SpreadSheet.Cell(data.NombreSubCentroCosto);

                    var number = Convert.ToInt64(data.NumeroIdentificacion);
                    worksheet.Cells[row, 8]  = new ExcelLibrary.SpreadSheet.Cell(number.ToString(), ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheet.Cells[row, 9]  = new ExcelLibrary.SpreadSheet.Cell(data.Nombre);
                    worksheet.Cells[row, 10] = new ExcelLibrary.SpreadSheet.Cell(Convert.ToInt32(data.Asignacion).ToString(), ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheet.Cells[row, 11] = new ExcelLibrary.SpreadSheet.Cell(data.Cargo, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheet.Cells[row, 12] = new ExcelLibrary.SpreadSheet.Cell(data.NombreCuenta);
                    worksheet.Cells[row, 13] = new ExcelLibrary.SpreadSheet.Cell(data.CuentaSIIGO, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheet.Cells[row, 14] = new ExcelLibrary.SpreadSheet.Cell(data.Enero, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheet.Cells[row, 15] = new ExcelLibrary.SpreadSheet.Cell(data.Febrero, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheet.Cells[row, 16] = new ExcelLibrary.SpreadSheet.Cell(data.Marzo, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheet.Cells[row, 17] = new ExcelLibrary.SpreadSheet.Cell(data.Abril, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheet.Cells[row, 18] = new ExcelLibrary.SpreadSheet.Cell(data.Mayo, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheet.Cells[row, 19] = new ExcelLibrary.SpreadSheet.Cell(data.Junio, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheet.Cells[row, 20] = new ExcelLibrary.SpreadSheet.Cell(data.Julio, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheet.Cells[row, 21] = new ExcelLibrary.SpreadSheet.Cell(data.Agosto, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheet.Cells[row, 22] = new ExcelLibrary.SpreadSheet.Cell(data.Septiembre, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheet.Cells[row, 23] = new ExcelLibrary.SpreadSheet.Cell(data.Octubre, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheet.Cells[row, 24] = new ExcelLibrary.SpreadSheet.Cell(data.Noviembre, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheet.Cells[row, 25] = new ExcelLibrary.SpreadSheet.Cell(data.Diciembre, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheet.Cells[row, 26] = new ExcelLibrary.SpreadSheet.Cell(data.Total, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheet.Cells[row, 27] = new ExcelLibrary.SpreadSheet.Cell(data.DetalleGasto);
                    worksheet.Cells[row, 28] = new ExcelLibrary.SpreadSheet.Cell(data.Facility);
                    worksheet.Cells[row, 29] = new ExcelLibrary.SpreadSheet.Cell(data.CuentaCotable);

                    i++;
                }



                #endregion
                #region ppto familiar

                Worksheet worksheetFamiliar = new Worksheet("Informes PPTOfamiliar");
                workbook.Worksheets.Add(worksheetFamiliar);

                for (int j = 0; j < 10; j++)
                {
                    worksheetFamiliar.Cells[j, 0] = new ExcelLibrary.SpreadSheet.Cell("");
                }

                worksheetFamiliar.Cells[0, 0]  = new ExcelLibrary.SpreadSheet.Cell("[Informe general Programas - PPTO FAMILIAR]");
                worksheetFamiliar.Cells[0, 4]  = new ExcelLibrary.SpreadSheet.Cell(string.Format("INFORME REALIZADO EL : [{0}]", DateTime.Now), ExcelLibrary.SpreadSheet.CellFormat.Date);
                worksheetFamiliar.Cells[0, 11] = new ExcelLibrary.SpreadSheet.Cell("FAMILIAR");
                //for (int i = 0; i < retorno.DetallePresupuesto.Count; i++)

                i   = 0;
                row = i + 2;


                worksheetFamiliar.Cells[row, 0]  = new ExcelLibrary.SpreadSheet.Cell("Nombre Rubro");
                worksheetFamiliar.Cells[row, 1]  = new ExcelLibrary.SpreadSheet.Cell("Clasificacion Gasto");
                worksheetFamiliar.Cells[row, 2]  = new ExcelLibrary.SpreadSheet.Cell("PROGRAMA");
                worksheetFamiliar.Cells[row, 3]  = new ExcelLibrary.SpreadSheet.Cell("AÑO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetFamiliar.Cells[row, 4]  = new ExcelLibrary.SpreadSheet.Cell("CENTRO COSTO");
                worksheetFamiliar.Cells[row, 5]  = new ExcelLibrary.SpreadSheet.Cell("NOMBRE CENTRO COSTO");
                worksheetFamiliar.Cells[row, 6]  = new ExcelLibrary.SpreadSheet.Cell("SUB CENTRO COSTO");
                worksheetFamiliar.Cells[row, 7]  = new ExcelLibrary.SpreadSheet.Cell("NOMBRE SUB CENTRO COSTO");
                worksheetFamiliar.Cells[row, 8]  = new ExcelLibrary.SpreadSheet.Cell("No. CASA", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetFamiliar.Cells[row, 9]  = new ExcelLibrary.SpreadSheet.Cell("No. KIDS");
                worksheetFamiliar.Cells[row, 10] = new ExcelLibrary.SpreadSheet.Cell("NOMBRE CUENTA");
                worksheetFamiliar.Cells[row, 11] = new ExcelLibrary.SpreadSheet.Cell("CUENTA SIIGO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetFamiliar.Cells[row, 12] = new ExcelLibrary.SpreadSheet.Cell("ENERO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetFamiliar.Cells[row, 13] = new ExcelLibrary.SpreadSheet.Cell("FEBRERO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetFamiliar.Cells[row, 14] = new ExcelLibrary.SpreadSheet.Cell("MARZO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetFamiliar.Cells[row, 15] = new ExcelLibrary.SpreadSheet.Cell("ABRIL", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetFamiliar.Cells[row, 16] = new ExcelLibrary.SpreadSheet.Cell("MAYO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetFamiliar.Cells[row, 17] = new ExcelLibrary.SpreadSheet.Cell("JUNIO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetFamiliar.Cells[row, 18] = new ExcelLibrary.SpreadSheet.Cell("JULIO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetFamiliar.Cells[row, 19] = new ExcelLibrary.SpreadSheet.Cell("AGOSTO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetFamiliar.Cells[row, 20] = new ExcelLibrary.SpreadSheet.Cell("SEPTIEMBRE", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetFamiliar.Cells[row, 21] = new ExcelLibrary.SpreadSheet.Cell("OCTUBRE", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetFamiliar.Cells[row, 22] = new ExcelLibrary.SpreadSheet.Cell("NOVIEMBRE", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetFamiliar.Cells[row, 23] = new ExcelLibrary.SpreadSheet.Cell("DICIEMBRE", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetFamiliar.Cells[row, 24] = new ExcelLibrary.SpreadSheet.Cell("TOTAL", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetFamiliar.Cells[row, 25] = new ExcelLibrary.SpreadSheet.Cell("DETALLE GASTO");
                worksheetFamiliar.Cells[row, 26] = new ExcelLibrary.SpreadSheet.Cell("FACILITY");
                worksheetFamiliar.Cells[row, 27] = new ExcelLibrary.SpreadSheet.Cell("CUENTA CONTABLE");
                foreach (var data in retorno.DetallePresupuesto.Where(x => x.EsPptp == true))
                {
                    row = i + 3;

                    worksheetFamiliar.Cells[row, 0] = new ExcelLibrary.SpreadSheet.Cell(data.NombreRubro);
                    worksheetFamiliar.Cells[row, 1] = new ExcelLibrary.SpreadSheet.Cell(data.ClasificacionGasto);


                    worksheetFamiliar.Cells[row, 2]  = new ExcelLibrary.SpreadSheet.Cell(data.Programa);
                    worksheetFamiliar.Cells[row, 3]  = new ExcelLibrary.SpreadSheet.Cell(data.Anio, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetFamiliar.Cells[row, 4]  = new ExcelLibrary.SpreadSheet.Cell(data.CentroCosto);
                    worksheetFamiliar.Cells[row, 5]  = new ExcelLibrary.SpreadSheet.Cell(data.NombreCentroCosto);
                    worksheetFamiliar.Cells[row, 6]  = new ExcelLibrary.SpreadSheet.Cell(data.SubCentroCosto);
                    worksheetFamiliar.Cells[row, 7]  = new ExcelLibrary.SpreadSheet.Cell(data.NombreSubCentroCosto);
                    worksheetFamiliar.Cells[row, 8]  = new ExcelLibrary.SpreadSheet.Cell(Convert.ToInt32(data.NoCasa), ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetFamiliar.Cells[row, 9]  = new ExcelLibrary.SpreadSheet.Cell(Convert.ToInt32(data.NoKids), ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetFamiliar.Cells[row, 10] = new ExcelLibrary.SpreadSheet.Cell(data.NombreCuenta);
                    worksheetFamiliar.Cells[row, 11] = new ExcelLibrary.SpreadSheet.Cell(data.CuentaSIIGO);
                    worksheetFamiliar.Cells[row, 12] = new ExcelLibrary.SpreadSheet.Cell(data.Enero, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetFamiliar.Cells[row, 13] = new ExcelLibrary.SpreadSheet.Cell(data.Febrero, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetFamiliar.Cells[row, 14] = new ExcelLibrary.SpreadSheet.Cell(data.Marzo, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetFamiliar.Cells[row, 15] = new ExcelLibrary.SpreadSheet.Cell(data.Abril, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetFamiliar.Cells[row, 16] = new ExcelLibrary.SpreadSheet.Cell(data.Mayo, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetFamiliar.Cells[row, 17] = new ExcelLibrary.SpreadSheet.Cell(data.Junio, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetFamiliar.Cells[row, 18] = new ExcelLibrary.SpreadSheet.Cell(data.Julio, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetFamiliar.Cells[row, 19] = new ExcelLibrary.SpreadSheet.Cell(data.Agosto, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetFamiliar.Cells[row, 20] = new ExcelLibrary.SpreadSheet.Cell(data.Septiembre, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetFamiliar.Cells[row, 21] = new ExcelLibrary.SpreadSheet.Cell(data.Octubre, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetFamiliar.Cells[row, 22] = new ExcelLibrary.SpreadSheet.Cell(data.Noviembre, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetFamiliar.Cells[row, 23] = new ExcelLibrary.SpreadSheet.Cell(data.Diciembre, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetFamiliar.Cells[row, 24] = new ExcelLibrary.SpreadSheet.Cell(data.Total, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetFamiliar.Cells[row, 25] = new ExcelLibrary.SpreadSheet.Cell(data.DetalleGasto, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetFamiliar.Cells[row, 26] = new ExcelLibrary.SpreadSheet.Cell(data.Facility, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetFamiliar.Cells[row, 27] = new ExcelLibrary.SpreadSheet.Cell(data.CuentaCotable, ExcelLibrary.SpreadSheet.CellFormat.General);
                    i++;
                }

                #endregion


                #region otro ppto

                Worksheet worksheetOtro = new Worksheet("Informes OTRO PPTO");
                workbook.Worksheets.Add(worksheetOtro);

                for (int j = 0; j < 10; j++)
                {
                    worksheetOtro.Cells[j, 0] = new ExcelLibrary.SpreadSheet.Cell("");
                }

                worksheetOtro.Cells[0, 0]  = new ExcelLibrary.SpreadSheet.Cell("[Informe general Programas - OTRO PPTO]");
                worksheetOtro.Cells[0, 4]  = new ExcelLibrary.SpreadSheet.Cell(string.Format("INFORME REALIZADO EL : [{0}]", DateTime.Now), ExcelLibrary.SpreadSheet.CellFormat.Date);
                worksheetOtro.Cells[0, 11] = new ExcelLibrary.SpreadSheet.Cell("OTRO PPTO");


                i   = 0;
                row = i + 2;

                worksheetOtro.Cells[row, 0]  = new ExcelLibrary.SpreadSheet.Cell("Nombre Rubro");
                worksheetOtro.Cells[row, 1]  = new ExcelLibrary.SpreadSheet.Cell("Clasificacion Gasto");
                worksheetOtro.Cells[row, 2]  = new ExcelLibrary.SpreadSheet.Cell("PROGRAMA");
                worksheetOtro.Cells[row, 3]  = new ExcelLibrary.SpreadSheet.Cell("AÑO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetOtro.Cells[row, 4]  = new ExcelLibrary.SpreadSheet.Cell("CENTRO COSTO");
                worksheetOtro.Cells[row, 5]  = new ExcelLibrary.SpreadSheet.Cell("NOMBRE CENTRO COSTO");
                worksheetOtro.Cells[row, 6]  = new ExcelLibrary.SpreadSheet.Cell("SUB CENTRO COSTO");
                worksheetOtro.Cells[row, 7]  = new ExcelLibrary.SpreadSheet.Cell("NOMBRE SUB CENTRO COSTO");
                worksheetOtro.Cells[row, 8]  = new ExcelLibrary.SpreadSheet.Cell("NOMBRE CUENTA");
                worksheetOtro.Cells[row, 9]  = new ExcelLibrary.SpreadSheet.Cell("CUENTA SIIGO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetOtro.Cells[row, 10] = new ExcelLibrary.SpreadSheet.Cell("ENERO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetOtro.Cells[row, 11] = new ExcelLibrary.SpreadSheet.Cell("FEBRERO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetOtro.Cells[row, 12] = new ExcelLibrary.SpreadSheet.Cell("MARZO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetOtro.Cells[row, 13] = new ExcelLibrary.SpreadSheet.Cell("ABRIL", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetOtro.Cells[row, 14] = new ExcelLibrary.SpreadSheet.Cell("MAYO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetOtro.Cells[row, 15] = new ExcelLibrary.SpreadSheet.Cell("JUNIO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetOtro.Cells[row, 16] = new ExcelLibrary.SpreadSheet.Cell("JULIO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetOtro.Cells[row, 17] = new ExcelLibrary.SpreadSheet.Cell("AGOSTO", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetOtro.Cells[row, 18] = new ExcelLibrary.SpreadSheet.Cell("SEPTIEMBRE", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetOtro.Cells[row, 19] = new ExcelLibrary.SpreadSheet.Cell("OCTUBRE", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetOtro.Cells[row, 20] = new ExcelLibrary.SpreadSheet.Cell("NOVIEMBRE", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetOtro.Cells[row, 21] = new ExcelLibrary.SpreadSheet.Cell("DICIEMBRE", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetOtro.Cells[row, 22] = new ExcelLibrary.SpreadSheet.Cell("TOTAL", ExcelLibrary.SpreadSheet.CellFormat.General);
                worksheetOtro.Cells[row, 23] = new ExcelLibrary.SpreadSheet.Cell("DETALLE GASTO");
                worksheetOtro.Cells[row, 24] = new ExcelLibrary.SpreadSheet.Cell("FACILITY");
                worksheetOtro.Cells[row, 25] = new ExcelLibrary.SpreadSheet.Cell("CUENTA CONTABLE");
                foreach (var data in retorno.DetallePresupuesto.Where(x => x.EsPptp == false && x.esNomina == false))
                {
                    row = i + 3;

                    worksheetOtro.Cells[row, 0] = new ExcelLibrary.SpreadSheet.Cell(data.NombreRubro);
                    worksheetOtro.Cells[row, 1] = new ExcelLibrary.SpreadSheet.Cell(data.ClasificacionGasto);


                    worksheetOtro.Cells[row, 2] = new ExcelLibrary.SpreadSheet.Cell(data.Programa);
                    worksheetOtro.Cells[row, 3] = new ExcelLibrary.SpreadSheet.Cell(data.Anio, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetOtro.Cells[row, 4] = new ExcelLibrary.SpreadSheet.Cell(data.CentroCosto);
                    worksheetOtro.Cells[row, 5] = new ExcelLibrary.SpreadSheet.Cell(data.NombreCentroCosto);
                    worksheetOtro.Cells[row, 6] = new ExcelLibrary.SpreadSheet.Cell(data.SubCentroCosto);
                    worksheetOtro.Cells[row, 7] = new ExcelLibrary.SpreadSheet.Cell(data.NombreSubCentroCosto);

                    worksheetOtro.Cells[row, 8]  = new ExcelLibrary.SpreadSheet.Cell(data.NombreCuenta);
                    worksheetOtro.Cells[row, 9]  = new ExcelLibrary.SpreadSheet.Cell(data.CuentaSIIGO);
                    worksheetOtro.Cells[row, 10] = new ExcelLibrary.SpreadSheet.Cell(data.Enero, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetOtro.Cells[row, 11] = new ExcelLibrary.SpreadSheet.Cell(data.Febrero, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetOtro.Cells[row, 12] = new ExcelLibrary.SpreadSheet.Cell(data.Marzo, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetOtro.Cells[row, 13] = new ExcelLibrary.SpreadSheet.Cell(data.Abril, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetOtro.Cells[row, 14] = new ExcelLibrary.SpreadSheet.Cell(data.Mayo, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetOtro.Cells[row, 15] = new ExcelLibrary.SpreadSheet.Cell(data.Junio, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetOtro.Cells[row, 16] = new ExcelLibrary.SpreadSheet.Cell(data.Julio, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetOtro.Cells[row, 17] = new ExcelLibrary.SpreadSheet.Cell(data.Agosto, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetOtro.Cells[row, 18] = new ExcelLibrary.SpreadSheet.Cell(data.Septiembre, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetOtro.Cells[row, 19] = new ExcelLibrary.SpreadSheet.Cell(data.Octubre, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetOtro.Cells[row, 20] = new ExcelLibrary.SpreadSheet.Cell(data.Noviembre, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetOtro.Cells[row, 21] = new ExcelLibrary.SpreadSheet.Cell(data.Diciembre, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetOtro.Cells[row, 22] = new ExcelLibrary.SpreadSheet.Cell(data.Total, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetOtro.Cells[row, 23] = new ExcelLibrary.SpreadSheet.Cell(data.DetalleGasto, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetOtro.Cells[row, 24] = new ExcelLibrary.SpreadSheet.Cell(data.Facility, ExcelLibrary.SpreadSheet.CellFormat.General);
                    worksheetOtro.Cells[row, 25] = new ExcelLibrary.SpreadSheet.Cell(data.CuentaCotable, ExcelLibrary.SpreadSheet.CellFormat.General);
                    i++;
                }

                #endregion


                if (!Directory.Exists("Informes/"))
                {
                    DirectoryInfo di = Directory.CreateDirectory("Informes/");
                }

                var nombre = "Informes/" + DateTime.Now.ToString("yyyyMM-ddHHmmss") + "Informe.xls";
                workbook.Save(nombre);


                retornoFinal = nombre;
            }
            catch (Exception e)
            {
                //new ClientListException("Erreur lors de la conversion en fichier Excel ! erreur : " + e.Message);
            }

            return(retornoFinal);
        }