X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fdeclara.git;a=blobdiff_plain;f=lib%2Fgera.c;h=aa22d4ffcd0d01cb66062e092a77bcaf143082bd;hp=d57a3218cd4cecc15f7d714c75127f24494ff4d9;hb=6ec61d7d67646324136872daee17d75875b0d39d;hpb=f173c1f2238f4401952ac0c2d78834a49004baf6 diff --git a/lib/gera.c b/lib/gera.c index d57a321..aa22d4f 100644 --- a/lib/gera.c +++ b/lib/gera.c @@ -33,6 +33,7 @@ #include "totais.h" #include "sistema.h" #include "ano.h" +#include "attr.h" static void gera_header(struct declaracao *dec, FILE *f) { @@ -956,22 +957,22 @@ static void gera_bem(struct declaracao *dec, FILE *f) fprintf(f, "%013lld", b->valor); /* Imóvel */ - fprintf(f, "%-40.40s", b->logradouro ?: ""); - fprintf(f, "%-6.6s", b->numero ?: ""); - fprintf(f, "%-40.40s", b->complemento ?: ""); - fprintf(f, "%-40.40s", b->bairro ?: ""); - fprintf(f, "%-9.9s", b->cep ?: ""); - fprintf(f, "%-2.2s", b->uf ?: ""); - fprintf(f, "%04d", b->cd_municipio); - fprintf(f, "%-40.40s", b->municipio ?: ""); + attr_out(f, b->attr, "logradouro", 40); + attr_out(f, b->attr, "numero", 6); + attr_out(f, b->attr, "complemento", 40); + attr_out(f, b->attr, "bairro", 40); + attr_out(f, b->attr, "cep", 9); + attr_out(f, b->attr, "uf", 2); + attr_out(f, b->attr, "cd_municipio", 4); + attr_out(f, b->attr, "municipio", 40); /* FIXME: Registro de imóveis, Nao (0), Sim (1), Vazio (2) */ - fprintf(f, "%d", b->registro ? 1 : 2); - fprintf(f, "%-40.40s", b->matricula ?: ""); - fprintf(f, "%-40.40s", b->registro ?: ""); - fprintf(f, "%011lld", b->area); + fprintf(f, "%d", attr_get(b->attr, "registro") ? 1 : 2); + attr_out(f, b->attr, "matricula", 40); + attr_out(f, b->attr, "registro", 40); + attr_out(f, b->attr, "area", 11); /* FIXME: Area, M2 (0), Ha (1), Vazio (2) */ - fprintf(f, "%d", (b->area == 0) ? 2 : 0); - fprintf(f, "%-60.60s", b->cartorio ?: ""); + fprintf(f, "%d", attr_get(b->attr, "area") ? 0 : 2); + attr_out(f, b->attr, "cartorio", 60); /* Número de chave */ fprintf(f, "%05d", dec->linhas[27] + 1); @@ -986,11 +987,22 @@ static void gera_bem(struct declaracao *dec, FILE *f) fprintf(f, "%-30.30s", ""); /* TODO: Registro Capitania dos Portos */ fprintf(f, "%04d", 0); /* TODO: Agência bancária */ fprintf(f, "%-15.15s", ""); /* TODO: Conta bancária e dígito verificador */ - fprintf(f, "%-14.14s", ""); /* TODO: CPF ou CNPJ */ + attr_out(f, b->attr, "cnpj", 14); } if (dec->ano >= 2019) { - fprintf(f, "%-30.30s", ""); /* TODO: IPTU */ + attr_out(f, b->attr, "iptu", 30); + } + if (dec->ano >= 2020) { + attr_out(f, b->attr, "banco", 3); + fprintf(f, "%c", b->dependente ? 'D' : 'T'); + if (b->dependente) { + struct dependente *d; + d = list_get(dec->dependentes, b->dependente - 1); + fprintf(f, "%-11.11s", d ? d->cpf : ""); + } else { + fprintf(f, "%-11.11s", dec->cpf); + } } }