*/
#include "calcula.h"
+#include <errno.h>
+#include <stdio.h>
#include "declaracao.h"
#include "cmd.h"
#include "rendimento.h"
-#include <errno.h>
-#include <stdio.h>
-
-static void total_rendimento(struct declaracao *dec)
-{
- long long tr = 0;
- struct rendimento *rendimento;
- int i;
- for (i = 0; rendimento = list_get(dec->rendimento, i); i++) {
- tr += rendimento->rendimento;
- }
- dec->totalrendimento = tr;
-}
+#include "totais.h"
static long long total_deducao(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);