2 * Copyright (C) 2015 Thadeu Lima de Souza Cascardo <cascardo@cascardo.eti.br>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #include "rendimento.h"
25 #include "pagamento.h"
28 #include "dependente.h"
42 SET_STRING(contacorrente);
45 static int run_resumo(struct declaracao *dec, char **args, int argc)
48 printf("retificadora\n");
50 printf("obrigatoria\n");
59 printf("pago: "FMT_R"\n", R(dec->pago));
60 printf("retido: "FMT_R"\n", R(dec->retido));
61 printf("devido: "FMT_R"\n", R(dec->devido));
62 if (dec->restituicao > 0)
63 printf("restituicao: "FMT_R"\n", R(dec->restituicao));
65 printf("a pagar: "FMT_R"\n", R(dec->pagar));
66 printf("base de cálculo: "FMT_R"\n",
67 R(totais_get(dec, "BASE")));
68 printf("isentos: "FMT_R"\n",
69 R(totais_get(dec, "ISENTOS")));
70 printf("exclusivos: "FMT_R"\n",
71 R(totais_get(dec, "EXCLUSIVOS")));
72 printf("bens: "FMT_R"\n",
73 R(totais_get(dec, "BENS")));
74 printf("bens: "FMT_R"\n",
75 R(totais_get(dec, "BENSANTERIOR")));
76 printf("hash: %010ld\n", dec->hash);
80 static int run_verbose(struct declaracao *dec, char **args, int argc)
88 static void salva(struct declaracao *dec, FILE *f)
90 fprintf(f, "ano %d\n", dec->ano);
92 fprintf(f, "cpf \"%s\"\n", dec->cpf);
94 fprintf(f, "nome \"%s\"\n", dec->nome);
96 fprintf(f, "recibo \"%s\"\n", dec->recibo);
98 fprintf(f, "retifica \"%s\"\n", dec->retifica);
100 fprintf(f, "banco \"%s\"\n", dec->banco);
102 fprintf(f, "agencia \"%s\"\n", dec->agencia);
103 if (dec->contacorrente)
104 fprintf(f, "contacorrente \"%s\"\n", dec->contacorrente);
106 fprintf(f, "dvconta \"%s\"\n", dec->dvconta);
107 contribuinte_salva(dec, f);
108 rendimento_salva(dec, f);
109 pagamento_salva(dec, f);
111 isento_salva(dec, f);
112 dependente_salva(dec, f);
113 conjuge_salva(dec, f);
114 sistema_salva(dec, f);
117 static int run_salva(struct declaracao *dec, char **args, int argc)
124 f = fopen(filename, "w");
132 static int run_simples(struct declaracao *dec, char **args, int argc)
136 dec->tipo = FORCA_SIMPLES;
140 static int run_completa(struct declaracao *dec, char **args, int argc)
144 dec->tipo = FORCA_COMPLETA;
148 static struct cmd cmd_salva = {
153 static struct cmd cmd_resumo = {
158 static struct cmd cmd_verbose = {
163 static struct cmd cmd_simples = {
168 static struct cmd cmd_completa = {
173 int base_cmd_init(void)
176 cmd_add(&cmd_resumo);
180 cmd_add(&cmd_recibo);
181 cmd_add(&cmd_retifica);
185 cmd_add(&cmd_agencia);
186 cmd_add(&cmd_contacorrente);
187 cmd_add(&cmd_dvconta);
189 cmd_add(&cmd_verbose);
190 cmd_add(&cmd_simples);
191 cmd_add(&cmd_completa);