This commit is contained in:
2026-10-26 17:02:11 +01:00
parent 39d184707a
commit 3f301c825b
+31 -14
View File
@@ -263,38 +263,55 @@ long nb_facons_rendre(int somme, int nb_pieces)
return dp[somme]; return dp[somme];
} }
/* F9 : catégorie d'une transaction (pour les statistiques) */ /* F9 : catégorie des transactions négatives */
int categorie(const Transaction *t) static int categorie_negative(const Transaction *t)
{ {
if (t->montant < 0) {
if (t->montant < -20000) { if (t->montant < -20000) {
if (t->jour % 7 == 5 || t->jour % 7 == 6) if (t->jour % 7 >= 5)
return 1; return 1;
else
return 2; return 2;
} else if (t->montant < -5000) { }
if (t->montant < -5000)
return 3; return 3;
} else {
if (t->client % 10 == 0) if (t->client % 10 == 0)
return 4; return 4;
return 5; return 5;
} }
} else if (t->montant == 0) {
return 0; /* F9 : catégorie des transactions positives */
} else { static int categorie_positive(const Transaction *t)
{
if (t->montant > 30000) { if (t->montant > 30000) {
if (t->client % 10 == 0 && t->jour % 7 < 5) if (t->client % 10 == 0 && t->jour % 7 < 5)
return 6; return 6;
return 7; return 7;
} else if (t->montant > 10000) { }
if (t->montant > 10000)
return 8; return 8;
} else if (t->montant > 1000) {
if (t->montant > 1000) {
if (t->jour % 30 == 0) if (t->jour % 30 == 0)
return 9; return 9;
return 10; return 10;
} }
return 11; return 11;
} }
/* F9 : catégorie d'une transaction */
int categorie(const Transaction *t)
{
if (t->montant < 0)
return categorie_negative(t);
if (t->montant == 0)
return 0;
return categorie_positive(t);
} }
/* F10 : ajoute une ligne à la fin du rapport */ /* F10 : ajoute une ligne à la fin du rapport */