Example #1
0
        public void ProcesarFondo(Cesantia c, string periodo)
        {
            var excelAppOut = new ExcelX.Application();
            var fecha       = DateTime.Now.ToString().Replace("/", "").Replace(":", "").Replace(" ", "");
            //var periodo = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString().PadLeft(2, '0');
            var rutaEntrada = @"C:\Fondos Nacionales\out\" + periodo + @"\Cesantia\Preliminar\IFCesantia";
            var rutaSalida  = @"C:\Fondos Nacionales\out\" + periodo + @"\Cesantia\";

            //excelAppOut.Workbooks.Open(rutaEntrada);
            Utilidades.AbrirLibro(excelAppOut, rutaEntrada);
            //"Feb-17"
            ExcelX._Worksheet Salida = (ExcelX.Worksheet)excelAppOut.Sheets["Template"];
            Salida.Cells["14", "I"] = c.AporteFiscalMes.Replace(".", "").Replace(",", "");
            Salida.Cells["16", "I"] = c.Reintego.Replace(".", "").Replace(",", "");
            Salida.Cells["27", "I"] = c.SubsidiosCesantia.Replace(".", "").Replace(",", "");

            System.IO.FileAttributes attr;
            try
            {
                attr = System.IO.File.GetAttributes(rutaSalida);
            }
            catch (Exception ex)
            {
                System.IO.Directory.CreateDirectory(rutaSalida);
            }

            Salida.Name = periodo;
            Salida.SaveAs(rutaSalida + "IFCesantia_" + fecha + Utilidades.ExtensionLibro(Salida.Application.ActiveWorkbook));

            excelAppOut.Quit();
            System.Runtime.InteropServices.Marshal.FinalReleaseComObject(excelAppOut);
        }
