Escapa o carectere %.
[cascardo/declara.git] / lib / base.c
index 3db915e..8007d12 100644 (file)
@@ -22,6 +22,7 @@
 #include <string.h>
 #include <errno.h>
 #include "rendimento.h"
+#include "carne.h"
 #include "pagamento.h"
 #include "bem.h"
 #include "isento.h"
@@ -56,26 +57,25 @@ static int run_resumo(struct declaracao *dec, char **args, int argc)
                printf("completa\n");
                break;
        }
-       printf("pago: %lld.%02d\n", reais(dec->pago), centavos(dec->pago));
-       printf("retido: %lld.%02d\n", reais(dec->retido),
-                                     centavos(dec->retido));
-       printf("devido: %lld.%02d\n", reais(dec->devido),
-                                     centavos(dec->devido));
+       printf("pago: "FMT_R"\n", R(dec->pago));
+       printf("retido: "FMT_R"\n", R(dec->retido));
+       printf("devido: "FMT_R"\n", R(dec->devido));
        if (dec->restituicao > 0)
-               printf("restituicao: %lld.%02d\n", reais(dec->restituicao),
-                                                  centavos(dec->restituicao));
+               printf("restituicao: "FMT_R"\n", R(dec->restituicao));
        if (dec->pagar > 0)
-               printf("a pagar: %lld.%02d\n", reais(dec->pagar),
-                                              centavos(dec->pagar));
-       printf("base de cálculo: %lld.%02d\n",
-               reais(totais_get(dec, "BASE")),
-               centavos(totais_get(dec, "BASE")));
-       printf("isentos: %lld.%02d\n",
-               reais(totais_get(dec, "ISENTOS")),
-               centavos(totais_get(dec, "ISENTOS")));
-       printf("exclusivos: %lld.%02d\n",
-               reais(totais_get(dec, "EXCLUSIVOS")),
-               centavos(totais_get(dec, "EXCLUSIVOS")));
+               printf("a pagar: "FMT_R"\n", R(dec->pagar));
+       printf("base de cálculo: "FMT_R"\n",
+               R(totais_get(dec, "BASE")));
+       printf("isentos: "FMT_R"\n",
+               R(totais_get(dec, "ISENTOS")));
+       printf("exclusivos: "FMT_R"\n",
+               R(totais_get(dec, "EXCLUSIVOS")));
+       printf("bens: "FMT_R"\n",
+               R(totais_get(dec, "BENS")));
+       printf("bens: "FMT_R"\n",
+               R(totais_get(dec, "BENSANTERIOR")));
+       printf("aliquota efetiva: "FMT_R"%%\n",
+               R(dec->aliquota_efetiva));
        printf("hash: %010ld\n", dec->hash);
        return 0;
 }
@@ -109,6 +109,7 @@ static void salva(struct declaracao *dec, FILE *f)
                fprintf(f, "dvconta \"%s\"\n", dec->dvconta);
        contribuinte_salva(dec, f);
        rendimento_salva(dec, f);
+       carne_salva(dec, f);
        pagamento_salva(dec, f);
        bem_salva(dec, f);
        isento_salva(dec, f);