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