| | | 1 | | using FAU.Entidades; |
| | | 2 | | |
| | | 3 | | namespace FAU.Logica.DTOs; |
| | | 4 | | |
| | | 5 | | public sealed class InsumosPeriodo |
| | | 6 | | { |
| | 57 | 7 | | public long PeriodoId { get; init; } |
| | 656 | 8 | | public ParametroPeriodo ParametroPeriodo { get; init; } = null!; |
| | 1457 | 9 | | public IReadOnlyDictionary<long, IReadOnlyDictionary<int, RemuneracionGrado>> RemuneracionesPorGrado { get; init; } |
| | 186 | 10 | | public IReadOnlyDictionary<long, IReadOnlyList<TablaPermanencia>> PermanenciasPorEscalafon { get; init; } = new Dict |
| | 182 | 11 | | public IReadOnlyList<FranjaIrpf> FranjasIrpf { get; init; } = Array.Empty<FranjaIrpf>(); |
| | | 12 | | // Tramos de Sanidad Militar (Art. 94 Ley 18.834), ordenados por Desde ASC |
| | 154 | 13 | | public IReadOnlyList<TramoSanidadMilitar> TramosSanidad { get; init; } = Array.Empty<TramoSanidadMilitar>(); |
| | 493 | 14 | | public IReadOnlyList<CatalogoItem> CatalogoItems { get; init; } = Array.Empty<CatalogoItem>(); |
| | 141 | 15 | | public IReadOnlyDictionary<long, IReadOnlyList<BeneficioSocial>> BeneficiosPorPersona { get; init; } = new Dictionar |
| | 140 | 16 | | public IReadOnlyDictionary<long, IReadOnlyList<ItemLoteCompensacion>> CompensacionesPorPersona { get; init; } = new |
| | 120 | 17 | | public IReadOnlyDictionary<long, IReadOnlyList<NovedadPeriodo>> NovedadesPorPersona { get; init; } = new Dictionary< |
| | | 18 | | // beneficioId → hijos registrados (para ASIGNACION_FAMILIAR) |
| | 140 | 19 | | public IReadOnlyDictionary<long, IReadOnlyList<BeneficioSocialBeneficiario>> BeneficiariosPorBeneficio { get; init; |
| | | 20 | | |
| | | 21 | | // Instructivos DFC — tipoFranja → registro vigente |
| | 140 | 22 | | public IReadOnlyDictionary<string, InstructivoAsigFamiliar> InstructivoAsigFamiliar { get; init; } = new Dictionary< |
| | | 23 | | // Instructivos DFC — numCategoria → registro vigente |
| | 140 | 24 | | public IReadOnlyDictionary<int, InstructivoPsf> InstructivoPsf { get; init; } = new Dictionary<int, InstructivoPsf>( |
| | | 25 | | // Tabla hogar constituido — tramos ordenados (hasta_haberes ASC, NULL al final) |
| | 140 | 26 | | public IReadOnlyList<TablaHogarConstituido> TablaPorHogar { get; init; } = Array.Empty<TablaHogarConstituido>(); |
| | | 27 | | |
| | | 28 | | // Aguinaldos (SAC) del año por persona — usado por AguinaldoCalculator (SIT14/15/18/20) |
| | 110 | 29 | | public IReadOnlyDictionary<long, IReadOnlyList<Aguinaldo>> AguinaldosPorPersona { get; init; } = new Dictionary<long |
| | | 30 | | |
| | | 31 | | // Diferencias de haberes por ascenso (OG 042.615) — cargado desde compensaciones_diferencia_ascenso |
| | 139 | 32 | | public IReadOnlyDictionary<long, CompensacionDiferenciaAscenso> CompensacionesDiferenciaAscensoPorPersona { get; ini |
| | | 33 | | |
| | | 34 | | // Orden de cada grado (para determinar porcentaje DI: clases 35% vs alistados 30%) |
| | | 35 | | // Cargado desde la tabla grados; key = grado_id, value = grado.orden |
| | 109 | 36 | | public IReadOnlyDictionary<long, short> OrdenPorGrado { get; init; } = new Dictionary<long, short>(); |
| | | 37 | | |
| | | 38 | | // Descuentos personales aprobados por persona (COFAnS, retención, comedor) |
| | 102 | 39 | | public IReadOnlyDictionary<long, IReadOnlyList<DescuentoPersonalPeriodo>> DescuentosPersonalesPorPersona { get; init |
| | | 40 | | |
| | | 41 | | public RemuneracionGrado? ObtenerRemuneracion(long gradoId, int codigoItem) |
| | | 42 | | { |
| | 1319 | 43 | | if (RemuneracionesPorGrado.TryGetValue(gradoId, out var items) && items.TryGetValue(codigoItem, out var remunera |
| | | 44 | | { |
| | 157 | 45 | | return remuneracion; |
| | | 46 | | } |
| | | 47 | | |
| | 1162 | 48 | | return null; |
| | | 49 | | } |
| | | 50 | | |
| | | 51 | | public TablaPermanencia? ObtenerPermanencia(long escalafonId, int aniosServicio) |
| | | 52 | | { |
| | 49 | 53 | | if (PermanenciasPorEscalafon.TryGetValue(escalafonId, out var filas)) |
| | | 54 | | { |
| | 8 | 55 | | return filas.FirstOrDefault(p => p.AniosDesde <= aniosServicio && aniosServicio <= p.AniosHasta); |
| | | 56 | | } |
| | | 57 | | |
| | 45 | 58 | | return null; |
| | | 59 | | } |
| | | 60 | | |
| | | 61 | | /// <summary> |
| | | 62 | | /// Retorna el tramo de Sanidad Militar cuyo rango [Desde, Hasta] contiene la base imponible. |
| | | 63 | | /// Hasta == null representa el último tramo (sin tope superior). |
| | | 64 | | /// </summary> |
| | | 65 | | public TramoSanidadMilitar? ObtenerTramoSanidad(decimal baseImponible) |
| | | 66 | | { |
| | 45 | 67 | | return TramosSanidad.FirstOrDefault(t => |
| | 58 | 68 | | baseImponible >= t.Desde && (t.Hasta is null || baseImponible <= t.Hasta)); |
| | | 69 | | } |
| | | 70 | | |
| | | 71 | | public IReadOnlyList<BeneficioSocial> ObtenerBeneficios(long personaId) |
| | | 72 | | { |
| | 39 | 73 | | return BeneficiosPorPersona.TryGetValue(personaId, out var beneficios) |
| | 39 | 74 | | ? beneficios |
| | 39 | 75 | | : Array.Empty<BeneficioSocial>(); |
| | | 76 | | } |
| | | 77 | | |
| | | 78 | | public IReadOnlyList<ItemLoteCompensacion> ObtenerCompensaciones(long personaId) |
| | | 79 | | { |
| | 38 | 80 | | return CompensacionesPorPersona.TryGetValue(personaId, out var items) |
| | 38 | 81 | | ? items |
| | 38 | 82 | | : Array.Empty<ItemLoteCompensacion>(); |
| | | 83 | | } |
| | | 84 | | |
| | | 85 | | public NovedadPeriodo? ObtenerNovedad(long personaId) |
| | | 86 | | { |
| | 1 | 87 | | return NovedadesPorPersona.TryGetValue(personaId, out var novedades) |
| | 1 | 88 | | ? novedades.FirstOrDefault() |
| | 1 | 89 | | : null; |
| | | 90 | | } |
| | | 91 | | |
| | | 92 | | /// <summary> |
| | | 93 | | /// Retorna la novedad de tipo 'dias_eximidos' para el prorrateo salarial. |
| | | 94 | | /// 'subsidio_enfermedad' no reduce el sueldo base — tiene su propio cálculo (pendiente). |
| | | 95 | | /// </summary> |
| | | 96 | | public NovedadPeriodo? ObtenerNovedadEximidos(long personaId) |
| | | 97 | | { |
| | 17 | 98 | | if (!NovedadesPorPersona.TryGetValue(personaId, out var novedades)) |
| | 14 | 99 | | return null; |
| | 6 | 100 | | return novedades.FirstOrDefault(n => n.Tipo == "dias_eximidos"); |
| | | 101 | | } |
| | | 102 | | |
| | | 103 | | public IReadOnlyList<NovedadPeriodo> ObtenerNovedades(long personaId) |
| | | 104 | | { |
| | 0 | 105 | | return NovedadesPorPersona.TryGetValue(personaId, out var novedades) |
| | 0 | 106 | | ? novedades |
| | 0 | 107 | | : Array.Empty<NovedadPeriodo>(); |
| | | 108 | | } |
| | | 109 | | |
| | | 110 | | public CompensacionDiferenciaAscenso? ObtenerDiferenciaAscenso(long personaId) |
| | | 111 | | { |
| | 37 | 112 | | return CompensacionesDiferenciaAscensoPorPersona.TryGetValue(personaId, out var diff) |
| | 37 | 113 | | ? diff |
| | 37 | 114 | | : null; |
| | | 115 | | } |
| | | 116 | | |
| | | 117 | | public IReadOnlyList<DescuentoPersonalPeriodo> ObtenerDescuentosPersonales(long personaId) |
| | | 118 | | { |
| | 0 | 119 | | return DescuentosPersonalesPorPersona.TryGetValue(personaId, out var descuentos) |
| | 0 | 120 | | ? descuentos |
| | 0 | 121 | | : Array.Empty<DescuentoPersonalPeriodo>(); |
| | | 122 | | } |
| | | 123 | | } |