Beispiel #1
0
        public IHttpActionResult actualizaVerificarPago(List <SubastaRequest> model)
        {
            OperacionDataAccess   _operadorDataAccess = new OperacionDataAccess();
            BaseResponse <string> result = new BaseResponse <string>();

            result = _operadorDataAccess.actualizarEstadoVerificado(model, NroDocumentoCurrenUser);
            return(Ok(result));
        }
Beispiel #2
0
        public IHttpActionResult operacionesInstruccionPago(SubastaRequest model)
        {
            OperacionDataAccess _operador = new OperacionDataAccess();

            var resultado = _operador.verListadoInstruccion(model);

            return(Ok(resultado));
        }
Beispiel #3
0
        public IHttpActionResult ListaGenerarPago(FiltroOperacionParam model)
        {
            OperacionDataAccess _operadorDataAccess        = new OperacionDataAccess();
            PageResultSP <ListaGenerarPagoResponse> result = new PageResultSP <ListaGenerarPagoResponse>();

            result = _operadorDataAccess.ListaGenerarPago(model);
            return(Ok(result));
        }
Beispiel #4
0
        public IHttpActionResult ListaOperacionPago(PageResultParam model)
        {
            OperacionDataAccess _operadorDataAccess        = new OperacionDataAccess();
            PageResultSP <VerificacionPagoResponse> result = new PageResultSP <VerificacionPagoResponse>();

            result = _operadorDataAccess.ListaVerificarPago(model);
            return(Ok(result));
        }
Beispiel #5
0
        public FileResult Descargar(string trasaccion)
        {
            // Obtener contenido del archivo
            //string text = "El texto para mi archivo.";
            //var stream = new MemoryStream(Encoding.ASCII.GetBytes(text));

            //return File(stream, "text/plain", "Prueba.txt");
            OperacionDataAccess _operadorDataAccess = new OperacionDataAccess();
            ExportFiles         file = new ExportFiles();

            file = _operadorDataAccess.descargarTxt(Convert.ToInt16(trasaccion));

            byte[] byteArray        = file.FileBytes;
            String NombreArchivo    = file.Name.ToString();
            String ExtensionArchivo = file.Extension.ToString();

            //MemoryStream ms = new MemoryStream(byteArray,false);

            return(File(byteArray, "text/" + ExtensionArchivo, NombreArchivo + "." + ExtensionArchivo));
        }
Beispiel #6
0
        public ActionResult DescargarExportableTXT(string transacciones)
        {
            OperacionDataAccess   _operadorDataAccess = new OperacionDataAccess();
            BaseResponse <string> result     = new BaseResponse <string>();
            List <ExportFiles>    listaFiles = new List <ExportFiles>();

            string[] codigoTransaccion = transacciones.Split(',');



            listaFiles = _operadorDataAccess.generarTxt(transacciones, IdCurrenUser);

            if (listaFiles.Count > 1)
            {
                byte[] byteArray = null;
                using (MemoryStream memoryStream = new MemoryStream())
                {
                    using (ZipArchive zip = new ZipArchive(memoryStream, ZipArchiveMode.Create, true))
                    {
                        foreach (ExportFiles f in listaFiles)
                        {
                            ZipArchiveEntry zipItem = zip.CreateEntry(f.Name + "." + f.Extension);
                            using (MemoryStream originalFileMemoryStream = new MemoryStream(f.FileBytes))
                            {
                                using (Stream entryStream = zipItem.Open())
                                {
                                    originalFileMemoryStream.CopyTo(entryStream);
                                }
                            }
                        }
                    }
                    byteArray = memoryStream.ToArray();
                }
                string dia  = DateTime.Now.Day.ToString();
                string mes  = DateTime.Now.Month.ToString();
                string hora = DateTime.Now.Hour.ToString();
                string min  = DateTime.Now.Minute.ToString();

                if (dia.Trim().Length == 1)
                {
                    dia = "0" + dia;
                }
                if (mes.Trim().Length == 1)
                {
                    mes = "0" + mes;
                }
                if (hora.Trim().Length == 1)
                {
                    hora = "0" + hora;
                }
                if (min.Trim().Length == 1)
                {
                    min = "0" + min;
                }

                String NombreArchivo = "Transaccion-" + dia + "-" + mes + "-" + DateTime.Now.Year.ToString() + "-" + hora + "" + min + "" + DateTime.Now.Second.ToString() + "" + DateTime.Now.Millisecond.ToString();

                Response.AddHeader("Content-Disposition", "attachment; filename=" + NombreArchivo + ".zip");
                //return RedirectToAction("GenerarPagos");
                return(File(byteArray, "application/zip"));
            }
            else
            {
                if (listaFiles.Count != 0)
                {
                    byte[] byteArray        = listaFiles[0].FileBytes;
                    String NombreArchivo    = listaFiles[0].Name.ToString();
                    String ExtensionArchivo = listaFiles[0].Extension.ToString();
                    //MemoryStream ms=new MemoryStream(byteArray,false);
                    return(File(byteArray, "text/" + ExtensionArchivo, NombreArchivo + "." + ExtensionArchivo));
                }
                else
                {
                    return(RedirectToAction("GenerarPagos"));
                }
            }
        }
