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"
37 SET_STRING(contacorrente);
40 static int run_resumo(struct declaracao *dec, char **args, int argc)
43 printf("retificadora\n");
45 printf("obrigatoria\n");
54 printf("pago: %lld.%02d\n", reais(dec->pago), centavos(dec->pago));
55 printf("retido: %lld.%02d\n", reais(dec->retido),
56 centavos(dec->retido));
57 printf("devido: %lld.%02d\n", reais(dec->devido),
58 centavos(dec->devido));
59 if (dec->restituicao > 0)
60 printf("restituicao: %lld.%02d\n", reais(dec->restituicao),
61 centavos(dec->restituicao));
63 printf("a pagar: %lld.%02d\n", reais(dec->pagar),
64 centavos(dec->pagar));
68 static void salva(struct declaracao *dec, FILE *f)
70 fprintf(f, "ano %d\n", dec->ano);
72 fprintf(f, "cpf \"%s\"\n", dec->cpf);
74 fprintf(f, "nome \"%s\"\n", dec->nome);
76 fprintf(f, "recibo \"%s\"\n", dec->recibo);
78 fprintf(f, "retifica \"%s\"\n", dec->retifica);
80 fprintf(f, "banco \"%s\"\n", dec->banco);
82 fprintf(f, "agencia \"%s\"\n", dec->agencia);
83 if (dec->contacorrente)
84 fprintf(f, "contacorrente \"%s\"\n", dec->contacorrente);
86 fprintf(f, "dvconta \"%s\"\n", dec->dvconta);
87 contribuinte_salva(dec, f);
88 rendimento_salva(dec, f);
89 pagamento_salva(dec, f);
93 static int run_salva(struct declaracao *dec, char **args, int argc)
100 f = fopen(filename, "w");
108 static struct cmd cmd_salva = {
113 static struct cmd cmd_resumo = {
118 int base_cmd_init(void)
121 cmd_add(&cmd_resumo);
125 cmd_add(&cmd_recibo);
126 cmd_add(&cmd_retifica);
130 cmd_add(&cmd_agencia);
131 cmd_add(&cmd_contacorrente);
132 cmd_add(&cmd_dvconta);