avance, se agregan el controlador, repositorio, y dtos para el funcionamiento de los reportes

feature/Reporte_Relacion_Facturas_Alen
Felix Morales 11 months ago
parent 92f2101244
commit 0313633cc4
  1. 9
      Contracts/Reportes/Embarques/IReportesEmbarquesRepository.cs
  2. 14
      Controllers/FileManagerController.cs
  3. 54
      Controllers/Reportes/ReportesEmbarquesController.cs
  4. 45
      DTO/Reportes/Embarques/DTOBuscarEmbarques.cs
  5. 69
      DTO/Reportes/Embarques/DTOEmbarquesDespachados.cs
  6. 63
      DTO/Reportes/Embarques/DTOEmbarquesPorImportar.cs
  7. 5
      Models/Corresponsales/CorresponsalPedimento.cs
  8. 2
      Models/Corresponsales/ITrafico.cs
  9. 3
      Program.cs
  10. 7
      Repository/Corresponsalias/CorresponsaliasPedimentoRepository.cs
  11. 4
      Repository/Corresponsalias/CorresponsaliasTraficosRepository.cs
  12. 35
      Repository/Reportes/Embarques/ReportesEmbarquesRepository.cs

@ -0,0 +1,9 @@
using CORRESPONSALBackend.DTO.Reportes.Embarques;
namespace CORRESPONSALBackend.Contracts.Reportes.Embarques{
public interface IReportesEmbarquesRepository {
public Task<IEnumerable<DTOEmbarquesPorImportar>> GetReporteEmbarquesPorImportar();
public Task<IEnumerable<DTOEmbarquesDespachados>> GetReporteEmbarquesDespachados(DateTime inicio, DateTime fin);
public Task<IEnumerable<DTOBuscarEmbarques>> BuscarEmbarques(string filtro);
}
}

@ -360,5 +360,19 @@ namespace CORRESPONSALBackend.Controllers
return BadRequest(ex.Message); return BadRequest(ex.Message);
} }
} }
[HttpGet("GetFileById")]
public async Task<IActionResult> GetFileById([FromQuery] int fileId){
var fileLog = await _Repo.getFileById(fileId);
var relativePath = await _RepoRelativePath.getPaths4ProcessById(fileLog.Proceso);
var filePath = RootPathCorresponsales + relativePath.Path + fileLog.NombreArchivo;
if(System.IO.File.Exists(filePath)){
byte[] fileBytes = System.IO.File.ReadAllBytes(filePath);
MemoryStream fileStream = new MemoryStream(fileBytes);
return File(fileStream, "application/pdf", fileLog.NombreArchivo);
}
return Ok();
}
} }
} }

@ -0,0 +1,54 @@
using System.Drawing;
using CORRESPONSALBackend.Contracts.Reportes.Embarques;
using CORRESPONSALBackend.DTO.Reportes.Embarques;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using OfficeOpenXml;
namespace CORRESPONSALBackend.Controllers.Reportes{
[Authorize]
[Route("api/[controller]")]
[ApiController]
public class ReportesEmbarquesController : ControllerBase{
private readonly IReportesEmbarquesRepository _repo;
public ReportesEmbarquesController(IReportesEmbarquesRepository repo){
_repo = repo;
}
[HttpGet("PorImportar")]
public async Task<IEnumerable<DTOEmbarquesPorImportar>> GetReporteEmbarquesPorImportar(){
var embarques = await _repo.GetReporteEmbarquesPorImportar();
return embarques;
}
[HttpGet("Despachados")]
public async Task<IEnumerable<DTOEmbarquesDespachados>> GetReporteEmbarquesDespachados([FromQuery] DateTime inicio, [FromQuery] DateTime fin){
var embarques = await _repo.GetReporteEmbarquesDespachados(inicio, fin);
return embarques;
}
[HttpGet("BuscarEmbarques")]
public async Task<IEnumerable<DTOBuscarEmbarques>> BuscarEmbarques([FromQuery] string filtro){
var embarques = await _repo.BuscarEmbarques(filtro);
return embarques;
}
[HttpGet("ExcelEmbarquesPorImportar")]
public async Task<IActionResult> GetExcelEmbarquesPorImportar(){
var embarques = await _repo.GetReporteEmbarquesPorImportar();
using (ExcelPackage excelPackage = new ExcelPackage()){
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
var today = new DateTime();
var worksheet = excelPackage.Workbook.Worksheets.Add($"EmbarquesPorImportar_{today.Day-today.Month-today.Year}");
worksheet.Cells["A1:A6"].Merge = true;
Image image = Image.FromFile("C:\\data\\Corresponsales\\Img\\LogoGemco.png");
worksheet.Column(2).Width = 194;
worksheet.Column(3).Width = 144;
worksheet.Column(4).Width = 143;
worksheet.Cells["B1:B6"].Merge = true;
}
return Ok();
}
}
}

