#include <errno.h>
#include <stdio.h>
-static long long total_rendimento(struct declaracao *dec)
+static void total_rendimento(struct declaracao *dec)
{
long long tr = 0;
struct rendimento *rendimento;
for (i = 0; rendimento = list_get(dec->rendimento, i); i++) {
tr += rendimento->rendimento;
}
- return tr;
+ dec->totalrendimento = tr;
}
static long long total_deducao(struct declaracao *dec)
struct taxtable *tt;
long long tr, td;
tt = table2015;
- tr = total_rendimento(dec);
+ tr = dec->totalrendimento;
dec->totalrendimento = tr;
if (tr / 5 < simples2015)
td = tr / 5;
return -EINVAL;
}
tt = table2015;
- tr = total_rendimento(dec);
+ tr = dec->totalrendimento;
td = total_deducao(dec);
- dec->totalrendimento = tr;
tr -= td;
return imposto(tt, tr);
}
if (dec->ano != 2015) {
return -EINVAL;
}
+ total_rendimento(dec);
i_simples = imposto_simples(dec);
i_completa = imposto_completa(dec);
total_pago(dec);