Compare commits

..

No commits in common. 'main' and 'develop' have entirely different histories.

  1. 477
      .gitignore
  2. 7
      .vscode/settings.json
  3. 3
      CORRESPONSALBackend.csproj
  4. 25
      CORRESPONSALBackend.sln
  5. 9
      Contracts/ArchivoElectronico/IArchivoElectronicoRepository.cs
  6. 5
      Contracts/ArchivoElectronico/IArchivoElectronicoService.cs
  7. 5
      Contracts/Auth/IAuthService.cs
  8. 12
      Contracts/Catalogos/ICatCentrosCostos.cs
  9. 9
      Contracts/Catalogos/ICatClavesPedimentosRepository.cs
  10. 7
      Contracts/Catalogos/ICatTiposContenedoresRepository.cs
  11. 2
      Contracts/Catalogos/ITabuladorRepository.cs
  12. 8
      Contracts/Catalogos/ITiposMercanciaRepository.cs
  13. 3
      Contracts/Contabilidad/Corresponsalias/IContabilidadCorresponsaliasRepository.cs
  14. 7
      Contracts/Corresponsalias/Anticipos/ICorresponsaliasAnticiposService.cs
  15. 1
      Contracts/Corresponsalias/ICorresponsaliasAnticiposRepository.cs
  16. 9
      Contracts/Corresponsalias/ICorresponsaliasPedimentosConsolidadosRepository.cs
  17. 11
      Contracts/Corresponsalias/ICorresponsaliasSolicitudesRepository.cs
  18. 9
      Contracts/Corresponsalias/ICorresponsaliasTraficosRepository.cs
  19. 7
      Contracts/Corresponsalias/Services/ICorresponsaliasFacturasService.cs
  20. 6
      Contracts/Corresponsalias/Services/ICorresponsaliasTraficosService.cs
  21. 6
      Contracts/Dashboard/IDashboardCorresponsalesRepository.cs
  22. 3
      Contracts/IClientesRepository.cs
  23. 16
      Contracts/Reportes/Alen/IEstadosCuentaAlenRepository.cs
  24. 5
      Contracts/Reportes/Alen/IReportesAlenRepository.cs
  25. 8
      Contracts/Reportes/Alen/IReportesAlenService.cs
  26. 7
      Contracts/Reportes/CuentasCerradas/IReporteCuentasCerradasRepository.cs
  27. 7
      Contracts/Reportes/CuentasCerradas/IReporteCuentasCerradasService.cs
  28. 9
      Contracts/Reportes/Embarques/IReportesEmbarquesRepository.cs
  29. 9
      Contracts/Reportes/Embarques/IReportesEmbarquesService.cs
  30. 8
      Contracts/Reportes/Facturacion/IReportesFacturacionRepository.cs
  31. 9
      Contracts/Reportes/GC50/IReporteGC50Repository.cs
  32. 7
      Contracts/Reportes/GC50/IReporteGC50Services.cs
  33. 7
      Contracts/Reportes/ITraficosClientesService.cs
  34. 13
      Contracts/Reportes/Newell/Mensual/IReporteMensualRepository.cs
  35. 5
      Contracts/Reportes/Newell/Mensual/IReporteMensualService.cs
  36. 5
      Contracts/Reportes/Newell/Semanal/IReporteSemanalService.cs
  37. 5
      Contracts/Utils/IFileManagerRepository.cs
  38. 9
      Controllers/AuthController.cs
  39. 40
      Controllers/Catalogos/CatCentrosCostosController.cs
  40. 23
      Controllers/Catalogos/CatClavesPedimentosController.cs
  41. 22
      Controllers/Catalogos/CatTiposContenedoresController.cs
  42. 6
      Controllers/Catalogos/TabuladorController.cs
  43. 25
      Controllers/Catalogos/TiposMercanciaController.cs
  44. 31
      Controllers/ClientesController.cs
  45. 12
      Controllers/Contabilidad/Corresponsales/ContabilidadTraficoController.cs
  46. 47
      Controllers/Corresponsalias/AnticiposController.cs
  47. 1
      Controllers/Corresponsalias/CatMediosEmbarquesController.cs
  48. 2
      Controllers/Corresponsalias/CatTiposEmbarqueController.cs
  49. 1
      Controllers/Corresponsalias/CuentasComplementariasController.cs
  50. 18
      Controllers/Corresponsalias/FacturasController.cs
  51. 42
      Controllers/Corresponsalias/PedimentosConsolidadosController.cs
  52. 57
      Controllers/Corresponsalias/SolicitudesController.cs
  53. 113
      Controllers/Corresponsalias/TraficosController.cs
  54. 59
      Controllers/Dashboard/CorresponsalesController.cs
  55. 425
      Controllers/FileManagerController.cs
  56. 2
      Controllers/PerfilesController.cs
  57. 252
      Controllers/Reportes/Alen/ReporteEstadosCuentaAlenController.cs
  58. 54
      Controllers/Reportes/Facturacion/ReportesFacturacionController.cs
  59. 30
      Controllers/Reportes/ReporteCuentasCerradasController.cs
  60. 43
      Controllers/Reportes/ReporteGC50Controller.cs
  61. 58
      Controllers/Reportes/ReportesAlenController.cs
  62. 84
      Controllers/Reportes/ReportesEmbarquesController.cs
  63. 54
      Controllers/Reportes/ReportesNewell.cs
  64. 2
      Controllers/UsuariosController.cs
  65. 93
      Controllers/Utils/ArchivoElectronicoController.cs
  66. 4
      Controllers/Utils/MFileManagerController.cs
  67. 1
      Controllers/Utils/ReportesController.cs
  68. 5
      DTO/Corresponsales/DTOCorresponsalTrafico.cs
  69. 12
      DTO/Corresponsales/DTOPdfAnticipo.cs
  70. 11
      DTO/Corresponsales/DTORectificacionHistorico.cs
  71. 2
      DTO/Corresponsales/DTOTraficoCompleto.cs
  72. 11
      DTO/Corresponsales/DTOTraficoSolicitud.cs
  73. 11
      DTO/DTOCentrosCostos.cs
  74. 50
      DTO/Reportes/Alen/DTOEstadosCuentaAlen.cs
  75. 13
      DTO/Reportes/Alen/DTOEstadosCuentaAlenFilters.cs
  76. 20
      DTO/Reportes/Alen/DTOReporteFacturasTraficosConsolidados.cs
  77. 26
      DTO/Reportes/CuentasCerradas/DTOReporteCuentasCerradas.cs
  78. 17
      DTO/Reportes/DTOFiltrosTraficosClientes.cs
  79. 4
      DTO/Reportes/DTOReporteCorresponsales.cs
  80. 11
      DTO/Reportes/DTOReporteSemanalNewel.cs
  81. 45
      DTO/Reportes/Embarques/DTOBuscarEmbarques.cs
  82. 69
      DTO/Reportes/Embarques/DTOEmbarquesDespachados.cs
  83. 63
      DTO/Reportes/Embarques/DTOEmbarquesPorImportar.cs
  84. 32
      DTO/Reportes/Facturacion/DTOReporteGeneralFacturacion.cs
  85. 27
      DTO/Reportes/GC50/DTOReporteGC50.cs
  86. 20
      DTO/Reportes/Newell/DTOOperacionesCdAcuna.cs
  87. 18
      DTO/Reportes/Newell/DTOOperacionesLazaroCardenas.cs
  88. 11
      DTO/Reportes/Newell/DTOReporteMensualCdAcuna.cs
  89. 8
      DTO/Reportes/Newell/DTOTrailasFile.cs
  90. 1
      DTO/Usuario/DTOUsuario.cs
  91. 10
      Models/Catalogos/CatCentrosCostos.cs
  92. 7
      Models/Catalogos/CatClavesPedimentos.cs
  93. 2
      Models/Catalogos/CatCorresponsales.cs
  94. 6
      Models/Catalogos/CatTiposContenedores.cs
  95. 9
      Models/Catalogos/CatTiposMercancia.cs
  96. 3
      Models/Catalogos/Tabulador.cs
  97. 1
      Models/Catalogos/TabuladorDetalle.cs
  98. 1
      Models/Clientes.cs
  99. 39
      Models/Clientes/Alen/EstadosCuenta.cs
  100. 5
      Models/Corresponsales/CorresponsalFacturas.cs
  101. Some files were not shown because too many files have changed in this diff Show More

477
.gitignore vendored

@ -1,477 +0,0 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET
project.lock.json
project.fragment.lock.json
artifacts/
# Tye
.tye/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp
# Visual Studio 6 technical files
*.ncb
*.aps
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# Visual Studio History (VSHistory) files
.vshistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
# JetBrains Rider
*.sln.iml
##
## Visual studio for Mac
##
# globs
Makefile.in
*.userprefs
*.usertasks
config.make
config.status
aclocal.m4
install-sh
autom4te.cache/
*.tar.gz
tarballs/
test-results/
# Mac bundle stuff
*.dmg
*.app
# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk

@ -1,16 +1,15 @@
{ {
"workbench.colorCustomizations": { "workbench.colorCustomizations": {
"titleBar.border": "#ff0000", "titleBar.border": "#ff0000",
/* "titleBar.activeForeground": "#fbfcff", /* "titleBar.activeForeground": "#fbfcff",
"titleBar.inactiveForeground": "#b4c0e8cc", "titleBar.inactiveForeground": "#b4c0e8cc",
"titleBar.activeBackground": "#06660e", "titleBar.activeBackground": "#06660e",
"titleBar.inactiveBackground": "#25eb77cc", */ "titleBar.inactiveBackground": "#25eb77cc", */
/* "activityBar.activeBackground": "#25eb77cc", /* "activityBar.activeBackground": "#25eb77cc",
"activityBar.background": "#06660e", "activityBar.background": "#06660e",
"activityBar.foreground": "#86b0da", "activityBar.foreground": "#86b0da",
"activityBar.inactiveForeground": "#7ea9d3", */ "activityBar.inactiveForeground": "#7ea9d3", */
"sideBar.background": "#011105", "sideBar.background": "#011105",
"list.hoverBackground": "#3c5866" "list.hoverBackground": "#3c5866"
}, }
"workbench.colorTheme": "Winter is Coming (Dark Black - No Italics)"
} }

@ -13,9 +13,6 @@
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.1.1" /> <PackageReference Include="Microsoft.Data.SqlClient" Version="5.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.5" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.5" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="7.0.5" /> <PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="7.0.5" />
<PackageReference Include="EPPlus" Version="6.2.9" />
<PackageReference Include="itext7" Version="8.0.2" />
<PackageReference Include="itext7.bouncy-castle-adapter" Version="8.0.2" />
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -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{
}
}

@ -1,5 +0,0 @@
namespace CORRESPONSALBackend.Contracts.Auth{
public interface IAuthService{
public Task<string> RefreshAgenteFacturacionToken();
}
}

@ -1,12 +0,0 @@
using CORRESPONSALBackend.DTO;
using CORRESPONSALBackend.Models.Catalogos;
namespace CORRESPONSALBackend.Contracts.Catalogos
{
public interface ICatCentrosCostosRepository
{
public Task<IEnumerable<DTOCentrosCostos>> GetAll();
public Task<IEnumerable<DTOCentrosCostos>> Append(CatCentrosCostos centroCostos);
public Task<CatCentrosCostos> Get(int idCliente);
}
}

@ -1,9 +0,0 @@
using CORRESPONSALBackend.Models.Catalogos;
namespace CORRESPONSALBackend.Contracts.Catalogos
{
public interface ICatClavesPedimentosRepository
{
public Task<IEnumerable<CatClavesPedimentos>> GetAll();
}
}

@ -1,7 +0,0 @@
using CORRESPONSALBackend.Models.Catalogos;
namespace CORRESPONSALBackend.Contracts.Catalogos{
public interface ICatTiposContenedoresRepository{
public Task<IEnumerable<CatTiposContenedores>> Get();
}
}

@ -3,7 +3,7 @@ namespace CORRESPONSALBackend.Contracts.Catalogos
{ {
public interface ITabuladorRepository 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<Tabulador> Append(Tabulador data);
public Task Delete(int id); public Task Delete(int id);
} }

@ -1,8 +0,0 @@
using CORRESPONSALBackend.Models.Catalogos;
namespace CORRESPONSALBackend.Contracts.Catalogos
{
public interface ITiposMercanciaRepository{
public Task<IEnumerable<CatTiposMercancia>> GetAll();
}
}

