static void gera_isentos2(struct declaracao *dec, FILE *f, int codigo, char *nome)
{
+ long long total = totais_get(dec, nome);
+ if (total == 0)
+ return;
fprintf(f, "23");
fprintf(f, "%-11.11s", dec->cpf);
fprintf(f, "%04d", codigo);
- fprintf(f, "%013lld", totais_get(dec, nome)); /* TODO: retistuição imposto anos anteriores */
+ fprintf(f, "%013lld", total);
}
static void gera_23_poupanca(struct declaracao *dec, FILE *f)
return -errno;
}
fn(dec, m);
- dec->linhas[0]++;
fflush(m);
+ if (bsize == 0) {
+ fclose(m);
+ return 0;
+ }
+ dec->linhas[0]++;
/* Calcula CRC32 para campo de controle dos registros. */
c = crc32(c, buf, bsize);