Example #2
0
        public void Procesar(Cesantia c, string periodo)
        {
            var excelAppOut = new ExcelX.Application();
            //var fecha = DateTime.Now.ToString().Replace("/", "").Replace(":","").Replace(" ","");
            //var periodo = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString().PadLeft(2, '0');
            var rutaSalida = @"C:\Fondos Nacionales\out\" + periodo + @"\Cesantia\Preliminar\";


            //excelAppOut.Workbooks.Open(@"C:\Fondos Nacionales\Templates\IF_CESANTIA.xls");
            Utilidades.AbrirLibro(excelAppOut, @"C:\Fondos Nacionales\Templates\IF_CESANTIA");
            //"Feb-17"
            ExcelX._Worksheet Salida = (ExcelX.Worksheet)excelAppOut.Sheets["Template"];
            Salida.Cells["14", "V"] = c.NroSubsidios.Replace(".", "").Replace(",", "");
            Salida.Cells["15", "V"] = c.NroAfiliados.Replace(".", "").Replace(",", "");
            //Salida.Cells["16", "V"] = "133";
            Salida.Cells["21", "T"] = c.NroEmpresas.Replace(".", "").Replace(",", "");

            Salida.Cells["52", "R"] = c.ValorNotaInterna.Replace(".", "").Replace(",", "");


            System.IO.FileAttributes attr;
            try
            {
                attr = System.IO.File.GetAttributes(rutaSalida);
            }
            catch (Exception ex)
            {
                System.IO.Directory.CreateDirectory(rutaSalida);
            }
            //_" + fecha + "
            Salida.SaveAs(rutaSalida + "IFCesantia" + Utilidades.ExtensionLibro(Salida.Application.ActiveWorkbook));

            excelAppOut.Quit();
            System.Runtime.InteropServices.Marshal.FinalReleaseComObject(excelAppOut);
        }
        public void ProcesarFondo(SIL c, string periodo)
        {
            var excelAppOut = new ExcelX.Application();
            var fecha       = DateTime.Now.ToString().Replace("/", "").Replace(":", "").Replace(" ", "");
            //var periodo = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString().PadLeft(2, '0');
            var rutaEntrada = @"C:\Fondos Nacionales\out\" + periodo + @"\Sil\Preliminar\IFSIL";
            var rutaSalida  = @"C:\Fondos Nacionales\out\" + periodo + @"\Sil\";

            Utilidades.AbrirLibro(excelAppOut, rutaEntrada);



            //"Feb-17"
            ExcelX._Worksheet Salida = (ExcelX.Worksheet)excelAppOut.Sheets["Template"];
            Salida.Cells["12", "I"] = c.Cotizaciones.Replace(".", "").Replace(",", "");
            Salida.Cells["13", "I"] = c.CotizacionesPeriodosAnteriores.Replace(".", "").Replace(",", "");
            Salida.Cells["14", "I"] = c.ReajusteLey17332.Replace(".", "").Replace(",", "");
            Salida.Cells["15", "I"] = c.CotizacionesEntidadesPagadorasdeSubsidios.Replace(".", "").Replace(",", "");
            Salida.Cells["16", "I"] = c.ReintegroporCobroIndebidodeSubsidio.Replace(".", "").Replace(",", "");


            Salida.Cells["23", "I"] = c.SILEnfermedadOrigenComun.Replace(".", "").Replace(",", "");
            Salida.Cells["24", "I"] = c.SILSubsidioMaternalSuplementario.Replace(".", "").Replace(",", "");

            Salida.Cells["26", "K"] = c.DescuentoBeneficiosNoCobrados.Replace(".", "").Replace(",", "");

            Salida.Cells["29", "I"] = c.SREnfermedadOrigenComun.Replace(".", "").Replace(",", "");
            Salida.Cells["30", "I"] = c.SRSubsidioMaternalSuplementario.Replace(".", "").Replace(",", "");

            Salida.Cells["33", "I"] = c.CFPEnfermedadOrigenComun.Replace(".", "").Replace(",", "");
            Salida.Cells["34", "I"] = c.CFPSubsidioMaternalSuplementario.Replace(".", "").Replace(",", "");

            Salida.Cells["37", "I"] = c.CFSEnfermedadOrigenComun.Replace(".", "").Replace(",", "");
            Salida.Cells["38", "I"] = c.CFSSubsidioMaternalSuplementario.Replace(".", "").Replace(",", "");

            Salida.Cells["41", "I"] = c.OCEnfermedadOrigenComun.Replace(".", "").Replace(",", "");
            Salida.Cells["42", "I"] = c.OCSubsidioMaternalSuplementario.Replace(".", "").Replace(",", "");

            Salida.Cells["46", "I"] = c.OtrosEgresos.Replace(".", "").Replace(",", "");


            System.IO.FileAttributes attr;
            try
            {
                attr = System.IO.File.GetAttributes(rutaSalida);
            }
            catch (Exception ex)
            {
                System.IO.Directory.CreateDirectory(rutaSalida);
            }

            Salida.Name = periodo;
            Salida.SaveAs(rutaSalida + "IFSIL_" + fecha + Utilidades.ExtensionLibro(Salida.Application.ActiveWorkbook));

            excelAppOut.Quit();
            System.Runtime.InteropServices.Marshal.FinalReleaseComObject(excelAppOut);
        }
        public void Procesar(SIL s, string periodo)
        {
            var excelAppOut  = new ExcelX.Application();
            var excelAppOut2 = new ExcelX.Application();

            var rutaEntrada = @"C:\Fondos Nacionales\Templates\IF_SIL";

            var rutaESTEMP = @"C:\Fondos Nacionales\in\" + periodo + @"\ESTEMP";

            Utilidades.AbrirLibro(excelAppOut, rutaEntrada);

            Utilidades.AbrirLibro(excelAppOut2, rutaESTEMP);



            ExcelX._Worksheet Salida        = (ExcelX.Worksheet)excelAppOut.Sheets["Template"];
            ExcelX._Worksheet EntradaESTEMP = (ExcelX.Worksheet)excelAppOut2.Sheets["Total Afil . y Emp. COTIZANTES"];
            Salida.Cells["12", "U"] = s.NumSubsidiosIniciados.Replace(".", "").Replace(",", "");
            Salida.Cells["13", "U"] = s.NumAfiliadosCotizantes.Replace(".", "").Replace(",", "");

            //TO DO: Agregar nuevo documento que tendrá este valor
            var from = EntradaESTEMP.Range["D62"];
            var to   = Salida.Range["U14"];

            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);



            //Salida.Cells["14", "U"] = s.NumEmpresasCotizantes.Replace(".", "").Replace(",", "");
            Salida.Cells["15", "U"] = s.NumTrabajadoresAfiliados.Replace(".", "").Replace(",", "");
            Salida.Cells["16", "U"] = s.NumEmpresasAfiliadas.Replace(".", "").Replace(",", "");

            Salida.Cells["52", "Q"] = s.ValorNotaInterna.Replace(".", "").Replace(",", "");



            //var fecha = DateTime.Now.ToString().Replace("/", "").Replace(":", "").Replace(" ", "");
            //var periodo = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString().PadLeft(2, '0');
            var rutaSalida = @"C:\Fondos Nacionales\out\" + periodo + @"\Sil\Preliminar\";

            System.IO.FileAttributes attr;
            try
            {
                attr = System.IO.File.GetAttributes(rutaSalida);
            }
            catch (Exception ex)
            {
                System.IO.Directory.CreateDirectory(rutaSalida);
            }
            //_" + fecha + "
            Salida.SaveAs(rutaSalida + "IFSIL" + Utilidades.ExtensionLibro(Salida.Application.ActiveWorkbook));

            excelAppOut.Quit();
            System.Runtime.InteropServices.Marshal.FinalReleaseComObject(excelAppOut);
        }