@ -5,7 +5,6 @@ namespace CORRESPONSALBackend.Contracts.Contabilidad.Corresponsalias
public interface IContabilidadCorresponsaliasRepository public interface IContabilidadCorresponsaliasRepository
{ {
public Task<CorresponsalTraficoContabilidad> Append(CorresponsalTraficoContabilidad data); public Task<CorresponsalTraficoContabilidad> Append(CorresponsalTraficoContabilidad data);
public Task<IEnumerable<string>> Get(int IdTrafico, int procesoAnterior, int nuevoProceso); public Task<IEnumerable<string>> Get(int IdTrafico, int tipo);
public Task<IEnumerable<string>> Historial(int IdTrafico);
} }
} }

@ -1,7 +0,0 @@
using CORRESPONSALBackend.DTO.Corresponsales;
namespace CORRESPONSALBackend.Contracts.Corresponsalias.Anticipos{
public interface ICorresponsaliasAnticiposService{
public Task<byte[]> GetPdf(DTOPdfAnticipo anticipo, string imageFile);
}
}

@ -11,6 +11,5 @@ namespace CORRESPONSALBackend.Contracts.Corresponsalias
public Task Delete(int id); public Task Delete(int id);
public Task<DashboardTotal> GetTotalAnticiposPendientes(); public Task<DashboardTotal> GetTotalAnticiposPendientes();
public Task<CorresponsalAnticipos> Autoriza(DTOCorresponsalesAnticipo data); public Task<CorresponsalAnticipos> Autoriza(DTOCorresponsalesAnticipo data);
public Task<DTOPdfAnticipo> GetPdfAnticipo(int idAnticipo);
} }
} }

@ -1,9 +0,0 @@
using CORRESPONSALBackend.Models.Corresponsales;
namespace CORRESPONSALBackend.Contracts.Corresponsalias{
public interface ICorresponsaliasPedimentosConsolidadosRepository{
public Task<IEnumerable<CorresponsalPedimentosConsolidados>> GetAll(int IdTrafico);
public Task<CorresponsalPedimentosConsolidados> Append(CorresponsalPedimentosConsolidados pedimento);
public Task Delete(int id);
}
}

@ -1,11 +0,0 @@
using CORRESPONSALBackend.DTO.Corresponsales;
using CORRESPONSALBackend.Models.Corresponsales;
namespace CORRESPONSALBackend.Contracts.Corresponsalias{
public interface ICorresponsaliasSolicitudesRepository{
public Task<ITraficoSolicitud> AppendSolicitudReapertura(ITraficoSolicitud solicitud);
public Task<DTOTraficoSolicitud> GetSolicitudReapertura(int idTrafico);
public Task<ITraficoSolicitud> AppendSolicitudEliminarReferencia(ITraficoSolicitud solicitud);
public Task<DTOTraficoSolicitud> GetSolicitudEliminarReferencia(int idTrafico);
}
}

@ -2,24 +2,19 @@ using CORRESPONSALBackend.Models;
using CORRESPONSALBackend.DTO.Corresponsales; using CORRESPONSALBackend.DTO.Corresponsales;
using CORRESPONSALBackend.Models.Corresponsales; using CORRESPONSALBackend.Models.Corresponsales;
using CORRESPONSALBackend.Repository.Corresponsalias; using CORRESPONSALBackend.Repository.Corresponsalias;
using CORRESPONSALBackend.DTO.Reportes;
namespace CORRESPONSALBackend.Contracts.Corresponsalias namespace CORRESPONSALBackend.Contracts.Corresponsalias
{ {
public interface ICorresponsaliasTraficosRepository public interface ICorresponsaliasTraficosRepository
{ {
public Task<ITrafico> Get(int id); public Task<ITrafico> Get(int id);
public Task<DTOReporteSemanalNewell> GetByPedimento(int pedimento, string aduana, int patente);
public Task<ITrafico> GetByReferencia(string referencia);
public Task<DashboardTotal> GetAll(int Mode); public Task<DashboardTotal> GetAll(int Mode);
public Task<IEnumerable<ICorRectificaciones>> GetRectificaciones(int id); public Task<IEnumerable<ICorRectificaciones>> GetRectificaciones(int id);
public Task<ICorRectificaciones> AddRectificacion(int id); public Task<ICorRectificaciones> AddRectificacion(int id);
public Task<ITrafico> Append(ITrafico data); public Task<ITrafico> Append(ITrafico data);
public Task<IEnumerable<CorresponsalesTraficoEstatus>> GetTraficoEstatus(); public Task<IEnumerable<CorresponsalesTraficoEstatus>> GetTraficoEstatus();
public Task<Boolean> ValidaTraficoCompleto(DTOTraficoCompleto data); public Task<Boolean> ValidaTraficoCompleto(DTOTraficoCompleto data);
public Task<CorresponsaliasTraficoRectificacionHistorico> RectificacionHistoricoAppend(DTORectificacionHistorico data); public Task<Boolean> RectificacionHistoricoAppend(DTORectificacionHistorico data);
public Task<IEnumerable<CorresponsaliasTraficoRectificacionHistorico>> RectificacionHistoricoGet(int IdTrafico); public Task<CorresponsaliasTraficoRectificacionHistorico> RectificacionHistoricoGet(int IdTrafico);
public Task<string> ValidaTraficoDuplicado(string aduana, int patente, int pedimento, int idTrafico);
} }
} }

@ -1,7 +0,0 @@
using CORRESPONSALBackend.Models.Corresponsales;
namespace CORRESPONSALBackend.Contracts.Corresponsalias.Services{
public interface ICorresponsaliasFacturasService{
public Task<MemoryStream> GetFacturasExcel(IEnumerable<CorresponsalFacturas> facturas, string folioGemco);
}
}

@ -1,6 +0,0 @@
namespace CORRESPONSALBackend.Contracts.Corresponsalias.Services{
public interface ICorresponsaliasTraficosService{
public Task<List<string[]>> ReadTxtFacturasAlen(int fileId);
public Task<string> GetTxtFacturacionData(int idTrafico);
}
}

@ -6,11 +6,5 @@ namespace CORRESPONSALBackend.Contracts.Dashboard
{ {
public Task<IEnumerable<DashboardCorresponsales>> Get(); public Task<IEnumerable<DashboardCorresponsales>> Get();
public Task<Decimal> GetTipoCambio(string Fecha); public Task<Decimal> GetTipoCambio(string Fecha);
public Task<DashboardCorresponsales> GetRechazosContabilidad();
public Task<IEnumerable<DashboardCorresponsales>> GetFacturacion();
public Task<DashboardCorresponsales> GetTraficosConCargosDlls();
public Task<DashboardCorresponsales> SolicitudesReapertura();
public Task<DashboardCorresponsales> SolicitudesElminarCuenta();
} }
} }

@ -1,6 +1,4 @@
using CORRESPONSALBackend.DTO.Cliente; using CORRESPONSALBackend.DTO.Cliente;
using CORRESPONSALBackend.DTO.Corresponsales;
using CORRESPONSALBackend.DTO.Reportes;
using CORRESPONSALBackend.DTO.Usuario; using CORRESPONSALBackend.DTO.Usuario;
using CORRESPONSALBackend.Models; using CORRESPONSALBackend.Models;
@ -14,6 +12,5 @@ namespace CORRESPONSALBackend.Contracts
public Task<IEnumerable<IClientes>> addCliente(DTOClienteUsuario CU); public Task<IEnumerable<IClientes>> addCliente(DTOClienteUsuario CU);
public Task<IEnumerable<DTOClienteProveedor>> asignaClienteProveedor(DTOClienteProveedor cp); public Task<IEnumerable<DTOClienteProveedor>> asignaClienteProveedor(DTOClienteProveedor cp);
public Task<IEnumerable<Transportistas>> asignaUsuarioTransportista(DTOUsuarioTransportista t); public Task<IEnumerable<Transportistas>> asignaUsuarioTransportista(DTOUsuarioTransportista t);
public Task<IEnumerable<DTOCorresponsalTrafico>> GetTraficos(DTOFiltrosTraficosClientes data);
} }
} }

@ -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,5 +0,0 @@
namespace CORRESPONSALBackend.Contracts.Reportes.Alen{
public interface IReportesAlenRepository{
public Task<IEnumerable<DTOReporteFacturasTraficosConsolidados>> GetFacturasTraficoConsolidado(int idTrafico, string referencia);
}
}

@ -1,8 +0,0 @@
using CORRESPONSALBackend.Models.Corresponsales;
namespace CORRESPONSALBackend.Contracts.Reportes.Alen{
public interface IReportesAlenService{
public Task<MemoryStream> GetRelacionFacturas(ITrafico trafico, IEnumerable<CorresponsalFacturas> facturas, IEnumerable<CorresponsalesContenedores> contenedores);
public Task<MemoryStream> GetReporteFacturasTraficoConsolidado(string referencia);
}
}

@ -1,7 +0,0 @@
using CORRESPONSALBackend.DTO.Reportes.CuentasCerradas;
namespace CORRESPONSALBackend.Contracts.Reportes.CuentasCerradas{
public interface IReporteCuentasCerradasRepository{
public Task<IEnumerable<DTOCuentasCerradas>> GetCuentasCerradas(string Inicio, string Fin, int TipoOperacion, int NoCliente, int IdCorresponsal);
}
}

@ -1,7 +0,0 @@
using CORRESPONSALBackend.DTO.Reportes.CuentasCerradas;
namespace CORRESPONSALBackend.Contracts.Reportes.CuentasCerradas{
public interface IReporteCuentasCerradasService{
public Task<MemoryStream> GetExcel(IEnumerable<DTOCuentasCerradas> cuentas);
}
}

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

@ -1,9 +0,0 @@
using CORRESPONSALBackend.DTO.Reportes.Embarques;
namespace CORRESPONSALBackend.Contracts.Reportes.Embarques{
public interface IReportesEmbarquesService{
public Task<MemoryStream> GetExcelEmbarquesPorImportar(IEnumerable<DTOEmbarquesPorImportar> embarques, string filePath);
public Task<MemoryStream> GetExcelEmbarquesDespachados(IEnumerable<DTOEmbarquesDespachados> embarques, string filePath);
public Task<MemoryStream> GetExcelBusquedaEmbarques(IEnumerable<DTOBuscarEmbarques> embarques, string filePath);
}
}

@ -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,9 +0,0 @@
using CORRESPONSALBackend.DTO.Corresponsales;
using CORRESPONSALBackend.DTO.Reportes;
using CORRESPONSALBackend.DTO.Reportes.GC50;
namespace CORRESPONSALBackend.Contracts.Reportes.GC50{
public interface IReporteGC50Repository{
public Task<IEnumerable<DTOReporteGC50>> GetAllCorresponsalesTraficos(DTOReporteCorresponsales data);
}
}

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

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

@ -1,13 +0,0 @@
namespace CORRESPONSALBackend.Contracts.Reportes.Newell.Mensual
{
public interface IReporteMensualRepository
{
public Task CrearTablasReporteMensual();
public Task<DTOTrailas> PopulateTrailasTable(DTOTrailas record);
public Task<DTOOperacionesCdAcuna> PopulateOperacionesCdAcunaTable(DTOOperacionesCdAcuna record);
public Task<DTOOperacionesLazaroCardenas> PopulateOperacionesLazaroCardenasTable(DTOOperacionesLazaroCardenas record);
public Task<IEnumerable<DTOReporteMensualCdAcuna>> GetRptMensualCdAcuna();
public Task<IEnumerable<DTOOperacionesLazaroCardenas>> GetRptMensualLazaroCardenas();
public Task DropTempTables();
}
}

@ -1,5 +0,0 @@
namespace CORRESPONSALBackend.Contracts.Reportes.Newell.Mensual{
public interface IReporteMensualService{
public Task<MemoryStream> GetReporteMensual(int idTrailasFile, int idRptCdAcunaFile, int idRptLazaroCardenasFile);
}
}

@ -1,5 +0,0 @@
namespace CORRESPONSALBackend.Contracts.Reportes.Newell.Semanal{
public interface IReporteSemanalService{
public Task<MemoryStream> GetReporteSemanal(int idRptSemanalFile);
}
}

@ -9,9 +9,6 @@ namespace CORRESPONSALBackend.Contracts.Utils
public Task<List<FileManager>> getAllFilesByProcess(long Tags, int Proceso); public Task<List<FileManager>> getAllFilesByProcess(long Tags, int Proceso);
public Task<FileManager> getFileById(long id); public Task<FileManager> getFileById(long id);
public Task deleteFileByProcess(long id, int Proceso); public Task deleteFileByProcess(long id, int Proceso);
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);
} }
} }