@ -0,0 +1,45 @@
namespace CORRESPONSALBackend.DTO.Reportes.Embarques{
public class DTOBuscarEmbarques{
public int Id { get; set; }
public string Aduana { get; set; }
public string TipoEmbarque { get; set; }
public string Destino { get; set; }
public int DiasEnAduana { get; set; }
public string Nombre { get; set; }
public string NoPedimento { get; set; }
public string Tipo { get; set; }
public string OrdenCompra { get; set; }
public string Factura { get; set; }
public string Proveedor { get; set; }
public string DescripcionMercancia { get; set; }
public int Bultos { get; set; }
public int CantidadContenedores { get; set; }
public int PesoNeto { get; set; }
public string Incoterm { get; set; }
public string? FechaETA { get; set; }
public string Estatus { get; set; }
public string Observaciones { get; set; }
public string FechaInicioGastosAlmacenaje { get; set; }
public int CostoDiarioAlmacenaje { get; set; }
public int CostoDiarioConexion { get; set; }
public int TotalPagar { get; set; }
public int TotalPagarConexion { get; set; }
public string? FechaDespacho { get; set; }
public string NombrePaqueteria { get; set; }
public string NoGuiaEmbarqueDestino { get; set; }
public string? FechaEntregaDestinoFinal { get; set; }
public int FacturaCorresponsal { get; set; }
public int CertificadoCalidad { get; set; }
public int PackingList { get; set; }
public int HojaTecnica { get; set; }
public int BL { get; set; }
public int PedimentoInformativo { get; set; }
public int PedimentoSimplificado { get; set; }
public int DODA { get; set; }
public int Honorarios { get; set; }
public int TotalHonorarios { get; set; }
public int GastosTerceros { get; set; }
public int TotalGastosTerceros { get; set; }
public int ComprobantesGastosTerceros { get; set; }
}
}

@ -0,0 +1,69 @@
namespace CORRESPONSALBackend.DTO.Reportes.Embarques{
public class DTOEmbarquesDespachados{
public int Id { get; set; }
public string Aduana { get; set; }
public string TipoEmbarque { get; set; }
public string Destino { get; set; }
public int DiasEnAduana { get; set; }
public string Nombre { get; set; }
public string Trafico { get; set; }
public string Referencia {get;set;}
public string NoPedimento { get; set; }
public string ClavePedimento { get; set; }
public string Tipo { get; set; }
public string OrdenCompra { get; set; }
public string Factura { get; set; }
public string Proveedor { get; set; }
public string DescripcionMercancia { get; set; }
public string LineaTransportistaInternacional { get; set; }
public string LineaNaviera { get; set; }
public string MAWB { get; set; }
public string HAWB { get; set; }
public string? FechaNotificacion { get; set; }
public int Bultos { get; set; }
public int CantidadContenedores { get; set; }
public string NumerosContenedores { get; set; }
public int PesoBruto { get; set; }
public int PesoNeto { get; set; }
public string Incoterm { get; set; }
public string? FechaETA { get; set; }
public string? FechaEntrada {get;set;}
public string? FechaRevalidacionGuia { get; set; }
public double MontoUSD { get; set; }
public string Origen { get; set; }
public string FraccionArancelaria { get; set; }
public string Descripcion { get; set; }
public string PreferenciaArancelaria { get; set; }
public string Estatus { get; set; }
public string Observaciones { get; set; }
public string FechaInicioGastosAlmacenaje { get; set; }
public int CostoDiarioAlmacenaje { get; set; }
public int CostoDiarioConexion { get; set; }
public int TotalPagar { get; set; }
public int TotalPagarConexion { get; set; }
public string? FechaPagoPedimento { get; set; }
public string? FechaInstrucciones { get; set; }
public TimeSpan? HoraInstrucciones { get; set; }
public string? FechaDespacho { get; set; }
public int DiasCPPagado {get;set;}
public string? FechaSalidaContenedores { get; set; }
public string NombrePaqueteria { get; set; }
public string NoGuiaEmbarqueDestino { get; set; }
public string? FechaEntregaDestinoFinal { get; set; }
public TimeSpan? HoraEntregaDestinoFinal { get; set; }
public int FacturaCorresponsal { get; set; }
public int CertificadoCalidad { get; set; }
public int PackingList { get; set; }
public int HojaTecnica { get; set; }
public int BL { get; set; }
public int PedimentoInformativo { get; set; }
public int PedimentoSimplificado { get; set; }
public int DODA { get; set; }
public int Honorarios { get; set; }
public int TotalHonorarios { get; set; }
public int GastosTerceros { get; set; }
public int TotalGastosTerceros { get; set; }
public int ComprobantesGastosTerceros { get; set; }
public int PruebaEntrega { get; set; }
}
}