Example #5
0
        public void ProcesarFondo(Asfam c, string periodo)
        {
            var excelAppOut = new ExcelX.Application();
            var fecha       = DateTime.Now.ToString().Replace("/", "").Replace(":", "").Replace(" ", "");
            //var periodo = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString().PadLeft(2, '0');
            var rutaEntrada = @"C:\Fondos Nacionales\out\" + periodo + @"\Asfam\Preliminar\IFAsfam";
            var rutaSalida  = @"C:\Fondos Nacionales\out\" + periodo + @"\Asfam\";

            Utilidades.AbrirLibro(excelAppOut, rutaEntrada);

            //"Feb-17"
            ExcelX._Worksheet Salida = (ExcelX.Worksheet)excelAppOut.Sheets["Template"];
            Salida.Cells["14", "M"] = c.AporteFiscalMes.Replace(".", "").Replace(",", "");
            Salida.Cells["15", "M"] = c.Reintego.Replace(".", "").Replace(",", "");

            Salida.Cells["21", "M"] = c.AsFamTrabajadoresActivosMesActual.Replace(".", "").Replace(",", "");
            Salida.Cells["22", "M"] = c.AsFamPensionadosMesActual.Replace(".", "").Replace(",", "");
            Salida.Cells["23", "M"] = c.AsFamTrabajadoresCesantesMesActual.Replace(".", "").Replace(",", "");
            Salida.Cells["24", "M"] = c.AsFamInstitucionesMesActual.Replace(".", "").Replace(",", "");

            Salida.Cells["27", "M"] = c.AsFamTrabajadoresActivosRetroactivo.Replace(".", "").Replace(",", "");
            Salida.Cells["28", "M"] = c.AsFamPensionadosRetroactivo.Replace(".", "").Replace(",", "");
            Salida.Cells["29", "M"] = c.AsFamTrabajadoresCesantesRetroactivo.Replace(".", "").Replace(",", "");
            Salida.Cells["30", "M"] = c.AsFamInstitucionesRetroactivo.Replace(".", "").Replace(",", "");

            Salida.Cells["32", "M"] = c.DocumentosRevalidados.Replace(".", "").Replace(",", "");

            Salida.Cells["38", "M"] = c.DocumentosCaducados.Replace(".", "").Replace(",", "");
            Salida.Cells["39", "M"] = c.DocumentosAnulados.Replace(".", "").Replace(",", "");

            Salida.Cells["47", "O"] = c.DevolucionDocumentosSAFEMCaducados.Replace(".", "").Replace(",", "");
            Salida.Cells["48", "O"] = c.DevolucionDocumentosSAFEMAnulados.Replace(".", "").Replace(",", "");
            Salida.Cells["49", "O"] = c.DocumentosSAFEMRevalidados.Replace(".", "").Replace(",", "");


            System.IO.FileAttributes attr;
            try
            {
                attr = System.IO.File.GetAttributes(rutaSalida);
            }
            catch (Exception ex)
            {
                System.IO.Directory.CreateDirectory(rutaSalida);
            }

            Salida.Name = periodo;
            Salida.SaveAs(rutaSalida + "IFAsfam_" + fecha + Utilidades.ExtensionLibro(Salida.Application.ActiveWorkbook));

            excelAppOut.Quit();
            System.Runtime.InteropServices.Marshal.FinalReleaseComObject(excelAppOut);
        }
