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"
38 SET_STRING(contacorrente);
41 static int run_resumo(struct declaracao *dec, char **args, int argc)
44 printf("retificadora\n");
46 printf("obrigatoria\n");
55 printf("pago: %lld.%02d\n", reais(dec->pago), centavos(dec->pago));
56 printf("retido: %lld.%02d\n", reais(dec->retido),
57 centavos(dec->retido));
58 printf("devido: %lld.%02d\n", reais(dec->devido),
59 centavos(dec->devido));
60 if (dec->restituicao > 0)
61 printf("restituicao: %lld.%02d\n", reais(dec->restituicao),
62 centavos(dec->restituicao));
64 printf("a pagar: %lld.%02d\n", reais(dec->pagar),
65 centavos(dec->pagar));
66 printf("base de cálculo: %lld.%02d\n",
67 reais(totais_get(dec, "BASE")),
68 centavos(totais_get(dec, "BASE")));
69 printf("isentos: %lld.%02d\n",
70 reais(totais_get(dec, "ISENTOS")),
71 centavos(totais_get(dec, "ISENTOS")));
72 printf("exclusivos: %lld.%02d\n",
73 reais(totais_get(dec, "EXCLUSIVOS")),
74 centavos(totais_get(dec, "EXCLUSIVOS")));
75 printf("hash: %010ld\n", dec->hash);
79 static void salva(struct declaracao *dec, FILE *f)
81 fprintf(f, "ano %d\n", dec->ano);
83 fprintf(f, "cpf \"%s\"\n", dec->cpf);
85 fprintf(f, "nome \"%s\"\n", dec->nome);
87 fprintf(f, "recibo \"%s\"\n", dec->recibo);
89 fprintf(f, "retifica \"%s\"\n", dec->retifica);
91 fprintf(f, "banco \"%s\"\n", dec->banco);
93 fprintf(f, "agencia \"%s\"\n", dec->agencia);
94 if (dec->contacorrente)
95 fprintf(f, "contacorrente \"%s\"\n", dec->contacorrente);
97 fprintf(f, "dvconta \"%s\"\n", dec->dvconta);
98 contribuinte_salva(dec, f);
99 rendimento_salva(dec, f);
100 pagamento_salva(dec, f);
104 static int run_salva(struct declaracao *dec, char **args, int argc)
111 f = fopen(filename, "w");
119 static int run_simples(struct declaracao *dec, char **args, int argc)
123 dec->tipo = FORCA_SIMPLES;
127 static int run_completa(struct declaracao *dec, char **args, int argc)
131 dec->tipo = FORCA_COMPLETA;
135 static struct cmd cmd_salva = {
140 static struct cmd cmd_resumo = {
145 static struct cmd cmd_simples = {
150 static struct cmd cmd_completa = {
155 int base_cmd_init(void)
158 cmd_add(&cmd_resumo);
162 cmd_add(&cmd_recibo);
163 cmd_add(&cmd_retifica);
167 cmd_add(&cmd_agencia);
168 cmd_add(&cmd_contacorrente);
169 cmd_add(&cmd_dvconta);
171 cmd_add(&cmd_simples);
172 cmd_add(&cmd_completa);