Refinamiento de permisos y ajustes en controles. Añade gestión sobre saldos y visualización. Entre otros..

This commit is contained in:
2025-06-06 18:33:09 -03:00
parent 8fb94f8cef
commit 35e24ab7d2
104 changed files with 5917 additions and 1205 deletions

View File

@@ -43,5 +43,7 @@ namespace GestionIntegral.Api.Data.Repositories.Reportes
Task<(IEnumerable<ListadoDistribucionDistSimpleDto> Simple, IEnumerable<ListadoDistribucionDistPromedioDiaDto> Promedios, string? Error)> ObtenerListadoDistribucionDistribuidoresAsync(int idDistribuidor, int idPublicacion, DateTime fechaDesde, DateTime fechaHasta);
Task<IEnumerable<LiquidacionCanillaDetalleDto>> GetLiquidacionCanillaDetalleAsync(DateTime fecha, int idCanilla);
Task<IEnumerable<LiquidacionCanillaGananciaDto>> GetLiquidacionCanillaGananciasAsync(DateTime fecha, int idCanilla);
Task<IEnumerable<ListadoDistCanMensualDiariosDto>> GetReporteMensualDiariosAsync(DateTime fechaDesde, DateTime fechaHasta, bool esAccionista);
Task<IEnumerable<ListadoDistCanMensualPubDto>> GetReporteMensualPorPublicacionAsync(DateTime fechaDesde, DateTime fechaHasta, bool esAccionista);
}
}

View File

@@ -481,39 +481,71 @@ namespace GestionIntegral.Api.Data.Repositories.Reportes
}
public async Task<IEnumerable<LiquidacionCanillaDetalleDto>> GetLiquidacionCanillaDetalleAsync(DateTime fecha, int idCanilla)
{
const string spName = "dbo.SP_DistCanillasLiquidacion";
var parameters = new DynamicParameters();
parameters.Add("@fecha", fecha, DbType.DateTime);
parameters.Add("@idCanilla", idCanilla, DbType.Int32);
try
{
using var connection = _dbConnectionFactory.CreateConnection();
return await connection.QueryAsync<LiquidacionCanillaDetalleDto>(spName, parameters, commandType: CommandType.StoredProcedure);
{
const string spName = "dbo.SP_DistCanillasLiquidacion";
var parameters = new DynamicParameters();
parameters.Add("@fecha", fecha, DbType.DateTime);
parameters.Add("@idCanilla", idCanilla, DbType.Int32);
try
{
using var connection = _dbConnectionFactory.CreateConnection();
return await connection.QueryAsync<LiquidacionCanillaDetalleDto>(spName, parameters, commandType: CommandType.StoredProcedure);
}
catch (Exception ex)
{
_logger.LogError(ex, "Error SP {SPName} para Liquidacion Canilla Detalle. Fecha: {Fecha}, Canilla: {IdCanilla}", spName, fecha, idCanilla);
return Enumerable.Empty<LiquidacionCanillaDetalleDto>();
}
}
catch (Exception ex)
{
_logger.LogError(ex, "Error SP {SPName} para Liquidacion Canilla Detalle. Fecha: {Fecha}, Canilla: {IdCanilla}", spName, fecha, idCanilla);
return Enumerable.Empty<LiquidacionCanillaDetalleDto>();
}
}
public async Task<IEnumerable<LiquidacionCanillaGananciaDto>> GetLiquidacionCanillaGananciasAsync(DateTime fecha, int idCanilla)
{
const string spName = "dbo.SP_DistCanillasLiquidacionGanancias";
var parameters = new DynamicParameters();
parameters.Add("@fecha", fecha, DbType.DateTime);
parameters.Add("@idCanilla", idCanilla, DbType.Int32);
try
{
using var connection = _dbConnectionFactory.CreateConnection();
return await connection.QueryAsync<LiquidacionCanillaGananciaDto>(spName, parameters, commandType: CommandType.StoredProcedure);
public async Task<IEnumerable<LiquidacionCanillaGananciaDto>> GetLiquidacionCanillaGananciasAsync(DateTime fecha, int idCanilla)
{
const string spName = "dbo.SP_DistCanillasLiquidacionGanancias";
var parameters = new DynamicParameters();
parameters.Add("@fecha", fecha, DbType.DateTime);
parameters.Add("@idCanilla", idCanilla, DbType.Int32);
try
{
using var connection = _dbConnectionFactory.CreateConnection();
return await connection.QueryAsync<LiquidacionCanillaGananciaDto>(spName, parameters, commandType: CommandType.StoredProcedure);
}
catch (Exception ex)
{
_logger.LogError(ex, "Error SP {SPName} para Liquidacion Canilla Ganancias. Fecha: {Fecha}, Canilla: {IdCanilla}", spName, fecha, idCanilla);
return Enumerable.Empty<LiquidacionCanillaGananciaDto>();
}
}
catch (Exception ex)
{
_logger.LogError(ex, "Error SP {SPName} para Liquidacion Canilla Ganancias. Fecha: {Fecha}, Canilla: {IdCanilla}", spName, fecha, idCanilla);
return Enumerable.Empty<LiquidacionCanillaGananciaDto>();
public async Task<IEnumerable<ListadoDistCanMensualDiariosDto>> GetReporteMensualDiariosAsync(DateTime fechaDesde, DateTime fechaHasta, bool esAccionista)
{
using var connection = _dbConnectionFactory.CreateConnection();
var parameters = new
{
fechaDesde = fechaDesde.Date,
fechaHasta = fechaHasta.Date, // El SP parece manejar el rango incluyendo el último día
accionista = esAccionista
};
return await connection.QueryAsync<ListadoDistCanMensualDiariosDto>(
"dbo.SP_DistCanillasAccConImporteEntreFechasDiarios",
parameters,
commandType: CommandType.StoredProcedure
);
}
public async Task<IEnumerable<ListadoDistCanMensualPubDto>> GetReporteMensualPorPublicacionAsync(DateTime fechaDesde, DateTime fechaHasta, bool esAccionista)
{
using var connection = _dbConnectionFactory.CreateConnection();
var parameters = new
{
fechaDesde = fechaDesde.Date,
fechaHasta = fechaHasta.Date,
accionista = esAccionista
};
return await connection.QueryAsync<ListadoDistCanMensualPubDto>(
"dbo.SP_DistCanillasAccConImporteEntreFechas",
parameters,
commandType: CommandType.StoredProcedure
);
}
}
}
}