Fix(Suscripciones): Insert en db arreglado y muestra en UI tipo factura
All checks were successful
Optimized Build and Deploy / remote-build-and-deploy (push) Successful in 3m25s
All checks were successful
Optimized Build and Deploy / remote-build-and-deploy (push) Successful in 3m25s
- Se arregla error al insertar en la db el registro de factura "Alta" - Se arregla UI por falla en la visualización del tipo de factura en la tabla de gestión de facturas.
This commit is contained in:
@@ -17,7 +17,7 @@ namespace GestionIntegral.Api.Services.Suscripciones
|
||||
private readonly DbConnectionFactory _connectionFactory;
|
||||
private readonly ILogger<DebitoAutomaticoService> _logger;
|
||||
|
||||
private const string NRO_PRESTACION = "123456"; // Reemplazar por el número real
|
||||
private const string NRO_PRESTACION = "26435"; // Reemplazar por el número real
|
||||
private const string ORIGEN_EMPRESA = "EMPRESA";
|
||||
|
||||
public DebitoAutomaticoService(
|
||||
|
||||
@@ -171,10 +171,13 @@ namespace GestionIntegral.Api.Services.Suscripciones
|
||||
DescuentoAplicado = descuentoPromocionesTotal,
|
||||
ImporteFinal = importeFinal,
|
||||
EstadoPago = "Pendiente",
|
||||
EstadoFacturacion = "Pendiente de Facturar"
|
||||
EstadoFacturacion = "Pendiente de Facturar",
|
||||
TipoFactura = "Mensual"
|
||||
};
|
||||
|
||||
var facturaCreada = await _facturaRepository.CreateAsync(nuevaFactura, transaction);
|
||||
if (facturaCreada == null) throw new DataException($"No se pudo crear la factura para suscriptor ID {idSuscriptor} y empresa ID {idEmpresa}");
|
||||
|
||||
facturasCreadas.Add(facturaCreada);
|
||||
foreach (var detalle in detallesParaFactura)
|
||||
{
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace GestionIntegral.Api.Services.Suscripciones
|
||||
|
||||
if (periodoSuscripcion <= ultimoPeriodo)
|
||||
{
|
||||
_logger.LogInformation("Suscripción en período ya cerrado detectada para Suscriptor {IdSuscriptor}. Generando factura de alta pro-rata.", creada.IdSuscriptor);
|
||||
_logger.LogInformation("Suscripción en período ya cerrado detectada. Generando factura de alta pro-rata.");
|
||||
|
||||
decimal importeProporcional = await _facturacionService.CalcularImporteParaSuscripcion(creada, creada.FechaInicio.Year, creada.FechaInicio.Month, transaction);
|
||||
|
||||
@@ -146,12 +146,12 @@ namespace GestionIntegral.Api.Services.Suscripciones
|
||||
IdSuscriptor = creada.IdSuscriptor,
|
||||
Periodo = creada.FechaInicio.ToString("yyyy-MM"),
|
||||
FechaEmision = DateTime.Now.Date,
|
||||
FechaVencimiento = DateTime.Now.AddDays(10).Date, // Vencimiento corto
|
||||
FechaVencimiento = DateTime.Now.AddDays(10).Date,
|
||||
ImporteBruto = importeProporcional,
|
||||
ImporteFinal = importeProporcional,
|
||||
EstadoPago = "Pendiente",
|
||||
EstadoFacturacion = "Pendiente de Facturar",
|
||||
TipoFactura = "Alta" // Marcamos la factura como de tipo "Alta"
|
||||
TipoFactura = "Alta"
|
||||
};
|
||||
|
||||
var facturaCreada = await _facturaRepository.CreateAsync(facturaDeAlta, transaction);
|
||||
|
||||
Reference in New Issue
Block a user