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"
26 #include "pagamento.h"
29 #include "dependente.h"
43 SET_STRING(contacorrente);
46 static int run_resumo(struct declaracao *dec, char **args, int argc)
49 printf("retificadora\n");
51 printf("obrigatoria\n");
60 printf("pago: "FMT_R"\n", R(dec->pago));
61 printf("retido: "FMT_R"\n", R(dec->retido));
62 printf("devido: "FMT_R"\n", R(dec->devido));
63 if (dec->restituicao > 0)
64 printf("restituicao: "FMT_R"\n", R(dec->restituicao));
66 printf("a pagar: "FMT_R"\n", R(dec->pagar));
67 printf("base de cálculo: "FMT_R"\n",
68 R(totais_get(dec, "BASE")));
69 printf("isentos: "FMT_R"\n",
70 R(totais_get(dec, "ISENTOS")));
71 printf("exclusivos: "FMT_R"\n",
72 R(totais_get(dec, "EXCLUSIVOS")));
73 printf("bens: "FMT_R"\n",
74 R(totais_get(dec, "BENS")));
75 printf("bens: "FMT_R"\n",
76 R(totais_get(dec, "BENSANTERIOR")));
77 printf("hash: %010ld\n", dec->hash);
81 static int run_verbose(struct declaracao *dec, char **args, int argc)
89 static void salva(struct declaracao *dec, FILE *f)
91 fprintf(f, "ano %d\n", dec->ano);
93 fprintf(f, "cpf \"%s\"\n", dec->cpf);
95 fprintf(f, "nome \"%s\"\n", dec->nome);
97 fprintf(f, "recibo \"%s\"\n", dec->recibo);
99 fprintf(f, "retifica \"%s\"\n", dec->retifica);
101 fprintf(f, "banco \"%s\"\n", dec->banco);
103 fprintf(f, "agencia \"%s\"\n", dec->agencia);
104 if (dec->contacorrente)
105 fprintf(f, "contacorrente \"%s\"\n", dec->contacorrente);
107 fprintf(f, "dvconta \"%s\"\n", dec->dvconta);
108 contribuinte_salva(dec, f);
109 rendimento_salva(dec, f);
111 pagamento_salva(dec, f);
113 isento_salva(dec, f);
114 dependente_salva(dec, f);
115 conjuge_salva(dec, f);
116 sistema_salva(dec, f);
119 static int run_salva(struct declaracao *dec, char **args, int argc)
126 f = fopen(filename, "w");
134 static int run_simples(struct declaracao *dec, char **args, int argc)
138 dec->tipo = FORCA_SIMPLES;
142 static int run_completa(struct declaracao *dec, char **args, int argc)
146 dec->tipo = FORCA_COMPLETA;
150 static struct cmd cmd_salva = {
155 static struct cmd cmd_resumo = {
160 static struct cmd cmd_verbose = {
165 static struct cmd cmd_simples = {
170 static struct cmd cmd_completa = {
175 int base_cmd_init(void)
178 cmd_add(&cmd_resumo);
182 cmd_add(&cmd_recibo);
183 cmd_add(&cmd_retifica);
187 cmd_add(&cmd_agencia);
188 cmd_add(&cmd_contacorrente);
189 cmd_add(&cmd_dvconta);
191 cmd_add(&cmd_verbose);
192 cmd_add(&cmd_simples);
193 cmd_add(&cmd_completa);