Obrigatoriedade para rendimentos isentos e exclusivos.
[cascardo/declara.git] / lib / calcula.c
index 1a132a2..a691472 100644 (file)
@@ -244,6 +244,7 @@ static long long imposto_completa(struct declaracao *dec)
 int calcula(struct declaracao *dec)
 {
        long long i_simples, i_completa;
+       long long isentos;
        if (!ANO_VALIDO(dec->ano)) {
                dec_set_error(dec, "Ano %d não suportado.", dec->ano);
                return -EINVAL;
@@ -258,6 +259,16 @@ int calcula(struct declaracao *dec)
                }
                dec->obrigatoria += 1;
        }
+       isentos = totais_get(dec, "ISENTOS") + totais_get(dec, "EXCLUSIVOS");
+       if (isentos > 4000000) {
+               if (dec->verbose) {
+                       printf("Declaracao obrigatoria pois rendimentos "
+                               "isentos e exclusivos maior que minimo para "
+                               "declaracao: " FMT_R" > "FMT_R"\n",
+                               R(isentos), R(4000000));
+               }
+               dec->obrigatoria += 2;
+       }
        if (totais_get(dec, "BENS") > 30000000) {
                if (dec->verbose) {
                        printf("Declaracao obrigatoria pois bens e direitos e"