|
|
|
@ -14,8 +14,15 @@ namespace CORRESPONSALBackend.Controllers.Reportes{ |
|
|
|
|
[ApiController] |
|
|
|
|
public class ReportesEmbarquesController : ControllerBase{ |
|
|
|
|
private readonly IReportesEmbarquesRepository _repo; |
|
|
|
|
public ReportesEmbarquesController(IReportesEmbarquesRepository repo){ |
|
|
|
|
private readonly IConfiguration _config; |
|
|
|
|
private readonly string RootPathCorresponsales; |
|
|
|
|
private readonly string PathLogoGemco; |
|
|
|
|
private readonly string LogoGemcoFileName = "LogoGemco.png"; |
|
|
|
|
public ReportesEmbarquesController(IReportesEmbarquesRepository repo, IConfiguration config){ |
|
|
|
|
_repo = repo; |
|
|
|
|
_config = config; |
|
|
|
|
RootPathCorresponsales = _config.GetValue<string>("AllFiles"); |
|
|
|
|
PathLogoGemco = _config.GetValue<string>("LogoGemco"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[HttpGet("PorImportar")] |
|
|
|
@ -175,7 +182,7 @@ namespace CORRESPONSALBackend.Controllers.Reportes{ |
|
|
|
|
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")); |
|
|
|
|
ExcelPicture excelImage = worksheet.Drawings.AddPicture("Logo", new FileInfo(RootPathCorresponsales + PathLogoGemco + LogoGemcoFileName)); |
|
|
|
|
excelImage.SetPosition(0,0,1,0); |
|
|
|
|
//Aqui comienza el encabezado del documento. |
|
|
|
|
worksheet.Cells["B1:D6"].Merge = true; |
|
|
|
@ -356,7 +363,7 @@ namespace CORRESPONSALBackend.Controllers.Reportes{ |
|
|
|
|
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")); |
|
|
|
|
ExcelPicture excelImage = worksheet.Drawings.AddPicture("Logo", new FileInfo(RootPathCorresponsales + PathLogoGemco + LogoGemcoFileName)); |
|
|
|
|
excelImage.SetPosition(0,0,1,0); |
|
|
|
|
//Aqui comienza el encabezado del documento. |
|
|
|
|
worksheet.Cells["B1:D6"].Merge = true; |
|
|
|
@ -492,7 +499,7 @@ namespace CORRESPONSALBackend.Controllers.Reportes{ |
|
|
|
|
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")); |
|
|
|
|
ExcelPicture excelImage = worksheet.Drawings.AddPicture("Logo", new FileInfo(RootPathCorresponsales + PathLogoGemco + LogoGemcoFileName)); |
|
|
|
|
excelImage.SetPosition(0,0,1,0); |
|
|
|
|
//Aqui comienza el encabezado del documento. |
|
|
|
|
worksheet.Cells["B1:D6"].Merge = true; |
|
|
|
@ -504,7 +511,7 @@ namespace CORRESPONSALBackend.Controllers.Reportes{ |
|
|
|
|
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["E2"].Value = "REPORTE DE EMBARQUES"; |
|
|
|
|
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; |
|
|
|
@ -517,7 +524,7 @@ namespace CORRESPONSALBackend.Controllers.Reportes{ |
|
|
|
|
var stream = new MemoryStream(); |
|
|
|
|
excelPackage.SaveAs(stream); |
|
|
|
|
stream.Position = 0; |
|
|
|
|
return File(stream, "application/octet-stream", "ReporteEmbarquesDespachados.xlsx"); |
|
|
|
|
return File(stream, "application/octet-stream", "ReporteEmbarques.xlsx"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}catch(Exception ex){ |
|
|
|
|