#include "rendimento.h"
#include "totais.h"
-static void total_rendimento(struct declaracao *dec)
-{
- dec->totalrendimento = totais_get(dec, "RENDPJTIT");
-}
-
static long long total_deducao(struct declaracao *dec)
{
long long td = 0;
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);
fprintf(f, "%08d", 0); /* Data saída */
fprintf(f, "%-11.11s", ""); /* CPF procurador */
fprintf(f, "000"); /* TODO: criterio obrigatoriedade */
- fprintf(f, "%013lld", dec->totalrendimento); /* Total tributavel */
+ fprintf(f, "%013lld", totais_get(dec, "RENDPJ")); /* Total tributavel */
fprintf(f, "%-14.14s", ""); /* TODO: CNPJ previdencia */
fprintf(f, "%-14.14s", ""); /* TODO: CNPJ previdencia 2 */
fprintf(f, "%013lld", 0); /* TODO: Total isentos */
{
fprintf(f, "18");
fprintf(f, "%s", dec->cpf); /* CPF: 11 dígitos */
- fprintf(f, "%013lld", dec->totalrendimento); /* TODO: rendimentos tributáveis */
+ fprintf(f, "%013lld", totais_get(dec, "RENDPJ")); /* TODO: rendimentos tributáveis */
fprintf(f, "%013lld", 0); /* TODO: desconto simplificado */
fprintf(f, "%013lld", 0); /* TODO: base cálculo */
fprintf(f, "%013lld", dec->devido); /* imposto devido */
fprintf(f, "%-4.4s", dec->contribuinte.ddd);
fprintf(f, "%-9.9s", dec->contribuinte.telefone);
fprintf(f, "%s", dec->retifica ? "S" : "N"); /* Retificadora */
- fprintf(f, "%013lld", dec->totalrendimento); /* Total tributavel */
+ fprintf(f, "%013lld", totais_get(dec, "RENDPJ")); /* Total tributavel */
fprintf(f, "%013lld", dec->devido); /* Imposto devido */
fprintf(f, "%013lld", dec->restituicao); /* Imposto a restituir */
fprintf(f, "%013lld", dec->pagar); /* Imposto a pagar */
rendimento_free(rendimento);
return r;
}
- r = totais_add(dec, "RENDPJTIT", rendimento->rendimento);
+ r = totais_add(dec, "RENDPJ", rendimento->rendimento);
+ r += totais_add(dec, "RENDPJTIT", rendimento->rendimento);
if (r) {
rendimento_free(rendimento);
return r;