Example #6
0
        public void Procesar(Asfam a, string periodo)
        {
            var excelAppOut = new ExcelX.Application();

            Utilidades.AbrirLibro(excelAppOut, @"C:\Fondos Nacionales\Templates\IF_ASFAM");

            ExcelX._Worksheet Salida = (ExcelX.Worksheet)excelAppOut.Sheets["Template"];
            Salida.Cells["15", "X"] = a.NroAsignacionesFamiliaresPagadas.Replace(".", "").Replace(",", "");
            Salida.Cells["16", "X"] = a.NroAfiliados.Replace(".", "").Replace(",", "");
            Salida.Cells["22", "V"] = a.NroEmpresas.Replace(".", "").Replace(",", "");

            Salida.Cells["57", "U"] = a.NI_Tramo0.Replace(".", "").Replace(",", "");
            Salida.Cells["58", "U"] = a.NI_Tramo1.Replace(".", "").Replace(",", "");
            Salida.Cells["59", "U"] = a.NI_Tramo2.Replace(".", "").Replace(",", "");
            Salida.Cells["60", "U"] = a.NI_Tramo3.Replace(".", "").Replace(",", "");
            Salida.Cells["61", "U"] = a.NI_Tramo4.Replace(".", "").Replace(",", "");


            //var fecha = DateTime.Now.ToString().Replace("/", "").Replace(":", "").Replace(" ", "");
            //var periodo = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString().PadLeft(2, '0');
            var rutaSalida = @"C:\Fondos Nacionales\out\" + periodo + @"\Asfam\Preliminar\";

            System.IO.FileAttributes attr;
            try
            {
                attr = System.IO.File.GetAttributes(rutaSalida);
            }
            catch (Exception ex)
            {
                System.IO.Directory.CreateDirectory(rutaSalida);
            }
            //_" + fecha + "
            Salida.SaveAs(rutaSalida + "IFAsfam" + Utilidades.ExtensionLibro(Salida.Application.ActiveWorkbook));

            excelAppOut.Quit();
            System.Runtime.InteropServices.Marshal.ReleaseComObject(excelAppOut);
        }
        public void GenerarAnexo(string periodo)
        {
            var excelApp = new ExcelX.Application();
            var fecha    = DateTime.Now.ToString().Replace("/", "").Replace(":", "").Replace(" ", "");
            //var periodo = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString().PadLeft(2, '0');
            var rutaEntrada  = @"C:\Fondos Nacionales\in\" + periodo + @"\SISILHIA";
            var rutaSalida   = @"C:\Fondos Nacionales\out\" + periodo + @"\Sil\Anexo\";
            var rutaTemplate = @"C:\Fondos Nacionales\Templates\ANEXO_SIL";
            var rutaDos      = @"C:\Fondos Nacionales\in\" + periodo + @"\ESTEMPMESCIERRE";
            var rutaAux      = @"C:\Fondos Nacionales\Auxiliar\AUX_DINAMICA";

            ExcelX.Workbook libroEntrada = Utilidades.AbrirLibro(excelApp, rutaEntrada);
            ExcelX.Workbook libroDestino = Utilidades.AbrirLibro(excelApp, rutaTemplate);


            //Primero
            ExcelX._Worksheet Cuadro1    = libroEntrada.Sheets["CUADRO N° 1"];
            ExcelX._Worksheet Cuadro1_a6 = libroDestino.Sheets["SIL Anexo 6 - Cuadro Nº1"];

            var from = Cuadro1.Range["D12:F13"];
            var to   = Cuadro1_a6.Range["E22:G23"];

            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Cuadro1.Range["H12:J13"];
            to   = Cuadro1_a6.Range["I22:K23"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            from = Cuadro1.Range["D16:F17"];
            to   = Cuadro1_a6.Range["E25:G26"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Cuadro1.Range["H16:J17"];
            to   = Cuadro1_a6.Range["I25:K26"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Cuadro1.Range["D20:F21"];
            to   = Cuadro1_a6.Range["E28:G29"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Cuadro1.Range["H20:J21"];
            to   = Cuadro1_a6.Range["I28:K29"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            //Segundo
            ExcelX._Worksheet Cuadro2a   = libroEntrada.Sheets["CUADRO N°2-A"];
            ExcelX._Worksheet Cuadro2b   = libroEntrada.Sheets["CUADRO N°2-B"];
            ExcelX._Worksheet Cuadro2_a6 = libroDestino.Sheets["SIL Anexo 6 - Cuadro N° 2-A y B"];

            from = Cuadro2a.Range["C10:J37"];
            to   = Cuadro2_a6.Range["D18:K45"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            from = Cuadro2b.Range["C10:J37"];
            to   = Cuadro2_a6.Range["D59:K86"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            //Tercero
            ExcelX._Worksheet Cuadro3    = libroEntrada.Sheets["CUADRO N°3"];
            ExcelX._Worksheet Cuadro3_a6 = libroDestino.Sheets["SIL Anexo 6 - Cuadro Nº 3"];

            from = Cuadro3.Range["C10:J24"];
            to   = Cuadro3_a6.Range["D18:K32"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            //cuarto
            ExcelX._Worksheet Cuadro4    = libroEntrada.Sheets["CUADRO N° 4"];
            ExcelX._Worksheet Cuadro4_a6 = libroDestino.Sheets["SIL Anexo 6 - Cuadro Nº 4"];

            from = Cuadro4.Range["C10:J19"];
            to   = Cuadro4_a6.Range["D21:K30"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            //Quinto
            ExcelX._Worksheet Cuadro5    = libroEntrada.Sheets["CUADRO N°5"];
            ExcelX._Worksheet Cuadro5_a6 = libroDestino.Sheets["SIL Anexo 6 - Cuadro Nº5"];

            from = Cuadro5.Range["D15:E29"];
            to   = Cuadro5_a6.Range["D19:E33"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            ///////////////////////////////
            ExcelX.Workbook libroDos = Utilidades.AbrirLibro(excelApp, rutaDos);
            ExcelX.Workbook libroAux = Utilidades.AbrirLibro(excelApp, rutaAux);
            //Quinto
            ExcelX._Worksheet Cuadro6      = libroDos.Sheets["Cuadro 6"];
            ExcelX._Worksheet Cuadro6y7_a6 = libroDestino.Sheets["SIL Anexo 6-Cuadro Nº 6 Y 7"];

            from = Cuadro6.Range["E12:E26"];
            to   = Cuadro6y7_a6.Range["D16:D30"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            //Quinto
            ExcelX._Worksheet Cuadro7  = libroDos.Sheets["Cuadro 7"];
            ExcelX._Worksheet auxiliar = libroAux.Sheets["aux"];

            from = Cuadro7.Range["M12:M27"];
            to   = auxiliar.Range["M12:M27"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            from = Cuadro7.Range["P12:P27"];
            to   = auxiliar.Range["P12:P27"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            ExcelX.PivotTables pts = (ExcelX.PivotTables)auxiliar.PivotTables(Type.Missing);

            var ctn = pts.Count;

            pts.Item(1).RefreshTable();

            from = auxiliar.Range["S13:T22"];
            to   = Cuadro6y7_a6.Range["D47:E56"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            //Resumen
            ExcelX._Worksheet Resumen    = libroEntrada.Sheets["ANEXO N° 3"];
            ExcelX._Worksheet Resumen_a6 = libroDestino.Sheets["Resumen Cotizaciones"];

            from = Resumen.Range["C12:E19"];
            to   = Resumen_a6.Range["D16:F23"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Resumen.Range["C25:E28"];
            to   = Resumen_a6.Range["D28:F31"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);



            //********

            from = Resumen.Range["C34:E35"];
            to   = Resumen_a6.Range["D35:F36"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Resumen.Range["C44:E45"];
            to   = Resumen_a6.Range["D42:F43"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            from = Resumen.Range["C46:E46"];
            to   = Resumen_a6.Range["D45:F45"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Resumen.Range["C47:E47"];
            to   = Resumen_a6.Range["D44:F44"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Resumen.Range["C48:E49"];
            to   = Resumen_a6.Range["D46:F47"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            from = Resumen.Range["F12:F19"];
            to   = Resumen_a6.Range["G16:G23"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Resumen.Range["G12:G19"];
            to   = Resumen_a6.Range["H16:H23"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Resumen.Range["F25:F28"];
            to   = Resumen_a6.Range["G28:G31"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Resumen.Range["G25:G28"];
            to   = Resumen_a6.Range["H28:H31"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            from = Resumen.Range["F34:F35"];
            to   = Resumen_a6.Range["G35:G36"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Resumen.Range["G34:G35"];
            to   = Resumen_a6.Range["H35:H36"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            from = Resumen.Range["F44:F49"];
            to   = Resumen_a6.Range["G42:G47"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Resumen.Range["G44:G49"];
            to   = Resumen_a6.Range["H42:H47"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            /***
             *
             *
             * */
            from = Resumen.Range["F46"];
            to   = Resumen_a6.Range["G45"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Resumen.Range["F47"];
            to   = Resumen_a6.Range["G44"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            from = Resumen.Range["G46"];
            to   = Resumen_a6.Range["H45"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Resumen.Range["G47"];
            to   = Resumen_a6.Range["H44"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);



            from = Resumen.Range["C26"];
            to   = Resumen_a6.Range["D30"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Resumen.Range["C27"];
            to   = Resumen_a6.Range["D29"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            //*********


            from = Resumen.Range["D26"];
            to   = Resumen_a6.Range["E30"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Resumen.Range["D27"];
            to   = Resumen_a6.Range["E29"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            from = Resumen.Range["E26"];
            to   = Resumen_a6.Range["F30"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Resumen.Range["E27"];
            to   = Resumen_a6.Range["F29"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Resumen.Range["F26"];
            to   = Resumen_a6.Range["G30"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Resumen.Range["F27"];
            to   = Resumen_a6.Range["G29"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Resumen.Range["G26"];
            to   = Resumen_a6.Range["H30"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Resumen.Range["G27"];
            to   = Resumen_a6.Range["H29"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            //----------------------------

            //cerrando
            System.IO.FileAttributes attr;
            try
            {
                attr = System.IO.File.GetAttributes(rutaSalida);
            }
            catch (Exception ex)
            {
                System.IO.Directory.CreateDirectory(rutaSalida);
            }


            libroDestino.SaveAs(rutaSalida + "Anexo_SIL_" + fecha + Utilidades.ExtensionLibro(libroDestino));

            libroDestino.Close(false);
            libroEntrada.Close(false);
            libroAux.Close(false);
            libroDos.Close(false);
            excelApp.Quit();
            System.Runtime.InteropServices.Marshal.FinalReleaseComObject(excelApp);
        }
        public void ProcesarFondo(Maternal m, string periodo)
        {
            var excelAppOut = new ExcelX.Application();
            var fecha       = DateTime.Now.ToString().Replace("/", "").Replace(":", "").Replace(" ", "");
            //var periodo = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString().PadLeft(2, '0');
            var rutaEntrada = @"C:\Fondos Nacionales\Templates\IF_MATERNAL";
            var rutaSalida  = @"C:\Fondos Nacionales\out\" + periodo + @"\Maternal\";


            Utilidades.AbrirLibro(excelAppOut, rutaEntrada);

            //"Feb-17"
            ExcelX._Worksheet Salida = (ExcelX.Worksheet)excelAppOut.Sheets["Template"];

            Salida.Cells["14", "K"] = m.A1.Replace(".", "").Replace(",", "");
            Salida.Cells["15", "K"] = m.A2.Replace(".", "").Replace(",", "");
            Salida.Cells["18", "I"] = m.A31.Replace(".", "").Replace(",", "");
            Salida.Cells["19", "I"] = m.A32.Replace(".", "").Replace(",", "");
            Salida.Cells["22", "I"] = m.A41.Replace(".", "").Replace(",", "");
            Salida.Cells["23", "I"] = m.A42.Replace(".", "").Replace(",", "");

            Salida.Cells["30", "K"] = m.C1.Replace(".", "").Replace(",", "");
            Salida.Cells["31", "K"] = m.C2.Replace(".", "").Replace(",", "");
            Salida.Cells["32", "K"] = m.C3.Replace(".", "").Replace(",", "");
            Salida.Cells["33", "K"] = m.C4.Replace(".", "").Replace(",", "");
            Salida.Cells["34", "K"] = m.C5.Replace(".", "").Replace(",", "");

            Salida.Cells["37", "I"] = m.C61.Replace(".", "").Replace(",", "");
            Salida.Cells["38", "I"] = m.C62.Replace(".", "").Replace(",", "");
            Salida.Cells["39", "I"] = m.C63.Replace(".", "").Replace(",", "");
            Salida.Cells["40", "I"] = m.C64.Replace(".", "").Replace(",", "");
            Salida.Cells["41", "I"] = m.C65.Replace(".", "").Replace(",", "");

            Salida.Cells["44", "I"] = m.C71.Replace(".", "").Replace(",", "");
            Salida.Cells["45", "I"] = m.C72.Replace(".", "").Replace(",", "");
            Salida.Cells["46", "I"] = m.C73.Replace(".", "").Replace(",", "");
            Salida.Cells["47", "I"] = m.C74.Replace(".", "").Replace(",", "");
            Salida.Cells["48", "I"] = m.C75.Replace(".", "").Replace(",", "");

            Salida.Cells["51", "I"] = m.C81.Replace(".", "").Replace(",", "");
            Salida.Cells["52", "I"] = m.C82.Replace(".", "").Replace(",", "");
            Salida.Cells["53", "I"] = m.C83.Replace(".", "").Replace(",", "");
            Salida.Cells["54", "I"] = m.C84.Replace(".", "").Replace(",", "");
            Salida.Cells["55", "I"] = m.C85.Replace(".", "").Replace(",", "");

            Salida.Cells["58", "I"] = m.C91.Replace(".", "").Replace(",", "");
            Salida.Cells["59", "I"] = m.C92.Replace(".", "").Replace(",", "");
            Salida.Cells["60", "I"] = m.C93.Replace(".", "").Replace(",", "");
            Salida.Cells["61", "I"] = m.C94.Replace(".", "").Replace(",", "");
            Salida.Cells["62", "I"] = m.C95.Replace(".", "").Replace(",", "");

            Salida.Cells["68", "K"] = m.E1.Replace(".", "").Replace(",", "");
            Salida.Cells["69", "K"] = m.E2.Replace(".", "").Replace(",", "");
            Salida.Cells["70", "K"] = m.E3.Replace(".", "").Replace(",", "");
            Salida.Cells["71", "K"] = m.E4.Replace(".", "").Replace(",", "");
            Salida.Cells["72", "K"] = m.E5.Replace(".", "").Replace(",", "");


            Salida.Cells["76", "K"] = m.F1.Replace(".", "").Replace(",", "");
            Salida.Cells["77", "K"] = m.F2.Replace(".", "").Replace(",", "");
            Salida.Cells["78", "K"] = m.F3.Replace(".", "").Replace(",", "");
            Salida.Cells["79", "K"] = m.F4.Replace(".", "").Replace(",", "");
            Salida.Cells["80", "K"] = m.F5.Replace(".", "").Replace(",", "");

            Salida.Cells["84", "K"] = m.G1.Replace(".", "").Replace(",", "");
            Salida.Cells["85", "K"] = m.G2.Replace(".", "").Replace(",", "");
            Salida.Cells["86", "K"] = m.G3.Replace(".", "").Replace(",", "");
            Salida.Cells["87", "K"] = m.G4.Replace(".", "").Replace(",", "");



            System.IO.FileAttributes attr;
            try
            {
                attr = System.IO.File.GetAttributes(rutaSalida);
            }
            catch (Exception ex)
            {
                System.IO.Directory.CreateDirectory(rutaSalida);
            }

            Salida.Name = periodo;
            Salida.SaveAs(rutaSalida + "IFMaternal_" + fecha + Utilidades.ExtensionLibro(Salida.Application.ActiveWorkbook));

            excelAppOut.Quit();
            System.Runtime.InteropServices.Marshal.FinalReleaseComObject(excelAppOut);
        }
        public void GenerarAnexo(string periodo)
        {
            var excelApp = new ExcelX.Application();
            var fecha    = DateTime.Now.ToString().Replace("/", "").Replace(":", "").Replace(" ", "");
            //var periodo = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString().PadLeft(2, '0');
            var rutaEntrada  = @"C:\Fondos Nacionales\in\" + periodo + @"\ANEXO4";
            var rutaSalida   = @"C:\Fondos Nacionales\out\" + periodo + @"\Maternal\Anexo\";
            var rutaTemplate = @"C:\Fondos Nacionales\Templates\ANEXO_MATERNAL";



            ExcelX.Workbook libroEntrada = Utilidades.AbrirLibro(excelApp, rutaEntrada);
            ExcelX.Workbook libroDestino = Utilidades.AbrirLibro(excelApp, rutaTemplate);

            //Primero
            ExcelX._Worksheet Cuadro1    = libroEntrada.Sheets["ResCotizPrevi"];
            ExcelX._Worksheet Cuadro1_a6 = libroDestino.Sheets["Anexo 4-Res"];

            var from = Cuadro1.Range["D11:D20"];
            var to   = Cuadro1_a6.Range["D13:D22"];

            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Cuadro1.Range["F11:F20"];
            to   = Cuadro1_a6.Range["E13:E22"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            from = Cuadro1.Range["H11:H20"];
            to   = Cuadro1_a6.Range["F13:F22"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Cuadro1.Range["I11:I20"];
            to   = Cuadro1_a6.Range["G13:G22"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            from = Cuadro1.Range["K11:K20"];
            to   = Cuadro1_a6.Range["H13:H22"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            from = Cuadro1.Range["L11:L20"];
            to   = Cuadro1_a6.Range["I13:I22"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Cuadro1.Range["M11:M20"];
            to   = Cuadro1_a6.Range["J13:J22"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            //SPRT
            from = Cuadro1.Range["D24:D29"];
            to   = Cuadro1_a6.Range["D26:D31"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);



            from = Cuadro1.Range["H24:H29"];
            to   = Cuadro1_a6.Range["F26:F31"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Cuadro1.Range["I24:I29"];
            to   = Cuadro1_a6.Range["G26:G31"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            from = Cuadro1.Range["K24:K29"];
            to   = Cuadro1_a6.Range["H26:H31"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Cuadro1.Range["L24:L29"];
            to   = Cuadro1_a6.Range["I26:I31"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Cuadro1.Range["M24:M29"];
            to   = Cuadro1_a6.Range["J26:J31"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            from = Cuadro1.Range["F33:F34"];
            to   = Cuadro1_a6.Range["E35:E36"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            from = Cuadro1.Range["H33:H34"];
            to   = Cuadro1_a6.Range["F35:F36"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Cuadro1.Range["I33:I34"];
            to   = Cuadro1_a6.Range["G35:G36"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            from = Cuadro1.Range["K33:K34"];
            to   = Cuadro1_a6.Range["H35:H36"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            //SPRT
            from = Cuadro1.Range["D41:D46"];
            to   = Cuadro1_a6.Range["D35:D36"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Cuadro1.Range["F41:F46"];
            to   = Cuadro1_a6.Range["E42:E27"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            from = Cuadro1.Range["H41:H46"];
            to   = Cuadro1_a6.Range["F42:F47"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            //from = Cuadro1.Range["I41:I46"];
            //to = Cuadro1_a6.Range["G42:G37"];
            //from.Copy();
            //to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            //from = Cuadro1.Range["K41:K46"];
            //to = Cuadro1_a6.Range["H42:H27"];
            //from.Copy();
            //to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);



            //from = Cuadro1.Range["I41:I46"];
            //to = Cuadro1_a6.Range["G42:G37"];
            //from.Copy();
            //to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            //from = Cuadro1.Range["K41:K46"];
            //to = Cuadro1_a6.Range["H42:H27"];
            //from.Copy();
            //to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            //SPRT
            from = Cuadro1.Range["D54:D60"];
            to   = Cuadro1_a6.Range["D55:D61"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Cuadro1.Range["F54:F60"];
            to   = Cuadro1_a6.Range["E55:E61"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            from = Cuadro1.Range["H54:H60"];
            to   = Cuadro1_a6.Range["F55:F61"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);

            from = Cuadro1.Range["I54:I60"];
            to   = Cuadro1_a6.Range["G55:G61"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            from = Cuadro1.Range["K54:K60"];
            to   = Cuadro1_a6.Range["H55:H61"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);



            from = Cuadro1.Range["L54:L59"];
            to   = Cuadro1_a6.Range["I55:I60"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            from = Cuadro1.Range["M54:M59"];
            to   = Cuadro1_a6.Range["J55:J60"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            //TO DO: Revisar por que no copia
            from = Cuadro1.Range["D33:D34"];
            to   = Cuadro1_a6.Range["D35:D36"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            //TO DO: Mirar por que no copia estos valores, aparte no suma la caja de total
            from = Cuadro1.Range["F24:F29"];
            to   = Cuadro1_a6.Range["E26:E31"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            //SPRT
            from = Cuadro1.Range["D50"];
            to   = Cuadro1_a6.Range["D51"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            from = Cuadro1.Range["F50"];
            to   = Cuadro1_a6.Range["E51"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);


            from = Cuadro1.Range["H50"];
            to   = Cuadro1_a6.Range["F51"];
            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);



            Cuadro1_a6.Range["E32"].Formula = "=SUM(E26:E31)";

            Cuadro1_a6.Range["D39"].Formula = "=D23+D32+D37";


            Cuadro1_a6.Range["D12:I64"].Replace(".", "");
            //Cuadro1_a6.Range["D12:I64"].NumberFormat = "#.##0";



            //cerrando
            System.IO.FileAttributes attr;
            try
            {
                attr = System.IO.File.GetAttributes(rutaSalida);
            }
            catch (Exception ex)
            {
                System.IO.Directory.CreateDirectory(rutaSalida);
            }


            libroDestino.SaveAs(rutaSalida + "Anexo_Maternal_" + fecha + Utilidades.ExtensionLibro(libroDestino));

            libroDestino.Close(false);
            libroEntrada.Close(false);
            excelApp.Quit();
            System.Runtime.InteropServices.Marshal.FinalReleaseComObject(excelApp);
        }