Compare commits

..

No commits in common. 'main' and 'feature/Agregar_Columnas_Reporte_Cuentas_Cerradas_20240410' have entirely different histories.

  1. 25
      CORRESPONSALBackend.sln
  2. 9
      Contracts/ArchivoElectronico/IArchivoElectronicoRepository.cs
  3. 5
      Contracts/ArchivoElectronico/IArchivoElectronicoService.cs
  4. 2
      Contracts/Catalogos/ITabuladorRepository.cs
  5. 16
      Contracts/Reportes/Alen/IEstadosCuentaAlenRepository.cs
  6. 8
      Contracts/Reportes/Facturacion/IReportesFacturacionRepository.cs
  7. 7
      Contracts/Reportes/ITraficosClientesService.cs
  8. 1
      Contracts/Utils/IFileManagerRepository.cs
  9. 6
      Controllers/AuthController.cs
  10. 6
      Controllers/Catalogos/TabuladorController.cs
  11. 21
      Controllers/ClientesController.cs
  12. 23
      Controllers/Dashboard/CorresponsalesController.cs
  13. 33
      Controllers/FileManagerController.cs
  14. 252
      Controllers/Reportes/Alen/ReporteEstadosCuentaAlenController.cs
  15. 54
      Controllers/Reportes/Facturacion/ReportesFacturacionController.cs
  16. 93
      Controllers/Utils/ArchivoElectronicoController.cs
  17. 4
      Controllers/Utils/MFileManagerController.cs
  18. 1
      Controllers/Utils/ReportesController.cs
  19. 50
      DTO/Reportes/Alen/DTOEstadosCuentaAlen.cs
  20. 13
      DTO/Reportes/Alen/DTOEstadosCuentaAlenFilters.cs
  21. 5
      DTO/Reportes/CuentasCerradas/DTOReporteCuentasCerradas.cs
  22. 32
      DTO/Reportes/Facturacion/DTOReporteGeneralFacturacion.cs
  23. 3
      Models/Catalogos/Tabulador.cs
  24. 1
      Models/Catalogos/TabuladorDetalle.cs
  25. 39
      Models/Clientes/Alen/EstadosCuenta.cs
  26. 1
      Models/Corresponsales/IPrecuenta.cs
  27. 11
      Models/Reportes/RptPedimentosPagadosAEO.cs
  28. 14
      Program.cs
  29. 31
      Repository/ArchivoElectronicoRepository.cs
  30. 1
      Repository/Catalogos/TabuladorDetalleRepository.cs
  31. 8
      Repository/Catalogos/TabuladorRepository.cs
  32. 138
      Repository/Reportes/Alen/EstadosCuentaAlenRepository.cs
  33. 34
      Repository/Reportes/Facturacion/ReportesFacturacionRepository.cs
  34. 11
      Repository/Utils/FileManagerRepository.cs
  35. 7
      Services/ArchivoElectronicoService.cs
  36. 6
      Services/Reportes/CuentasCerradas/ReporteCuentasCerradasService.cs
  37. 63
      Services/Reportes/TraficosClientesService.cs
  38. 1
      appsettings.Development.json
  39. 1
      appsettings.Staging.json
  40. 1
      appsettings.json
  41. 2
      web.config

@ -1,25 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CORRESPONSALBackend", "CORRESPONSALBackend.csproj", "{5FEAD431-682F-483D-8B56-E2F066C67B9D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5FEAD431-682F-483D-8B56-E2F066C67B9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5FEAD431-682F-483D-8B56-E2F066C67B9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5FEAD431-682F-483D-8B56-E2F066C67B9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5FEAD431-682F-483D-8B56-E2F066C67B9D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3F707F07-2501-48B3-A5A3-AE1EF8C6847B}
EndGlobalSection
EndGlobal

@ -1,9 +0,0 @@
using CORRESPONSALBackend.DTO.ArchivoElectronico;
using GEMCO.Backend.Models.Reportes;
namespace CORRESPONSALBackend.Contracts.ArchivoElectronico{
public interface IArchivoElectronicoRepository
{
public Task<List<RptPedimentosPagadosAEO>> getRptPedimentoPagadosAEO(DTOAEPeriodo dTOData);
}
}

@ -1,5 +0,0 @@
namespace CORRESPONSALBackend.Contracts.ArchivoElectronico{
public interface IArchivoElectronicoService{
}
}

@ -3,7 +3,7 @@ namespace CORRESPONSALBackend.Contracts.Catalogos
{
public interface ITabuladorRepository
{
public Task<IEnumerable<Tabulador>> GetAll(int id, int IdCliente, int? idCorresponsal);
public Task<IEnumerable<Tabulador>> GetAll(int id, int IdCliente);
public Task<Tabulador> Append(Tabulador data);
public Task Delete(int id);
}

@ -1,16 +0,0 @@
using CORRESPONSALBackend.DTO.Reportes.Alen;
using CORRESPONSALBackend.Models.Clientes.Alen;
namespace CORRESPONSALBackend.Contracts.Reportes.Alen{
public interface IEstadosCuentaAlenRepository{
public Task ClearData();
public Task<IEnumerable<DTOEstadosCuentaAlen>> GetAll(DTOEstadosCuentaAlenFilters filters);
public Task<EstadosCuenta> Append (EstadosCuenta data);
public Task<EstadosCuenta> GetByFolio (string Folio);
public Task<EstadosCuenta> MarkAsProgramado (string NoMovimiento, string NoSerie);
public Task<EstadosCuenta> AppendOrdenCompra(DTOEstadosCuentaAlen data);
public Task<EstadosCuenta> AppendObservaciones(DTOEstadosCuentaAlen data);
}
}

@ -1,8 +0,0 @@
using CORRESPONSALBackend.DTO.Reportes;
using CORRESPONSALBackend.DTO.Reportes.Facturacion;
namespace CORRESPONSALBackend.Contracts.Reportes.Facturacion{
public interface IReportesFacturacionRepository{
public Task<IEnumerable<DTOReporteGeneralFacturacion>> GetCuentasFacturadas(DTOReporteCorresponsales data);
}
}

@ -1,7 +0,0 @@
using CORRESPONSALBackend.DTO.Corresponsales;
namespace CORRESPONSALBackend.Contracts.Reportes{
public interface ITraficosClientesService{
public Task<MemoryStream> GetExcel(IEnumerable<DTOCorresponsalTrafico> traficos);
}
}

@ -12,6 +12,5 @@ namespace CORRESPONSALBackend.Contracts.Utils
public Task<FileManager> UpdateFileNameById(long id, string newFileName);
public Task<IEnumerable<FileManager>> GetFilesByProcessId(int process);
public Task<FileManager> UpdateFileProcessById(long fileId, int process);
public Task<IEnumerable<FileManager>> GetTraficoFiles(int idTrafico);
}
}

