From 0d31539a5aaa6b5acae7e131c6c2cca4d54dc200 Mon Sep 17 00:00:00 2001 From: Thadeu Lima de Souza Cascardo Date: Sun, 10 Apr 2016 16:32:57 -0300 Subject: [PATCH] =?utf8?q?Dedu=C3=A7=C3=B5es=20pode=20ser=20maiores=20que?= =?utf8?q?=20rendimentos=20tribut=C3=A1veis.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Base de cálculo deve ser zero nesses casos, não negativa. --- lib/calcula.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/calcula.c b/lib/calcula.c index fdf3b83..c928a02 100644 --- a/lib/calcula.c +++ b/lib/calcula.c @@ -135,6 +135,8 @@ static long long imposto_simples(struct declaracao *dec) td = simples[ANO(dec->ano)]; totais_add(dec, "DESCONTO", td); tr -= td; + if (tr < 0) + tr = 0; totais_add(dec, "BASESIMPLES", tr); if (dec->verbose) { printf("Desconto simplificado é "FMT_R"\n", R(td)); @@ -151,6 +153,8 @@ static long long imposto_completa(struct declaracao *dec) td = total_deducao(dec); totais_add(dec, "DEDUCOES", td); tr -= td; + if (tr < 0) + tr = 0; totais_add(dec, "BASECOMPLETA", tr); if (dec->verbose) { printf("Desconto completa é "FMT_R"\n", R(td)); -- 2.20.1