Adiciona totais de rendimentos tributáveis.
authorThadeu Lima de Souza Cascardo <cascardo@cascardo.eti.br>
Tue, 28 Feb 2017 20:36:31 +0000 (17:36 -0300)
committerThadeu Lima de Souza Cascardo <cascardo@cascardo.eti.br>
Tue, 28 Feb 2017 20:36:31 +0000 (17:36 -0300)
Rendimentos tributáveis e de pessoas físicas são adicionados. Onde
rendimentos tributáveis devem ser utilizados, ao invés de apenas
rendimentos de pessoa jurídica, a mudança foi feita.

lib/calcula.c
lib/gera.c
lib/rendimento.c

index 607ff9d..ac2ed73 100644 (file)
@@ -193,7 +193,7 @@ static long long imposto_simples(struct declaracao *dec)
        struct taxtable *tt;
        long long tr, td;
        tt = table[ANO(dec->ano)];
-       tr = totais_get(dec, "RENDPJ");
+       tr = totais_get(dec, "RENDTRIB");
        if (tr / 5 < simples[ANO(dec->ano)])
                td = tr / 5;
        else
@@ -214,7 +214,7 @@ static long long imposto_completa(struct declaracao *dec)
        struct taxtable *tt;
        long long tr, td;
        tt = table[ANO(dec->ano)];
-       tr = totais_get(dec, "RENDPJ");
+       tr = totais_get(dec, "RENDTRIB");
        td = total_deducao(dec);
        totais_add(dec, "DEDUCOES", td);
        tr -= td;
@@ -234,12 +234,12 @@ int calcula(struct declaracao *dec)
                dec_set_error(dec, "Ano %d não suportado.", dec->ano);
                return -EINVAL;
        }
