X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=lib%2Fbase.c;h=7c55b851a1cd4d02b698b81b6a8f3dd7ecfc0ac0;hb=6c1c229c39002932d0f842f7b5662992c5466628;hp=f15c4ea4ce46931a51fa11c7c570792bb2a58ca0;hpb=b224a56d707ea30265e3ce2095b93c46ec3bbbec;p=cascardo%2Fdeclara.git diff --git a/lib/base.c b/lib/base.c index f15c4ea..7c55b85 100644 --- a/lib/base.c +++ b/lib/base.c @@ -24,6 +24,7 @@ #include "rendimento.h" #include "pagamento.h" #include "bem.h" +#include "totais.h" #include "util.h" SET_INT(ano); @@ -62,6 +63,16 @@ static int run_resumo(struct declaracao *dec, char **args, int argc) 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("hash: %010ld\n", dec->hash); return 0; } @@ -105,6 +116,22 @@ static int run_salva(struct declaracao *dec, char **args, int argc) return 0; } +static int run_simples(struct declaracao *dec, char **args, int argc) +{ + if (argc != 1) + return -EINVAL; + dec->tipo = FORCA_SIMPLES; + return 0; +} + +static int run_completa(struct declaracao *dec, char **args, int argc) +{ + if (argc != 1) + return -EINVAL; + dec->tipo = FORCA_COMPLETA; + return 0; +} + static struct cmd cmd_salva = { .name = "salva", .run = run_salva, @@ -115,6 +142,16 @@ static struct cmd cmd_resumo = { .run = run_resumo, }; +static struct cmd cmd_simples = { + .name = "simples", + .run = run_simples, +}; + +static struct cmd cmd_completa = { + .name = "completa", + .run = run_completa, +}; + int base_cmd_init(void) { cmd_add(&cmd_salva); @@ -131,5 +168,8 @@ int base_cmd_init(void) cmd_add(&cmd_contacorrente); cmd_add(&cmd_dvconta); + cmd_add(&cmd_simples); + cmd_add(&cmd_completa); + return 0; }