diff --git a/htdocs/compta/paiement/cheque/fiche.php b/htdocs/compta/paiement/cheque/fiche.php
index 03bbb1ff511f8e12df52c13e04b454dc0a32d703..9fee3f401f160fcb93c707e11e43a8cb111f39f3 100644
--- a/htdocs/compta/paiement/cheque/fiche.php
+++ b/htdocs/compta/paiement/cheque/fiche.php
@@ -55,6 +55,8 @@ if ($page < 0) { $page = 0 ; }
 $limit = $conf->liste_limit;
 $offset = $limit * $page ;
 
+$dir=$conf->banque->dir_output.'/bordereau/';
+
 
 /*
  * Actions
@@ -454,9 +456,9 @@ if ($_GET['action'] != 'new')
 {
 	if ($remisecheque->statut == 1)
 	{
-		$dir = $conf->comptabilite->dir_output.'/bordereau/'.get_exdir($remisecheque->number);
+		$dirchequereceipts = $dir.get_exdir($remisecheque->number,2,1).'/'.$remisecheque->ref;
 		$gen = array('blochet'=>'blochet');
-		$formfile->show_documents("remisecheque","",$dir,$_SERVER["PHP_SELF"].'?id='.$remisecheque->id,$gen,1);
+		$formfile->show_documents("remisecheque","",$dirchequereceipts,$_SERVER["PHP_SELF"].'?id='.$remisecheque->id,$gen,1);
 	}
 }
 
diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php
index 112bcbbd6ee6fd1905cffd6bc066cfa565b41756..849ed02273b883becc57ce21e6836c2cae5b9c1a 100644
--- a/htdocs/compta/paiement/rapport.php
+++ b/htdocs/compta/paiement/rapport.php
@@ -38,7 +38,7 @@ if ($user->societe_id > 0)
 {
 	$action = '';
 	$socid = $user->societe_id;
-	$dir = DOL_DATA_ROOT.'/private/'.$user->id.'/compta';
+	$dir = $conf->facture->dir_output.'/payments/private/'.$user->id;
 }
 
 $year = $_GET["year"];
diff --git a/htdocs/document.php b/htdocs/document.php
index d2babbac6a93cedabcaa70b1d46fbe4efc559cc8..58486bf9569741a97fa547f64a2fb31ef91cb190 100644
--- a/htdocs/document.php
+++ b/htdocs/document.php
@@ -212,8 +212,8 @@ if ($modulepart)
 		{
 			$accessallowed=1;
 		}
-		if ($user->societe_id > 0) $original_file=DOL_DATA_ROOT.'/private/'.$user->id.'/compta/'.$original_file;
-		else $original_file=$conf->compta->dir_output.'/payments/'.$original_file;
+		if ($user->societe_id > 0) $original_file=$conf->facture->dir_output.'/payments/private/'.$user->id.'/'.$original_file;
+		else $original_file=$conf->facture->dir_output.'/payments/'.$original_file;
 		//$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='$refname'";
 	}
 
diff --git a/htdocs/includes/modules/cheque/pdf/pdf_blochet.class.php b/htdocs/includes/modules/cheque/pdf/pdf_blochet.class.php
index b0fcd79e38cb0438a295368b297c97888b6a364d..737b0fa6b97880c28ec457055abe74f3332b03d3 100644
--- a/htdocs/includes/modules/cheque/pdf/pdf_blochet.class.php
+++ b/htdocs/includes/modules/cheque/pdf/pdf_blochet.class.php
@@ -95,7 +95,7 @@ class BordereauChequeBlochet extends FPDF
 		$outputlangs->load("bills");
 		$outputlangs->load("products");
 
-		$dir = $_dir . "/".get_exdir($number);
+		$dir = $_dir . "/".get_exdir($number,2,1)."/".$number;
 
 		if (! is_dir($dir))
 		{
@@ -110,7 +110,7 @@ class BordereauChequeBlochet extends FPDF
 
 		$month = sprintf("%02d",$month);
 		$year = sprintf("%04d",$year);
-		$_file = $dir . "bordereau-00".$number.".pdf"; //Todo: r�paration provisoire, ajout de 2 zero
+		$_file = $dir . "/bordereau-".$number.".pdf";
 
 		// Protection et encryption du pdf
 		if ($conf->global->PDF_SECURITY_ENCRYPTION)
diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php
index 7af1993798c9a4db06687db4a84229d066587655..4ce047ebc64d58c67052fa3819091534233fd97b 100644
--- a/htdocs/lib/functions.lib.php
+++ b/htdocs/lib/functions.lib.php
@@ -2376,11 +2376,13 @@ function yn($yesno, $case=1, $color=0)
  *	\remarks    Examples: 1->"0/0/1/", 15->"0/1/5/"
  *	\param      $num        Id to develop
  *	\param      $level		Level of development (1, 2 or 3 level)
+ * 	\param		$alpha		Use alpha ref
  */
-function get_exdir($num,$level=3)
+function get_exdir($num,$level=3,$alpha=0)
 {
 	$path = '';
-	$num = eregi_replace('[^0-9]','',$num);
+	if (empty($alpha)) $num = eregi_replace('[^0-9]','',$num);
+	else $num = eregi_replace('^.*\-','',$num);
 	$num = substr("000".$num, -$level);
 	if ($level == 1) $path = substr($num,0,1).'/';
 	if ($level == 2) $path = substr($num,1,1).'/'.substr($num,0,1).'/';