@ -54,7 +54,6 @@ namespace CORRESPONSALBackend.Controllers
claims.Add(new Claim("Departamento", (user.sDept ?? user.sDept ?? "No asignado"))); claims.Add(new Claim("Departamento", (user.sDept ?? user.sDept ?? "No asignado")));
claims.Add(new Claim("UserType", (user != null) ? user.TipoUsuario.ToString() : "0")); claims.Add(new Claim("UserType", (user != null) ? user.TipoUsuario.ToString() : "0"));
claims.Add(new Claim("Perfil", ProfileData.Perfil)); claims.Add(new Claim("Perfil", ProfileData.Perfil));
claims.Add(new Claim("IdCorresponsal", user.IdCorresponsal != null ? user.IdCorresponsal.ToString() : "0"));
foreach (Menu item in menu) { claims.Add(new Claim(ClaimTypes.Role, item.Url)); } foreach (Menu item in menu) { claims.Add(new Claim(ClaimTypes.Role, item.Url)); }
var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_config["Jwt:Key"])); var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_config["Jwt:Key"]));
var signIn = new SigningCredentials(key, SecurityAlgorithms.HmacSha256); var signIn = new SigningCredentials(key, SecurityAlgorithms.HmacSha256);
@ -62,7 +61,7 @@ namespace CORRESPONSALBackend.Controllers
_config["Jwt:Issuer"], _config["Jwt:Issuer"],
_config["Jwt:Audience"], _config["Jwt:Audience"],
claims, claims,
expires: _userData.Usuario.Contains("Agente") ? DateTime.UtcNow.AddHours(168) : DateTime.UtcNow.AddHours(Int32.Parse(_config["Jwt:ExpirationHours"])), expires: DateTime.UtcNow.AddHours(Int32.Parse(_config["Jwt:ExpirationHours"])),
//expires: DateTime.UtcNow.AddMinutes(5), //expires: DateTime.UtcNow.AddMinutes(5),
signingCredentials: signIn); signingCredentials: signIn);
@ -133,10 +132,10 @@ namespace CORRESPONSALBackend.Controllers
{ {
DTOPINData PINData = await _usuariosRepo.CreatePIN(IdUser); DTOPINData PINData = await _usuariosRepo.CreatePIN(IdUser);
string htmlContent = $@"<table> 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>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>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 GEMCO.</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>"; </table>";
if (PINData.PIN > 0) if (PINData.PIN > 0)
{ {

@ -1,40 +0,0 @@
using CORRESPONSALBackend.Contracts.Catalogos;
using CORRESPONSALBackend.DTO;
using CORRESPONSALBackend.Models.Catalogos;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace CORRESPONSALBackend.Controllers.Catalogos
{
[Authorize]
[Route("api/Catalogos/[controller]")]
public class CatCentrosCostosController : Controller
{
private readonly ICatCentrosCostosRepository _repo;
public CatCentrosCostosController(ICatCentrosCostosRepository repo){
_repo = repo;
}
[HttpGet("GetAll")]
public async Task<IEnumerable<DTOCentrosCostos>> GetAll(){
var centrosCostos = await _repo.GetAll();
return centrosCostos;
}
[HttpGet]
public async Task<CatCentrosCostos> Get([FromQuery] int idCliente){
var centroCostos = await _repo.Get(idCliente);
return centroCostos;
}
[HttpPost("Append")]
public async Task<IEnumerable<DTOCentrosCostos>> Append([FromBody] CatCentrosCostos centroCostos){
try{
var centrosCostos = await _repo.Append(centroCostos);
return centrosCostos;
}catch(Exception ex){
throw new Exception(ex.Message);
}
}
}
}

@ -1,23 +0,0 @@
using CORRESPONSALBackend.Contracts.Catalogos;
using CORRESPONSALBackend.Models.Catalogos;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace CORRESPONSALBackend.Controllers.Catalogos{
[Authorize]
[Route("api/Catalogos/[controller]")]
public class CatClavesPedimentosController : Controller{
private readonly ICatClavesPedimentosRepository _repo;
public CatClavesPedimentosController(ICatClavesPedimentosRepository repo){
_repo = repo;
}
[HttpGet("GetAll")]
public async Task<IEnumerable<CatClavesPedimentos>> GetAll(){
var claves = await _repo.GetAll();
return claves;
}
}
}

@ -1,22 +0,0 @@
using CORRESPONSALBackend.Contracts.Catalogos;
using CORRESPONSALBackend.Models.Catalogos;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace CORRESPONSALBackend.Controllers.Catalogos{
[Authorize]
[Route("api/Catalogos/[controller]")]
public class CatTiposContenedoresController : Controller{
private readonly ICatTiposContenedoresRepository _repo;
public CatTiposContenedoresController(ICatTiposContenedoresRepository repo){
_repo = repo;
}
[HttpGet]
public async Task<IEnumerable<CatTiposContenedores>> Get(){
var tipos = await _repo.Get();
return tipos;
}
}
}

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

@ -1,25 +0,0 @@
using CORRESPONSALBackend.Models.Catalogos;
using CORRESPONSALBackend.Contracts.Catalogos;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
namespace CORRESPONSALBackend.Controllers.Catalogos
{
[Authorize]
[Route("api/Catalogos/[controller]")]
public class TiposMercanciaController : ControllerBase
{
private readonly IConfiguration _config;
private readonly ITiposMercanciaRepository _repo;
public TiposMercanciaController(IConfiguration config, ITiposMercanciaRepository repo){
_config = config;
_repo = repo;
}
[HttpGet]
public async Task<IEnumerable<CatTiposMercancia>> GetAll(){
var tipos = await _repo.GetAll();
return tipos;
}
}
}

@ -1,26 +1,19 @@
using CORRESPONSALBackend.Contracts; using CORRESPONSALBackend.Contracts;
using CORRESPONSALBackend.Contracts.Reportes;
using CORRESPONSALBackend.DTO.Cliente; using CORRESPONSALBackend.DTO.Cliente;
using CORRESPONSALBackend.DTO.Corresponsales;
using CORRESPONSALBackend.DTO.Reportes;
using CORRESPONSALBackend.DTO.Usuario; using CORRESPONSALBackend.DTO.Usuario;
using CORRESPONSALBackend.Models; using CORRESPONSALBackend.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace CORRESPONSALBackend.Controllers namespace CORRESPONSALBackend.Controllers
{ {
[Authorize]
[Route("api/[controller]")] [Route("api/[controller]")]
public class ClientesController : Controller public class ClientesController : Controller
{ {
private readonly IClientesRepository _clientesRepo; private readonly IClientesRepository _clientesRepo;
private readonly ITraficosClientesService _traficosClientesService;
public ClientesController(IClientesRepository clientesRepo, ITraficosClientesService traficosClientesService) public ClientesController(IClientesRepository clientesRepo)
{ {
_clientesRepo = clientesRepo; _clientesRepo = clientesRepo;
_traficosClientesService = traficosClientesService;
} }
[Route("getAllClientes")] [Route("getAllClientes")]
@ -102,27 +95,5 @@ namespace CORRESPONSALBackend.Controllers
return StatusCode(500, ex.Message); return StatusCode(500, ex.Message);
} }
} }
[HttpGet("Traficos")]
public async Task<IEnumerable<DTOCorresponsalTrafico>> GetTraficosClientes([FromQuery] DTOFiltrosTraficosClientes data){
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);
}
}
} }
} }

@ -29,17 +29,9 @@ namespace CORRESPONSALBackend.Controllers.Contabilidad.Corresponsales
[HttpGet] [HttpGet]
[Route("Get")] [Route("Get")]
public async Task<IEnumerable<string>> Get(int IdTrafico, int procesoAnterior, int nuevoProceso) public async Task<IEnumerable<string>> Get(int IdTrafico, int tipo)
{ {
var entrada = await _Repo.Get(IdTrafico, procesoAnterior, nuevoProceso); var entrada = await _Repo.Get(IdTrafico, tipo);
return entrada;
}
[HttpGet]
[Route("Historial")]
public async Task<IEnumerable<string>> Historial(int IdTrafico)
{
var entrada = await _Repo.Historial(IdTrafico);
return entrada; return entrada;
} }
} }

@ -4,18 +4,6 @@ using CORRESPONSALBackend.DTO.Corresponsales;
using CORRESPONSALBackend.Models.Corresponsales; using CORRESPONSALBackend.Models.Corresponsales;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using CORRESPONSALBackend.Contracts.Utils;
using iText.Kernel.Pdf;
using iText.Layout;
using iText.Kernel.Geom;
using iText.Layout.Element;
using iText.IO.Image;
using iText.Layout.Properties;
using iText.Kernel.Colors;
using iText.Layout.Borders;
using iText.Kernel.Font;
using iText.IO.Font.Constants;
using CORRESPONSALBackend.Contracts.Corresponsalias.Anticipos;
namespace CORRESPONSALBackend.Controllers.Corresponsalias namespace CORRESPONSALBackend.Controllers.Corresponsalias
{ {
@ -27,19 +15,11 @@ namespace CORRESPONSALBackend.Controllers.Corresponsalias
{ {
private readonly ICorresponsaliasAnticiposRepository _Repo; private readonly ICorresponsaliasAnticiposRepository _Repo;
private readonly IConfiguration _config; private readonly IConfiguration _config;
private readonly IFileManagerRepository _fileManager;
private readonly string _rootPathCorresponsales;
private readonly string _logoGemcoPath;
private readonly ICorresponsaliasAnticiposService _Service;
public AnticiposController(ICorresponsaliasAnticiposRepository Repo, IConfiguration config, IFileManagerRepository fileManager, ICorresponsaliasAnticiposService service) public AnticiposController(ICorresponsaliasAnticiposRepository Repo, IConfiguration config)
{ {
_config = config; _config = config;
_Repo = Repo; _Repo = Repo;
_fileManager = fileManager;
_rootPathCorresponsales = _config.GetValue<string>("AllFiles");
_logoGemcoPath = _config.GetValue<string>("LogoGemco");
_Service = service;
} }
[HttpPost] [HttpPost]
@ -55,16 +35,6 @@ namespace CORRESPONSALBackend.Controllers.Corresponsalias
public async Task<IEnumerable<CorresponsalAnticipos>> GetAll([FromQuery] int IdTrafico) public async Task<IEnumerable<CorresponsalAnticipos>> GetAll([FromQuery] int IdTrafico)
{ {
var entrada = await _Repo.getAll(IdTrafico); var entrada = await _Repo.getAll(IdTrafico);
var sinAutorizar = entrada.Where(x => x.Autoriza == 0).ToList();
if(sinAutorizar.Count > 0){
foreach (var anticipo in sinAutorizar){
var comprobanteAnticipo = await _fileManager.getFileByProcess(anticipo.id, 4);
if(comprobanteAnticipo.Tags != ""){
await Autoriza(new DTOCorresponsalesAnticipo(){id= anticipo.id, IdUsuario = comprobanteAnticipo.IdUsuario});
}
}
return await _Repo.getAll(IdTrafico);
}
return entrada; return entrada;
} }
@ -91,21 +61,6 @@ namespace CORRESPONSALBackend.Controllers.Corresponsalias
return entrada; return entrada;
} }
[HttpGet("Download")]
public async Task<IActionResult> Download([FromQuery] int idTrafico, [FromQuery] int idAnticipo){
try{
var anticipo = await _Repo.GetPdfAnticipo(idAnticipo);
String imageFile = $"{_rootPathCorresponsales}{_logoGemcoPath}LogoGemco.png";
var byteStream = await _Service.GetPdf(anticipo, imageFile);
MemoryStream ms = new MemoryStream();
ms.Write(byteStream, 0, byteStream.Length);
ms.Position = 0;
return new FileStreamResult(ms, "application/pdf");
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
} }
} }