Beispiel #7
0
        public ActionResult DescargarLiquidacionExcel(string numPartner, string numLiq, string estadoLiq, int tipo)
        {
            OperacionDataAccess _operacionDataAccess = new OperacionDataAccess();
            BaseResponse <List <PartnerLiquidacionResponse> > result = new BaseResponse <List <PartnerLiquidacionResponse> >();

            if (numPartner == null)
            {
                numPartner = "";
            }
            if (tipo == 1)
            {
                numPartner = NroRucEmpresaCurrenUser;
            }
            result = _operacionDataAccess.generarLiquidacionExcel(1, 100, numPartner, numLiq, estadoLiq);
            if (result.success)
            {
                string       plantilla = System.Configuration.ConfigurationManager.AppSettings["LiquidacionPartner"];
                XSSFWorkbook hssfworkbook;
                string       path = AppDomain.CurrentDomain.BaseDirectory + plantilla;


                using (FileStream file = new FileStream(path, FileMode.Open, FileAccess.Read))
                {
                    hssfworkbook = new XSSFWorkbook(file);
                }

                ISheet sheet1 = hssfworkbook.GetSheet("Reporte");
                IRow   row    = sheet1.GetRow(7);


                int     i = 19;
                decimal totalUsdCompra   = 0;
                decimal totalSolesCompra = 0;

                decimal totalUsdVenta   = 0;
                decimal totalSolesVenta = 0;

                decimal totalDolares = 0;
                decimal totalSoles   = 0;

                string accionUSD = "";
                string accionPEN = "";

                string   numliquidacion = "";
                DateTime fechaPrincipal = DateTime.Now;
                //List<OperacionesHistoricas> operacionesHistoricas;

                CultureInfo culture;
                string      specifier;
                specifier = "N2";

                string specifier4;
                specifier4 = "N4";
                culture    = CultureInfo.CreateSpecificCulture("eu-ES");

                row = sheet1.GetRow(11);
                if (row == null)
                {
                    row = sheet1.CreateRow(11);
                }
                this.SetCellAumentValue(hssfworkbook, row, 5, result.data[0].partnersAdjuntado.ToString());

                //row = sheet1.GetRow(15);
                //if (row == null) row = sheet1.CreateRow(15);
                //this.SetCellGrisMontoValue(hssfworkbook, row, 4, accionUSD);
                //this.SetCellAzulValue(hssfworkbook, row, 5, totalDolares.ToString(specifier, CultureInfo.InvariantCulture));



                //fechaPrincipal
                result.data.Where(y => y.quiere == "Compra").ToList().ForEach(x =>
                {
                    row = sheet1.GetRow(i);
                    if (row == null)
                    {
                        row = sheet1.CreateRow(i);
                    }
                    this.SetCellValue(hssfworkbook, row, 1, x.idTransaccion);
                    this.SetCellCenterValue(hssfworkbook, row, 2, x.fecha.Value.ToString("dd/mm/yyyy"));
                    this.SetCellCenterValue(hssfworkbook, row, 3, x.fecha.Value.ToString("HH:mm"));
                    this.SetCellValue(hssfworkbook, row, 4, x.cliente);
                    this.SetCellCenterValue(hssfworkbook, row, 5, x.quiere);
                    this.SetCellValue(hssfworkbook, row, 6, x.montoUSDCompraText);
                    this.SetCellValue(hssfworkbook, row, 7, x.cambioCompraText);
                    this.SetCellValue(hssfworkbook, row, 8, x.montoSolesCompraText);
                    if (x.fechaLiquidacion.HasValue)
                    {
                        fechaPrincipal = x.fechaLiquidacion.Value;
                    }
                    totalUsdCompra   += x.montoUSDCompra;
                    totalSolesCompra += x.montoSolesCompra;
                    numliquidacion    = x.numLiquidacion;
                    numPartner        = x.numPartner;
                    i++;
                });

                row = sheet1.GetRow(i);
                if (row == null)
                {
                    row = sheet1.CreateRow(i);
                }

                row = sheet1.GetRow(i + 1);
                if (row == null)
                {
                    row = sheet1.CreateRow(i + 1);
                }
                this.SetCellNegritaValue(hssfworkbook, row, 5, "Partner envía");
                this.SetCellValue(hssfworkbook, row, 6, totalUsdCompra.ToString(specifier, CultureInfo.InvariantCulture));
                this.SetCellNegritaValue(hssfworkbook, row, 7, "Partner recibe");
                this.SetCellValue(hssfworkbook, row, 8, totalSolesCompra.ToString(specifier, CultureInfo.InvariantCulture));

                row = sheet1.GetRow(i + 3);
                if (row == null)
                {
                    row = sheet1.CreateRow(i + 3);
                }
                row.Height = 600;

                this.SetCellHeaderValue(hssfworkbook, row, 1, "ID Transaccion");
                this.SetCellHeaderValue(hssfworkbook, row, 2, "Fecha Adjudicacion");
                this.SetCellHeaderValue(hssfworkbook, row, 3, "Hora");
                this.SetCellHeaderValue(hssfworkbook, row, 4, "Nombre Cliente");
                this.SetCellHeaderValue(hssfworkbook, row, 5, "Cliente");
                this.SetCellHeaderValue(hssfworkbook, row, 6, "Monto DOL");
                this.SetCellHeaderValue(hssfworkbook, row, 7, "Tip de Cambio ");
                this.SetCellHeaderValue(hssfworkbook, row, 8, "Monto SOL");

                i = i + 4;

                result.data.Where(y => y.quiere == "Venta").ToList().ForEach(x =>
                {
                    row = sheet1.GetRow(i);
                    if (row == null)
                    {
                        row = sheet1.CreateRow(i);
                    }
                    this.SetCellValue(hssfworkbook, row, 1, x.idTransaccion);
                    this.SetCellCenterValue(hssfworkbook, row, 2, x.fecha.Value.ToString("dd/mm/yyyy"));
                    this.SetCellCenterValue(hssfworkbook, row, 3, x.fecha.Value.ToString("HH:mm"));
                    this.SetCellValue(hssfworkbook, row, 4, x.cliente);
                    this.SetCellCenterValue(hssfworkbook, row, 5, x.quiere);
                    this.SetCellValue(hssfworkbook, row, 6, x.montoUSDventaText);
                    this.SetCellValue(hssfworkbook, row, 7, x.cambioVentaText);
                    this.SetCellValue(hssfworkbook, row, 8, x.montoSolesventaText);
                    if (x.fechaLiquidacion.HasValue)
                    {
                        fechaPrincipal = x.fechaLiquidacion.Value;
                    }
                    totalUsdVenta   += x.montoUSDventa;
                    totalSolesVenta += x.montoSolesventa;
                    numliquidacion   = x.numLiquidacion;
                    numPartner       = x.numPartner;
                    i++;
                });

                row = sheet1.GetRow(i);
                if (row == null)
                {
                    row = sheet1.CreateRow(i);
                }

                row = sheet1.GetRow(i + 1);
                if (row == null)
                {
                    row = sheet1.CreateRow(i + 1);
                }
                this.SetCellNegritaValue(hssfworkbook, row, 5, "Partner Recibe");
                this.SetCellValue(hssfworkbook, row, 6, totalUsdVenta.ToString(specifier, CultureInfo.InvariantCulture));
                this.SetCellNegritaValue(hssfworkbook, row, 7, "Partner envía");
                this.SetCellValue(hssfworkbook, row, 8, totalSolesVenta.ToString(specifier, CultureInfo.InvariantCulture));



                if (totalUsdCompra > totalUsdVenta)
                {
                    totalDolares = totalUsdCompra - totalUsdVenta;
                    accionUSD    = "Envia USD:";
                }

                if (totalUsdVenta > totalUsdCompra)
                {
                    totalDolares = totalUsdVenta - totalUsdCompra;
                    accionUSD    = "Recibe USD:";
                }


                if (totalSolesCompra > totalSolesVenta)
                {
                    totalSoles = totalSolesCompra - totalSolesVenta;
                    accionPEN  = "Recibe PEN:";
                }

                if (totalSolesVenta > totalSolesCompra)
                {
                    totalSoles = totalSolesVenta - totalSolesCompra;
                    accionPEN  = "Envia PEN:";
                }

                row = sheet1.GetRow(15);
                if (row == null)
                {
                    row = sheet1.CreateRow(15);
                }
                this.SetCellGrisMontoValue(hssfworkbook, row, 4, accionUSD);
                this.SetCellAzulValue(hssfworkbook, row, 5, totalDolares.ToString(specifier, CultureInfo.InvariantCulture));

                row = sheet1.GetRow(16);
                if (row == null)
                {
                    row = sheet1.CreateRow(16);
                }
                this.SetCellGrisMontoValue(hssfworkbook, row, 4, accionPEN);
                this.SetCellAzulValue(hssfworkbook, row, 5, totalSoles.ToString(specifier, CultureInfo.InvariantCulture));

                row = sheet1.GetRow(8);
                if (row == null)
                {
                    row = sheet1.CreateRow(8);
                }
                this.SetCellGrisValue(hssfworkbook, row, 1, "Código de la liquidación " + numliquidacion);

                fechaPrincipal = DateTime.Now;
                row            = sheet1.GetRow(9);
                if (row == null)
                {
                    row = sheet1.CreateRow(9);
                }
                this.SetCellGrisValue(hssfworkbook, row, 1, "Fecha:" + fechaPrincipal.ToString("d MMMM") + " " + fechaPrincipal.Year.ToString() + " Hora: " + fechaPrincipal.ToString("hh:mm:ss tt", new CultureInfo("en-US")));

                //fechaPrincipal Fecha: 25 Abril 2019 Hora: 13:00 pm
                //
                row = sheet1.GetRow(12);
                if (row == null)
                {
                    row = sheet1.CreateRow(12);
                }
                this.SetCellAumentValue(hssfworkbook, row, 5, numPartner);


                MemoryStream stream = new MemoryStream();
                hssfworkbook.Write(stream);

                return(File(stream.ToArray(), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "LiquidacionPartner.xlsx"));
            }
            else
            {
                return(RedirectToAction("ListaOperacionesHistoricas"));
            }
        }