@ -0,0 +1,63 @@
namespace CORRESPONSALBackend.DTO.Reportes.Embarques{
public class DTOEmbarquesPorImportar{
public int Id { get; set; }
public string Aduana { get; set; }
public string TipoEmbarque { get; set; }
public string Destino { get; set; }
public int DiasEnAduana { get; set; }
public string Nombre { get; set; }
public string Trafico { get; set; }
public string Referencia {get;set;}
public string NoPedimento { get; set; }
public string ClavePedimento { get; set; }
public string Tipo { get; set; }
public string OrdenCompra { get; set; }
public string Factura { get; set; }
public string Proveedor { get; set; }
public string DescripcionMercancia { get; set; }
public string LineaTransportistaInternacional { get; set; }
public string LineaNaviera { get; set; }
public string MAWB { get; set; }
public string HAWB { get; set; }
public string? FechaNotificacion { get; set; }
public int Bultos { get; set; }
public int CantidadContenedores { get; set; }
public string NumerosContenedores { get; set; }
public int PesoBruto { get; set; }
public int PesoNeto { get; set; }
public string Incoterm { get; set; }
public string? FechaETA { get; set; }
public string? FechaEntrada {get;set;}
public string? FechaRevalidacionGuia { get; set; }
public double MontoUSD { get; set; }
public string Origen { get; set; }
public string FraccionArancelaria { get; set; }
public string Descripcion { get; set; }
public string PreferenciaArancelaria { get; set; }
public string Estatus { get; set; }
public string Observaciones { get; set; }
public string FechaInicioGastosAlmacenaje { get; set; }
public int CostoDiarioAlmacenaje { get; set; }
public int CostoDiarioConexion { get; set; }
public int TotalPagar { get; set; }
public int TotalPagarConexion { get; set; }
public string? FechaPagoPedimento { get; set; }
public string? FechaInstrucciones { get; set; }
public TimeSpan? HoraInstrucciones { get; set; }
public string? FechaDespacho { get; set; }
public int DiasCPPagado {get;set;}
public string? FechaSalidaContenedores { get; set; }
public string NombrePaqueteria { get; set; }
public string NoGuiaEmbarqueDestino { get; set; }
public string? FechaEntregaDestinoFinal { get; set; }
public TimeSpan? HoraEntregaDestinoFinal { get; set; }
public int FacturaCorresponsal { get; set; }
public int CertificadoCalidad { get; set; }
public int PackingList { get; set; }
public int HojaTecnica { get; set; }
public int BL { get; set; }
public int PedimentoInformativo { get; set; }
public int PedimentoSimplificado { get; set; }
public int DODA { get; set; }
}
}

@ -35,5 +35,10 @@ namespace CORRESPONSALBackend.Models.Corresponsales
public int TipoEmbarque { get; set; } public int TipoEmbarque { get; set; }
public double TotalPagar { get; set; } public double TotalPagar { get; set; }
public byte Activo { get; set; } = 1; public byte Activo { get; set; } = 1;
public string FraccionArancelaria { get; set; } = null!;
public string LineaNaviera { get; set; } = null!;
public string FNotificacion { get; set; } = null!;
public double CostoDiarioConexion { get; set; }
public double TotalPagarConexion { get; set; }
} }
} }

@ -44,5 +44,7 @@
public int? idTipoMercancia {get;set;} = null; public int? idTipoMercancia {get;set;} = null;
public int CargoA {get;set;} = 0; public int CargoA {get;set;} = 0;
public string CausaRectificacion {get;set;} = ""; public string CausaRectificacion {get;set;} = "";
public double TotalHonorariosAA { get; set; }
public double TotalGastosTerceros { get; set; }
} }
} }