@ -5,7 +5,6 @@ using Microsoft.AspNetCore.Mvc;
namespace CORRESPONSALBackend.Controllers.Corresponsalias namespace CORRESPONSALBackend.Controllers.Corresponsalias
{ {
[Authorize]
[ApiController] [ApiController]
[Route("api/Corresponsalias/[controller]")] [Route("api/Corresponsalias/[controller]")]
public class CatMediosEmbarquesController : Controller public class CatMediosEmbarquesController : Controller

@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Mvc;
namespace CORRESPONSALBackend.Controllers.Corresponsalias namespace CORRESPONSALBackend.Controllers.Corresponsalias
{ {
[Authorize] // [Authorize]
[ApiController] [ApiController]
[Route("api/Corresponsalias/[controller]")] [Route("api/Corresponsalias/[controller]")]
public class CatTiposEmbarqueController : ControllerBase public class CatTiposEmbarqueController : ControllerBase

@ -8,7 +8,6 @@ using Microsoft.AspNetCore.Authorization;
namespace CORRESPONSALBackend.Controllers.Corresponsalias namespace CORRESPONSALBackend.Controllers.Corresponsalias
{ {
[Authorize]
[ApiController] [ApiController]
[Route("api/Corresponsalias/[controller]")] [Route("api/Corresponsalias/[controller]")]
public class CuentasComplementariasController : ControllerBase public class CuentasComplementariasController : ControllerBase

@ -1,6 +1,5 @@
using System.IO.Compression; using System.IO.Compression;
using CORRESPONSALBackend.Contracts.Corresponsalias; using CORRESPONSALBackend.Contracts.Corresponsalias;
using CORRESPONSALBackend.Contracts.Corresponsalias.Services;
using CORRESPONSALBackend.Models.Corresponsales; using CORRESPONSALBackend.Models.Corresponsales;
using CORRESPONSALBackend.Services.C1896; using CORRESPONSALBackend.Services.C1896;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
@ -14,15 +13,11 @@ namespace CORRESPONSALBackend.Controllers.Corresponsalias
public class FacturasController : Controller public class FacturasController : Controller
{ {
private readonly ICorresponsaliasFacturasRepository _Repo; private readonly ICorresponsaliasFacturasRepository _Repo;
private readonly ICorresponsaliasFacturasService _Service;
private readonly ICorresponsaliasTraficosRepository _TraficosRepo;
private readonly IConfiguration _config; private readonly IConfiguration _config;
public FacturasController(ICorresponsaliasFacturasRepository Repo, IConfiguration config, ICorresponsaliasFacturasService Service, ICorresponsaliasTraficosRepository TraficosRepo) public FacturasController(ICorresponsaliasFacturasRepository Repo, IConfiguration config)
{ {
_config = config; _config = config;
_Service = Service;
_Repo = Repo; _Repo = Repo;
_TraficosRepo = TraficosRepo;
} }
/// Corresponsales: Facturas /// Corresponsales: Facturas
@ -58,16 +53,5 @@ namespace CORRESPONSALBackend.Controllers.Corresponsalias
return Srv.ReadDataFromFile(@"c:\data\layout_omg_alen.txt"); return Srv.ReadDataFromFile(@"c:\data\layout_omg_alen.txt");
} }
*/ */
[HttpGet("GetExcel")]
public async Task<IActionResult> GetFacturasExcel([FromQuery] int idTrafico){
try{
var facturas = await _Repo.GetAll(idTrafico);
var trafico = await _TraficosRepo.Get(idTrafico);
var stream = await _Service.GetFacturasExcel(facturas, trafico.FolioGemco);
return File(stream, "application/octet-stream", $"Facturas.xlsx");
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
} }
} }

@ -1,42 +0,0 @@
using CORRESPONSALBackend.Contracts.Corresponsalias;
using CORRESPONSALBackend.Models.Corresponsales;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace CORRESPONSALBackend.Controllers.Corresponsalias{
[Authorize]
[Route("api/Corresponsalias/[controller]")]
[ApiController]
public class PedimentosConsolidados : ControllerBase{
private readonly ICorresponsaliasPedimentosConsolidadosRepository _repo;
public PedimentosConsolidados(ICorresponsaliasPedimentosConsolidadosRepository repo){
_repo = repo;
}
[HttpPost("Append")]
public async Task<IActionResult> Append([FromBody] CorresponsalPedimentosConsolidados data){
try{
var entrada = await _repo.Append(data);
return Ok(entrada);
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
[HttpGet("GetAll")]
public async Task<IEnumerable<CorresponsalPedimentosConsolidados>> GetAll([FromQuery] int IdTrafico){
var entrada = await _repo.GetAll(IdTrafico);
return entrada;
}
[HttpDelete("Delete/{id}")]
public async Task<IActionResult> Delete(int id){
try{
await _repo.Delete(id);
return new OkObjectResult(new { respuesta = "Se elimino el registro" });
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
}
}

@ -1,57 +0,0 @@
using CORRESPONSALBackend.Contracts.Corresponsalias;
using CORRESPONSALBackend.Models.Corresponsales;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace CORRESPONSALBackend.Controllers.Corresponsalias{
[Authorize]
[Route("api/Corresponsalias/[controller]")]
[ApiController]
public class SolicitudesController : ControllerBase
{
private readonly ICorresponsaliasSolicitudesRepository _Repo;
public SolicitudesController(ICorresponsaliasSolicitudesRepository Repo){
_Repo = Repo;
}
[HttpPost("Reapertura/Append")]
public async Task<IActionResult> AppendSolicitudReapertura([FromBody] ITraficoSolicitud solicitud){
try{
var response = await _Repo.AppendSolicitudReapertura(solicitud);
return Ok(response);
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
[HttpGet("Reapertura/Get")]
public async Task<IActionResult> GetSolicitudReapertura([FromQuery] int idTrafico){
try{
var solicitud = await _Repo.GetSolicitudReapertura(idTrafico);
return Ok(solicitud);
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
[HttpPost("EliminarCuenta/Append")]
public async Task<IActionResult> AppendSolicitudEliminarCuenta([FromBody] ITraficoSolicitud solicitud){
try{
var response = await _Repo.AppendSolicitudEliminarReferencia(solicitud);
return Ok(response);
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
[HttpGet("EliminarCuenta/Get")]
public async Task<IActionResult> GetSolicitudEliminarCuenta([FromQuery] int idTrafico){
try{
var solicitud = await _Repo.GetSolicitudEliminarReferencia(idTrafico);
return Ok(solicitud);
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
}
}

@ -6,11 +6,6 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using CORRESPONSALBackend.Services.C1896; using CORRESPONSALBackend.Services.C1896;
using CORRESPONSALBackend.Repository.Corresponsalias; using CORRESPONSALBackend.Repository.Corresponsalias;
using CORRESPONSALBackend.DTO.Reportes;
using CORRESPONSALBackend.Contracts.Corresponsalias.Services;
using CORRESPONSALBackend.Contracts.Catalogos;
using System.Globalization;
using CORRESPONSALBackend.Contracts;
namespace CORRESPONSALBackend.Controllers.Corresponsalias namespace CORRESPONSALBackend.Controllers.Corresponsalias
{ {
@ -23,31 +18,14 @@ namespace CORRESPONSALBackend.Controllers.Corresponsalias
private readonly ICorresponsaliasTraficosRepository _Repo; private readonly ICorresponsaliasTraficosRepository _Repo;
private readonly ICorresponsaliasFacturasRepository _RepoFacturas; private readonly ICorresponsaliasFacturasRepository _RepoFacturas;
private readonly ICorresponsaliasContenedoresRepository _RepoContenedores; private readonly ICorresponsaliasContenedoresRepository _RepoContenedores;
private readonly ICorresponsaliasTraficosService _traficosService;
private readonly IProveedoresRepository _proveedoresRepository;
private readonly ICorresponsaliasFacturasRepository _facturasRepository;
private readonly ICorresponsaliasContenedoresRepository _contenedoresRepository;
private readonly IClientesRepository _clientesRepository;
private readonly ICatCentrosCostosRepository _centrosCostosRepository;
private readonly ITiposMercanciaRepository _tiposMercanciaRepository;
private readonly IConfiguration _config; private readonly IConfiguration _config;
public TraficosController(ICorresponsaliasTraficosRepository Repo, ICorresponsaliasFacturasRepository RepoFacturas, IClientesRepository clientesRepository, public TraficosController(ICorresponsaliasTraficosRepository Repo, ICorresponsaliasFacturasRepository RepoFacturas, ICorresponsaliasContenedoresRepository RepoContenedores, IConfiguration config)
ICorresponsaliasContenedoresRepository RepoContenedores, IConfiguration config, ICorresponsaliasTraficosService traficosService,
IProveedoresRepository proveedoresRepository, ICorresponsaliasFacturasRepository facturasRepository, ICorresponsaliasContenedoresRepository contenedoresRepository,
ICatCentrosCostosRepository centrosCostosRepository, ITiposMercanciaRepository tiposMercanciaRepository)
{ {
_config = config; _config = config;
_Repo = Repo; _Repo = Repo;
_RepoFacturas = RepoFacturas; _RepoFacturas = RepoFacturas;
_RepoContenedores = RepoContenedores; _RepoContenedores = RepoContenedores;
_traficosService = traficosService;
_proveedoresRepository = proveedoresRepository;
_facturasRepository = facturasRepository;
_contenedoresRepository = contenedoresRepository;
_clientesRepository = clientesRepository;
_centrosCostosRepository = centrosCostosRepository;
_tiposMercanciaRepository = tiposMercanciaRepository;
} }
/// Corresponsales: Traficos /// Corresponsales: Traficos
@ -67,14 +45,6 @@ namespace CORRESPONSALBackend.Controllers.Corresponsalias
return entrada; return entrada;
} }
[HttpGet]
[Route("GetByPedimento")]
public async Task<DTOReporteSemanalNewell> GetByPedimento([FromQuery] int pedimento, string aduana, int patente)
{
var entrada = await _Repo.GetByPedimento(pedimento, aduana, patente);
return entrada;
}
[HttpPut("AddRectificacion/{id}")] [HttpPut("AddRectificacion/{id}")]
public async Task<ICorRectificaciones> AddRectificacion(int id) public async Task<ICorRectificaciones> AddRectificacion(int id)
{ {
@ -144,89 +114,18 @@ namespace CORRESPONSALBackend.Controllers.Corresponsalias
[HttpPost] [HttpPost]
[Route("Rectificacion/Historico/Append")] [Route("Rectificacion/Historico/Append")]
public async Task<IActionResult> RectificacionHistoricoAppend(DTORectificacionHistorico data) public async Task<Boolean> RectificacionHistoricoAppend(DTORectificacionHistorico data)
{ {
try{ var entrada = await _Repo.RectificacionHistoricoAppend(data);
var entrada = await _Repo.RectificacionHistoricoAppend(data); return entrada;
return Ok(entrada);
}catch(Exception ex){
return BadRequest(ex.Message);
}
} }
[HttpGet] [HttpGet]
[Route("Rectificacion/Historico/Get")] [Route("Rectificacion/Historico/Get")]
public async Task<IEnumerable<CorresponsaliasTraficoRectificacionHistorico>> RectificacionHistoricoGet(int IdTrafico) public async Task<CorresponsaliasTraficoRectificacionHistorico> RectificacionHistoricoGet(int IdTrafico)
{ {
var entrada = await _Repo.RectificacionHistoricoGet(IdTrafico); var entrada = await _Repo.RectificacionHistoricoGet(IdTrafico);
return entrada; return entrada;
} }
[HttpGet]
[Route("Duplicado")]
public async Task<string> ValidaTraficoDuplicado(string aduana, int patente, int pedimento, int idTrafico)
{
var referencia = await _Repo.ValidaTraficoDuplicado(aduana, patente, pedimento, idTrafico);
return referencia;
}
[HttpPost("Append/LayoutAlen")]
public async Task<IActionResult> AppendFacturasContenedoresAlen([FromQuery] int idTrafico, [FromQuery] int fileId){
try{
var trafico = await _Repo.Get(idTrafico);
var proveedores = await _proveedoresRepository.GetAll(0);
proveedores.ToList();
var facturas = await _traficosService.ReadTxtFacturasAlen(fileId);
var facturasOrdenadas = facturas.OrderByDescending(x => DateTime.ParseExact(x[22].Replace(" "," "), "MM/dd/yyyy h:mm:ss tt", CultureInfo.InvariantCulture)).ToArray();
{
trafico.Pedimento = int.Parse(facturasOrdenadas[0][6]);
trafico.FechaPago = facturasOrdenadas[0][7];
trafico.Clave = facturasOrdenadas[0][8];
trafico.TipoCambio = double.Parse(facturasOrdenadas[0][15]);
trafico.CantidadFracciones = int.Parse(facturasOrdenadas[0][21]);
trafico.DescripcionMercancia = facturasOrdenadas[0][14];
trafico.Observaciones = facturasOrdenadas[0][48];
trafico.FechaDesaduanamiento = facturasOrdenadas[0][22];
await _Repo.Append(trafico);
}
foreach(var factura in facturasOrdenadas){
if (!new List<string>() { " ", "-", "_" }.Contains(factura[13]) && !String.IsNullOrEmpty(factura[13])){
//Crear modelo de contenedor y asignar los datos en la factura actual
CorresponsalesContenedores nuevoContenedor = new CorresponsalesContenedores(){
id = 0,
IdTrafico = idTrafico,
Contenedor = factura[32],
Semaforo = (byte?)(factura[45] == "VERDE" ? 2 : 1),
FSemaforo = factura[22]
};
var contenedorGuardado = await _contenedoresRepository.Append(nuevoContenedor);
//Crear modelo de factura y asignar los datos en la factura actual
var proveedorFactura = proveedores.FirstOrDefault(p => p.Nombre == factura[10]);
CorresponsalFacturas nuevaFactura = new CorresponsalFacturas(){
id = 0,
Factura = factura[13],
IdTrafico = idTrafico,
ValorFacturaDls = double.Parse(factura[16]),
Proveedor = proveedorFactura.id,
Pedido = factura[29],
FechaFactura = factura[7],
Activo = true,
Code = 0,
FolioGEMCO = "",
COVE = factura[50],
Entrega = factura[52],
Transporte = factura[51],
UUID = factura[33],
IdContenedor = contenedorGuardado.id
};
await _facturasRepository.Append(nuevaFactura);
}
}
return new OkObjectResult(new {trafico, facturas = await _facturasRepository.GetAll(idTrafico), contenedores = await _contenedoresRepository.GetAll(idTrafico)});
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
} }
} }

@ -2,11 +2,10 @@
using CORRESPONSALBackend.Models; using CORRESPONSALBackend.Models;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using System.IO;
namespace CORRESPONSALBackend.Controllers.Dashboard namespace CORRESPONSALBackend.Controllers.Dashboard
{ {
[Authorize] // [Authorize]
[Route("api/Dashboard/[controller]")] [Route("api/Dashboard/[controller]")]
[ApiController] [ApiController]
public class CorresponsalesController : ControllerBase public class CorresponsalesController : ControllerBase
@ -36,61 +35,5 @@ namespace CORRESPONSALBackend.Controllers.Dashboard
return await _Repo.GetTipoCambio(Fecha); return await _Repo.GetTipoCambio(Fecha);
} }
[HttpGet]
[Route("RechazosContabilidad")]
public async Task<DashboardCorresponsales> GetRechazosContabilidad(){
var rechazos = await _Repo.GetRechazosContabilidad();
return rechazos;
}
[HttpGet]
[Route("GetFacturacionDashboard")]
public async Task<IEnumerable<DashboardCorresponsales>> GetFacturacion()
{
return await _Repo.GetFacturacion();
}
[HttpGet]
[Route("TraficosConCargos")]
public async Task<DashboardCorresponsales> TraficosConCargosDlls(){
var traficos = await _Repo.GetTraficosConCargosDlls();
return traficos;
}
[HttpGet]
[Route("SolicitudesReapertura")]
public async Task<DashboardCorresponsales> SolicitudesReapertura(){
var traficos = await _Repo.SolicitudesReapertura();
return traficos;
}
[HttpGet]
[Route("SolicitudesEliminarCuenta")]
public async Task<DashboardCorresponsales> SolicitudesElminarCuenta(){
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");
}
} }
} }

@ -7,16 +7,10 @@ using CORRESPONSALBackend.Contracts.Utils;
using CORRESPONSALBackend.Models.Utils; using CORRESPONSALBackend.Models.Utils;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http.HttpResults;
using CORRESPONSALBackend.Contracts.Auth;
using CORRESPONSALBackend.Contracts.Corresponsalias;
using CORRESPONSALBackend.Contracts.Corresponsalias.Services;
using Newtonsoft.Json;
using System.Text;
namespace CORRESPONSALBackend.Controllers namespace CORRESPONSALBackend.Controllers
{ {
[Authorize] // [Authorize]
[Route("api/[controller]")] [Route("api/[controller]")]
// [ApiController] // [ApiController]
public class FileManagerController : Controller public class FileManagerController : Controller
@ -26,24 +20,21 @@ namespace CORRESPONSALBackend.Controllers
private readonly ICasaCuervoRepository _RepoCasaCuervo; private readonly ICasaCuervoRepository _RepoCasaCuervo;
private readonly IFilePaths4ProcessRepository _RepoRelativePath; private readonly IFilePaths4ProcessRepository _RepoRelativePath;
private readonly IConfiguration _config; private readonly IConfiguration _config;
private readonly IAuthService _authService;
private readonly ICorresponsaliasTraficosService _traficoService;
private readonly ICorresponsaliasTraficosRepository _traficosRepository;
private readonly string RootPathCorresponsales; private readonly string RootPathCorresponsales;
public FileManagerController(IFileManagerRepository Repo, IFilePaths4ProcessRepository RepoRelativePath, IConfiguration config, IUsuariosRepository RepoUsuarios, public FileManagerController(IFileManagerRepository Repo,
ICasaCuervoRepository RepoCasaCuervo, IAuthService authService, ICorresponsaliasTraficosRepository traficosRepository, ICorresponsaliasTraficosService traficoService) IFilePaths4ProcessRepository RepoRelativePath,
IConfiguration config,
IUsuariosRepository RepoUsuarios,
ICasaCuervoRepository RepoCasaCuervo)
{ {
_config = config; _config = config;
_Repo = Repo; _Repo = Repo;
_RepoUsuarios = RepoUsuarios; _RepoUsuarios = RepoUsuarios;
_RepoCasaCuervo = RepoCasaCuervo; _RepoCasaCuervo = RepoCasaCuervo;
_RepoRelativePath = RepoRelativePath; _RepoRelativePath = RepoRelativePath;
_traficoService = traficoService;
RootPathCorresponsales = _config.GetValue<string>("AllFiles"); RootPathCorresponsales = _config.GetValue<string>("AllFiles");
_authService = authService;
_traficosRepository = traficosRepository;
} }
[Route("GetFileInfoByProcess")] [Route("GetFileInfoByProcess")]
@ -65,59 +56,89 @@ namespace CORRESPONSALBackend.Controllers
} }
[Route("AppendFileByProcess")] [Route("AppendFileByProcess")]
[RequestSizeLimit(209715200)]
[RequestFormLimits(MultipartBodyLengthLimit = 209715200)]
[HttpPost] [HttpPost]
public async Task<dynamic> AppendFileByProcess(IFormFile file, int IdUsuario, int Proceso, string Tags, int crud) public async Task<FileManager> AppendFileByProcess(IFormFile file, int IdUsuario, int Proceso, string Tags, int crud)
{ {
try DateTime time = DateTime.Now;
FilePaths4Process RelativePath = await _RepoRelativePath.getPaths4ProcessById(Proceso);
string fullPath = "";
fullPath = RootPathCorresponsales + RelativePath.Path;
string fileMime = file.FileName.Substring(file.FileName.LastIndexOf('.') + 1);
string newFileName = file.FileName.Replace("." + fileMime, "") + "_" + time.ToString("yyyy_MM_dd_HH_mm_ss") + "." + fileMime;
FileManager data = new FileManager();
data.id = 0;
data.IdUsuario = IdUsuario;
data.NombreArchivo = newFileName;
data.Proceso = Proceso;
data.FechaRegistro = "";
data.Tags = Tags;
data.Activo = 1;
long fileLength = 0;
if (@crud == 1)
{ {
DateTime time = DateTime.Now; if (file.Length > 0)
FilePaths4Process RelativePath = await _RepoRelativePath.getPaths4ProcessById(Proceso);
string fullPath = "";
fullPath = RootPathCorresponsales + RelativePath.Path;
string fileMime = file.FileName.Substring(file.FileName.LastIndexOf('.') + 1);
string newFileName = file.FileName.Replace("." + fileMime, "") + "_" + time.ToString("yyyy_MM_dd_HH_mm_ss") + "." + fileMime;
FileManager data = new FileManager();
data.id = 0;
data.IdUsuario = IdUsuario;
data.NombreArchivo = newFileName;
data.Proceso = Proceso;
data.FechaRegistro = "";
data.Tags = Tags;
data.Activo = 1;
long fileLength = 0;
if (@crud == 1)
{ {
if (file.Length > 0) var filePath = fullPath + newFileName;
using (var stream = System.IO.File.Create(filePath))
{ {
var filePath = fullPath + newFileName; await file.CopyToAsync(stream);
using (var stream = System.IO.File.Create(filePath)) }
{ fileLength = new System.IO.FileInfo(filePath).Length / 1024;
await file.CopyToAsync(stream); data.Size = fileLength;
} if (fileLength > 0)
if(fileMime == "txt"){ {
data.Size = 1; return await _Repo.FileManager(data);
return await _Repo.FileManager(data);
}
fileLength = new System.IO.FileInfo(filePath).Length / 1024;
data.Size = fileLength;
if (fileLength > 0)
{
return await _Repo.FileManager(data);
}
} }
} }
return data;
}
catch (Exception ex)
{
return BadRequest(ex.Message);
} }
return data;
} }
// El aifuiente procaso se tiene que validar de todo a todo, ya que sera facilitado el acceso a usuarios externos a GEMCO: Clientes, Corresponsales, etc
/* [Route("AppendFileUpdatesCasaCuervo")]
[HttpPost]
public async Task<IActionResult> AppendFileUpdatesCasaCuervo(IFormFile file, string Usuario, string Contrasenia)
{
int Proceso = 6;
string Tags = "-1";
DateTime time = DateTime.Now;
FilePaths4Process RelativePath = await _RepoRelativePath.getPaths4ProcessById(Proceso);
string fullPath = "";
fullPath = RootPathCorresponsales + RelativePath.Path;
string fileMime = file.FileName.Substring(file.FileName.Length - 4);
string newFileName = file.FileName.Replace(fileMime, "") + "_" + time.ToString("yyyy_MM_dd_HH_mm_ss") + fileMime;
DTOLogin authUser = new DTOLogin();
authUser.Usuario = Usuario;
authUser.Contrasena = Contrasenia;
var ExternalUser = await _RepoUsuarios.GetUsuario(authUser);
FileManager data = new FileManager();
data.id = 0;
data.IdUsuario = ExternalUser.Id;
data.NombreArchivo = newFileName;
data.Proceso = Proceso;
data.FechaRegistro = "";
data.Tags = Tags;
data.Activo = 1;
long fileLength = 0;
string filePath = "";
filePath = fullPath + newFileName;
using (var stream = System.IO.File.Create(filePath))
{
await file.CopyToAsync(stream);
}
fileLength = new System.IO.FileInfo(filePath).Length / 1024;
data.Size = fileLength;
if (fileLength > 0)
{
SCasaCuervo proc = new SCasaCuervo(_RepoCasaCuervo, filePath);
var result = await proc.UpdateInfoFromCorresponsal();
if (result) return new OkObjectResult(new { respuesta = "El archivo se agrego exitosamente" });
else return new OkObjectResult(new { respuesta = "Ocurrio un error, el archivo no se guardo, verifique que el formato de fecha sea MM/dd/yyyy" });
}
return new OkObjectResult(new { respuesta = "Ocurrio un error el archivo no se guardo" });
} */
[Route("getFile")] [Route("getFile")]
[HttpGet, DisableRequestSizeLimit] [HttpGet, DisableRequestSizeLimit]
public async Task<IActionResult> getFileFromFileManager([FromQuery] long id, int Proceso) public async Task<IActionResult> getFileFromFileManager([FromQuery] long id, int Proceso)
@ -131,7 +152,7 @@ namespace CORRESPONSALBackend.Controllers
{ {
try try
{ {
if (System.IO.File.Exists(fullPath + recFound.NombreArchivo)) if (System.IO.File.Exists(Path.Combine(fullPath, recFound.NombreArchivo)))
{ {
ExisteEnDisco = true; ExisteEnDisco = true;
} }
@ -157,73 +178,6 @@ namespace CORRESPONSALBackend.Controllers
return BadRequest(new { respuesta = "Ese archivo no existe" }); return BadRequest(new { respuesta = "Ese archivo no existe" });
} }
[Route("ConvertExcel2New")]
[HttpGet, DisableRequestSizeLimit]
public async Task<IActionResult> ConvertExcel2New([FromQuery] long id, int Proceso)
{
bool ExisteEnDisco = false;
FileManager recFound = await _Repo.getFileById(id);
FilePaths4Process RelativePath = await _RepoRelativePath.getPaths4ProcessById(Proceso);
string fullPath = "";
fullPath = RootPathCorresponsales + RelativePath.Path;
if (!String.IsNullOrEmpty(recFound.NombreArchivo))
{
try
{
if (System.IO.File.Exists(fullPath+ recFound.NombreArchivo))
{
ExisteEnDisco = true;
}
else return BadRequest(new { respuesta = "Ese archivo no existe" });
}
catch (IOException ex)
{
return BadRequest(new { respuesta = "Ese archivo no existe" + ex.ToString() });
}
if (ExisteEnDisco)
{
string targetFile = fullPath + recFound.NombreArchivo;
if (System.IO.File.Exists(targetFile))
{
byte[] pdfBytes = System.IO.File.ReadAllBytes(targetFile);
MemoryStream ms = new MemoryStream(pdfBytes);
var file = await Convert2NewFormat("https://amazon-pyapi.gemcousa.solutions/convertXLS2XLSX", ms, recFound.NombreArchivo);
using( var newFileStream = System.IO.File.Create(targetFile+"x")){
await file.CopyToAsync(newFileStream);
var newFile = await _Repo.UpdateFileNameById(id, recFound.NombreArchivo+"x");
if(newFile.NombreArchivo != recFound.NombreArchivo){
System.IO.File.Delete(targetFile);
}
}
return Ok("Archivo subido con exito");
}
}
}
return BadRequest(new { respuesta = "Ese archivo no existe" });
}
private async Task<Stream> Convert2NewFormat(string actionUrl, Stream paramFileStream, string oldFilename)
{
HttpContent fileStreamContent = new StreamContent(paramFileStream);
using (var client = new HttpClient())
using (var formData = new MultipartFormDataContent())
{
formData.Add(fileStreamContent, "file", oldFilename);
var response = await client.PostAsync(actionUrl, formData);
if (response.IsSuccessStatusCode)
{
System.Net.Http.HttpContent content = response.Content;
var contentStream = await content.ReadAsStreamAsync();
return File(contentStream, "application/octet-stream", oldFilename + "x").FileStream;
}
else
{
throw new FileNotFoundException();
}
}
}
[HttpDelete("DeleteById/{id}")] [HttpDelete("DeleteById/{id}")]
public async Task<IActionResult> DeleteByProcess(long id) public async Task<IActionResult> DeleteByProcess(long id)
{ {
@ -233,9 +187,9 @@ namespace CORRESPONSALBackend.Controllers
fullPath = RootPathCorresponsales + RelativePath.Path; fullPath = RootPathCorresponsales + RelativePath.Path;
try try
{ {
if (System.IO.File.Exists(fullPath + Found.NombreArchivo)) if (System.IO.File.Exists(Path.Combine(fullPath, Found.NombreArchivo)))
{ {
System.IO.File.Delete(fullPath + Found.NombreArchivo); System.IO.File.Delete(Path.Combine(fullPath, Found.NombreArchivo));
await _Repo.deleteFileByProcess(Found.id, Found.Proceso); await _Repo.deleteFileByProcess(Found.id, Found.Proceso);
} }
else return new OkObjectResult(new { respuesta = "Ese archivo no existe" }); else return new OkObjectResult(new { respuesta = "Ese archivo no existe" });
@ -246,222 +200,5 @@ namespace CORRESPONSALBackend.Controllers
} }
return new OkObjectResult(new { respuesta = "Se elimino el registro" }); return new OkObjectResult(new { respuesta = "Se elimino el registro" });
} }
[HttpGet("UnprocessedTextFiles")]
public async Task<IActionResult> GetUnprocessedTextFilesZip(){
try{
var unprocessedFiles = await _Repo.GetFilesByProcessId(31);//Se obtiene el listado de archivos que no se han procesado
if(unprocessedFiles.Count() > 0){
var newToken = await _authService.RefreshAgenteFacturacionToken();
var tokenRefresed = await CreateNewTokenTextFile(newToken);
FilePaths4Process unprocessedFilesRelativePath = await _RepoRelativePath.getPaths4ProcessById(31);//Se obtiene la ruta relativa de los archivos sin procesar
FilePaths4Process processedFilesRelativePath = await _RepoRelativePath.getPaths4ProcessById(35);//Se obtiene la ruta relativa de los archivos procesados
var unprocessedFilesPath = RootPathCorresponsales + unprocessedFilesRelativePath.Path;//Se genera la ruta completa de los archivos sin procesar
var processedFilesPath = RootPathCorresponsales + processedFilesRelativePath.Path;//Se genera la ruta completa de los archivos procesados
string zipName = $"ZippedFilesToProcess_{DateTime.Now:yyyyMMddHHmmss}.zip"; //Se crea el nombre del zip
System.IO.Compression.ZipFile.CreateFromDirectory(unprocessedFilesPath, processedFilesPath+zipName);//Se comprime el folder de los archivos sin procesar.
if(System.IO.File.Exists(processedFilesPath + zipName))//Se valida que se haya creado el archivo zip
{
byte[] zipBytes = System.IO.File.ReadAllBytes(processedFilesPath + zipName);
MemoryStream zipStream = new MemoryStream(zipBytes);//Se obtiene el contenido del zip
if(zipStream.Length > 0)//Se valida que el zip pese mas de 0 bytes
{
foreach(var unprocessedFile in unprocessedFiles)//se recorren los archivos que no han sido procesados
{
if(System.IO.File.Exists(unprocessedFilesPath+unprocessedFile.NombreArchivo))//Se valida si el archivo actual existe
{
byte[] txtBytes = System.IO.File.ReadAllBytes(unprocessedFilesPath + unprocessedFile.NombreArchivo);
MemoryStream txtStream = new MemoryStream(txtBytes);//Se obtiene el contenido del archivo actual que no ha sido procesado
using(var processedFileStream = System.IO.File.Create(processedFilesPath + unprocessedFile.NombreArchivo))//Se crea un nuevo archivo en la ruta de los procesados con el nombre del archivo sin procesar
{
await txtStream.CopyToAsync(processedFileStream);//Se copia el contenido del archivo sin procesar al nuevo archivo en la ruta de los procesados.
System.IO.File.Delete(unprocessedFilesPath + unprocessedFile.NombreArchivo);//Se borra el archivo en la ruta de los no procesados.
await _Repo.UpdateFileProcessById(unprocessedFile.id, 35);//Se actualiza el proceso en el log al archivo actual.
}
}//Deberia borrar el registro de la BD del archivo que no existe?
}
System.IO.File.Delete(processedFilesPath + zipName);//Se borra el archivo zip.
return File(zipStream, "application/zip", zipName);//Se envia como respuesta el contenido del archivo zip.
}else{
System.IO.File.Delete(processedFilesPath + zipName);//Se borra el archivo zip.
throw new Exception("Ocurrio un error al comprimir los archivos de texto. Intentelo de nuevo.");
}
}else{
throw new Exception("Ocurrio un error al comprimir los archivos de texto. Intentelo de nuevo.");
}
}else{
return new OkObjectResult( new {respuesta = "Sin archivos por procesar pro el momento"});
}
}catch(Exception ex){
return new BadRequestObjectResult(new {respuesta = ex.Message});
}
}
private async Task<bool> CreateNewTokenTextFile(string token){
try {
FilePaths4Process RelativePath = await _RepoRelativePath.getPaths4ProcessById(31);//Se obtiene la ruta de los archivos sin procesar para agregar el archivo del token.
string refreshTokenFilePath = RootPathCorresponsales + RelativePath.Path + "Token.txt";
if(System.IO.File.Exists(refreshTokenFilePath)){
System.IO.File.Delete(refreshTokenFilePath);
}
var fileStream = System.IO.File.Create(refreshTokenFilePath);
fileStream.Close();
var writer = new StreamWriter(refreshTokenFilePath);
await writer.WriteLineAsync(token);
writer.Close();
return true;
}catch(Exception ex){
return false;
}
}
[HttpGet("GetClientesZip")]
public async Task<IActionResult> GetClientesZip(int id){
try{
var trafico = await _traficosRepository.Get(id);//Se obtiene el modelo del trafico.
FilePaths4Process tempFilesRelativePath = await _RepoRelativePath.getPaths4ProcessById(40); // Path: Corresponsales\Zips\Facturacion\Entregas\
var tempFilesPath = RootPathCorresponsales + tempFilesRelativePath.Path;// Path: C:data\Corresponsales\Zips\Facturacion\Entregas\
var zipFilePath = tempFilesPath + trafico.FolioGemco + ".zip";
if(!System.IO.File.Exists(zipFilePath)){//Se valida si no existe el archivo
var procesos = new int[]{2,37,38,39,41};//Se crea un array con los procesos de los cuales se van a necesitar los archivos
if(trafico.PedimentoObligatorio == 0){
procesos = new int[]{37,38,39,41};
}
string folderName = string.Concat(trafico.FolioGemco, "\\"); // "23-000xxxC" -> "23-000xxxC\"
if(!System.IO.Directory.Exists(tempFilesPath + folderName))
System.IO.Directory.CreateDirectory(tempFilesPath + folderName);// Path: C:data\Corresponsales\Zips\Facturacion\Entregas\23-000xxxC\
//Se copian los archivos necesarios a la ruta donde se van a comprimir.
foreach (var proceso in procesos){
var fileLog = await _Repo.getFileByProcess(id, proceso);//Se busca el registro del archivo en la BD
if(fileLog.Tags == "" && proceso != 39 && proceso != 41)//Se valida que exista el registro de la BD de los archivos obligatorios
throw new Exception("No se han encontrado uno o más de los archivos obligatorios");
if(fileLog.Tags == "" && (proceso == 39 || proceso == 41)) continue; //Si es un archivo opcional se salta la ejecucion del resto del foreach
//Se obtienen las rutas relativas donde se alojan los archivos.
FilePaths4Process fileRelativePath = await _RepoRelativePath.getPaths4ProcessById(proceso);
var filePath = RootPathCorresponsales + fileRelativePath.Path + fileLog!.NombreArchivo;
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(tempFilesPath + folderName + fileLog.NombreArchivo)){
await originalFileStream.CopyToAsync(tempFileStream);
}
}else{
throw new Exception("No se han encontrado uno o más de los archivos obligatorios");
}
}
string zipFileName = tempFilesPath + trafico.FolioGemco + ".zip";
//Se comprime el folder con el nombre del trafico para crear el zip en la ruta: c:data\Corresponsales\Zips\Facturacion\Entregas\{NombreDelZip.zip}
System.IO.Compression.ZipFile.CreateFromDirectory(tempFilesPath + folderName, zipFileName);
//Se borra el folder que contenia los archivos temporales
Directory.Delete(tempFilesPath + folderName, true);
}
var zipBytes = await System.IO.File.ReadAllBytesAsync(zipFilePath);
var zipStream = new MemoryStream(zipBytes);
return File(zipStream, "application/zip", trafico.FolioGemco + ".zip");
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
[HttpGet("GetFileById")]
public async Task<IActionResult> GetFileById([FromQuery] int fileId){
var fileLog = await _Repo.getFileById(fileId);
var relativePath = await _RepoRelativePath.getPaths4ProcessById(fileLog.Proceso);
var filePath = RootPathCorresponsales + relativePath.Path + fileLog.NombreArchivo;
if(System.IO.File.Exists(filePath)){
byte[] fileBytes = System.IO.File.ReadAllBytes(filePath);
MemoryStream fileStream = new MemoryStream(fileBytes);
return File(fileStream, "application/pdf", fileLog.NombreArchivo);
}
return Ok();
}
[HttpGet("CreateFacturacionTxt")]
public async Task<IActionResult> CreateFacturacionTxt(string folioTrafico, int idTrafico, int idUsuario){
try {
var fileData = await _traficoService.GetTxtFacturacionData(idTrafico);
FilePaths4Process RelativePath = await _RepoRelativePath.getPaths4ProcessById(31);//Se obtiene la ruta de los archivos sin procesar para agregar el archivo del token.
string FileName = folioTrafico + "_" + DateTime.Now.ToString("yyyy_MM_dd_hh_mm_ss")+ ".txt";
string txtFacturacionPath = RootPathCorresponsales + RelativePath.Path + FileName;
if(System.IO.File.Exists(txtFacturacionPath)){
System.IO.File.Delete(txtFacturacionPath);
}
//Se crea el txt de faturacion. Por el momento se encuentra vacío
var fileStream = System.IO.File.Create(txtFacturacionPath);
fileStream.Close();
//Se "abre" el archivo y se escribe el contenido obtenido del servicio de los traficos
var writer = new StreamWriter(txtFacturacionPath);
await writer.WriteLineAsync(fileData);
//Se cierra el archivo
writer.Close();
//Comienza el proceso para guardar los datos del archivo en la base de datos.
FileManager dto = new FileManager(){
id = 0,
IdUsuario = idUsuario,
NombreArchivo = FileName,
Proceso = 31,
FechaRegistro = "",
Tags = idTrafico.ToString(),
Activo = 1,
Size = 1,
};
return Ok(await _Repo.FileManager(dto));
}catch(Exception ex){
var jsonContent = JsonConvert.SerializeObject(new {
To = "fmorales@gemcousa.com",
Subject = "Error al crear el txt de Facturación",
Text = "",
Html = @$"
<h3>El se detectó el siguiente error durante la creación del archivo texto del trafico {folioTrafico}</h3>
<br/>
<p>{ex.Message}</p>
"
});
HttpContent httpContent = new StringContent(jsonContent, Encoding.UTF8, "application/json");
using (var client = new HttpClient())
using (var formData = new MultipartFormDataContent())
{
var response = await client.PostAsync("https://pyapi.gemcousa.mx/SendEmail", httpContent);
}
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);
}
}
} }
} }

@ -2,12 +2,10 @@ using CORRESPONSALBackend.Contracts;
using CORRESPONSALBackend.DTO; using CORRESPONSALBackend.DTO;
using CORRESPONSALBackend.DTO.Usuario; using CORRESPONSALBackend.DTO.Usuario;
using CORRESPONSALBackend.Models; using CORRESPONSALBackend.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace CORRESPONSALBackend.Controllers namespace CORRESPONSALBackend.Controllers
{ {
[Authorize]
[Route("api/[controller]")] [Route("api/[controller]")]
[ApiController] [ApiController]
public class PerfilesController : ControllerBase public class PerfilesController : ControllerBase

@ -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,30 +0,0 @@
using CORRESPONSALBackend.Contracts.Reportes.CuentasCerradas;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace CORRESPONSALBackend.Controllers.Reportes{
[Authorize]
[Route("api/[controller]")]
[ApiController]
public class ReporteCuentasCerradasController : ControllerBase{
private readonly IReporteCuentasCerradasService _service;
private readonly IReporteCuentasCerradasRepository _repository;
public ReporteCuentasCerradasController(IReporteCuentasCerradasService service, IReporteCuentasCerradasRepository repository){
_service = service;
_repository = repository;
}
[HttpGet("GetExcel")]
public async Task<IActionResult> ReporteCuentasCerradas([FromQuery] string Inicio, string Fin, int TipoOperacion, int NoCliente, int IdCorresponsal){
try{
var cuentas = await _repository.GetCuentasCerradas(Inicio, Fin, TipoOperacion, NoCliente, IdCorresponsal);
var stream = await _service.GetExcel(cuentas);
stream.Position = 0;
return File(stream, "application/octet-stream", $"Reporte.xlsx");
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
}
}

@ -1,43 +0,0 @@
using CORRESPONSALBackend.Contracts.Reportes.GC50;
using CORRESPONSALBackend.DTO.Corresponsales;
using CORRESPONSALBackend.DTO.Reportes;
using CORRESPONSALBackend.DTO.Reportes.GC50;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using OfficeOpenXml;
using OfficeOpenXml.Table;
namespace CORRESPONSALBackend.Controllers.Reportes{
[Authorize]
[Route("api/[controller]")]
[ApiController]
public class ReporteGC50Controller : ControllerBase{
private readonly IReporteGC50Repository _reportesRepo;
private readonly IReporteGC50Service _service;
public ReporteGC50Controller(IReporteGC50Repository reportesRepo, IReporteGC50Service service)
{
_reportesRepo = reportesRepo;
_service = service;
}
[HttpGet]
public async Task<IEnumerable<DTOReporteGC50>> GetAllCorresponsalesTraficos([FromQuery] DTOReporteCorresponsales data)
{
var entrada = await _reportesRepo.GetAllCorresponsalesTraficos(data);
return entrada;
}
[HttpGet("ExcelGc50")]
public async Task<IActionResult> GetExcelGc50([FromQuery] DTOReporteCorresponsales data ){
try{
var traficos = await _reportesRepo.GetAllCorresponsalesTraficos(data);
var today = DateTime.Now;
var stream = await _service.GetExcel(traficos);
stream.Position = 0;
return File(stream, "application/octet-stream", $"ReporteGC50_{today.Day}-{today.Month}-{today.Year}.xlsx");
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
}
}

@ -1,58 +0,0 @@
using CORRESPONSALBackend.Contracts.Corresponsalias;
using CORRESPONSALBackend.Contracts.Reportes.Alen;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace CORRESPONSALBackend.Controllers.Reportes{
[Authorize]
[Route("api/[controller]")]
[ApiController]
public class ReportesAlenController : ControllerBase{
private readonly ICorresponsaliasTraficosRepository _traficosRepository;
private readonly ICorresponsaliasFacturasRepository _facturasRepository;
private readonly ICorresponsaliasContenedoresRepository _contenedoresRepository;
private readonly IReportesAlenService _reportesAlenService;
public ReportesAlenController(ICorresponsaliasTraficosRepository traficosRepository, ICorresponsaliasFacturasRepository facturasRepository,
IReportesAlenService reportesAlenService, ICorresponsaliasContenedoresRepository contenedoresRepository){
_traficosRepository = traficosRepository;
_facturasRepository = facturasRepository;
_contenedoresRepository = contenedoresRepository;
_reportesAlenService = reportesAlenService;
}
[HttpGet("RelacionFacturas")]
public async Task<IActionResult> GetRelacionFacturas([FromQuery] string referencia){
try{
var trafico = await _traficosRepository.GetByReferencia(referencia);
var facturas = await _facturasRepository.GetAll(trafico.id);
var contenedores = await _contenedoresRepository.GetAll(trafico.id);
var stream = await _reportesAlenService.GetRelacionFacturas(trafico, facturas, contenedores);
if(stream.Length > 0){
stream.Position = 0;
return File(stream,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml", $"RelacionFacturas.xlsx");
}else{
throw new Exception("Ocurrio un error al generar el reporte, intentelo de nuevo");
}
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
[HttpGet("FacturasConsolidados")]
public async Task<IActionResult> FacturasConsolidados([FromQuery] string referencia){
try{
var trafico = await _traficosRepository.GetByReferencia(referencia);
var stream = await _reportesAlenService.GetReporteFacturasTraficoConsolidado(referencia);
if(stream.Length > 0){
stream.Position = 0;
return File(stream,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml", $"FacturasConsolidado_{trafico.FolioGemco}.xlsx");
}else{
throw new Exception("Ocurrio un error al generar el reporte, intentelo de nuevo");
}
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
}
}

@ -1,84 +0,0 @@
using System.Drawing;
using CORRESPONSALBackend.Contracts.Reportes.Embarques;
using CORRESPONSALBackend.DTO.Reportes.Embarques;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using OfficeOpenXml;
using OfficeOpenXml.Drawing;
using OfficeOpenXml.Style;
using OfficeOpenXml.Table;
namespace CORRESPONSALBackend.Controllers.Reportes{
[Authorize]
[Route("api/[controller]")]
[ApiController]
public class ReportesEmbarquesController : ControllerBase{
private readonly IReportesEmbarquesRepository _repo;
private readonly IConfiguration _config;
private readonly IReportesEmbarquesService _service;
private readonly string RootPathCorresponsales;
private readonly string PathLogoGemco;
private readonly string LogoGemcoFileName = "LogoGemco.png";
public ReportesEmbarquesController(IReportesEmbarquesRepository repo, IConfiguration config, IReportesEmbarquesService service){
_repo = repo;
_config = config;
_service = service;
RootPathCorresponsales = _config.GetValue<string>("AllFiles");
PathLogoGemco = _config.GetValue<string>("LogoGemco");
}
[HttpGet("PorImportar")]
public async Task<IEnumerable<DTOEmbarquesPorImportar>> GetReporteEmbarquesPorImportar(){
var embarques = await _repo.GetReporteEmbarquesPorImportar();
return embarques;
}
[HttpGet("Despachados")]
public async Task<IEnumerable<DTOEmbarquesDespachados>> GetReporteEmbarquesDespachados([FromQuery] DateTime inicio, [FromQuery] DateTime fin){
var embarques = await _repo.GetReporteEmbarquesDespachados(inicio, fin);
return embarques;
}
[HttpGet("BuscarEmbarques")]
public async Task<IEnumerable<DTOBuscarEmbarques>> BuscarEmbarques([FromQuery] string filtro){
var embarques = await _repo.BuscarEmbarques(filtro);
return embarques;
}
[HttpGet("ExcelEmbarquesPorImportar")]
public async Task<IActionResult> GetExcelEmbarquesPorImportar(){
try{
var embarques = await _repo.GetReporteEmbarquesPorImportar();
string filePath = RootPathCorresponsales + PathLogoGemco + LogoGemcoFileName;
var stream = await _service.GetExcelEmbarquesPorImportar(embarques, filePath);
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);
string filePath = RootPathCorresponsales + PathLogoGemco + LogoGemcoFileName;
var stream = await _service.GetExcelEmbarquesDespachados(embarques, filePath);
return File(stream, "application/octet-stream", "ReporteEmbarquesSinImportar.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);
string filePath = RootPathCorresponsales + PathLogoGemco + LogoGemcoFileName;
var stream = await _service.GetExcelBusquedaEmbarques(embarques, filePath);
return File(stream, "application/octet-stream", "ReporteEmbarques.xlsx");
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
}
}

@ -1,54 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using CORRESPONSALBackend.Contracts.Utils;
using CORRESPONSALBackend.Models.Utils;
using OfficeOpenXml;
using OfficeOpenXml.Table;
using OfficeOpenXml.Style;
using CORRESPONSALBackend.Contracts.Reportes.Newell.Mensual;
using CORRESPONSALBackend.Contracts.Reportes.Newell.Semanal;
namespace CORRESPONSALBackend.Controllers.Reportes{
[Authorize]
[Route("api/[controller]")]
[ApiController]
public class ReportesNewellController : ControllerBase
{
private readonly IReporteMensualRepository _reporteMensualRepository;
private readonly IReporteMensualService _reporteMensualService;
private readonly IReporteSemanalService _reporteSemanalService;
public ReportesNewellController(IReporteMensualRepository reporteMensualRepository, IReporteMensualService reporteMensualService, IReporteSemanalService reporteSemanalService){
_reporteMensualRepository = reporteMensualRepository;
_reporteMensualService = reporteMensualService;
_reporteSemanalService = reporteSemanalService;
}
[HttpGet("ReporteMensual")]
public async Task<IActionResult> GetReporteMensual([FromQuery] int idTrailasFile, int idRptCdAcunaFile, int idRptLazaroCardenasFile){
try{
await _reporteMensualRepository.CrearTablasReporteMensual();
var stream = await _reporteMensualService.GetReporteMensual(idTrailasFile, idRptCdAcunaFile, idRptLazaroCardenasFile);
if(stream.Length > 0){
stream.Position = 0;
await _reporteMensualRepository.DropTempTables();
return File(stream,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml", $"ReporteMensual.xlsx");
}else{
throw new Exception("Ocurrio un error al generar el reporte, intentelo de nuevo");
}
}catch(Exception ex){
await _reporteMensualRepository.DropTempTables();
return StatusCode(500,ex.Message);
}
}
[HttpGet("ReporteSemanal")]
public async Task<IActionResult> GetReporteSemanal([FromQuery] int idRptSemanalFile){
try{
var stream = await _reporteSemanalService.GetReporteSemanal(idRptSemanalFile);
return File(stream,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml", $"ReporteSemanal.xlsx");
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
}
}

@ -3,11 +3,9 @@ using CORRESPONSALBackend.DTO;
using CORRESPONSALBackend.Models; using CORRESPONSALBackend.Models;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using CORRESPONSALBackend.DTO.Usuario; using CORRESPONSALBackend.DTO.Usuario;
using Microsoft.AspNetCore.Authorization;
namespace CORRESPONSALBackend.Controllers namespace CORRESPONSALBackend.Controllers
{ {
[Authorize]
[Route("api/[controller]")] [Route("api/[controller]")]
[ApiController] [ApiController]
public class UsuariosController : ControllerBase public class UsuariosController : ControllerBase

@ -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")] [Route("GetFileContentById")]
public async Task<IActionResult> GetFileContentById(long id, int Proceso) public async Task<IActionResult> GetFileContentById(long id, int Proceso)
{ {
try{
FilePaths4Process RelativePath = await _RepoRelativePath.getPaths4ProcessById(Proceso); FilePaths4Process RelativePath = await _RepoRelativePath.getPaths4ProcessById(Proceso);
SvcMFileManager FM = new SvcMFileManager(_config, _Repo, RootPath + RelativePath.Path); SvcMFileManager FM = new SvcMFileManager(_config, _Repo, RootPath + RelativePath.Path);
return await FM.getFileContentById(id); return await FM.getFileContentById(id);
}catch(Exception ex){
return BadRequest(ex.Message);
}
} }

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

@ -3,7 +3,7 @@ namespace CORRESPONSALBackend.DTO.Corresponsales
public class DTOCorresponsalTrafico public class DTOCorresponsalTrafico
{ {
public int id { get; set; } = 0; public int id { get; set; } = 0;
public string? FolioGemco { get; set; } = null!; public string? Folio { get; set; } = null!;
public string? FechaRegistro { get; set; } = null!; public string? FechaRegistro { get; set; } = null!;
public int IdUsuario { get; set; } = 0; public int IdUsuario { get; set; } = 0;
public string sUsuario { get; set; } = null!; public string sUsuario { get; set; } = null!;
@ -22,7 +22,7 @@ namespace CORRESPONSALBackend.DTO.Corresponsales
public int? Estatus { get; set; } = 0; public int? Estatus { get; set; } = 0;
public string sEstatus { get; set; } = null!; public string sEstatus { get; set; } = null!;
public string? Trafico { get; set; } = null!; public string? Trafico { get; set; } = null!;
public string? Aduana { get; set; } = "0"; public int? Aduana { get; set; } = 0;
public int? Patente { get; set; } = 0; public int? Patente { get; set; } = 0;
public int? Pedimento { get; set; } = 0; public int? Pedimento { get; set; } = 0;
public string? Clave { get; set; } = null!; public string? Clave { get; set; } = null!;
@ -48,6 +48,5 @@ namespace CORRESPONSALBackend.DTO.Corresponsales
public int Rechazado { get; set; } = 0; public int Rechazado { get; set; } = 0;
public int NoRecti { get; set; } = 0; public int NoRecti { get; set; } = 0;
public byte? Activo { get; set; } = 0; public byte? Activo { get; set; } = 0;
public int TieneSolicitud {get;set;} = 0;
} }
} }

@ -1,12 +0,0 @@
namespace CORRESPONSALBackend.DTO.Corresponsales{
public class DTOPdfAnticipo{
public int Id {get;set;}
public string FolioGemco { get; set; }
public string Pedimento { get; set; }
public string Cliente { get; set; }
public string Producto { get; set; }
public string FechaCruce { get; set; }
public string Proveedor { get; set; }
public string Anticipo { get; set; }
}
}

@ -5,16 +5,5 @@ namespace CORRESPONSALBackend.DTO.Corresponsales
{ {
public int IdTrafico { get; set; } = 0; public int IdTrafico { get; set; } = 0;
public int IdUsuario { get; set; } = 0; public int IdUsuario { get; set; } = 0;
public int IdPedimento { get; set; } = 0;
public string Aduana { get; set; } = "0";
public int Patente { get; set; } = 0;
public int Pedimento { get; set; } = 0;
public string Clave { get; set; } = "";
public string FechaPago { get; set; } = "";
public string AduanaH { get; set; } = "0";
public int PatenteH { get; set; } = 0;
public int PedimentoH { get; set; } = 0;
public string ClaveH { get; set; } = "";
public string FechaPagoH { get; set; } = "";
} }
} }

@ -4,7 +4,7 @@ namespace CORRESPONSALBackend.DTO.Corresponsales
{ {
public int Id { get; set; } = 0; public int Id { get; set; } = 0;
public int IdUsuario { get; set; } = 0; public int IdUsuario { get; set; } = 0;
public byte PedimentoObligatorio { get; set; } = 0; public byte Estatus { get; set; } = 0;
public string Comentarios { get; set; } = null!; public string Comentarios { get; set; } = null!;
} }
} }

@ -1,11 +0,0 @@
namespace CORRESPONSALBackend.DTO.Corresponsales{
public class DTOTraficoSolicitud{
public int Id { get; set; }
public int IdTrafico { get; set; }
public int IdUsuarioSolicita { get; set; }
public string UsuarioSolicita { get; set; }
public string FechaSolicita { get; set; }
public string MotivoSolicita { get; set; }
public int Estado { get; set; }
}
}

@ -1,11 +0,0 @@
namespace CORRESPONSALBackend.DTO
{
public class DTOCentrosCostos
{
public int id { set; get; } = 0;
public int idCliente { get; set; }
public string CentroCostos { get; set; }
public string NombreCliente {get;set;}
public int ClienteFacturacion { get; set; }
}
}

@ -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;} = "";
}
}

@ -1,20 +0,0 @@
public class DTOReporteFacturasTraficosConsolidados{
public string trafico { get; set; }
public string TipoOperacion { get; set; }
public string Cliente { get; set; }
public string Proveedor { get; set; }
public string Corresponsal { get; set; }
public string Aduana { get; set; }
public int Patente { get; set; }
public string Pedimento { get; set; }
public int PedimentoMaster { get; set; }
public string Fecha { get; set; }
public string Cuenta { get; set; }
public string Factura { get; set; }
public string Descripcion { get; set; }
public string Semaforo { get; set; }
public string ClavePedimento { get; set; }
public string TipoCambio { get; set; }
public string Operacion { get; set; }
public string Contenedor { get; set; }
}

@ -1,26 +0,0 @@
namespace CORRESPONSALBackend.DTO.Reportes.CuentasCerradas{
public class DTOCuentasCerradas{
public string Trafico { get; set; }
public string TipoOperacion { get; set; }
public string Cliente { get; set; }
public string Proveedor { get; set; }
public string Corresponsal { get; set; }
public string Aduana { get; set; }
public string Patente { get; set; }
public string Pedimento { get; set; }
public string FechaPago { get; set; }
public string Facturas { get; set; }
public string Descripcion { get; set; }
public string FechaAlta { get; set; }
public string Clave { get; set; }
public string ValorMn { get; set; }
public string ValorDls { get; set; }
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 FechaCruce {get;set;}
public string Semaforo {get;set;} */
}
}

@ -1,17 +0,0 @@
namespace CORRESPONSALBackend.DTO.Reportes
{
public class DTOFiltrosTraficosClientes
{
public string? Inicio { get; set; } = null!;
public string? Fin { get; set; } = null!;
public int? TipoOperacion { get; set; } = 0;
public int? NoCliente { get; set; } = 0;
public int IdCorresponsal { get; set; } = 0;
public int Pedimento {get;set;} = 0;
public int Patente {get;set;} = 0;
public string Aduana {get;set;} = "0";
public string? Referencia { get; set; } = null!;
public int IdUsuario {get;set;} = 0;
public int Estado {get;set;} = 0;
}
}

@ -14,9 +14,5 @@ namespace CORRESPONSALBackend.DTO.Reportes
public int IdCorresponsal { get; set; } = 0; public int IdCorresponsal { get; set; } = 0;
public int Proceso { get; set; } = 0; public int Proceso { get; set; } = 0;
public int Modo { get; set; } = 0; public int Modo { get; set; } = 0;
public int Pedimento {get;set;} = 0;
public int Patente {get;set;} = 0;
public string Aduana {get;set;} = "0";
public string? Referencia { get; set; } = null!;
} }
} }

@ -1,11 +0,0 @@
namespace CORRESPONSALBackend.DTO.Reportes
{
public class DTOReporteSemanalNewell{
public string GC {get;set;}
public string Contenedor { get; set; }
public string TipoContenedor {get;set;}
public string CuentaDeGastos { get; set; }
public string Razon { get; set; }
public float Maniobras { get; set; }
}
}

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

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

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

@ -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; }
}
}

@ -1,27 +0,0 @@
namespace CORRESPONSALBackend.DTO.Reportes.GC50{
public class DTOReporteGC50{
public string Trafico { get; set; }
public string Corresponsal { get; set; }
public string Aduana { get; set; }
public int Patente { get; set; }
public string PedimentoCorresponsal { 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? FechaTerminado { get; set; }
public string? FechaRegistroContabilizar { get; set; }
public string? FechaContabilizado { get; set; }
public string? FechaFacturaCorresponsal { get; set; }
public string MotivoCuentaRechazada { get; set; }
public string EstatusOperacion { get; set; }
public string CargoShipper { get; set; }
}
}

@ -1,20 +0,0 @@
public class DTOOperacionesCdAcuna{
public string? Aduana { get; set; }
public string? Patente { get; set; }
public string? Pedimento { get; set; }
/*public DateTime? FechaEntrega { get; set; }
public DateTime? FechaPago { get; set; }
public string ValorComercialMxn { get; set; }
public string ValorComercialDlls { get; set; }
public string ValorAduana { get; set; }*/
public string? Clave { get; set; }
/*public string Iva { get; set; }
public string Dta { get; set; }
public string Prv { get; set; }
public string Lgi { get; set; }*/
public string? Factura { get; set; }
public string? Tc { get; set; }
public string? Proveedor { get; set; }
public string? TaxId { get; set; }
public string? Producto { get; set; }
}

@ -1,18 +0,0 @@
public class DTOOperacionesLazaroCardenas{
public string? Pedimento { get; set; }
public string? NoContenedor { get; set; }
public int? CantidadContenedores { get; set; }
public string? Soia { get; set; }
public int? TiempoDespacho { get; set; }
public string? Clave { get; set; }
public string? PedimentoRectificado { get; set; }
public string? Causa { get; set; }
public string? CargoA { get; set; }
public int? TiempoProceso { get; set; }
public int? TiempoCruce { get; set; }
public string? Cumple { get; set; }
public string? NoCumple { get; set; }
public string? RazonNoCumple { get; set; }
public string? CargoDe { get; set; }
public string? MedioSalida { get; set; }
}

@ -1,11 +0,0 @@
public class DTOReporteMensualCdAcuna{
public string Pedimento { get; set; }
public string Traila { get; set; }
public int NoContenedores { get; set; }
public string Soia { get; set; }
public int TiempoDespacho { get; set; }
public string Clave { get; set; }
public string PedimentoRectificado { get; set; }
public string Causa { get; set; }
public string CargoA { get; set; }
}

@ -1,8 +0,0 @@
public class DTOTrailas{
public DateTime? Fecha { get; set; }
public string? Traila { get; set; }
public string? Pedimento { get; set; }
public string? Candado { get; set; }
public string? Doda { get; set; }
public string? Soia { get; set; }
}

@ -10,6 +10,5 @@ namespace CORRESPONSALBackend.DTO.Usuario
public int TipoUsuario { get; set; } = 0; public int TipoUsuario { get; set; } = 0;
public int IdPerfil { get; set; } = 0; public int IdPerfil { get; set; } = 0;
public string? FechaAlta { get; set; } = null!; public string? FechaAlta { get; set; } = null!;
public int? IdCorresponsal {get;set;} = null!;
} }
} }

@ -1,10 +0,0 @@
namespace CORRESPONSALBackend.Models.Catalogos
{
public class CatCentrosCostos
{
public int id { set; get; } = 0;
public int idCliente { get; set; }
public string CentroCostos { get; set; }
public int ClienteFacturacion { get; set; }
}
}

@ -1,7 +0,0 @@
namespace CORRESPONSALBackend.Models.Catalogos{
public class CatClavesPedimentos{
public int id {get;set;}
public string Clave {get;set;}
public string Descripcion {get;set;}
}
}

@ -5,7 +5,7 @@ namespace CORRESPONSALBackend.Models.Catalogos
public int id { set; get; } = 0; public int id { set; get; } = 0;
public string Nombre { set; get; } = null!; public string Nombre { set; get; } = null!;
public int Patente { set; get; } = 0; public int Patente { set; get; } = 0;
public string Aduana { set; get; } = "0"; public int Aduana { set; get; } = 0;
public string Correos { set; get; } = null!; public string Correos { set; get; } = null!;
} }
} }

@ -1,6 +0,0 @@
namespace CORRESPONSALBackend.Models.Catalogos{
public class CatTiposContenedores {
public int id { get; set; }
public string Descripcion { get; set; }
}
}

@ -1,9 +0,0 @@
namespace CORRESPONSALBackend.Models.Catalogos
{
public class CatTiposMercancia
{
public int id { set; get; } = 0;
public string Clave { set; get; } = null!;
public string Descripcion { set; get; } = null!;
}
}

@ -6,8 +6,5 @@
public string Nombre { set; get; } = null!; public string Nombre { set; get; } = null!;
public int IdCliente { set; get; } = 0; public int IdCliente { set; get; } = 0;
public Boolean Activo { set; get; } = true; 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 string? Concepto { set; get; } = null!;
public double Costo { set; get; } = 0; public double Costo { set; get; } = 0;
public int Activo { set; get; } = 0; public int Activo { set; get; } = 0;
public double CostoCorresponsal { set; get; } = 0;
} }
} }

@ -5,7 +5,6 @@ namespace CORRESPONSALBackend.Models
public int sClave { set; get; } public int sClave { set; get; }
public byte Agrupado { set; get; } public byte Agrupado { set; get; }
public string sRazonSocial { set; get; } = null!; public string sRazonSocial { set; get; } = null!;
public string sRFC {get;set;}=null!;
} }
} }

@ -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;
}
}

@ -12,10 +12,5 @@
public Boolean? Activo { get; set; } = true; public Boolean? Activo { get; set; } = true;
public int? Code { get; set; } = 0; public int? Code { get; set; } = 0;
public string? FolioGEMCO { get; set; } = null!; public string? FolioGEMCO { get; set; } = null!;
public string? COVE {get;set;} = null!;
public string? Entrega {get;set;}=null!;
public string? Transporte {get;set;}=null!;
public string? UUID {get;set;}= null!;
public int? IdContenedor {get;set;} = 0;
} }
} }

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save