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: %lld.%02d\n", reais(dec->pago), centavos(dec->pago));
60 printf("retido: %lld.%02d\n", reais(dec->retido),
61 centavos(dec->retido));
62 printf("devido: %lld.%02d\n", reais(dec->devido),
63 centavos(dec->devido));
64 if (dec->restituicao > 0)
65 printf("restituicao: %lld.%02d\n", reais(dec->restituicao),
66 centavos(dec->restituicao));
68 printf("a pagar: %lld.%02d\n", reais(dec->pagar),
69 centavos(dec->pagar));
70 printf("base de cálculo: %lld.%02d\n",
71 reais(totais_get(dec, "BASE")),
72 centavos(totais_get(dec, "BASE")));
73 printf("isentos: %lld.%02d\n",
74 reais(totais_get(dec, "ISENTOS")),
75 centavos(totais_get(dec, "ISENTOS")));
76 printf("exclusivos: %lld.%02d\n",
77 reais(totais_get(dec, "EXCLUSIVOS")),
78 centavos(totais_get(dec, "EXCLUSIVOS")));
79 printf("hash: %010ld\n", dec->hash);
83 static void salva(struct declaracao *dec, FILE *f)
85 fprintf(f, "ano %d\n", dec->ano);
87 fprintf(f, "cpf \"%s\"\n", dec->cpf);
89 fprintf(f, "nome \"%s\"\n", dec->nome);
91 fprintf(f, "recibo \"%s\"\n", dec->recibo);
93 fprintf(f, "retifica \"%s\"\n", dec->retifica);
95 fprintf(f, "banco \"%s\"\n", dec->banco);
97 fprintf(f, "agencia \"%s\"\n", dec->agencia);
98 if (dec->contacorrente)
99 fprintf(f, "contacorrente \"%s\"\n", dec->contacorrente);
101 fprintf(f, "dvconta \"%s\"\n", dec->dvconta);
102 contribuinte_salva(dec, f);
103 rendimento_salva(dec, f);
104 pagamento_salva(dec, f);
106 isento_salva(dec, f);
107 dependente_salva(dec, f);
108 conjuge_salva(dec, f);
109 sistema_salva(dec, f);
112 static int run_salva(struct declaracao *dec, char **args, int argc)
119 f = fopen(filename, "w");
127 static int run_simples(struct declaracao *dec, char **args, int argc)
131 dec->tipo = FORCA_SIMPLES;
135 static int run_completa(struct declaracao *dec, char **args, int argc)
139 dec->tipo = FORCA_COMPLETA;
143 static struct cmd cmd_salva = {
148 static struct cmd cmd_resumo = {
153 static struct cmd cmd_simples = {
158 static struct cmd cmd_completa = {
163 int base_cmd_init(void)
166 cmd_add(&cmd_resumo);
170 cmd_add(&cmd_recibo);
171 cmd_add(&cmd_retifica);
175 cmd_add(&cmd_agencia);
176 cmd_add(&cmd_contacorrente);
177 cmd_add(&cmd_dvconta);
179 cmd_add(&cmd_simples);
180 cmd_add(&cmd_completa);