#include "rendimento.h"
#include "totais.h"
-static void total_rendimento(struct declaracao *dec)
-{
- dec->totalrendimento = totais_get(dec, "RENDPJTIT");
-}
-
+/* Alguns totais precisam ser limitados. Portanto, um total de decuções
+ * precisa ser ajustado para tais limites. Esta função considerará tais
+ * limites no futuro. */
static long long total_deducao(struct declaracao *dec)
{
- long long td = 0;
- struct rendimento *rendimento;
- int i;
- for (i = 0; rendimento = list_get(dec->rendimento, i); i++) {
- td += rendimento->previdencia;
- }
- return td;
+ return totais_get(dec, "INSS") + totais_get(dec, "PAGAMENTOS");
}
static void total_pago(struct declaracao *dec)
struct taxtable *tt;
long long tr, td;
tt = table2015;
- tr = dec->totalrendimento;
- dec->totalrendimento = tr;
+ tr = totais_get(dec, "RENDPJ");
if (tr / 5 < simples2015)
td = tr / 5;
else
return -EINVAL;
}
tt = table2015;
- tr = dec->totalrendimento;
+ tr = totais_get(dec, "RENDPJ");
td = total_deducao(dec);
tr -= td;
return imposto(tt, tr);
if (dec->ano != 2015) {
return -EINVAL;
}
- total_rendimento(dec);
- if (dec->totalrendimento > obrigatoriedade2015)
+ if (totais_get(dec, "RENDPJ") > obrigatoriedade2015)
dec->obrigatoria = 1;
i_simples = imposto_simples(dec);
i_completa = imposto_completa(dec);