Spaces:
Running
Running
Update src/modules/Check_Up_Loans.py
Browse files
src/modules/Check_Up_Loans.py
CHANGED
|
@@ -637,10 +637,6 @@ def show_check_up_loans(client, sheet_name):
|
|
| 637 |
nouvelle_date_debut = date.today()
|
| 638 |
nouvelle_date_fin = nouvelle_date_debut
|
| 639 |
|
| 640 |
-
# ============================================================================
|
| 641 |
-
# CALCULS AUTOMATIQUES SELON LE TYPE DE PRÊT
|
| 642 |
-
# ============================================================================
|
| 643 |
-
|
| 644 |
# -----------------------------------------------------------
|
| 645 |
# 1. LOGIQUE IN FINE (1 seul versement à la fin)
|
| 646 |
# -----------------------------------------------------------
|
|
@@ -821,6 +817,40 @@ def show_check_up_loans(client, sheet_name):
|
|
| 821 |
res4.metric("Montant Total", f"{int(nouveau_montant_total):,} XOF".replace(",", " "),
|
| 822 |
delta=f"+{int(nouveau_cout_credit):,}")
|
| 823 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 824 |
# ============================================================================
|
| 825 |
# COMPARAISON AVANT / APRÈS
|
| 826 |
# ============================================================================
|
|
|
|
| 637 |
nouvelle_date_debut = date.today()
|
| 638 |
nouvelle_date_fin = nouvelle_date_debut
|
| 639 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 640 |
# -----------------------------------------------------------
|
| 641 |
# 1. LOGIQUE IN FINE (1 seul versement à la fin)
|
| 642 |
# -----------------------------------------------------------
|
|
|
|
| 817 |
res4.metric("Montant Total", f"{int(nouveau_montant_total):,} XOF".replace(",", " "),
|
| 818 |
delta=f"+{int(nouveau_cout_credit):,}")
|
| 819 |
|
| 820 |
+
|
| 821 |
+
|
| 822 |
+
# ============================================================================
|
| 823 |
+
# CALCUL DU TAUX D'ENDETTEMENT POUR LE NOUVEAU PRÊT
|
| 824 |
+
# ============================================================================
|
| 825 |
+
|
| 826 |
+
from Analytics.AnalyseFinance import calculer_taux_endettement
|
| 827 |
+
|
| 828 |
+
# Calcul du nouveau taux
|
| 829 |
+
nouveau_taux_endettement = calculer_taux_endettement(
|
| 830 |
+
nouveau_type_code,
|
| 831 |
+
nouveau_montant_versement,
|
| 832 |
+
nouveau_nb_versements,
|
| 833 |
+
nouvelle_duree_semaines,
|
| 834 |
+
client_info['Revenus_Mensuels']
|
| 835 |
+
)
|
| 836 |
+
|
| 837 |
+
# Récupération de l'ancien taux (avec gestion des prêts qui n'ont pas cette colonne)
|
| 838 |
+
try:
|
| 839 |
+
taux_endettement_actuel = float(selected_loan.get('Taux_Endettement', 0))
|
| 840 |
+
except (ValueError, TypeError):
|
| 841 |
+
taux_endettement_actuel = 0.0
|
| 842 |
+
|
| 843 |
+
# Affichage pour information
|
| 844 |
+
if nouveau_taux_endettement > 0:
|
| 845 |
+
st.info(f"📊 **Nouveau taux d'endettement calculé** : {nouveau_taux_endettement:.2f}%")
|
| 846 |
+
|
| 847 |
+
# Warning si le taux dépasse 33%
|
| 848 |
+
if nouveau_taux_endettement > 33:
|
| 849 |
+
st.warning(f"⚠️ Le taux d'endettement ({nouveau_taux_endettement:.2f}%) dépasse le seuil recommandé de 33%")
|
| 850 |
+
|
| 851 |
+
|
| 852 |
+
|
| 853 |
+
|
| 854 |
# ============================================================================
|
| 855 |
# COMPARAISON AVANT / APRÈS
|
| 856 |
# ============================================================================
|