#include "cmd.h"
#include "rendimento.h"
#include "pagamento.h"
+#include "bem.h"
#include "totais.h"
static void gera_header(struct declaracao *dec, FILE *f)
fprintf(f, "\r\n");
}
+static void gera_bem(struct declaracao *dec, FILE *f)
+{
+ struct bem *b;
+ b = list_get(dec->bens, dec->linhas[27]);
+
+ fprintf(f, "27");
+ fprintf(f, "%s", dec->cpf);
+ fprintf(f, "%02d", b->codigo);
+
+ /* FIXME: exterior */
+ fprintf(f, "0");
+ fprintf(f, "105"); /* código Brasil */
+
+ fprintf(f, "%-512.512s", b->descricao);
+ fprintf(f, "%013lld", b->valor_anterior);
+ 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 ?: "");
+ /* FIXME: Registro de imóveis, Nao (0), Sim (1), Vazio (2) */
+ fprintf(f, "%d", b->registro ? 1 : 0);
+ fprintf(f, "%-40.40s", b->matricula ?: "");
+ fprintf(f, "%-40.40s", b->registro ?: "");
+ fprintf(f, "%011lld", b->area);
+ /* FIXME: Area, M2 (0), Ha (1), Vazio (2) */
+ fprintf(f, "%d", 0);
+ fprintf(f, "%-60.60s", b->cartorio ?: "");
+
+ /* Número de chave */
+ fprintf(f, "%05d", dec->linhas[27] + 1);
+
+ fprintf(f, "%-10.10s", "0000000000"); /* FIXME: controle */
+ fprintf(f, "\r\n");
+}
+
+
typedef void (gera_linha)(struct declaracao *dec, FILE *f);
int i;
struct rendimento *rendimento;
struct pagamento *pagamento;
+ struct bem *bem;
#define W(fn, dec, f) \
do { \
for (i = 0; (pagamento = list_get(dec->pagamentos, i)); i++) {
W(gera_pagamento, dec, f);
}
+ for (i = 0; (bem = list_get(dec->bens, i)); i++) {
+ W(gera_bem, dec, f);
+ }
W(gera_trailler, dec, f);
W(gera_reciboheader, dec, f);
W(gera_recibodetalhe, dec, f);