Esempio n. 1
0
        private void r24_TotalizaTributacaoExclusiva()
        {
            var dicValores = new Dictionary <int, decimal>();

            // Zera todos
            //for (int i = 1; i <= 12; i++) dicValores.Add(i, 0);

            // São os campos próprios (calculados) e os 88, 89

            // 01: Décimo terceiro do Titular => R21
            if (RendimentosPJ != null)
            {
                dicValores[1] = RendimentosPJ.Sum(o => o.VR_DecTerc);
            }
            // 02: Ganhos de Capital          =>
            //--
            // 03: Ganhos de Capital Estrangeira =>
            //--
            // 04: Ganhos de Capital em espécie  =>
            //--
            // 05: Ganhos Renda Variável  =>
            if (RendimentosTributacaoExclusiva != null)
            {
                dicValores[5] = RendimentosTributacaoExclusiva
                                .Where(o => o.CD_Exclusivo == 5)
                                .Sum(o => o.VR_Valor);
            }
            // 07: RRA
            //--
            // 08: Décimo terceiro dos Dependentes => R32
            if (RendimentosPJDependentes != null)
            {
                dicValores[8] = RendimentosPJDependentes.Sum(o => o.VR_DecTerc);
            }
            // 09: RRA Dependentes
            //--
            // 06: Rendimentos Aplicações => R88
            // 10: JCP     => R88
            // 11: RendPLR => R88
            if (RendimentoExclusivo_Tipo2 != null)
            {
                foreach (var v in RendimentoExclusivo_Tipo2)
                {
                    if (!dicValores.ContainsKey(v.NR_Cod))
                    {
                        dicValores.Add(v.NR_Cod, 0);
                    }
                    dicValores[v.NR_Cod] += v.VR_Valor;
                }
            }
            // 12: Outros  => R89
            if (RendimentoExclusivo_Tipo3 != null)
            {
                dicValores[12] = RendimentoExclusivo_Tipo3.Sum(o => o.VR_Valor);
            }

            RendimentosTributacaoExclusiva = dicValores
                                             .Where(o => o.Value > 0)
                                             .Select(pair => new Classes_DEC.R24_RendimentosTributacaoExclusiva(Header)
            {
                CD_Exclusivo = pair.Key,
                VR_Valor     = pair.Value
            })
                                             .ToArray();
        }