Imprime imposto devido no cabeƧalho
[cascardo/declara.git] / declaracao.c
index eb3c81f..d88c48d 100644 (file)
@@ -19,6 +19,8 @@
 #include "declaracao.h"
 #include <stdlib.h>
 #include <string.h>
+#include "list.h"
+#include "rendimento.h"
 
 struct declaracao * declaracao_new(int ano)
 {
@@ -28,6 +30,16 @@ struct declaracao * declaracao_new(int ano)
                return NULL;
        memset(dec, 0, sizeof(*dec));
        dec->ano = ano;
+       dec->rendimento = list_new();
+       if (!dec->rendimento) {
+               free(dec);
+               return NULL;
+       }
+       dec->totalrendimento = 0;
+       dec->pago = 0;
+       dec->devido = 0;
+       dec->restituicao = 0;
+       dec->tipo = SIMPLES;
        return dec;
 }
 
@@ -37,5 +49,10 @@ void declaracao_free(struct declaracao *dec)
                free(dec->cpf);
        if (dec->nome)
                free(dec->nome);
+       if (dec->recibo)
+               free(dec->recibo);
+       if (dec->retifica);
+               free(dec->retifica);
+       list_free(dec->rendimento, rendimento_free);
        free(dec);
 }