-       if (totais_get(dec, "RENDPJ") > obrigatoriedade[ANO(dec->ano)]) {
+       if (totais_get(dec, "RENDTRIB") > obrigatoriedade[ANO(dec->ano)]) {
                if (dec->verbose) {
                        printf("Declaracao obrigatoria pois rendimento e"
                                "maior que mínimo para declaracao: "
                                FMT_R" > "FMT_R"\n",
-                               R(totais_get(dec, "RENDPJ")),
+                               R(totais_get(dec, "RENDTRIB")),
                                R(obrigatoriedade[ANO(dec->ano)]));
                }
                dec->obrigatoria = 1;
index bd70fdc..96574ce 100644 (file)
@@ -135,7 +135,7 @@ static void gera_header(struct declaracao *dec, FILE *f)
        fprintf(f, "%08d", 0); /* Data saída */
        fprintf(f, "%-11.11s", ""); /* CPF procurador */
        fprintf(f, "%03d", dec->obrigatoria); /* criterio obrigatoriedade */
-       fprintf(f, "%013lld", totais_get(dec, "RENDPJ")); /* Total tributavel */
+       fprintf(f, "%013lld", totais_get(dec, "RENDTRIB")); /* Total tributavel */
        /* CNPJ previdencia */
        fprintf(f, "%-14.14s", inss_cnpj_ordenado(dec, 0));
        /* CNPJ previdencia 2 */
@@ -277,11 +277,11 @@ static void gera_simples(struct declaracao *dec, FILE *f)
        fprintf(f, "%013lld", totais_get(dec, "EXCLUSIVOSDEP")); /* exclusivos dependentes */
        fprintf(f, "%-13.13s", ""); /* FILLER */
        fprintf(f, "%-13.13s", ""); /* FILLER */
-       fprintf(f, "%013lld", 0); /* TODO: rendimentos PF */
+       fprintf(f, "%013lld", totais_get(dec, "RENDPF")); /* rendimentos PF */
        fprintf(f, "%013lld", 0); /* TODO: rendimentos PF dependentes */
        fprintf(f, "%013lld", 0); /* TODO: rendimentos PF exterior */
        fprintf(f, "%013lld", 0); /* TODO: rendimentos PF ext. depend. */
-       fprintf(f, "%013lld", 0); /* TODO: carnê-leão PF? */
+       fprintf(f, "%013lld", totais_get(dec, "RENDPF")); /* TODO: carnê-leão PF? */
        fprintf(f, "%013lld", 0); /* TODO: carnê-leão dependentes */
        fprintf(f, "%013lld", totais_get(dec, "DEPENDENTES")); /* dedução dependentes */
        fprintf(f, "%013lld", 0); /* TODO: previdência RRA */
@@ -297,7 +297,7 @@ static void gera_totais_simples(struct declaracao *dec, FILE *f)
 {
        fprintf(f, "18");
        fprintf(f, "%s", dec->cpf); /* CPF: 11 dígitos */
-       fprintf(f, "%013lld", totais_get(dec, "RENDPJ")); /* TODO: rendimentos tributáveis */
+       fprintf(f, "%013lld", totais_get(dec, "RENDTRIB")); /* rendimentos tributáveis */
        /* desconto simplificado */
        fprintf(f, "%013lld", totais_get(dec, "DESCONTO"));
         /* base de cálculo */
@@ -305,7 +305,7 @@ static void gera_totais_simples(struct declaracao *dec, FILE *f)
        fprintf(f, "%013lld", dec->devido); /* imposto devido */
        fprintf(f, "%013lld", dec->retido); /* imposto retido */
        fprintf(f, "%013lld", 0); /* TODO: imposto complementar */
-       fprintf(f, "%013lld", 0); /* TODO: carnê-leão */
+       fprintf(f, "%013lld", totais_get(dec, "RENDPF")); /* TODO: carnê-leão */
        fprintf(f, "%013lld", 0); /* TODO: imposto retido Lei 11.033 */
        fprintf(f, "%013lld", dec->restituicao); /* imposto a restituir */
        fprintf(f, "%013lld", dec->pagar); /* imposto pagar */
@@ -383,7 +383,7 @@ static void gera_completa(struct declaracao *dec, FILE *f)
        fprintf(f, "%013lld", 0); /* TODO: 13o dependente */
        fprintf(f, "%05d", totais_get(dec, "DEPSINSTRUCAO")); /* dependentes com instrucao */
        fprintf(f, "%05d", 0); /* TODO: alimentandos com instrucao */
-       fprintf(f, "%013lld", 0); /* TODO: rendimentos PF titular */
+       fprintf(f, "%013lld", totais_get(dec, "RENDPFTIT")); /* TODO: rendimentos PF titular */
        fprintf(f, "%013lld", 0); /* TODO: rendimentos PF dependente */
        fprintf(f, "%013lld", 0); /* TODO: rendimentos PF exterior titular */
        fprintf(f, "%013lld", 0); /* TODO: rendimentos PF exterior dependente */
@@ -404,10 +404,10 @@ static void gera_totais_completa(struct declaracao *dec, FILE *f)
        fprintf(f, "%s", dec->cpf); /* CPF: 11 dígitos */
        /* FIXME: completar campos */
        fprintf(f, "%013lld", totais_get(dec, "RENDPJTIT")); /* rendimentos PJ titular */
-       fprintf(f, "%013lld", 0); /* TODO: rendimentos PF titular */
+       fprintf(f, "%013lld", totais_get(dec, "RENDPFTIT")); /* TODO: rendimentos PF titular */
        fprintf(f, "%013lld", 0); /* TODO: rendimentos PF dependente */
        fprintf(f, "%013lld", 0); /* TODO: resultado atividade rural */
-       fprintf(f, "%013lld", totais_get(dec, "RENDPJ")); /* TODO: total rendimentos tributáveis */
+       fprintf(f, "%013lld", totais_get(dec, "RENDTRIB")); /* total rendimentos tributáveis */
        /* TODO (2016): somar FUNPRESP até o limite */
        fprintf(f, "%013lld", totais_get(dec, "INSS")); /* previdencia oficial */
        /* TODO (2016): somar FUNPRESP acima do limite */
@@ -427,7 +427,7 @@ static void gera_totais_completa(struct declaracao *dec, FILE *f)
        fprintf(f, "%013lld", dec->devido); /* TODO: imposto devido menos patronal */
        fprintf(f, "%013lld", dec->devido); /* TODO: imposto devido mais RRA */
        fprintf(f, "%013lld", dec->retido); /* imposto na fonte */
-       fprintf(f, "%013lld", 0); /* TODO: carne leao */
+       fprintf(f, "%013lld", totais_get(dec, "RENDPF")); /* TODO: carne leao */
 
        fprintf(f, "%013lld", 0); /* TODO: imposto complementar */
        fprintf(f, "%013lld", 0); /* TODO: imposto pago exterior */
@@ -621,7 +621,7 @@ static void gera_recibodetalhe(struct declaracao *dec, FILE *f)
        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", totais_get(dec, "RENDPJ")); /* Total tributavel */
+       fprintf(f, "%013lld", totais_get(dec, "RENDTRIB")); /* 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 */
index 508a6fb..2e1d369 100644 (file)
@@ -91,7 +91,8 @@ static int run_rendimento(struct declaracao *dec, char **args, int argc)
                rendimento_free(rendimento);
                return r;
        }
-       r = totais_add(dec, "RENDPJ", rendimento->rendimento);
+       r = totais_add(dec, "RENDTRIB", rendimento->rendimento);
+       r += totais_add(dec, "RENDPJ", rendimento->rendimento);
        r += totais_add(dec, "RENDPJTIT", rendimento->rendimento);
        r += totais_add(dec, "INSS", rendimento->previdencia);
        r += totais_add(dec, "DECIMOTERCEIRO", rendimento->decimoterceiro);