@ -32,6 +32,8 @@ using CORRESPONSALBackend.Contracts.Reportes.Newell.Mensual;
using CORRESPONSALBackend.Services.Reportes.Newell.Mensual; using CORRESPONSALBackend.Services.Reportes.Newell.Mensual;
using CORRESPONSALBackend.Contracts.Auth; using CORRESPONSALBackend.Contracts.Auth;
using CORRESPONSALBackend.Services.Auth; using CORRESPONSALBackend.Services.Auth;
using CORRESPONSALBackend.Contracts.Reportes.Embarques;
using CORRESPONSALBackend.Repository.Reportes.Embarques;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
@ -46,6 +48,7 @@ builder.Services.AddScoped<IBatteryRepository, BatteryRepository>();
builder.Services.AddScoped<IReporteMensualRepository, ReporteMensualRepository>(); builder.Services.AddScoped<IReporteMensualRepository, ReporteMensualRepository>();
builder.Services.AddScoped<IReporteMensualService, ReporteMensualService>(); builder.Services.AddScoped<IReporteMensualService, ReporteMensualService>();
builder.Services.AddScoped<IAuthService, AuthService>(); builder.Services.AddScoped<IAuthService, AuthService>();
builder.Services.AddScoped<IReportesEmbarquesRepository, ReportesEmbarquesRepository>();
// Corresponsalias // Corresponsalias
builder.Services.AddScoped<IContabilidadCorresponsaliasRepository, ContabilidadCorresponsaliasRepository>(); builder.Services.AddScoped<IContabilidadCorresponsaliasRepository, ContabilidadCorresponsaliasRepository>();

@ -50,7 +50,12 @@ namespace CORRESPONSALBackend.Repository.Corresponsalias
@PreferenciaArancelaria = data.PreferenciaArancelaria, @PreferenciaArancelaria = data.PreferenciaArancelaria,
@Seguros = data.Seguros, @Seguros = data.Seguros,
@TipoEmbarque = data.TipoEmbarque, @TipoEmbarque = data.TipoEmbarque,
@TotalPagar = data.TotalPagar @TotalPagar = data.TotalPagar,
@LineaNaviera = data.LineaNaviera,
@FNotificacion = data.FNotificacion,
@FraccionArancelaria = data.FraccionArancelaria,
@CostoDiarioConexion = data.CostoDiarioConexion,
@TotalPagarConexion = data.TotalPagarConexion
}, },
commandType: CommandType.StoredProcedure); commandType: CommandType.StoredProcedure);
return entrada.First(); return entrada.First();

@ -115,7 +115,9 @@ namespace CORRESPONSALBackend.Repository.Corresponsalias
@IdTabulador = data.IdTabulador, @IdTabulador = data.IdTabulador,
@IdTipoMercancia = data.idTipoMercancia, @IdTipoMercancia = data.idTipoMercancia,
@CargoA = data.CargoA, @CargoA = data.CargoA,
@CausaRectificacion = data.CausaRectificacion @CausaRectificacion = data.CausaRectificacion,
@TotalHonorariosAA = data.TotalHonorariosAA,
@TotalGastosTerceros = data.TotalGastosTerceros
}, },
commandType: CommandType.StoredProcedure); commandType: CommandType.StoredProcedure);
return entrada.First(); return entrada.First();

@ -0,0 +1,35 @@
using System.Data;
using CORRESPONSALBackend.Context;
using CORRESPONSALBackend.Contracts.Reportes.Embarques;
using CORRESPONSALBackend.DTO.Reportes.Embarques;
using Dapper;
namespace CORRESPONSALBackend.Repository.Reportes.Embarques{
public class ReportesEmbarquesRepository : IReportesEmbarquesRepository
{
private readonly DapperContext _context;
public ReportesEmbarquesRepository(DapperContext context) { _context = context; }
public async Task<IEnumerable<DTOEmbarquesPorImportar>> GetReporteEmbarquesPorImportar()
{
var query = "[Reportes.Embarques.GetPorImportar]";
var connection = _context.CreateConnection();
var embarques = await connection.QueryAsync<DTOEmbarquesPorImportar>(query, new {}, commandType: CommandType.StoredProcedure);
return embarques.ToList();
}
public async Task<IEnumerable<DTOEmbarquesDespachados>> GetReporteEmbarquesDespachados(DateTime inicio, DateTime fin)
{
var query = "[Reportes.Embarques.GetDespachados]";
var connection = _context.CreateConnection();
var embarques = await connection.QueryAsync<DTOEmbarquesDespachados>(query, new {@inicio = inicio, @fin = fin}, commandType: CommandType.StoredProcedure);
return embarques.ToList();
}
public async Task<IEnumerable<DTOBuscarEmbarques>> BuscarEmbarques(string filtro)
{
var query = "[Reportes.Embarques.BuscarEmbarques]";
var connection = _context.CreateConnection();
var embarques = await connection.QueryAsync<DTOBuscarEmbarques>(query, new {@Filtro = filtro}, commandType: CommandType.StoredProcedure);
return embarques.ToList();
}
}
}
Loading…
Cancel
Save