X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=lib%2Fbase.c;h=8007d123a4e8a1cd5ed8e3c08cab5a0c9eba13dc;hb=6ec61d7d67646324136872daee17d75875b0d39d;hp=c2f88b99ee4431c05e67275d1a430b7c0458769d;hpb=f529d003c632437011fe687b256c985d5e503ed7;p=cascardo%2Fdeclara.git diff --git a/lib/base.c b/lib/base.c index c2f88b9..8007d12 100644 --- a/lib/base.c +++ b/lib/base.c @@ -22,6 +22,7 @@ #include #include #include "rendimento.h" +#include "carne.h" #include "pagamento.h" #include "bem.h" #include "isento.h" @@ -56,30 +57,37 @@ 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; } +static int run_verbose(struct declaracao *dec, char **args, int argc) +{ + if (argc != 1) + return -EINVAL; + dec->verbose = 1; + return 0; +} + static void salva(struct declaracao *dec, FILE *f) { fprintf(f, "ano %d\n", dec->ano); @@ -101,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); @@ -150,6 +159,11 @@ static struct cmd cmd_resumo = { .run = run_resumo, }; +static struct cmd cmd_verbose = { + .name = "verbose", + .run = run_verbose, +}; + static struct cmd cmd_simples = { .name = "simples", .run = run_simples, @@ -176,6 +190,7 @@ int base_cmd_init(void) cmd_add(&cmd_contacorrente); cmd_add(&cmd_dvconta); + cmd_add(&cmd_verbose); cmd_add(&cmd_simples); cmd_add(&cmd_completa);