Inclui imposto sobre décimo terceiro no rendimento
authorThadeu Lima de Souza Cascardo <cascardo@cascardo.eti.br>
Sun, 19 Jul 2015 14:36:58 +0000 (11:36 -0300)
committerThadeu Lima de Souza Cascardo <cascardo@cascardo.eti.br>
Sun, 19 Jul 2015 14:38:07 +0000 (11:38 -0300)
O arquivo de declaração inclui esse valor na linha sobre rendimentos
de PJ.

rendimento.c
rendimento.h

index f4ab9b2..80311db 100644 (file)
@@ -45,17 +45,19 @@ static struct rendimento * rendimento_new(char **args)
        rendimento = malloc(sizeof(*rendimento));
        rendimento->cnpj = strdup(args[1]);
        rendimento->nome = strdup(args[2]);
-       rendimento->saida = strdup(args[7]);
+       rendimento->saida = strdup(args[8]);
        r += set_llong(args[3], &rendimento->rendimento);
        r += set_llong(args[4], &rendimento->previdencia);
        r += set_llong(args[5], &rendimento->decimoterceiro);
        r += set_llong(args[6], &rendimento->imposto);
+       r += set_llong(args[7], &rendimento->imposto_13o);
        if (!rendimento->cnpj || !rendimento->nome || !rendimento->saida) {
                rendimento_free(rendimento);
                return NULL;
        }
        if (r < 0 || rendimento->rendimento < 0 || rendimento->previdencia < 0 ||
-           rendimento->decimoterceiro < 0 || rendimento->imposto < 0) {
+           rendimento->decimoterceiro < 0 || rendimento->imposto < 0 ||
+           rendimento->imposto_13o < 0) {
                rendimento_free(rendimento);
                return NULL;
        }
@@ -66,7 +68,7 @@ static int run_rendimento(struct declaracao *dec, char **args, int argc)
 {
        struct rendimento *rendimento;
        int r;
-       if (argc != 8)
+       if (argc != 9)
                return -EINVAL;
        rendimento = rendimento_new(args);
        if (!rendimento)
@@ -84,9 +86,9 @@ void rendimento_salva(struct declaracao *dec, FILE *f)
        int i;
        struct rendimento *j;
        for (i = 0; j = list_get(dec->rendimento, i); i++)
-               fprintf(f, "rendimento \"%s\" \"%s\" %lld %lld %lld %lld \"%s\"\n",
+               fprintf(f, "rendimento \"%s\" \"%s\" %lld %lld %lld %lld %lld \"%s\"\n",
                        j->cnpj, j->nome, j->rendimento, j->previdencia,
-                       j->decimoterceiro, j->imposto, j->saida);
+                       j->decimoterceiro, j->imposto, j->imposto_13o, j->saida);
 }
 
 static struct cmd cmd_rendimento = {
index 11fc0ab..0f183a7 100644 (file)
@@ -29,6 +29,7 @@ struct rendimento {
        long long previdencia;
        long long decimoterceiro;
        long long imposto;
+       long long imposto_13o;
        char *saida;
 };