|
|
@ -4,6 +4,9 @@ using CORRESPONSALBackend.DTO.Reportes.Embarques; |
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using OfficeOpenXml; |
|
|
|
using OfficeOpenXml; |
|
|
|
|
|
|
|
using OfficeOpenXml.Drawing; |
|
|
|
|
|
|
|
using OfficeOpenXml.Style; |
|
|
|
|
|
|
|
using OfficeOpenXml.Table; |
|
|
|
|
|
|
|
|
|
|
|
namespace CORRESPONSALBackend.Controllers.Reportes{ |
|
|
|
namespace CORRESPONSALBackend.Controllers.Reportes{ |
|
|
|
[Authorize] |
|
|
|
[Authorize] |
|
|
@ -11,7 +14,6 @@ namespace CORRESPONSALBackend.Controllers.Reportes{ |
|
|
|
[ApiController] |
|
|
|
[ApiController] |
|
|
|
public class ReportesEmbarquesController : ControllerBase{ |
|
|
|
public class ReportesEmbarquesController : ControllerBase{ |
|
|
|
private readonly IReportesEmbarquesRepository _repo; |
|
|
|
private readonly IReportesEmbarquesRepository _repo; |
|
|
|
|
|
|
|
|
|
|
|
public ReportesEmbarquesController(IReportesEmbarquesRepository repo){ |
|
|
|
public ReportesEmbarquesController(IReportesEmbarquesRepository repo){ |
|
|
|
_repo = repo; |
|
|
|
_repo = repo; |
|
|
|
} |
|
|
|
} |
|
|
@ -36,19 +38,491 @@ namespace CORRESPONSALBackend.Controllers.Reportes{ |
|
|
|
|
|
|
|
|
|
|
|
[HttpGet("ExcelEmbarquesPorImportar")] |
|
|
|
[HttpGet("ExcelEmbarquesPorImportar")] |
|
|
|
public async Task<IActionResult> GetExcelEmbarquesPorImportar(){ |
|
|
|
public async Task<IActionResult> GetExcelEmbarquesPorImportar(){ |
|
|
|
var embarques = await _repo.GetReporteEmbarquesPorImportar(); |
|
|
|
try{ |
|
|
|
using (ExcelPackage excelPackage = new ExcelPackage()){ |
|
|
|
var embarques = await _repo.GetReporteEmbarquesPorImportar(); |
|
|
|
|
|
|
|
ExcelPackage.LicenseContext = LicenseContext.NonCommercial; |
|
|
|
|
|
|
|
using (ExcelPackage excelPackage = new ExcelPackage()){ |
|
|
|
|
|
|
|
var today = DateTime.Now; |
|
|
|
|
|
|
|
var worksheet = excelPackage.Workbook.Worksheets.Add($"EmbarquesPorImportar_{today.Day}-{today.Month}-{today.Year}"); |
|
|
|
|
|
|
|
//Se crean los encabezados |
|
|
|
|
|
|
|
#region Encabezados |
|
|
|
|
|
|
|
worksheet.Cells["A7"].Value = "ADUANA"; |
|
|
|
|
|
|
|
worksheet.Cells["B7"].Value = "TIPO DE EMBARQUE"; |
|
|
|
|
|
|
|
worksheet.Cells["C7"].Value = "DESTINO"; |
|
|
|
|
|
|
|
worksheet.Cells["D7"].Value = "DIAS EN ADUANA"; |
|
|
|
|
|
|
|
worksheet.Cells["E7"].Value = "NOMBRE"; |
|
|
|
|
|
|
|
worksheet.Cells["F7"].Value = "TRAFICO"; |
|
|
|
|
|
|
|
worksheet.Cells["G7"].Value = "REFERENCIA"; |
|
|
|
|
|
|
|
worksheet.Cells["H7"].Value = "NO DE PEDIMENTO"; |
|
|
|
|
|
|
|
worksheet.Cells["I7"].Value = "CLAVE DE PEDIMENTO"; |
|
|
|
|
|
|
|
worksheet.Cells["J7"].Value = "TIPO"; |
|
|
|
|
|
|
|
worksheet.Cells["K7"].Value = "ORDEN DE COMPRA"; |
|
|
|
|
|
|
|
worksheet.Cells["L7"].Value = "FACTURA"; |
|
|
|
|
|
|
|
worksheet.Cells["M7"].Value = "PROVEEDOR"; |
|
|
|
|
|
|
|
worksheet.Cells["N7"].Value = "DESCRIPCION MERCANCIA"; |
|
|
|
|
|
|
|
worksheet.Cells["O7"].Value = "LÍNEA TRANSPORTISTA INTERNACIONAL"; |
|
|
|
|
|
|
|
worksheet.Cells["P7"].Value = "LINEA NAVIERA"; |
|
|
|
|
|
|
|
worksheet.Cells["Q7"].Value = "MAWB"; |
|
|
|
|
|
|
|
worksheet.Cells["R7"].Value = "HAWB"; |
|
|
|
|
|
|
|
worksheet.Cells["S7"].Value = "FECHA DE NOTIFICACION"; |
|
|
|
|
|
|
|
worksheet.Cells["T7"].Value = "BULTOS"; |
|
|
|
|
|
|
|
worksheet.Cells["U7"].Value = "CANTIDAD CONTENEDORES"; |
|
|
|
|
|
|
|
worksheet.Cells["V7"].Value = "NO. CONTENEDORES"; |
|
|
|
|
|
|
|
worksheet.Cells["W7"].Value = "PESO BRUTO"; |
|
|
|
|
|
|
|
worksheet.Cells["X7"].Value = "PESO NETO"; |
|
|
|
|
|
|
|
worksheet.Cells["Y7"].Value = "INCOTERM"; |
|
|
|
|
|
|
|
worksheet.Cells["Z7"].Value = "FECHA ETA"; |
|
|
|
|
|
|
|
worksheet.Cells["AA7"].Value = "FECHA DE ENTRADA"; |
|
|
|
|
|
|
|
worksheet.Cells["AB7"].Value = "FECHA DE REVALIDACION GUIA"; |
|
|
|
|
|
|
|
worksheet.Cells["AC7"].Value = "MONTO USD"; |
|
|
|
|
|
|
|
worksheet.Cells["AD7"].Value = "ORIGEN"; |
|
|
|
|
|
|
|
worksheet.Cells["AE7"].Value = "FRACCION ARANCELARIA"; |
|
|
|
|
|
|
|
worksheet.Cells["AF7"].Value = "DESCRIPCION"; |
|
|
|
|
|
|
|
worksheet.Cells["AG7"].Value = "PPREFERENCIA ARANCELARIA"; |
|
|
|
|
|
|
|
worksheet.Cells["AH7"].Value = "ESTATUS"; |
|
|
|
|
|
|
|
worksheet.Cells["AI7"].Value = "OBSERVACIONES"; |
|
|
|
|
|
|
|
worksheet.Cells["AJ7"].Value = "FECHA DE INICIO DE GASTOS DE ALMACENAJE"; |
|
|
|
|
|
|
|
worksheet.Cells["AK7"].Value = "COSTO DIARIO ALMACENAJE"; |
|
|
|
|
|
|
|
worksheet.Cells["AL7"].Value = "COSTO DIARIO CONEXIÓN"; |
|
|
|
|
|
|
|
worksheet.Cells["AM7"].Value = "TOTAL A PAGAR ALMACENAJE"; |
|
|
|
|
|
|
|
worksheet.Cells["AN7"].Value = "TOTAL A PAGAR CONEXIÓN"; |
|
|
|
|
|
|
|
worksheet.Cells["AO7"].Value = "FECHA DE PAGO PEDIMENTO"; |
|
|
|
|
|
|
|
worksheet.Cells["AP7"].Value = "FECHA DE INSTRUCCIONES"; |
|
|
|
|
|
|
|
worksheet.Cells["AQ7"].Value = "HORA DE INSTRUCCIONES"; |
|
|
|
|
|
|
|
worksheet.Cells["AR7"].Value = "FECHA DE DESPACHO"; |
|
|
|
|
|
|
|
worksheet.Cells["AS7"].Value = "DIAS C/PDTO PAGADO"; |
|
|
|
|
|
|
|
worksheet.Cells["AT7"].Value = "FECHA SALIDA DE CONTENEDORES"; |
|
|
|
|
|
|
|
worksheet.Cells["AU7"].Value = "NOMBRE DE PAQUETERIA O TRANSPORTISTA"; |
|
|
|
|
|
|
|
worksheet.Cells["AV7"].Value = "NO. DE GUIA DE EMBARQUE A DESTINO"; |
|
|
|
|
|
|
|
worksheet.Cells["AW7"].Value = "FECHA DE ENTREGA EN DESTINO FINAL"; |
|
|
|
|
|
|
|
worksheet.Cells["AX7"].Value = "HORA DE ENTREGA EN DESTINO FINAL"; |
|
|
|
|
|
|
|
worksheet.Cells["AY7"].Value = "FACTURA CORRESPONSAL"; |
|
|
|
|
|
|
|
worksheet.Cells["AZ7"].Value = "CERTIFICADO DE CALIDAD"; |
|
|
|
|
|
|
|
worksheet.Cells["BA7"].Value = "PACKING LIST"; |
|
|
|
|
|
|
|
worksheet.Cells["BB7"].Value = "HOJA TECNICA"; |
|
|
|
|
|
|
|
worksheet.Cells["BC7"].Value = "BL"; |
|
|
|
|
|
|
|
worksheet.Cells["BD7"].Value = "PEDIMENTO INFORMATIVO"; |
|
|
|
|
|
|
|
worksheet.Cells["BE7"].Value = "PEDIMENTO SIMPLIFICADO"; |
|
|
|
|
|
|
|
worksheet.Cells["BF7"].Value = "DODA"; |
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
#region Llenado de datos |
|
|
|
|
|
|
|
int currentRow = 8; |
|
|
|
|
|
|
|
foreach(var embarque in embarques){ |
|
|
|
|
|
|
|
worksheet.Cells[$"A{currentRow}"].Value = embarque.Aduana; |
|
|
|
|
|
|
|
worksheet.Cells[$"B{currentRow}"].Value = embarque.TipoEmbarque; |
|
|
|
|
|
|
|
worksheet.Cells[$"C{currentRow}"].Value = embarque.Destino; |
|
|
|
|
|
|
|
worksheet.Cells[$"D{currentRow}"].Value = embarque.DiasEnAduana; |
|
|
|
|
|
|
|
worksheet.Cells[$"E{currentRow}"].Value = embarque.Nombre; |
|
|
|
|
|
|
|
worksheet.Cells[$"F{currentRow}"].Value = embarque.Trafico; |
|
|
|
|
|
|
|
worksheet.Cells[$"G{currentRow}"].Value = embarque.Referencia; |
|
|
|
|
|
|
|
worksheet.Cells[$"H{currentRow}"].Value = embarque.NoPedimento; |
|
|
|
|
|
|
|
worksheet.Cells[$"I{currentRow}"].Value = embarque.ClavePedimento; |
|
|
|
|
|
|
|
worksheet.Cells[$"J{currentRow}"].Value = embarque.Tipo; |
|
|
|
|
|
|
|
worksheet.Cells[$"K{currentRow}"].Value = embarque.OrdenCompra; |
|
|
|
|
|
|
|
worksheet.Cells[$"L{currentRow}"].Value = embarque.Factura; |
|
|
|
|
|
|
|
worksheet.Cells[$"M{currentRow}"].Value = embarque.Proveedor; |
|
|
|
|
|
|
|
worksheet.Cells[$"N{currentRow}"].Value = embarque.DescripcionMercancia; |
|
|
|
|
|
|
|
worksheet.Cells[$"O{currentRow}"].Value = embarque.LineaTransportistaInternacional; |
|
|
|
|
|
|
|
worksheet.Cells[$"P{currentRow}"].Value = embarque.LineaNaviera; |
|
|
|
|
|
|
|
worksheet.Cells[$"Q{currentRow}"].Value = embarque.MAWB; |
|
|
|
|
|
|
|
worksheet.Cells[$"R{currentRow}"].Value = embarque.HAWB; |
|
|
|
|
|
|
|
worksheet.Cells[$"S{currentRow}"].Value = embarque.FechaNotificacion; |
|
|
|
|
|
|
|
worksheet.Cells[$"T{currentRow}"].Value = embarque.Bultos; |
|
|
|
|
|
|
|
worksheet.Cells[$"U{currentRow}"].Value = embarque.CantidadContenedores; |
|
|
|
|
|
|
|
worksheet.Cells[$"V{currentRow}"].Value = embarque.NumerosContenedores; |
|
|
|
|
|
|
|
worksheet.Cells[$"W{currentRow}"].Value = embarque.PesoBruto; |
|
|
|
|
|
|
|
worksheet.Cells[$"X{currentRow}"].Value = embarque.PesoNeto; |
|
|
|
|
|
|
|
worksheet.Cells[$"Y{currentRow}"].Value = embarque.Incoterm; |
|
|
|
|
|
|
|
worksheet.Cells[$"Z{currentRow}"].Value = embarque.FechaETA; |
|
|
|
|
|
|
|
worksheet.Cells[$"AA{currentRow}"].Value = embarque.FechaEntrada; |
|
|
|
|
|
|
|
worksheet.Cells[$"AB{currentRow}"].Value = embarque.FechaRevalidacionGuia; |
|
|
|
|
|
|
|
worksheet.Cells[$"AC{currentRow}"].Value = embarque.MontoUSD; |
|
|
|
|
|
|
|
worksheet.Cells[$"AD{currentRow}"].Value = embarque.Origen; |
|
|
|
|
|
|
|
worksheet.Cells[$"AE{currentRow}"].Value = embarque.FraccionArancelaria; |
|
|
|
|
|
|
|
worksheet.Cells[$"AF{currentRow}"].Value = embarque.Descripcion; |
|
|
|
|
|
|
|
worksheet.Cells[$"AG{currentRow}"].Value = embarque.PreferenciaArancelaria; |
|
|
|
|
|
|
|
worksheet.Cells[$"AH{currentRow}"].Value = embarque.Estatus; |
|
|
|
|
|
|
|
worksheet.Cells[$"AI{currentRow}"].Value = embarque.Observaciones; |
|
|
|
|
|
|
|
worksheet.Cells[$"AJ{currentRow}"].Value = embarque.FechaInicioGastosAlmacenaje; |
|
|
|
|
|
|
|
worksheet.Cells[$"AK{currentRow}"].Value = embarque.CostoDiarioAlmacenaje; |
|
|
|
|
|
|
|
worksheet.Cells[$"AL{currentRow}"].Value = embarque.CostoDiarioConexion; |
|
|
|
|
|
|
|
worksheet.Cells[$"AM{currentRow}"].Value = embarque.TotalPagar; |
|
|
|
|
|
|
|
worksheet.Cells[$"AN{currentRow}"].Value = embarque.TotalPagarConexion; |
|
|
|
|
|
|
|
worksheet.Cells[$"AO{currentRow}"].Value = embarque.FechaPagoPedimento; |
|
|
|
|
|
|
|
worksheet.Cells[$"AP{currentRow}"].Value = embarque.FechaInstrucciones; |
|
|
|
|
|
|
|
worksheet.Cells[$"AQ{currentRow}"].Value = embarque.HoraInstrucciones; |
|
|
|
|
|
|
|
worksheet.Cells[$"AR{currentRow}"].Value = embarque.FechaDespacho; |
|
|
|
|
|
|
|
worksheet.Cells[$"AS{currentRow}"].Value = embarque.DiasCPPagado; |
|
|
|
|
|
|
|
worksheet.Cells[$"AT{currentRow}"].Value = embarque.FechaSalidaContenedores; |
|
|
|
|
|
|
|
worksheet.Cells[$"AU{currentRow}"].Value = embarque.NombrePaqueteria; |
|
|
|
|
|
|
|
worksheet.Cells[$"AV{currentRow}"].Value = embarque.NoGuiaEmbarqueDestino; |
|
|
|
|
|
|
|
worksheet.Cells[$"AW{currentRow}"].Value = embarque.FechaEntregaDestinoFinal; |
|
|
|
|
|
|
|
worksheet.Cells[$"AX{currentRow}"].Value = embarque.HoraEntregaDestinoFinal; |
|
|
|
|
|
|
|
worksheet.Cells[$"AY{currentRow}"].Value = embarque.FacturaCorresponsal == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
worksheet.Cells[$"AZ{currentRow}"].Value = embarque.CertificadoCalidad == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
worksheet.Cells[$"BA{currentRow}"].Value = embarque.PackingList == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
worksheet.Cells[$"BB{currentRow}"].Value = embarque.HojaTecnica == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
worksheet.Cells[$"BC{currentRow}"].Value = embarque.BL == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
worksheet.Cells[$"BD{currentRow}"].Value = embarque.PedimentoInformativo == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
worksheet.Cells[$"BE{currentRow}"].Value = embarque.PedimentoSimplificado == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
worksheet.Cells[$"BF{currentRow}"].Value = embarque.DODA == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
currentRow++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
//Se crea la tabla en el rango de celdas donde se mostrara la inforamcion. |
|
|
|
|
|
|
|
ExcelRange range = worksheet.Cells[7, 1,embarques.Count() + 7, 58]; |
|
|
|
|
|
|
|
ExcelTable tab = worksheet.Tables.Add(range, "Table1"); |
|
|
|
|
|
|
|
tab.TableStyle = TableStyles.Light1; |
|
|
|
|
|
|
|
worksheet.Cells["A1:A6"].Merge = true; |
|
|
|
|
|
|
|
//Se agrega el logo de GEMCO al documento. |
|
|
|
|
|
|
|
ExcelPicture excelImage = worksheet.Drawings.AddPicture("Logo", new FileInfo("C:\\data\\Corresponsales\\Img\\LogoGemco.png")); |
|
|
|
|
|
|
|
excelImage.SetPosition(0,0,1,0); |
|
|
|
|
|
|
|
//Aqui comienza el encabezado del documento. |
|
|
|
|
|
|
|
worksheet.Cells["B1:D6"].Merge = true; |
|
|
|
|
|
|
|
worksheet.Cells["E1:J1"].Merge = true; |
|
|
|
|
|
|
|
worksheet.Cells["E2:J2"].Merge = true; |
|
|
|
|
|
|
|
worksheet.Cells["E3:J3"].Merge = true; |
|
|
|
|
|
|
|
worksheet.Cells["E4:J4"].Merge = true; |
|
|
|
|
|
|
|
worksheet.Cells["E5:J5"].Merge = true; |
|
|
|
|
|
|
|
worksheet.Cells["E6:J6"].Merge = true; |
|
|
|
|
|
|
|
worksheet.Cells["E1:J6"].Style.Font.Size = 16; |
|
|
|
|
|
|
|
worksheet.Cells["E1:J6"].Style.Font.Color.SetColor(Color.FromArgb(74,74,173)); |
|
|
|
|
|
|
|
worksheet.Cells["E2"].Value = "REPORTE DE EMBARQUES POR IMPORTAR"; |
|
|
|
|
|
|
|
worksheet.Cells["E3"].Value = $"Reporte Generado al: {today.Day}/{today.Month}/{today.Year}"; |
|
|
|
|
|
|
|
worksheet.Cells["E4"].Value = $"Fecha y Hora de Creación: {today.Day}/{today.Month}/{today.Year} {today.Hour}:{today.Minute}:{today.Second}"; |
|
|
|
|
|
|
|
worksheet.Cells["A1:BG6"].Style.Fill.PatternType = ExcelFillStyle.Solid; |
|
|
|
|
|
|
|
worksheet.Cells["A1:BG6"].Style.Fill.BackgroundColor.SetColor(ColorTranslator.FromHtml("#FFFFFF")); |
|
|
|
|
|
|
|
worksheet.Cells["A7:BG7"].Style.Font.Bold = true; |
|
|
|
|
|
|
|
worksheet.Cells["A7:BG7"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; |
|
|
|
|
|
|
|
worksheet.Cells["A7:BG7"].Style.VerticalAlignment = ExcelVerticalAlignment.Center; |
|
|
|
|
|
|
|
worksheet.Cells[worksheet.Dimension.Address].AutoFitColumns(); |
|
|
|
|
|
|
|
excelPackage.Workbook.Calculate(); |
|
|
|
|
|
|
|
var stream = new MemoryStream(); |
|
|
|
|
|
|
|
excelPackage.SaveAs(stream); |
|
|
|
|
|
|
|
stream.Position = 0; |
|
|
|
|
|
|
|
return File(stream, "application/octet-stream", "ReporteEmbarquesSinImportar.xlsx"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}catch(Exception ex){ |
|
|
|
|
|
|
|
return BadRequest(ex.Message); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[HttpGet("ExcelEmbarquesDespachados")] |
|
|
|
|
|
|
|
public async Task<ActionResult> GetExcelEmbarquesDespachados([FromQuery] DateTime inicio, [FromQuery] DateTime fin){ |
|
|
|
|
|
|
|
try{ |
|
|
|
|
|
|
|
var embarques = await _repo.GetReporteEmbarquesDespachados(inicio, fin); |
|
|
|
|
|
|
|
ExcelPackage.LicenseContext = LicenseContext.NonCommercial; |
|
|
|
|
|
|
|
using (ExcelPackage excelPackage = new ExcelPackage()){ |
|
|
|
|
|
|
|
var today = DateTime.Now; |
|
|
|
|
|
|
|
var worksheet = excelPackage.Workbook.Worksheets.Add($"EmbarquesPorImportar_{today.Day}-{today.Month}-{today.Year}"); |
|
|
|
|
|
|
|
//Se crean los encabezados |
|
|
|
|
|
|
|
#region Encabezados |
|
|
|
|
|
|
|
worksheet.Cells["A7"].Value = "ADUANA"; |
|
|
|
|
|
|
|
worksheet.Cells["B7"].Value = "TIPO DE EMBARQUE"; |
|
|
|
|
|
|
|
worksheet.Cells["C7"].Value = "DESTINO"; |
|
|
|
|
|
|
|
worksheet.Cells["D7"].Value = "DIAS EN ADUANA"; |
|
|
|
|
|
|
|
worksheet.Cells["E7"].Value = "NOMBRE"; |
|
|
|
|
|
|
|
worksheet.Cells["F7"].Value = "TRAFICO"; |
|
|
|
|
|
|
|
worksheet.Cells["G7"].Value = "REFERENCIA"; |
|
|
|
|
|
|
|
worksheet.Cells["H7"].Value = "NO DE PEDIMENTO"; |
|
|
|
|
|
|
|
worksheet.Cells["I7"].Value = "CLAVE DE PEDIMENTO"; |
|
|
|
|
|
|
|
worksheet.Cells["J7"].Value = "TIPO"; |
|
|
|
|
|
|
|
worksheet.Cells["K7"].Value = "ORDEN DE COMPRA"; |
|
|
|
|
|
|
|
worksheet.Cells["L7"].Value = "FACTURA"; |
|
|
|
|
|
|
|
worksheet.Cells["M7"].Value = "PROVEEDOR"; |
|
|
|
|
|
|
|
worksheet.Cells["N7"].Value = "DESCRIPCION MERCANCIA"; |
|
|
|
|
|
|
|
worksheet.Cells["O7"].Value = "LÍNEA TRANSPORTISTA INTERNACIONAL"; |
|
|
|
|
|
|
|
worksheet.Cells["P7"].Value = "LINEA NAVIERA"; |
|
|
|
|
|
|
|
worksheet.Cells["Q7"].Value = "MAWB"; |
|
|
|
|
|
|
|
worksheet.Cells["R7"].Value = "HAWB"; |
|
|
|
|
|
|
|
worksheet.Cells["S7"].Value = "FECHA DE NOTIFICACION"; |
|
|
|
|
|
|
|
worksheet.Cells["T7"].Value = "BULTOS"; |
|
|
|
|
|
|
|
worksheet.Cells["U7"].Value = "CANTIDAD CONTENEDORES"; |
|
|
|
|
|
|
|
worksheet.Cells["V7"].Value = "NO. CONTENEDORES"; |
|
|
|
|
|
|
|
worksheet.Cells["W7"].Value = "PESO BRUTO"; |
|
|
|
|
|
|
|
worksheet.Cells["X7"].Value = "PESO NETO"; |
|
|
|
|
|
|
|
worksheet.Cells["Y7"].Value = "INCOTERM"; |
|
|
|
|
|
|
|
worksheet.Cells["Z7"].Value = "FECHA ETA"; |
|
|
|
|
|
|
|
worksheet.Cells["AA7"].Value = "FECHA DE ENTRADA"; |
|
|
|
|
|
|
|
worksheet.Cells["AB7"].Value = "FECHA DE REVALIDACION GUIA"; |
|
|
|
|
|
|
|
worksheet.Cells["AC7"].Value = "MONTO USD"; |
|
|
|
|
|
|
|
worksheet.Cells["AD7"].Value = "ORIGEN"; |
|
|
|
|
|
|
|
worksheet.Cells["AE7"].Value = "FRACCION ARANCELARIA"; |
|
|
|
|
|
|
|
worksheet.Cells["AF7"].Value = "DESCRIPCION"; |
|
|
|
|
|
|
|
worksheet.Cells["AG7"].Value = "PPREFERENCIA ARANCELARIA"; |
|
|
|
|
|
|
|
worksheet.Cells["AH7"].Value = "ESTATUS"; |
|
|
|
|
|
|
|
worksheet.Cells["AI7"].Value = "OBSERVACIONES"; |
|
|
|
|
|
|
|
worksheet.Cells["AJ7"].Value = "FECHA DE INICIO DE GASTOS DE ALMACENAJE"; |
|
|
|
|
|
|
|
worksheet.Cells["AK7"].Value = "COSTO DIARIO ALMACENAJE"; |
|
|
|
|
|
|
|
worksheet.Cells["AL7"].Value = "COSTO DIARIO CONEXIÓN"; |
|
|
|
|
|
|
|
worksheet.Cells["AM7"].Value = "TOTAL A PAGAR ALMACENAJE"; |
|
|
|
|
|
|
|
worksheet.Cells["AN7"].Value = "TOTAL A PAGAR CONEXIÓN"; |
|
|
|
|
|
|
|
worksheet.Cells["AO7"].Value = "FECHA DE PAGO PEDIMENTO"; |
|
|
|
|
|
|
|
worksheet.Cells["AP7"].Value = "FECHA DE INSTRUCCIONES"; |
|
|
|
|
|
|
|
worksheet.Cells["AQ7"].Value = "HORA DE INSTRUCCIONES"; |
|
|
|
|
|
|
|
worksheet.Cells["AR7"].Value = "FECHA DE DESPACHO"; |
|
|
|
|
|
|
|
worksheet.Cells["AS7"].Value = "DIAS C/PDTO PAGADO"; |
|
|
|
|
|
|
|
worksheet.Cells["AT7"].Value = "FECHA SALIDA DE CONTENEDORES"; |
|
|
|
|
|
|
|
worksheet.Cells["AU7"].Value = "NOMBRE DE PAQUETERIA O TRANSPORTISTA"; |
|
|
|
|
|
|
|
worksheet.Cells["AV7"].Value = "NO. DE GUIA DE EMBARQUE A DESTINO"; |
|
|
|
|
|
|
|
worksheet.Cells["AW7"].Value = "FECHA DE ENTREGA EN DESTINO FINAL"; |
|
|
|
|
|
|
|
worksheet.Cells["AX7"].Value = "HORA DE ENTREGA EN DESTINO FINAL"; |
|
|
|
|
|
|
|
worksheet.Cells["AY7"].Value = "FACTURA CORRESPONSAL"; |
|
|
|
|
|
|
|
worksheet.Cells["AZ7"].Value = "CERTIFICADO DE CALIDAD"; |
|
|
|
|
|
|
|
worksheet.Cells["BA7"].Value = "PACKING LIST"; |
|
|
|
|
|
|
|
worksheet.Cells["BB7"].Value = "HOJA TECNICA"; |
|
|
|
|
|
|
|
worksheet.Cells["BC7"].Value = "BL"; |
|
|
|
|
|
|
|
worksheet.Cells["BD7"].Value = "PEDIMENTO INFORMATIVO"; |
|
|
|
|
|
|
|
worksheet.Cells["BE7"].Value = "PEDIMENTO SIMPLIFICADO"; |
|
|
|
|
|
|
|
worksheet.Cells["BF7"].Value = "DODA"; |
|
|
|
|
|
|
|
worksheet.Cells["BG7"].Value = "HONORARIOS AA"; |
|
|
|
|
|
|
|
worksheet.Cells["BH7"].Value = "TOTAL HONORARIOS AA"; |
|
|
|
|
|
|
|
worksheet.Cells["BI7"].Value = "GASTOS TERCEROS"; |
|
|
|
|
|
|
|
worksheet.Cells["BJ7"].Value = "TOTAL GASTOS TERCEROS"; |
|
|
|
|
|
|
|
worksheet.Cells["BK7"].Value = "COMPROBANTES GASTOS TERCEROS"; |
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
#region Llenado de datos |
|
|
|
|
|
|
|
int currentRow = 8; |
|
|
|
|
|
|
|
foreach(var embarque in embarques){ |
|
|
|
|
|
|
|
worksheet.Cells[$"A{currentRow}"].Value = embarque.Aduana; |
|
|
|
|
|
|
|
worksheet.Cells[$"B{currentRow}"].Value = embarque.TipoEmbarque; |
|
|
|
|
|
|
|
worksheet.Cells[$"C{currentRow}"].Value = embarque.Destino; |
|
|
|
|
|
|
|
worksheet.Cells[$"D{currentRow}"].Value = embarque.DiasEnAduana; |
|
|
|
|
|
|
|
worksheet.Cells[$"E{currentRow}"].Value = embarque.Nombre; |
|
|
|
|
|
|
|
worksheet.Cells[$"F{currentRow}"].Value = embarque.Trafico; |
|
|
|
|
|
|
|
worksheet.Cells[$"G{currentRow}"].Value = embarque.Referencia; |
|
|
|
|
|
|
|
worksheet.Cells[$"H{currentRow}"].Value = embarque.NoPedimento; |
|
|
|
|
|
|
|
worksheet.Cells[$"I{currentRow}"].Value = embarque.ClavePedimento; |
|
|
|
|
|
|
|
worksheet.Cells[$"J{currentRow}"].Value = embarque.Tipo; |
|
|
|
|
|
|
|
worksheet.Cells[$"K{currentRow}"].Value = embarque.OrdenCompra; |
|
|
|
|
|
|
|
worksheet.Cells[$"L{currentRow}"].Value = embarque.Factura; |
|
|
|
|
|
|
|
worksheet.Cells[$"M{currentRow}"].Value = embarque.Proveedor; |
|
|
|
|
|
|
|
worksheet.Cells[$"N{currentRow}"].Value = embarque.DescripcionMercancia; |
|
|
|
|
|
|
|
worksheet.Cells[$"O{currentRow}"].Value = embarque.LineaTransportistaInternacional; |
|
|
|
|
|
|
|
worksheet.Cells[$"P{currentRow}"].Value = embarque.LineaNaviera; |
|
|
|
|
|
|
|
worksheet.Cells[$"Q{currentRow}"].Value = embarque.MAWB; |
|
|
|
|
|
|
|
worksheet.Cells[$"R{currentRow}"].Value = embarque.HAWB; |
|
|
|
|
|
|
|
worksheet.Cells[$"S{currentRow}"].Value = embarque.FechaNotificacion; |
|
|
|
|
|
|
|
worksheet.Cells[$"T{currentRow}"].Value = embarque.Bultos; |
|
|
|
|
|
|
|
worksheet.Cells[$"U{currentRow}"].Value = embarque.CantidadContenedores; |
|
|
|
|
|
|
|
worksheet.Cells[$"V{currentRow}"].Value = embarque.NumerosContenedores; |
|
|
|
|
|
|
|
worksheet.Cells[$"W{currentRow}"].Value = embarque.PesoBruto; |
|
|
|
|
|
|
|
worksheet.Cells[$"X{currentRow}"].Value = embarque.PesoNeto; |
|
|
|
|
|
|
|
worksheet.Cells[$"Y{currentRow}"].Value = embarque.Incoterm; |
|
|
|
|
|
|
|
worksheet.Cells[$"Z{currentRow}"].Value = embarque.FechaETA; |
|
|
|
|
|
|
|
worksheet.Cells[$"AA{currentRow}"].Value = embarque.FechaEntrada; |
|
|
|
|
|
|
|
worksheet.Cells[$"AB{currentRow}"].Value = embarque.FechaRevalidacionGuia; |
|
|
|
|
|
|
|
worksheet.Cells[$"AC{currentRow}"].Value = embarque.MontoUSD; |
|
|
|
|
|
|
|
worksheet.Cells[$"AD{currentRow}"].Value = embarque.Origen; |
|
|
|
|
|
|
|
worksheet.Cells[$"AE{currentRow}"].Value = embarque.FraccionArancelaria; |
|
|
|
|
|
|
|
worksheet.Cells[$"AF{currentRow}"].Value = embarque.Descripcion; |
|
|
|
|
|
|
|
worksheet.Cells[$"AG{currentRow}"].Value = embarque.PreferenciaArancelaria; |
|
|
|
|
|
|
|
worksheet.Cells[$"AH{currentRow}"].Value = embarque.Estatus; |
|
|
|
|
|
|
|
worksheet.Cells[$"AI{currentRow}"].Value = embarque.Observaciones; |
|
|
|
|
|
|
|
worksheet.Cells[$"AJ{currentRow}"].Value = embarque.FechaInicioGastosAlmacenaje; |
|
|
|
|
|
|
|
worksheet.Cells[$"AK{currentRow}"].Value = embarque.CostoDiarioAlmacenaje; |
|
|
|
|
|
|
|
worksheet.Cells[$"AL{currentRow}"].Value = embarque.CostoDiarioConexion; |
|
|
|
|
|
|
|
worksheet.Cells[$"AM{currentRow}"].Value = embarque.TotalPagar; |
|
|
|
|
|
|
|
worksheet.Cells[$"AN{currentRow}"].Value = embarque.TotalPagarConexion; |
|
|
|
|
|
|
|
worksheet.Cells[$"AO{currentRow}"].Value = embarque.FechaPagoPedimento; |
|
|
|
|
|
|
|
worksheet.Cells[$"AP{currentRow}"].Value = embarque.FechaInstrucciones; |
|
|
|
|
|
|
|
worksheet.Cells[$"AQ{currentRow}"].Value = embarque.HoraInstrucciones; |
|
|
|
|
|
|
|
worksheet.Cells[$"AR{currentRow}"].Value = embarque.FechaDespacho; |
|
|
|
|
|
|
|
worksheet.Cells[$"AS{currentRow}"].Value = embarque.DiasCPPagado; |
|
|
|
|
|
|
|
worksheet.Cells[$"AT{currentRow}"].Value = embarque.FechaSalidaContenedores; |
|
|
|
|
|
|
|
worksheet.Cells[$"AU{currentRow}"].Value = embarque.NombrePaqueteria; |
|
|
|
|
|
|
|
worksheet.Cells[$"AV{currentRow}"].Value = embarque.NoGuiaEmbarqueDestino; |
|
|
|
|
|
|
|
worksheet.Cells[$"AW{currentRow}"].Value = embarque.FechaEntregaDestinoFinal; |
|
|
|
|
|
|
|
worksheet.Cells[$"AX{currentRow}"].Value = embarque.HoraEntregaDestinoFinal; |
|
|
|
|
|
|
|
worksheet.Cells[$"AY{currentRow}"].Value = embarque.FacturaCorresponsal == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
worksheet.Cells[$"AZ{currentRow}"].Value = embarque.CertificadoCalidad == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
worksheet.Cells[$"BA{currentRow}"].Value = embarque.PackingList == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
worksheet.Cells[$"BB{currentRow}"].Value = embarque.HojaTecnica == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
worksheet.Cells[$"BC{currentRow}"].Value = embarque.BL == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
worksheet.Cells[$"BD{currentRow}"].Value = embarque.PedimentoInformativo == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
worksheet.Cells[$"BE{currentRow}"].Value = embarque.PedimentoSimplificado == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
worksheet.Cells[$"BF{currentRow}"].Value = embarque.DODA == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
worksheet.Cells[$"BG{currentRow}"].Value = embarque.Honorarios == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
worksheet.Cells[$"BH{currentRow}"].Value = embarque.TotalHonorarios; |
|
|
|
|
|
|
|
worksheet.Cells[$"BI{currentRow}"].Value = embarque.GastosTerceros == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
worksheet.Cells[$"BJ{currentRow}"].Value = embarque.TotalGastosTerceros; |
|
|
|
|
|
|
|
worksheet.Cells[$"BK{currentRow}"].Value = embarque.ComprobantesGastosTerceros == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
currentRow++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
//Se crea el rango de celdas que abarcara la tabla. |
|
|
|
|
|
|
|
ExcelRange range = worksheet.Cells[7, 1,embarques.Count() + 7, 63]; |
|
|
|
|
|
|
|
ExcelTable tab = worksheet.Tables.Add(range, "Table1"); |
|
|
|
|
|
|
|
tab.TableStyle = TableStyles.Light1; |
|
|
|
|
|
|
|
worksheet.Cells["A1:A6"].Merge = true; |
|
|
|
|
|
|
|
//Se agrega el logo de GEMCO al documento. |
|
|
|
|
|
|
|
ExcelPicture excelImage = worksheet.Drawings.AddPicture("Logo", new FileInfo("C:\\data\\Corresponsales\\Img\\LogoGemco.png")); |
|
|
|
|
|
|
|
excelImage.SetPosition(0,0,1,0); |
|
|
|
|
|
|
|
//Aqui comienza el encabezado del documento. |
|
|
|
|
|
|
|
worksheet.Cells["B1:D6"].Merge = true; |
|
|
|
|
|
|
|
worksheet.Cells["E1:J1"].Merge = true; |
|
|
|
|
|
|
|
worksheet.Cells["E2:J2"].Merge = true; |
|
|
|
|
|
|
|
worksheet.Cells["E3:J3"].Merge = true; |
|
|
|
|
|
|
|
worksheet.Cells["E4:J4"].Merge = true; |
|
|
|
|
|
|
|
worksheet.Cells["E5:J5"].Merge = true; |
|
|
|
|
|
|
|
worksheet.Cells["E6:J6"].Merge = true; |
|
|
|
|
|
|
|
worksheet.Cells["E1:J6"].Style.Font.Size = 16; |
|
|
|
|
|
|
|
worksheet.Cells["E1:J6"].Style.Font.Color.SetColor(Color.FromArgb(74,74,173)); |
|
|
|
|
|
|
|
worksheet.Cells["E2"].Value = "REPORTE DE EMBARQUES POR DESPACHADOS"; |
|
|
|
|
|
|
|
worksheet.Cells["E3"].Value = $"Reporte Generado al: {today.Day}/{today.Month}/{today.Year}"; |
|
|
|
|
|
|
|
worksheet.Cells["E4"].Value = $"Fecha y Hora de Creación: {today.Day}/{today.Month}/{today.Year} {today.Hour}:{today.Minute}:{today.Second}"; |
|
|
|
|
|
|
|
worksheet.Cells["A1:BK6"].Style.Fill.PatternType = ExcelFillStyle.Solid; |
|
|
|
|
|
|
|
worksheet.Cells["A1:BK6"].Style.Fill.BackgroundColor.SetColor(ColorTranslator.FromHtml("#FFFFFF")); |
|
|
|
|
|
|
|
worksheet.Cells["A7:BK7"].Style.Font.Bold = true; |
|
|
|
|
|
|
|
worksheet.Cells["A7:BK7"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; |
|
|
|
|
|
|
|
worksheet.Cells["A7:BK7"].Style.VerticalAlignment = ExcelVerticalAlignment.Center; |
|
|
|
|
|
|
|
worksheet.Cells[worksheet.Dimension.Address].AutoFitColumns(); |
|
|
|
|
|
|
|
excelPackage.Workbook.Calculate(); |
|
|
|
|
|
|
|
var stream = new MemoryStream(); |
|
|
|
|
|
|
|
excelPackage.SaveAs(stream); |
|
|
|
|
|
|
|
stream.Position = 0; |
|
|
|
|
|
|
|
return File(stream, "application/octet-stream", "ReporteEmbarquesDespachados.xlsx"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}catch(Exception ex){ |
|
|
|
|
|
|
|
return BadRequest(ex.Message); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[HttpGet("ExcelBuscarEmbarques")] |
|
|
|
|
|
|
|
public async Task<IActionResult> GetExcelBusquedaEmbarques([FromQuery] string filtro){ |
|
|
|
|
|
|
|
try{ |
|
|
|
|
|
|
|
var embarques = await _repo.BuscarEmbarques(filtro); |
|
|
|
ExcelPackage.LicenseContext = LicenseContext.NonCommercial; |
|
|
|
ExcelPackage.LicenseContext = LicenseContext.NonCommercial; |
|
|
|
var today = new DateTime(); |
|
|
|
using (ExcelPackage excelPackage = new ExcelPackage()){ |
|
|
|
var worksheet = excelPackage.Workbook.Worksheets.Add($"EmbarquesPorImportar_{today.Day-today.Month-today.Year}"); |
|
|
|
var today = DateTime.Now; |
|
|
|
worksheet.Cells["A1:A6"].Merge = true; |
|
|
|
var worksheet = excelPackage.Workbook.Worksheets.Add($"EmbarquesPorImportar_{today.Day}-{today.Month}-{today.Year}"); |
|
|
|
Image image = Image.FromFile("C:\\data\\Corresponsales\\Img\\LogoGemco.png"); |
|
|
|
//Se crean los encabezados |
|
|
|
worksheet.Column(2).Width = 194; |
|
|
|
#region Encabezados |
|
|
|
worksheet.Column(3).Width = 144; |
|
|
|
worksheet.Cells["A7"].Value = "ADUANA"; |
|
|
|
worksheet.Column(4).Width = 143; |
|
|
|
worksheet.Cells["B7"].Value = "TIPO DE EMBARQUE"; |
|
|
|
worksheet.Cells["B1:B6"].Merge = true; |
|
|
|
worksheet.Cells["C7"].Value = "DESTINO"; |
|
|
|
|
|
|
|
worksheet.Cells["D7"].Value = "DIAS EN ADUANA"; |
|
|
|
|
|
|
|
worksheet.Cells["E7"].Value = "NOMBRE"; |
|
|
|
|
|
|
|
worksheet.Cells["F7"].Value = "TIPO"; |
|
|
|
|
|
|
|
worksheet.Cells["G7"].Value = "NO DE PEDIMENTO"; |
|
|
|
|
|
|
|
worksheet.Cells["H7"].Value = "ORDEN DE COMPRA"; |
|
|
|
|
|
|
|
worksheet.Cells["I7"].Value = "FACTURA"; |
|
|
|
|
|
|
|
worksheet.Cells["J7"].Value = "PROVEEDOR"; |
|
|
|
|
|
|
|
worksheet.Cells["K7"].Value = "DESCRIPCION"; |
|
|
|
|
|
|
|
worksheet.Cells["L7"].Value = "BULTOS"; |
|
|
|
|
|
|
|
worksheet.Cells["M7"].Value = "CANTIDAD CONTENEDORES"; |
|
|
|
|
|
|
|
worksheet.Cells["N7"].Value = "PESO NETO"; |
|
|
|
|
|
|
|
worksheet.Cells["O7"].Value = "INCOTERM"; |
|
|
|
|
|
|
|
worksheet.Cells["P7"].Value = "FECHA ETA"; |
|
|
|
|
|
|
|
worksheet.Cells["Q7"].Value = "ESTATUS"; |
|
|
|
|
|
|
|
worksheet.Cells["R7"].Value = "OBSERVACIONES"; |
|
|
|
|
|
|
|
worksheet.Cells["S7"].Value = "FECHA DE INICIO DE GASTOS DE ALMACENAJE"; |
|
|
|
|
|
|
|
worksheet.Cells["T7"].Value = "COSTO DIARIO ALMACENAJE"; |
|
|
|
|
|
|
|
worksheet.Cells["U7"].Value = "COSTO DIARIO CONEXION"; |
|
|
|
|
|
|
|
worksheet.Cells["V7"].Value = "TOTAL A PAGAR ALMACENAJE"; |
|
|
|
|
|
|
|
worksheet.Cells["W7"].Value = "TOTAL A PAGAR CONEXION"; |
|
|
|
|
|
|
|
worksheet.Cells["X7"].Value = "FECHA DE DESPACHO"; |
|
|
|
|
|
|
|
worksheet.Cells["Y7"].Value = "NOMBRE DE PAQUETERIA O TRANPORTISTA"; |
|
|
|
|
|
|
|
worksheet.Cells["Z7"].Value = "NO. DE GUIA DE EMBARQUE A DESTINO"; |
|
|
|
|
|
|
|
worksheet.Cells["AA7"].Value = "FECHA DE ENTREGA EN DESTINO FINAL"; |
|
|
|
|
|
|
|
worksheet.Cells["AB7"].Value = "FACTURA CORREPSONSAL"; |
|
|
|
|
|
|
|
worksheet.Cells["AC7"].Value = "CERTIFICADO DE CALIDAD"; |
|
|
|
|
|
|
|
worksheet.Cells["AD7"].Value = "PACKING LIST"; |
|
|
|
|
|
|
|
worksheet.Cells["AE7"].Value = "HOJA TECNICA"; |
|
|
|
|
|
|
|
worksheet.Cells["AF7"].Value = "BL"; |
|
|
|
|
|
|
|
worksheet.Cells["AG7"].Value = "PEDIMENTO INFORMATIVO"; |
|
|
|
|
|
|
|
worksheet.Cells["AH7"].Value = "PEDIMENTO SIMPLIFICADO"; |
|
|
|
|
|
|
|
worksheet.Cells["AI7"].Value = "DODA"; |
|
|
|
|
|
|
|
worksheet.Cells["AJ7"].Value = "HONORARIOS AA"; |
|
|
|
|
|
|
|
worksheet.Cells["AK7"].Value = "TOTAL HONORARIOS AA"; |
|
|
|
|
|
|
|
worksheet.Cells["AL7"].Value = "GASTOS A TERCEROS"; |
|
|
|
|
|
|
|
worksheet.Cells["AM7"].Value = "TOTAL GASTOS A TERCEROS"; |
|
|
|
|
|
|
|
worksheet.Cells["AN7"].Value = "COMPROBANTES GASTOS A TERCEROS"; |
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
#region Llenado de datos |
|
|
|
|
|
|
|
int currentRow = 8; |
|
|
|
|
|
|
|
foreach(var embarque in embarques){ |
|
|
|
|
|
|
|
worksheet.Cells[$"A{currentRow}"].Value = embarque.Aduana; |
|
|
|
|
|
|
|
worksheet.Cells[$"B{currentRow}"].Value = embarque.TipoEmbarque; |
|
|
|
|
|
|
|
worksheet.Cells[$"C{currentRow}"].Value = embarque.Destino; |
|
|
|
|
|
|
|
worksheet.Cells[$"D{currentRow}"].Value = embarque.DiasEnAduana; |
|
|
|
|
|
|
|
worksheet.Cells[$"E{currentRow}"].Value = embarque.Nombre; |
|
|
|
|
|
|
|
worksheet.Cells[$"F{currentRow}"].Value = embarque.Tipo; |
|
|
|
|
|
|
|
worksheet.Cells[$"G{currentRow}"].Value = embarque.NoPedimento; |
|
|
|
|
|
|
|
worksheet.Cells[$"H{currentRow}"].Value = embarque.OrdenCompra; |
|
|
|
|
|
|
|
worksheet.Cells[$"I{currentRow}"].Value = embarque.Factura; |
|
|
|
|
|
|
|
worksheet.Cells[$"J{currentRow}"].Value = embarque.Proveedor; |
|
|
|
|
|
|
|
worksheet.Cells[$"K{currentRow}"].Value = embarque.DescripcionMercancia; |
|
|
|
|
|
|
|
worksheet.Cells[$"L{currentRow}"].Value = embarque.Bultos; |
|
|
|
|
|
|
|
worksheet.Cells[$"M{currentRow}"].Value = embarque.CantidadContenedores; |
|
|
|
|
|
|
|
worksheet.Cells[$"N{currentRow}"].Value = embarque.PesoNeto; |
|
|
|
|
|
|
|
worksheet.Cells[$"O{currentRow}"].Value = embarque.Incoterm; |
|
|
|
|
|
|
|
worksheet.Cells[$"P{currentRow}"].Value = embarque.FechaETA; |
|
|
|
|
|
|
|
worksheet.Cells[$"Q{currentRow}"].Value = embarque.Estatus; |
|
|
|
|
|
|
|
worksheet.Cells[$"R{currentRow}"].Value = embarque.Observaciones; |
|
|
|
|
|
|
|
worksheet.Cells[$"S{currentRow}"].Value = embarque.FechaInicioGastosAlmacenaje; |
|
|
|
|
|
|
|
worksheet.Cells[$"T{currentRow}"].Value = embarque.CostoDiarioAlmacenaje; |
|
|
|
|
|
|
|
worksheet.Cells[$"U{currentRow}"].Value = embarque.CostoDiarioConexion; |
|
|
|
|
|
|
|
worksheet.Cells[$"V{currentRow}"].Value = embarque.TotalPagar; |
|
|
|
|
|
|
|
worksheet.Cells[$"W{currentRow}"].Value = embarque.TotalPagarConexion; |
|
|
|
|
|
|
|
worksheet.Cells[$"X{currentRow}"].Value = embarque.FechaDespacho; |
|
|
|
|
|
|
|
worksheet.Cells[$"Y{currentRow}"].Value = embarque.NombrePaqueteria; |
|
|
|
|
|
|
|
worksheet.Cells[$"Z{currentRow}"].Value = embarque.NoGuiaEmbarqueDestino; |
|
|
|
|
|
|
|
worksheet.Cells[$"AA{currentRow}"].Value = embarque.FechaEntregaDestinoFinal; |
|
|
|
|
|
|
|
worksheet.Cells[$"AB{currentRow}"].Value = embarque.FacturaCorresponsal == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
worksheet.Cells[$"AC{currentRow}"].Value = embarque.CertificadoCalidad == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
worksheet.Cells[$"AD{currentRow}"].Value = embarque.PackingList == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
worksheet.Cells[$"AE{currentRow}"].Value = embarque.HojaTecnica == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
worksheet.Cells[$"AF{currentRow}"].Value = embarque.BL == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
worksheet.Cells[$"AG{currentRow}"].Value = embarque.PedimentoInformativo == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
worksheet.Cells[$"AH{currentRow}"].Value = embarque.PedimentoSimplificado == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
worksheet.Cells[$"AI{currentRow}"].Value = embarque.DODA == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
worksheet.Cells[$"AJ{currentRow}"].Value = embarque.Honorarios == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
worksheet.Cells[$"AK{currentRow}"].Value = embarque.TotalHonorarios; |
|
|
|
|
|
|
|
worksheet.Cells[$"AL{currentRow}"].Value = embarque.GastosTerceros == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
worksheet.Cells[$"AM{currentRow}"].Value = embarque.TotalGastosTerceros; |
|
|
|
|
|
|
|
worksheet.Cells[$"AN{currentRow}"].Value = embarque.ComprobantesGastosTerceros == 0 ? "NO" : "SI"; |
|
|
|
|
|
|
|
currentRow++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
//Se crea el rango de celdas que abarcara la tabla. |
|
|
|
|
|
|
|
ExcelRange range = worksheet.Cells[7, 1,embarques.Count() + 7, 40]; |
|
|
|
|
|
|
|
ExcelTable tab = worksheet.Tables.Add(range, "Table1"); |
|
|
|
|
|
|
|
tab.TableStyle = TableStyles.Light1; |
|
|
|
|
|
|
|
worksheet.Cells["A1:A6"].Merge = true; |
|
|
|
|
|
|
|
//Se agrega el logo de GEMCO al documento. |
|
|
|
|
|
|
|
ExcelPicture excelImage = worksheet.Drawings.AddPicture("Logo", new FileInfo("C:\\data\\Corresponsales\\Img\\LogoGemco.png")); |
|
|
|
|
|
|
|
excelImage.SetPosition(0,0,1,0); |
|
|
|
|
|
|
|
//Aqui comienza el encabezado del documento. |
|
|
|
|
|
|
|
worksheet.Cells["B1:D6"].Merge = true; |
|
|
|
|
|
|
|
worksheet.Cells["E1:J1"].Merge = true; |
|
|
|
|
|
|
|
worksheet.Cells["E2:J2"].Merge = true; |
|
|
|
|
|
|
|
worksheet.Cells["E3:J3"].Merge = true; |
|
|
|
|
|
|
|
worksheet.Cells["E4:J4"].Merge = true; |
|
|
|
|
|
|
|
worksheet.Cells["E5:J5"].Merge = true; |
|
|
|
|
|
|
|
worksheet.Cells["E6:J6"].Merge = true; |
|
|
|
|
|
|
|
worksheet.Cells["E1:J6"].Style.Font.Size = 16; |
|
|
|
|
|
|
|
worksheet.Cells["E1:J6"].Style.Font.Color.SetColor(Color.FromArgb(74,74,173)); |
|
|
|
|
|
|
|
worksheet.Cells["E2"].Value = "REPORTE DE EMBARQUES POR DESPACHADOS"; |
|
|
|
|
|
|
|
worksheet.Cells["E3"].Value = $"Reporte Generado al: {today.Day}/{today.Month}/{today.Year}"; |
|
|
|
|
|
|
|
worksheet.Cells["E4"].Value = $"Fecha y Hora de Creación: {today.Day}/{today.Month}/{today.Year} {today.Hour}:{today.Minute}:{today.Second}"; |
|
|
|
|
|
|
|
worksheet.Cells["A1:BK6"].Style.Fill.PatternType = ExcelFillStyle.Solid; |
|
|
|
|
|
|
|
worksheet.Cells["A1:BK6"].Style.Fill.BackgroundColor.SetColor(ColorTranslator.FromHtml("#FFFFFF")); |
|
|
|
|
|
|
|
worksheet.Cells["A7:BK7"].Style.Font.Bold = true; |
|
|
|
|
|
|
|
worksheet.Cells["A7:BK7"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; |
|
|
|
|
|
|
|
worksheet.Cells["A7:BK7"].Style.VerticalAlignment = ExcelVerticalAlignment.Center; |
|
|
|
|
|
|
|
worksheet.Cells[worksheet.Dimension.Address].AutoFitColumns(); |
|
|
|
|
|
|
|
excelPackage.Workbook.Calculate(); |
|
|
|
|
|
|
|
var stream = new MemoryStream(); |
|
|
|
|
|
|
|
excelPackage.SaveAs(stream); |
|
|
|
|
|
|
|
stream.Position = 0; |
|
|
|
|
|
|
|
return File(stream, "application/octet-stream", "ReporteEmbarquesDespachados.xlsx"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}catch(Exception ex){ |
|
|
|
|
|
|
|
return BadRequest(ex.Message); |
|
|
|
} |
|
|
|
} |
|
|
|
return Ok(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |