diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php
index 5bbc3c54d7355d5a474f5247d08a2f6c47ab83e5..7d564443b856913fa02c746c425a56e33dbb1d1e 100644
--- a/htdocs/facture.class.php
+++ b/htdocs/facture.class.php
@@ -114,7 +114,17 @@ class Facture
 	    }
 	  $this->db->free();
 	}
-      $datelim = $this->date + ( $cdr_nbjour * 3600 * 24 );
+      $datelim = $this->date + ( $cdr_nbjour * 3600 * 24 );
+      
+      if ($cdr_fdm)
+	{
+	  $mois=date('m', $datelim);
+	  $annee=date('Y', $datelim);
+	  $fins=array(31,28,31,30,31,30,31,31,30,31,30,31);	  
+	  $datelim=mktime(0,0,0,$mois,$fins[$mois-1],$annee);
+	}
+      
+      
       /*
        * Lecture de la remise exceptionnelle
        *