@ -133,10 +133,10 @@ namespace CORRESPONSALBackend.Controllers
{
DTOPINData PINData = await _usuariosRepo.CreatePIN(IdUser);
string htmlContent = $@"<table>
<tr><td>Estimado usuario, mediante este correo se le notifica que está en proceso de cambiar su contraseña.</td></tr>
<tr><td>Estimado usuario, mediante este correo se le notifica que esta en proceso de cambiar su contraseña</td></tr>
<tr><td>Se ha generado un PIN para poder cambiar su contraseña. PIN : <b>{PINData.PIN}</b> </td></tr>
<tr><td>El PIN tiene un tiempo de vida de 10 minutos, a partir de su generación.</td></tr>
<tr><td>Si usted <b>NO</b> es quien ha activando este mecanismo, favor de ponerse en contacto con personal de GEMCO.</td></tr>
<tr><td>El PIN tiene un tiempo de vida de 10 minutos, a partir de su generacion, despues de ese tiempo caduca</td></tr>
<tr><td>Si usted <b>no</b> es quien ha activando este mecanismo, favor de ponerse en contacto con personal de ZINC</td></tr>
</table>";
if (PINData.PIN > 0)
{

@ -22,16 +22,16 @@ namespace CORRESPONSALBackend.Controllers.Catalogos
[HttpGet]
[Route("getAll")]
public async Task<IEnumerable<Tabulador>> GetAll(int id, int IdCliente, int? idCorresponsal)
public async Task<IEnumerable<Tabulador>> GetAll(int id, int IdCliente)
{
return await _Repo.GetAll(id, IdCliente, idCorresponsal);
return await _Repo.GetAll(id, IdCliente);
}
[HttpGet]
[Route("getByCustomer")]
public async Task<IEnumerable<Tabulador>> GetByCustomer(int IdCliente)
{
return await _Repo.GetAll(0, IdCliente, 0);
return await _Repo.GetAll(0, IdCliente);
}

@ -1,5 +1,4 @@
using CORRESPONSALBackend.Contracts;
using CORRESPONSALBackend.Contracts.Reportes;
using CORRESPONSALBackend.DTO.Cliente;
using CORRESPONSALBackend.DTO.Corresponsales;
using CORRESPONSALBackend.DTO.Reportes;
@ -15,12 +14,10 @@ namespace CORRESPONSALBackend.Controllers
public class ClientesController : Controller
{
private readonly IClientesRepository _clientesRepo;
private readonly ITraficosClientesService _traficosClientesService;
public ClientesController(IClientesRepository clientesRepo, ITraficosClientesService traficosClientesService)
public ClientesController(IClientesRepository clientesRepo)
{
_clientesRepo = clientesRepo;
_traficosClientesService = traficosClientesService;
}
[Route("getAllClientes")]
@ -108,21 +105,5 @@ namespace CORRESPONSALBackend.Controllers
var entrada = await _clientesRepo.GetTraficos(data);
return entrada;
}
[HttpGet("Excel")]
public async Task<IActionResult> GetExcel([FromQuery] DTOFiltrosTraficosClientes data){
try{
var traficos = await _clientesRepo.GetTraficos(data);
var stream = await _traficosClientesService.GetExcel(traficos);
if(stream.Length > 0){
stream.Position = 0;
return File(stream,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml", $"Reporte_Operaciones.xlsx");
}else{
throw new Exception("Ocurrio un error al generar el reporte, intentelo de nuevo");
}
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
}
}

@ -2,7 +2,6 @@
using CORRESPONSALBackend.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using System.IO;
namespace CORRESPONSALBackend.Controllers.Dashboard
{
@ -70,27 +69,5 @@ namespace CORRESPONSALBackend.Controllers.Dashboard
var traficos = await _Repo.SolicitudesElminarCuenta();
return traficos;
}
[HttpGet("GetDiskUsage")]
public async Task<IActionResult> GetTotalFreeSpace()
{
var diskName = _config.GetValue<string>("DataDisk");
//List<DashboardCorresponsales> diskData = new List<DashboardCorresponsales>();
foreach (DriveInfo drive in DriveInfo.GetDrives())
{
if (drive.IsReady && drive.Name == diskName)
{
long driveFreeSpaceInGB = drive.TotalFreeSpace / 1024 / 1024 / 1024;
long driveTotalSpaceInGB = drive.TotalSize / 1024 / 1024 / 1024;
long driveTotalUsedSpaceInGB = driveTotalSpaceInGB - driveFreeSpaceInGB;
long usedStoragePercentage = driveTotalUsedSpaceInGB * 100 / driveTotalSpaceInGB;
return new OkObjectResult(new DashboardCorresponsales(){
Total = Convert.ToInt32(usedStoragePercentage),
Descripcion = $"{driveTotalUsedSpaceInGB} GB usados de {driveTotalSpaceInGB} GB"
});
}
}
return BadRequest("No se pudo obtener la información de la unidad");
}
}
}

@ -65,8 +65,6 @@ namespace CORRESPONSALBackend.Controllers
}
[Route("AppendFileByProcess")]
[RequestSizeLimit(209715200)]
[RequestFormLimits(MultipartBodyLengthLimit = 209715200)]
[HttpPost]
public async Task<dynamic> AppendFileByProcess(IFormFile file, int IdUsuario, int Proceso, string Tags, int crud)
{
@ -432,36 +430,5 @@ namespace CORRESPONSALBackend.Controllers
return BadRequest(ex.Message);
}
}
[HttpGet("FileListByReferencia")]
public async Task<IActionResult> GeFileListByReferencia([FromQuery] string referencia){
try{
var trafico = await _traficosRepository.GetByReferencia(referencia);
var fileList = await _Repo.GetTraficoFiles(trafico.id);
return Ok(fileList);
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
[HttpGet("GetAEO")]
public async Task<IActionResult> GetArchivoElectronicoOficial([FromQuery] string serie, string noMovimiento, string fileMime, string trafico){
try{
FilePaths4Process RelativePath = await _RepoRelativePath.getPaths4ProcessById(47);
string folderPath = RootPathCorresponsales + RelativePath.Path + trafico + "\\";
string fileName = $"RGMS960730IL9_{serie}-00000{noMovimiento}.{fileMime}";
string fullPath = folderPath + fileName;
if (!System.IO.File.Exists(fullPath))
{
throw new Exception("No se encontró el archivo solicitado.");
}
var mime = "application/" + fileMime.ToLower();
byte[] pdfBytes = System.IO.File.ReadAllBytes(fullPath);
MemoryStream ms = new MemoryStream(pdfBytes);
return new FileStreamResult(ms, mime);//D:\data\ArchivoElectronicoSIR\www.gemcousa.com\SIR-GEMCO\DOCS-SIR\ALEN DEL NORTE SA DE CV\2024\24-00665E
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
}
}

@ -1,252 +0,0 @@
using System.Globalization;
using CORRESPONSALBackend.Contracts.Reportes.Alen;
using CORRESPONSALBackend.Contracts.Utils;
using CORRESPONSALBackend.DTO.Reportes.Alen;
using CORRESPONSALBackend.Models.Clientes.Alen;
using CORRESPONSALBackend.Models.Utils;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using OfficeOpenXml;
using OfficeOpenXml.Style;
using OfficeOpenXml.Table;
namespace CORRESPONSALBackend.Controllers.Reportes.Alen{
[Authorize]
[ApiController]
[Route("api/[controller]")]
public class ReporteEstadosCuentaAlenController : ControllerBase{
private readonly IFileManagerRepository _Repo;
private readonly IFilePaths4ProcessRepository _RepoRelativePath;
private readonly IConfiguration _config;
private readonly string RootPathCorresponsales;
private readonly IEstadosCuentaAlenRepository _EstadosCuentaAlenRepo;
public ReporteEstadosCuentaAlenController(IFilePaths4ProcessRepository RepoRelativePath, IConfiguration config, IFileManagerRepository Repo, IEstadosCuentaAlenRepository EstadosCuentaAlenRepo){
_Repo = Repo;
_RepoRelativePath = RepoRelativePath;
_config = config;
RootPathCorresponsales = _config.GetValue<string>("AllFiles");
_EstadosCuentaAlenRepo = EstadosCuentaAlenRepo;
}
[HttpPost("Append")]
public async Task<IActionResult> Append(IFormFile file){
try{
await _EstadosCuentaAlenRepo.ClearData();
//Obtener la ruta del archivo
//Se obtiene la ruta del archivo
//FileManager recFound = await _Repo.getFileById(45);
FilePaths4Process RelativePath = await _RepoRelativePath.getPaths4ProcessById(45);
if(!System.IO.Directory.Exists(RootPathCorresponsales + RelativePath.Path)){
System.IO.Directory.CreateDirectory(RootPathCorresponsales + RelativePath.Path);
}
string filePath = RootPathCorresponsales + RelativePath.Path + file.FileName;
if(System.IO.File.Exists(filePath)){
System.IO.File.Delete(filePath);
}
//Si es un archivo nuevo se guarda
using(var stream = System.IO.File.Create(filePath)){
await file.CopyToAsync(stream);
}
//Leer el archivo con epplus
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
using(ExcelPackage package = new ExcelPackage(filePath)){
var worksheet = package.Workbook.Worksheets.FirstOrDefault();
int rowCount = 2;
worksheet.Column(18).Style.Numberformat.Format = "yyyy-mm-dd";
worksheet.Column(19).Style.Numberformat.Format = "yyyy-mm-dd";
worksheet.Column(20).Style.Numberformat.Format = "yyyy-mm-dd";
while(string.IsNullOrWhiteSpace(worksheet?.Cells[rowCount, 4].Value?.ToString()) == false){
EstadosCuenta estadoCuenta = new EstadosCuenta(){
id=0,
TipoMovimiento = worksheet.Cells[rowCount, 1].Value != null ? worksheet.Cells[rowCount, 1].Value?.ToString() : "",
NoSerie = worksheet.Cells[rowCount, 2].Value != null ? worksheet.Cells[rowCount, 2].Value?.ToString() : "",
NoMovimiento = worksheet.Cells[rowCount, 3].Value != null ? worksheet.Cells[rowCount, 3].Value?.ToString() : "",
Trafico = worksheet.Cells[rowCount, 4].Value != null ? worksheet.Cells[rowCount, 4].Value?.ToString() : "",
Impexp = worksheet.Cells[rowCount, 5].Value != null ? worksheet.Cells[rowCount, 5].Value?.ToString() : "",
Aduana = worksheet.Cells[rowCount, 6].Value != null ? worksheet.Cells[rowCount, 6].Value?.ToString() : "",
Patente = worksheet.Cells[rowCount, 7].Value != null ? worksheet.Cells[rowCount, 7].Value?.ToString() : "",
Pedimento = worksheet.Cells[rowCount, 8].Value != null ? worksheet.Cells[rowCount, 8].Value?.ToString() : "",
Clave = worksheet.Cells[rowCount, 9].Value != null ? worksheet.Cells[rowCount, 9].Value?.ToString() : "",
NoCliente = worksheet.Cells[rowCount, 10].Value != null ? worksheet.Cells[rowCount, 10].Value?.ToString() : "",
NoCentro = worksheet.Cells[rowCount, 11].Value != null ? worksheet.Cells[rowCount, 11].Value?.ToString() : "",
SubCentro = worksheet.Cells[rowCount, 12].Value != null ? worksheet.Cells[rowCount, 12].Value?.ToString() : "",
Nombre = worksheet.Cells[rowCount, 13].Value != null ? worksheet.Cells[rowCount, 13].Value?.ToString() : "",
SubCtaNombre = worksheet.Cells[rowCount, 14].Value != null ? worksheet.Cells[rowCount, 14].Value?.ToString() : "",
TipoRangos = worksheet.Cells[rowCount, 15].Value != null ? worksheet.Cells[rowCount, 15].Value?.ToString() : "",
Cargos = worksheet.Cells[rowCount, 16].Value != null ? worksheet.Cells[rowCount, 16].Value?.ToString() : "",
Abonos = worksheet.Cells[rowCount, 17].Value != null ? worksheet.Cells[rowCount, 17].Value?.ToString() : "",
Fecha = worksheet.Cells[rowCount, 18].Value != null ? StringToDateTime(worksheet.Cells[rowCount, 18].Value?.ToString().Substring(0,10)) : "",
FechaPedimento = worksheet.Cells[rowCount, 19].Value != null ? StringToDateTime(worksheet.Cells[rowCount, 19].Value?.ToString().Substring(0,10)) : "",
FechaRev = worksheet.Cells[rowCount, 20].Value != null ? StringToDateTime(worksheet.Cells[rowCount, 20].Value?.ToString().Substring(0,10)) : "",
DiasPedimCta = worksheet.Cells[rowCount, 21].Value != null ? worksheet.Cells[rowCount, 21].Value?.ToString() : "",
DiasCtaRev = worksheet.Cells[rowCount, 22].Value != null ? worksheet.Cells[rowCount, 22].Value?.ToString() : "",
DiasRev = worksheet.Cells[rowCount, 23].Value != null ? worksheet.Cells[rowCount, 23].Value?.ToString() : "",
IvaAl = worksheet.Cells[rowCount, 24].Value != null ? worksheet.Cells[rowCount, 24].Value?.ToString() : "",
TotalFacturado = worksheet.Cells[rowCount, 25].Value != null ? worksheet.Cells[rowCount, 25].Value?.ToString() : "",
SaldoFinal = worksheet.Cells[rowCount, 26].Value != null ? worksheet.Cells[rowCount, 26].Value?.ToString() : "",
Anticipo = worksheet.Cells[rowCount, 27].Value != null ? worksheet.Cells[rowCount, 27].Value?.ToString() : "",
UUID = worksheet.Cells[rowCount, 28].Value != null ? worksheet.Cells[rowCount, 28].Value?.ToString() : "",
Descripcion = worksheet.Cells[rowCount, 29].Value != null ? worksheet.Cells[rowCount, 29].Value?.ToString() : "",
Remitente = worksheet.Cells[rowCount, 30].Value != null ? worksheet.Cells[rowCount, 30].Value?.ToString() : "",
Pedido = worksheet.Cells[rowCount, 31].Value != null ? worksheet.Cells[rowCount, 31].Value?.ToString() : "",
TipoMercancia = worksheet.Cells[rowCount, 32].Value != null ? worksheet.Cells[rowCount, 32].Value?.ToString() : "",
CampoAdicional5 = worksheet.Cells[rowCount, 33].Value != null ? worksheet.Cells[rowCount, 33].Value?.ToString() : "",
};
var resp = await _EstadosCuentaAlenRepo.Append(estadoCuenta);
rowCount++;
}
}
return Ok();
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
private string StringToDateTime(string s){
return DateTime.ParseExact(s, "dd/MM/yyyy",CultureInfo.InvariantCulture).ToString("yyyy-MM-dd");
}
[HttpGet("GetAll")]
public async Task<IActionResult> GetAll([FromQuery] DTOEstadosCuentaAlenFilters filters){
try{
var estados = await _EstadosCuentaAlenRepo.GetAll(filters);
return Ok(estados);
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
[HttpPost("Export")]
public async Task<IActionResult> Export([FromBody] DTOEstadosCuentaAlen[] estados){
try{
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
using (ExcelPackage excelPackage = new ExcelPackage()){
var worksheet = excelPackage.Workbook.Worksheets.Add("sheet1");
int rowCount = 2;
worksheet.Cells[$"A1"].Value = "Serie";
worksheet.Cells[$"B1"].Value = "Movimiento";
worksheet.Cells[$"C1"].Value = "Fecha";
worksheet.Cells[$"D1"].Value = "Trafico";
worksheet.Cells[$"E1"].Value = "Aduana";
worksheet.Cells[$"F1"].Value = "Patente";
worksheet.Cells[$"G1"].Value = "Pedimento";
worksheet.Cells[$"H1"].Value = "Cve. Pedim.";
worksheet.Cells[$"I1"].Value = "Impo/Expo";
worksheet.Cells[$"J1"].Value = "No. Cte.";
worksheet.Cells[$"K1"].Value = "Nombre Cliente";
worksheet.Cells[$"L1"].Value = "Cargos";
worksheet.Cells[$"M1"].Value = "Abonos";
worksheet.Cells[$"N1"].Value = "SaldoFinal";
worksheet.Cells[$"O1"].Value = "% IVA";
worksheet.Cells[$"P1"].Value = "Descripcion";
worksheet.Cells[$"Q1"].Value = "Remitente";
worksheet.Cells[$"R1"].Value = "Pedido";
worksheet.Cells[$"S1"].Value = "Orden Compra";
worksheet.Cells[$"T1"].Value = "Tipo Mcia";
foreach (var estado in estados){
worksheet.Cells[$"A{rowCount}"].Value = estado.Serie;
worksheet.Cells[$"B{rowCount}"].Value = estado.NoMovimiento;
worksheet.Cells[$"C{rowCount}"].Value = estado.Fecha;
worksheet.Cells[$"D{rowCount}"].Value = estado.Trafico;
worksheet.Cells[$"E{rowCount}"].Value = estado.Aduana;
worksheet.Cells[$"F{rowCount}"].Value = estado.Patente;
worksheet.Cells[$"G{rowCount}"].Value = estado.Pedimento;
worksheet.Cells[$"H{rowCount}"].Value = estado.Clave;
worksheet.Cells[$"I{rowCount}"].Value = estado.Impexp;
worksheet.Cells[$"J{rowCount}"].Value = estado.NoCliente;
worksheet.Cells[$"K{rowCount}"].Value = estado.Nombre;
worksheet.Cells[$"L{rowCount}"].Value = estado.Cargos;
worksheet.Cells[$"M{rowCount}"].Value = estado.Abonos;
worksheet.Cells[$"N{rowCount}"].Value = estado.SaldoFinal;
worksheet.Cells[$"O{rowCount}"].Value = estado.IvaAl;
worksheet.Cells[$"P{rowCount}"].Value = estado.Descripcion;
worksheet.Cells[$"Q{rowCount}"].Value = estado.Remitente;
worksheet.Cells[$"R{rowCount}"].Value = estado.Pedido;
worksheet.Cells[$"S{rowCount}"].Value = estado.OrdenCompra;
worksheet.Cells[$"T{rowCount}"].Value = estado.TipoMercancia;
rowCount++;
}
ExcelRange range = worksheet.Cells[1, 1,estados.Count() + 1, 20];
ExcelTable tab = worksheet.Tables.Add(range, "Table1");
tab.TableStyle = TableStyles.Light1;
worksheet.Cells[worksheet.Dimension.Address].AutoFitColumns();
worksheet.Cells[worksheet.Dimension.Address].Style.VerticalAlignment = ExcelVerticalAlignment.Center;
excelPackage.Workbook.Calculate();
var stream = new MemoryStream();
excelPackage.SaveAs(stream);
if(stream.Length > 0){
stream.Position = 0;
return File(stream,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml", $"Reporte_Operaciones.xlsx");
}else{
throw new Exception("Ocurrio un error al generar el reporte, intentelo de nuevo");
}
}
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
[HttpPost("AppendProgramacionesPago")]
public async Task<IActionResult> AppendProgramacionesPago(IFormFile file){
try{
FilePaths4Process RelativePath = await _RepoRelativePath.getPaths4ProcessById(46);
if(!System.IO.Directory.Exists(RootPathCorresponsales + RelativePath.Path)){
System.IO.Directory.CreateDirectory(RootPathCorresponsales + RelativePath.Path);
}
string filePath = RootPathCorresponsales + RelativePath.Path + file.FileName;
if(System.IO.File.Exists(filePath)){
System.IO.File.Delete(filePath);
}
//Si es un archivo nuevo se guarda
using(var stream = System.IO.File.Create(filePath)){
await file.CopyToAsync(stream);
}
//Leer el archivo con epplus
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
using(ExcelPackage package = new ExcelPackage(filePath)){
var worksheet = package.Workbook.Worksheets.FirstOrDefault();
int rowCount = 3;
while(string.IsNullOrWhiteSpace(worksheet?.Cells[rowCount, 2].Value?.ToString()) == false){
//Quitar el prefijo de la serie del numero de cuenta.
string folio = worksheet.Cells[rowCount, 2].Value != null ? worksheet.Cells[rowCount, 2].Value?.ToString().Substring(1,5) : "";
//Buscar el registro de la cuenta
var cuenta = await _EstadosCuentaAlenRepo.GetByFolio(folio);
if(cuenta.id != 0){
//Hacer la llamada a al base de datos para actualizar el registro
cuenta = await _EstadosCuentaAlenRepo.MarkAsProgramado(cuenta.NoMovimiento, cuenta.NoSerie);
}
rowCount++;
}
}
return Ok();
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
[HttpPost("AppendOrdenCompra")]
public async Task<IActionResult> AppendOrdenCompra([FromBody] DTOEstadosCuentaAlen data){
try{
var trafico = await _EstadosCuentaAlenRepo.AppendOrdenCompra(data);
return Ok(trafico);
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
[HttpPost("AppendObservaciones")]
public async Task<IActionResult> AppendObservaciones([FromBody] DTOEstadosCuentaAlen data){
try{
var trafico = await _EstadosCuentaAlenRepo.AppendObservaciones(data);
return Ok(trafico);
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
}
}

@ -1,54 +0,0 @@
using CORRESPONSALBackend.Contracts.Reportes.Facturacion;
using CORRESPONSALBackend.DTO.Reportes;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using OfficeOpenXml;
using OfficeOpenXml.Table;
namespace CORRESPONSALBackend.Controllers.Reportes.Facturacion{
[Authorize]
[ApiController]
[Route("api/[controller]")]
public class ReportesFacturacionController : ControllerBase{
private readonly IReportesFacturacionRepository _cuentasRepo;
public ReportesFacturacionController(IReportesFacturacionRepository cuentasRepo){
_cuentasRepo = cuentasRepo;
}
[HttpGet("CuentasFacturadas")]
public async Task<IActionResult> GetCuentasFacturadas([FromQuery] DTOReporteCorresponsales data){
try{
var cuentas = await _cuentasRepo.GetCuentasFacturadas(data);
return Ok(cuentas);
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
[HttpGet("FacturacionExcel")]
public async Task<IActionResult> GetFacturacionExcel([FromQuery] DTOReporteCorresponsales data ){
try{
var traficos = await _cuentasRepo.GetCuentasFacturadas(data);
var today = DateTime.Now;
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
using (ExcelPackage excelPackage = new ExcelPackage()){
var worksheet = excelPackage.Workbook.Worksheets.Add("sheet1");
worksheet.Cells["A1"].LoadFromCollection(traficos, true);
//Se crea la tabla en el rango de celdas donde se mostrara la inforamcion.
ExcelRange range = worksheet.Cells[1, 1,traficos.Count() + 1, 27];
ExcelTable tab = worksheet.Tables.Add(range, "Table1");
tab.TableStyle = TableStyles.Light1;
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", $"ReporteFacturacion_{today.Day}-{today.Month}-{today.Year}.xlsx");
}
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
}
}

@ -1,93 +0,0 @@
using CORRESPONSALBackend.Contracts.ArchivoElectronico;
using CORRESPONSALBackend.Contracts.Corresponsalias;
using CORRESPONSALBackend.Contracts.Utils;
using CORRESPONSALBackend.DTO.ArchivoElectronico;
using CORRESPONSALBackend.Models.Utils;
using CORRESPONSALBackend.Repository.Utils;
using GEMCO.Backend.Models.Reportes;
using Microsoft.AspNetCore.Mvc;
namespace CORRESPONSALBackend.Controllers.Utils{
[Route("api/[controller]")]
[ApiController]
public class ArchivoElectronicoController : ControllerBase {
private readonly IArchivoElectronicoRepository _AERepo;
private readonly IConfiguration _config;
private readonly IFilePaths4ProcessRepository _RepoRelativePath;
private readonly string RootPathCorresponsales;
private readonly ICorresponsaliasTraficosRepository _traficosRepository;
private readonly IFileManagerRepository _fileManagerRepo;
public ArchivoElectronicoController(IArchivoElectronicoRepository AERepo, IConfiguration config,
ICorresponsaliasTraficosRepository traficosRepository, IFilePaths4ProcessRepository RepoRelativePath,
IFileManagerRepository fileManagerRepo){
_AERepo = AERepo;
_traficosRepository = traficosRepository;
_config = config;
_RepoRelativePath = RepoRelativePath;
_fileManagerRepo = fileManagerRepo;
RootPathCorresponsales = _config.GetValue<string>("AllFiles");
}
[HttpGet]
[Route("RptArchivoElectronicoOficial")]
public async Task<List<RptPedimentosPagadosAEO>> GetReporteArchivElectronicoOficial([FromQuery] DTOAEPeriodo DTOData)
{
List<RptPedimentosPagadosAEO> data = await _AERepo.getRptPedimentoPagadosAEO(DTOData);
return data;
}
[HttpPost]
[Route("DownloadZippedArchivosOficiales")]
public async Task<IActionResult> DownloadZippedArchivosOficiales([FromBody] DTOAEPeriodoSeleccion data){
try{
//Se obtiene la ruta donde se alojará temporalmente el zip
FilePaths4Process tempFilesRelativePath = await _RepoRelativePath.getPaths4ProcessById(44); // Path: Corresponsales\Zips\Facturacion\Entregas\
var tempFilesPath = RootPathCorresponsales + tempFilesRelativePath.Path;// Path: C:data\Corresponsales\Zips\Clientes\ArchivosElectronicos
string tempFolderName = "ReporteArchivosElectronicos";//Nombre del folder Temporal
string tempFolderPath= tempFilesPath + $"{tempFolderName}\\";//ruta del folder temporal Path: C:data\Corresponsales\Zips\Clientes\ArchivosElectronicos\ReporteArchivosElectronicos
string zipFileName = $"{tempFolderName}.zip";//Nombre del zip final
var zipFilePath = tempFilesPath + zipFileName;//Ruta del zip final Path: C:data\Corresponsales\Zips\Clientes\ArchivosElectronicos\ReporteArchivosElectronicos.zip
if(System.IO.File.Exists(zipFilePath)){//Si ya existe un zip de una descarga anterior lo borra
System.IO.File.Delete(zipFilePath);
}
if(System.IO.Directory.Exists(tempFolderPath)){//Si ya existe la carpeta temporal de una descarga anterior la borra
System.IO.Directory.Delete(tempFolderPath, true);
}
System.IO.Directory.CreateDirectory(tempFolderPath);//Se crea el folder temporal donde se pondran los archivos oficiales
foreach(var referencia in data.Referencias){
var trafico = await _traficosRepository.GetByReferencia(referencia);
string folderAE = tempFolderPath + $"{referencia}\\";//Se obtiene el nombre de la subcarpeta del AE de cada referencia
if(System.IO.Directory.Exists(folderAE)){//Si existe la carpeta se borra
System.IO.Directory.Delete(folderAE);
}
System.IO.Directory.CreateDirectory(folderAE);//Se crea la carpeta
//Obtener la lista de archivos de la referencia actual.
var filesLog = await _fileManagerRepo.GetTraficoFiles(trafico.id);
var filteredFilesLog = filesLog.Where(x => new List<int>(){2,10,11,12,13,14,15,19,17,18,37,38,39,41}.Contains(x.Proceso));
foreach(var fileLog in filteredFilesLog){
FilePaths4Process fileRelativePath = await _RepoRelativePath.getPaths4ProcessById(fileLog.Proceso);//Se obtiene la ruta relativa donde debe estar alojado el archivo
var filePath = RootPathCorresponsales + fileRelativePath.Path + fileLog!.NombreArchivo;//Ahora se obtiene la ruta completa del archivo.
if(System.IO.File.Exists(filePath)){
var bytes = await System.IO.File.ReadAllBytesAsync(filePath);
var originalFileStream = new MemoryStream(bytes);
using(var tempFileStream = System.IO.File.Create(folderAE + fileLog.NombreArchivo)){
await originalFileStream.CopyToAsync(tempFileStream);
}
}
}
}
System.IO.Compression.ZipFile.CreateFromDirectory(tempFolderPath, zipFilePath);//Se comprime la carpeta con los archivos electronicos de las referencias
Directory.Delete(tempFolderPath, true);//Se borra el folder temporal
var zipBytes = await System.IO.File.ReadAllBytesAsync(zipFilePath);
var zipStream = new MemoryStream(zipBytes);
return File(zipStream, "application/zip", zipFileName);
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
}
}

@ -39,13 +39,9 @@ namespace CORRESPONSALBackend.Controllers.Utils
[Route("GetFileContentById")]
public async Task<IActionResult> GetFileContentById(long id, int Proceso)
{
try{
FilePaths4Process RelativePath = await _RepoRelativePath.getPaths4ProcessById(Proceso);
SvcMFileManager FM = new SvcMFileManager(_config, _Repo, RootPath + RelativePath.Path);
return await FM.getFileContentById(id);
}catch(Exception ex){
return BadRequest(ex.Message);
}
}

@ -6,7 +6,6 @@ using CORRESPONSALBackend.DTO.Corresponsales;
namespace CORRESPONSALBackend.Controllers
{
[Authorize]
[Route("api/[controller]")]
[ApiController]
public class ReportesController : ControllerBase

@ -1,50 +0,0 @@
namespace CORRESPONSALBackend.DTO.Reportes.Alen{
public class DTOEstadosCuentaAlen{
public int id { get; set; }
public string? TipoMovimiento { get; set; } = "";
public string? NoSerie { get; set; } = "";
public string? NoMovimiento {get;set;} = "";
public string? Trafico {get;set;} = "";
public string? Impexp {get;set;} = "";
public string? Aduana {get;set;} = "";
public string? Patente {get;set;} = "";
public string? Pedimento {get;set;} = "";
public string? Clave {get;set;} = "";
public string? NoCliente {get;set;} = "";
public string? NoCentro {get;set;} = "";
public string? SubCentro {get;set;} = "";
public string? Nombre {get;set;} = "";
public string? SubCtaNombre {get;set;} = "";
public string? TipoRangos {get;set;} = "";
public string? Cargos {get;set;} = "";
public string? Abonos {get;set;} = "";
public string? Fecha {get;set;} = "";
public string? FechaPedimento {get;set;} = "";
public string? FechaRev {get;set;} = "";
public string? DiasPedimCta {get;set;} = "";
public string? DiasCtaRev {get;set;} = "";
public string? DiasRev {get;set;} = "";
public string? IvaAl {get;set;} = "";
public string? TotalFacturado {get;set;} = "";
public string? SaldoFinal {get;set;} = "";
public string? Anticipo {get;set;} = "";
public string? UUID {get;set;} = "";
public string? Descripcion {get;set;} = "";
public string? Remitente {get;set;} = "";
public string? Pedido {get;set;} = "";
public string? TipoMercancia {get;set;} = "";
public string? CampoAdicional5 {get;set;} = "";
public int? IdPdf {get;set;}=0;
public string? Pdf {get;set;}="";
public int? IdXml {get;set;}=0;
public string? Xml {get;set;}="";
public int? IdNotasCargo {get;set;}=0;
public string? NotasCargo {get;set;}="";
public bool? Programado {get;set;} = false;
public string? Serie {get;set;} = "";
public int? IdOrdenCompra {get;set;} = 0;
public string? OrdenCompra {get;set;} = "";
public int? IdObservaciones {get;set;} = 0;
public string? Observaciones {get;set;} = "";
}
}

@ -1,13 +0,0 @@
namespace CORRESPONSALBackend.DTO.Reportes.Alen{
public class DTOEstadosCuentaAlenFilters{
public string? Trafico {get;set;}="";
public string? Impexp {get;set;}="";
public string? Aduana {get;set;}="";
public string? Patente {get;set;}="";
public string? Pedimento {get;set;}="";
public string? Inicio {get;set;}="";
public string? Fin {get;set;}="";
public string? Remitente {get;set;}="";
public string? Programado {get;set;} = "";
}
}

@ -18,9 +18,8 @@ namespace CORRESPONSALBackend.DTO.Reportes.CuentasCerradas{
public string TipoCambio { get; set; }
public string ValorComercial { get; set; }
public string Fracciones { get; set; }
public string TotalPagado { get; set; }
/* public string Caja { get; set; }
public string Caja { get; set; }
public string FechaCruce {get;set;}
public string Semaforo {get;set;} */
public string Semaforo {get;set;}
}
}

@ -1,32 +0,0 @@
namespace CORRESPONSALBackend.DTO.Reportes.Facturacion{
public class DTOReporteGeneralFacturacion
{
public string Trafico { get; set; }
public string Corresponsal { get; set; }
public string Aduana { get; set; }
public int Patente { get; set; }
public string PedimentoCorreponsal { get; set; }
public string PedimentoCorresponsalR1 { get; set; }
public string FechaPago { get; set; }
public string FechaAnticipo { get; set; }
public double SumaAnticipoCorresponsalFinanciado { get; set; }
public string FechaAlta { get; set; }
public string UsuarioAlta { get; set; }
public int Cliente { get; set; }
public string Nombrecliente { get; set; }
public string Cuenta { get; set; }
public string TipoOperacion { get; set; }
public string Terminado { get; set; }
public string FechaRegistroContabilizar { get; set; }
public string FechaContabilizado { get; set; }
public string FechaFacturado { get; set; }
public string FechaFacturaCorresponsal { get; set; }
public string FechaCruce { get; set; }
public string MotivoCuentaRechazadaContabilidad { get; set; }
public string MotivoCuentaRechazadaFacturacion { get; set; }
public string MotivoSolicitaReapertura { get; set; }
public string SolicitudReaperturaAutorizada { get; set; }
public string EstatusOperacion { get; set; }
public string CargoShipper { get; set; }
}
}

@ -6,8 +6,5 @@
public string Nombre { set; get; } = null!;
public int IdCliente { set; get; } = 0;
public Boolean Activo { set; get; } = true;
public int? IdCorresponsal {get;set;} = null;
public int? Tipo {get; set;} = 0;
public int? Moneda {get; set;} = 0;
}
}

@ -8,6 +8,5 @@
public string? Concepto { set; get; } = null!;
public double Costo { set; get; } = 0;
public int Activo { set; get; } = 0;
public double CostoCorresponsal { set; get; } = 0;
}
}

@ -1,39 +0,0 @@
namespace CORRESPONSALBackend.Models.Clientes.Alen{
public class EstadosCuenta{
public int id { get; set; }
public string? TipoMovimiento { get; set; } = "";
public string? NoSerie { get; set; } = "";
public string? NoMovimiento {get;set;} = "";
public string? Trafico {get;set;} = "";
public string? Impexp {get;set;} = "";
public string? Aduana {get;set;} = "";
public string? Patente {get;set;} = "";
public string? Pedimento {get;set;} = "";
public string? Clave {get;set;} = "";
public string? NoCliente {get;set;} = "";
public string? NoCentro {get;set;} = "";
public string? SubCentro {get;set;} = "";
public string? Nombre {get;set;} = "";
public string? SubCtaNombre {get;set;} = "";
public string? TipoRangos {get;set;} = "";
public string? Cargos {get;set;} = "";
public string? Abonos {get;set;} = "";
public string? Fecha {get;set;} = "";
public string? FechaPedimento {get;set;} = "";
public string? FechaRev {get;set;} = "";
public string? DiasPedimCta {get;set;} = "";
public string? DiasCtaRev {get;set;} = "";
public string? DiasRev {get;set;} = "";
public string? IvaAl {get;set;} = "";
public string? TotalFacturado {get;set;} = "";
public string? SaldoFinal {get;set;} = "";
public string? Anticipo {get;set;} = "";
public string? UUID {get;set;} = "";
public string? Descripcion {get;set;} = "";
public string? Remitente {get;set;} = "";
public string? Pedido {get;set;} = "";
public string? TipoMercancia {get;set;} = "";
public string? CampoAdicional5 {get;set;} = "";
public bool? Programado = false;
}
}

@ -9,6 +9,5 @@
public string Concepto { get; set; } = null!;
public double Costo { get; set; } = 0;
public byte Activo { get; set; } = 0;
public double CostoCorresponsal {get; set;} = 0;
}
}

@ -1,11 +0,0 @@
namespace GEMCO.Backend.Models.Reportes
{
public class RptPedimentosPagadosAEO
{
public string Referencia { set; get; } = null!;
public int Aduana { get; set; } = 0;
public int Patente { get; set; } = 0;
public int Pedimento { get; set; } = 0;
public string FechaPago { set; get; } = null!;
}
}

@ -50,13 +50,6 @@ using CORRESPONSALBackend.Services.Reportes.Alen;
using CORRESPONSALBackend.Contracts.Reportes.CuentasCerradas;
using CORRESPONSALBackend.Repository.Reportes.CuentasCerradas;
using CORRESPONSALBackend.Services.Reportes.CuentasCerradas;
using CORRESPONSALBackend.Contracts.Reportes;
using CORRESPONSALBackend.Services.Reportes;
using CORRESPONSALBackend.Contracts.ArchivoElectronico;
using CORRESPONSALBackend.Services;
using CORRESPONSALBackend.Repository.Reportes.Alen;
using CORRESPONSALBackend.Contracts.Reportes.Facturacion;
using CORRESPONSALBackend.Repository.Reportes.Facturacion;
var builder = WebApplication.CreateBuilder(args);
@ -83,7 +76,6 @@ builder.Services.AddScoped<IReportesAlenService, ReportesAlenService>();
builder.Services.AddScoped<IReportesAlenRepository, ReportesAlenRepository>();
builder.Services.AddScoped<IReporteCuentasCerradasRepository, ReporteCuentasCerradasRepository>();
builder.Services.AddScoped<IReporteCuentasCerradasService, ReporteCuentasCerradasService>();
builder.Services.AddScoped<IReportesFacturacionRepository, ReportesFacturacionRepository>();
// Corresponsalias
builder.Services.AddScoped<IContabilidadCorresponsaliasRepository, ContabilidadCorresponsaliasRepository>();
builder.Services.AddScoped<ICorresponsaliasContenedoresRepository, CorresponsaliasContenedoresRepository>();
@ -98,13 +90,9 @@ builder.Services.AddScoped<ICorresponsaliasPedimentoPartidasRepository, Correspo
builder.Services.AddScoped<ICorresponsaliasCuentasComplementarias, CorresponsaliasCuentaComplementariaRepository>();
builder.Services.AddScoped<ICorresponsaliasPedimentosConsolidadosRepository, CorresponsaliasPedimentosConsolidadosRepository>();
builder.Services.AddScoped<ICorresponsaliasSolicitudesRepository, CorresponsaliasSolicitudesRepository>();
builder.Services.AddScoped<ITraficosClientesService, TraficosClientesService>();
builder.Services.AddScoped<IArchivoElectronicoRepository, ArchivoElectronicoRepository>();
builder.Services.AddScoped<IArchivoElectronicoService, ArchivoElectronicoService>();
//Clientes
builder.Services.AddScoped<ICasaCuervoRepository, CasaCuervoRepository>();
//Estados de Cuenta
builder.Services.AddScoped<IEstadosCuentaAlenRepository, EstadosCuentaAlenRepository>();
// Dashboards
builder.Services.AddScoped<IDashboardCorresponsalesRepository, DashboardCorresponsalesRepository>();

@ -1,31 +0,0 @@
using System.Data;
using CORRESPONSALBackend.Context;
using CORRESPONSALBackend.Contracts.ArchivoElectronico;
using CORRESPONSALBackend.DTO.ArchivoElectronico;
using Dapper;
using GEMCO.Backend.Models.Reportes;
namespace CORRESPONSALBackend.Repository{
public class ArchivoElectronicoRepository : IArchivoElectronicoRepository
{
private readonly DapperContext _context;
public ArchivoElectronicoRepository(DapperContext context) { _context = context; }
public async Task<List<RptPedimentosPagadosAEO>> getRptPedimentoPagadosAEO(DTOAEPeriodo data)
{
var query = "getRptArchivoElectronicoOficial";
using (var connection = _context.CreateConnection())
{
var entrada = await connection.QueryAsync<RptPedimentosPagadosAEO>(query,
new
{
@Anio = data.Anio,
@Mes = data.Mes,
@NoCliente = data.NoCliente,
@TipoOperacion = data.TipoOperacion
},
commandType: CommandType.StoredProcedure);
return entrada.ToList();
}
}
}
}

@ -21,7 +21,6 @@ namespace CORRESPONSALBackend.Repository.Catalogos
data.IdTabulador,
data.IdConcepto,
data.Costo,
data.CostoCorresponsal
},
commandType: CommandType.StoredProcedure);
return entrada;

@ -12,15 +12,14 @@ namespace CORRESPONSALBackend.Repository.Catalogos
private readonly DapperContext _context;
public TabuladorRepository(DapperContext context) { _context = context; }
public async Task<IEnumerable<Tabulador>> GetAll(int id, int IdCliente, int? idCorresponsal)
public async Task<IEnumerable<Tabulador>> GetAll(int id, int IdCliente)
{
var query = "[Catalogo.Tabulador.Get]";
using var connection = _context.CreateConnection();
var entrada = await connection.QueryAsync<Tabulador>(query, new
{
@id = id,
@IdCliente = IdCliente,
@IdCorresponsal = idCorresponsal
@IdCliente = IdCliente
},
commandType: CommandType.StoredProcedure);
return entrada;
@ -36,9 +35,6 @@ namespace CORRESPONSALBackend.Repository.Catalogos
data.id,
data.Nombre,
data.IdCliente,
data.IdCorresponsal,
data.Tipo,
data.Moneda
},
commandType: CommandType.StoredProcedure);
return entrada.First();

@ -1,138 +0,0 @@
using System.Data;
using CORRESPONSALBackend.Context;
using CORRESPONSALBackend.Contracts.Reportes.Alen;
using CORRESPONSALBackend.DTO.Reportes.Alen;
using CORRESPONSALBackend.Models.Clientes.Alen;
using Dapper;
namespace CORRESPONSALBackend.Repository.Reportes.Alen{
public class EstadosCuentaAlenRepository : IEstadosCuentaAlenRepository
{
private readonly DapperContext _context;
private readonly IConfiguration _config;
public EstadosCuentaAlenRepository(DapperContext context, IConfiguration config)
{
_context = context;
_config = config;
}
public async Task<EstadosCuenta> Append(EstadosCuenta data)
{
var query = "[EstadosCuenta.Alen.Append]";
using (var connection = _context.CreateConnection())
{
var estado = await connection.QueryAsync<EstadosCuenta>(query, new
{
data.TipoMovimiento,
data.NoSerie,
data.NoMovimiento,
data.Trafico,
data.Impexp,
data.Aduana,
data.Patente,
data.Pedimento,
data.Clave,
data.NoCliente,
data.NoCentro,
data.SubCentro,
data.Nombre,
data.SubCtaNombre,
data.TipoRangos,
data.Cargos,
data.Abonos,
data.Fecha,
data.FechaPedimento,
data.FechaRev,
data.DiasPedimCta,
data.DiasCtaRev,
data.DiasRev,
data.IvaAl,
data.TotalFacturado,
data.SaldoFinal,
data.Anticipo,
data.UUID,
data.Descripcion,
data.Remitente,
data.Pedido,
data.TipoMercancia,
data.CampoAdicional5,
}, commandType: CommandType.StoredProcedure);
return estado.First();
}
}
public async Task<EstadosCuenta> AppendObservaciones(DTOEstadosCuentaAlen data)
{
var query = "[EstadosCuenta.Alen.AppendObservaciones]";
using (var connection = _context.CreateConnection())
{
var cuenta = await connection.QueryAsync<EstadosCuenta>(query, new {data.IdObservaciones, @NoCuenta = data.NoMovimiento, data.Observaciones}, commandType: CommandType.StoredProcedure);
return cuenta.First();
}
}
public async Task<EstadosCuenta> AppendOrdenCompra(DTOEstadosCuentaAlen data)
{
var query = "[EstadosCuenta.Alen.AppendOrdenCompra]";
using (var connection = _context.CreateConnection())
{
var cuenta = await connection.QueryAsync<EstadosCuenta>(query, new {data.IdOrdenCompra, @NoCuenta = data.NoMovimiento, data.OrdenCompra}, commandType: CommandType.StoredProcedure);
return cuenta.First();
}
}
public async Task ClearData()
{
var query = "[EstadosCuenta.Alen.Clear]";
using (var connection = _context.CreateConnection())
{
await connection.QueryAsync<DTOEstadosCuentaAlen>(query, new {}, commandType: CommandType.StoredProcedure);
}
}
public async Task<IEnumerable<DTOEstadosCuentaAlen>> GetAll(DTOEstadosCuentaAlenFilters filters)
{
var query = "[EstadosCuenta.Alen.GetAll]";
using (var connection = _context.CreateConnection())
{
var estados = await connection.QueryAsync<DTOEstadosCuentaAlen>(query, new {
filters.Trafico,
filters.Impexp,
filters.Aduana,
filters.Patente,
filters.Pedimento,
filters.Inicio,
filters.Fin,
filters.Remitente,
filters.Programado
}, commandType: CommandType.StoredProcedure);
return estados;
}
}
public async Task<EstadosCuenta> GetByFolio(string Folio)
{
var query = "[EstadosCuenta.Alen.GetByFolio]";
using (var connection = _context.CreateConnection())
{
var cuenta= await connection.QueryAsync<EstadosCuenta>(query, new {
@Folio
}, commandType: CommandType.StoredProcedure);
return cuenta.FirstOrDefault(new EstadosCuenta(){id=0});
}
}
public async Task<EstadosCuenta> MarkAsProgramado(string NoMovimiento, string NoSerie)
{
var query = "[EstadosCuenta.Alen.MarkAsProgramado]";
using (var connection = _context.CreateConnection())
{
var cuenta= await connection.QueryFirstOrDefaultAsync<EstadosCuenta>(query, new {
@NoCuenta = NoMovimiento,
@NoSerie = NoSerie
}, commandType: CommandType.StoredProcedure);
return cuenta;
}
}
}
}

@ -1,34 +0,0 @@
using System.Data;
using CORRESPONSALBackend.Context;
using CORRESPONSALBackend.Contracts.Reportes.Facturacion;
using CORRESPONSALBackend.DTO.Reportes;
using CORRESPONSALBackend.DTO.Reportes.Facturacion;
using Dapper;
namespace CORRESPONSALBackend.Repository.Reportes.Facturacion{
public class ReportesFacturacionRepository : IReportesFacturacionRepository
{
private readonly DapperContext _context;
public ReportesFacturacionRepository(DapperContext context) { _context = context; }
public async Task<IEnumerable<DTOReporteGeneralFacturacion>> GetCuentasFacturadas(DTOReporteCorresponsales data)
{
var query = "[Reportes.Facturacion.GetCuentasFacturadas]";
using var connection = _context.CreateConnection();
var entrada = await connection.QueryAsync<DTOReporteGeneralFacturacion>(query, new
{
@Inicio = data.Inicio,
@Fin = data.Fin,
@NoCliente = data.NoCliente,
@TipoOperacion = data.TipoOperacion,
@IdCorresponsal = data.IdCorresponsal,
@Patente = data.Patente,
@Aduana = data.Aduana,
@Pedimento = data.Pedimento,
@Proceso = data.Proceso,
@Modo = data.Modo
},
commandType: CommandType.StoredProcedure);
return entrada;
}
}
}

@ -122,16 +122,5 @@ namespace CORRESPONSALBackend.Repository.Utils
commandType: CommandType.StoredProcedure);
return entrada.FirstOrDefault();
}
public async Task<IEnumerable<FileManager>> GetTraficoFiles(int idTrafico){
string query = "[Utils.FileManager.GetTraficoFiles]";
using var connection = _context.CreateConnection();
var entrada = await connection.QueryAsync<FileManager>(query, new
{
@idtrafico = idTrafico
},
commandType: CommandType.StoredProcedure);
return entrada.ToList();
}
}
}

@ -1,7 +0,0 @@
using CORRESPONSALBackend.Contracts.ArchivoElectronico;
namespace CORRESPONSALBackend.Services{
public class ArchivoElectronicoService : IArchivoElectronicoService{
}
}

@ -15,7 +15,7 @@ namespace CORRESPONSALBackend.Services.Reportes.CuentasCerradas{
var worksheet = excelPackage.Workbook.Worksheets.Add("sheet1");
worksheet.Cells["A1"].LoadFromCollection(cuentas, true);
//Se crea la tabla en el rango de celdas donde se mostrara la inforamcion.
ExcelRange range = worksheet.Cells[1, 1,cuentas.Count() + 1, 19];
ExcelRange range = worksheet.Cells[1, 1,cuentas.Count() + 1, 21];
ExcelTable tab = worksheet.Tables.Add(range, "Table1");
tab.TableStyle = TableStyles.Light1;
worksheet.Cells[worksheet.Dimension.Address].AutoFitColumns();
@ -23,12 +23,12 @@ namespace CORRESPONSALBackend.Services.Reportes.CuentasCerradas{
worksheet.Column(10).Style.WrapText = true;
worksheet.Column(11).Width = 100;
worksheet.Column(11).Style.WrapText = true;
/* worksheet.Column(19).Width = 100;
worksheet.Column(19).Width = 100;
worksheet.Column(19).Style.WrapText = true;
worksheet.Column(20).Width = 100;
worksheet.Column(20).Style.WrapText = true;
worksheet.Column(21).Width = 100;
worksheet.Column(21).Style.WrapText = true; */
worksheet.Column(21).Style.WrapText = true;
worksheet.Cells[worksheet.Dimension.Address].Style.VerticalAlignment = ExcelVerticalAlignment.Center;
excelPackage.Workbook.Calculate();
var stream = new MemoryStream();

@ -1,63 +0,0 @@
using CORRESPONSALBackend.Contracts.Reportes;
using CORRESPONSALBackend.DTO.Corresponsales;
using OfficeOpenXml;
using OfficeOpenXml.Table;
namespace CORRESPONSALBackend.Services.Reportes{
public class TraficosClientesService : ITraficosClientesService{
public TraficosClientesService(){
}
public async Task<MemoryStream> GetExcel(IEnumerable<DTOCorresponsalTrafico> traficos)
{
try{
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
using (ExcelPackage excelPackage = new ExcelPackage()){
var worksheet = excelPackage.Workbook.Worksheets.Add("sheet1");
worksheet.Cells["A1"].Value="Estado";
worksheet.Cells["B1"].Value="Trafico";
worksheet.Cells["C1"].Value="Fecha Registro";
worksheet.Cells["D1"].Value="Usuario";
worksheet.Cells["E1"].Value="Cliente";
worksheet.Cells["F1"].Value="Tipo Operación";
worksheet.Cells["G1"].Value="Estado Operación";
worksheet.Cells["H1"].Value="Patente";
worksheet.Cells["I1"].Value="Aduana";
worksheet.Cells["J1"].Value="Pedimento";
worksheet.Cells["K1"].Value="Fecha Pago";
worksheet.Cells["L1"].Value="Fecha Desaduanado";
worksheet.Cells["M1"].Value="Fecha Ultima Actualización";
int currentRow=2;
foreach(var trafico in traficos){
worksheet.Cells[$"A{currentRow}"].Value = trafico.Proceso == 1 ? "Por Terminar" : trafico.Proceso == 2 || trafico.Proceso == 3 ? "Despachado sin Facturar" : "Despachado y Facturado";
worksheet.Cells[$"B{currentRow}"].Value = trafico.Trafico;
worksheet.Cells[$"C{currentRow}"].Value = trafico.FechaRegistro;
worksheet.Cells[$"D{currentRow}"].Value = trafico.sUsuario;
worksheet.Cells[$"E{currentRow}"].Value = trafico.sCliente;
worksheet.Cells[$"F{currentRow}"].Value = trafico.sTipoOperacion;
worksheet.Cells[$"G{currentRow}"].Value = trafico.sEstatus;
worksheet.Cells[$"H{currentRow}"].Value = trafico.Patente;
worksheet.Cells[$"I{currentRow}"].Value = trafico.Aduana;
worksheet.Cells[$"J{currentRow}"].Value = trafico.Pedimento;
worksheet.Cells[$"K{currentRow}"].Value = trafico.FechaPago;
worksheet.Cells[$"L{currentRow}"].Value = trafico.FechaDesaduanamiento;
worksheet.Cells[$"M{currentRow}"].Value = trafico.UltimaActualizacion;
currentRow++;
}
ExcelRange range = worksheet.Cells[1, 1,traficos.Count() + 1, 13];
ExcelTable tab = worksheet.Tables.Add(range, "Table1");
tab.TableStyle = TableStyles.Light1;
worksheet.Cells[worksheet.Dimension.Address].AutoFitColumns();
excelPackage.Workbook.Calculate();
var stream = new MemoryStream();
excelPackage.SaveAs(stream);
stream.Position = 0;
return stream;
}
}catch(Exception ex){
throw new Exception(ex.Message);
}
}
}
}

@ -8,7 +8,6 @@
"Microsoft.AspNetCore": "Warning"
}
},
"DataDisk":"C:\\",
"EmailServer": "gemcousa-com.mail.protection.outlook.com",
"EmailPort": 25,
"pathArchivoElectronico": "C:\\downs\\ArchivoElectronicoSIR\\www.gemcousa.com\\SIR-GEMCO\\DOCS-SIR\\",

@ -8,7 +8,6 @@
"Microsoft.AspNetCore": "Warning"
}
},
"DataDisk":"D:\\",
"EmailServer": "gemcousa-com.mail.protection.outlook.com",
"EmailPort": 25,
"pathArchivoElectronico": "D:\\data\\ArchivoElectronicoSIR\\www.gemcousa.com\\SIR-GEMCO\\DOCS-SIR\\",

@ -19,7 +19,6 @@
"Subject": "JWTServiceAccessToken",
"ExpirationHours": 4
},
"DataDisk":"D:\\",
"EmailServer": "gemcousa-com.mail.protection.outlook.com",
"EmailPort": 25,
"pathArchivoElectronico": "D:\\data\\ArchivoElectronicoSIR\\www.gemcousa.com\\SIR-GEMCO\\DOCS-SIR\\",

@ -12,7 +12,7 @@
</aspNetCore>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="209715200" />
<requestLimits maxAllowedContentLength="62914561" />
</requestFiltering>
</security>
</system.webServer>

Loading…
Cancel
Save