feature/Reporte_Relacion_Facturas_Alen
parent
92f2101244
commit
0313633cc4
@ -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); |
||||||
|
} |
||||||
|
} |
@ -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; } |
||||||
|
} |
||||||
|
} |
@ -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…
Reference in new issue