diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php index c71d1a7d26d..e6de71740ae 100644 --- a/htdocs/compta/paiement/rapport.php +++ b/htdocs/compta/paiement/rapport.php @@ -39,6 +39,7 @@ if (!$user->admin && $user->societe_id > 0) $year = $_GET["year"]; +if (! $year) { $year=date("Y"); } require("../../includes/modules/rapport/pdf_paiement.class.php"); @@ -63,9 +64,10 @@ llxHeader(); * Affichage liste des paiements * */ -print_titre("Rapport paiements"); +print_titre("Rapport paiements".($year?" $year":"")); -print '
'; +// Formulaire de génération +print '
'; print ''; $cmonth = date("n", time()); $syear = date("Y", time()); @@ -114,38 +116,43 @@ print "\n"; print ''; print '
'; + clearstatcache(); -$handle=opendir($dir); -while (($file = readdir($handle))!==false) -{ - if (is_dir($dir.$file) && substr($file, 0, 1) <> '.') +if (is_dir($dir)) { + $handle=opendir($dir); + while (($file = readdir($handle))!==false) { - print ''.$file.' '; + if (is_dir($dir.$file) && substr($file, 0, 1) <> '.') + { + print ''.$file.' '; + } } } if ($year) { - $handle=opendir($dir.'/'.$year); - print '
'; - print ''; - print ''; - $var=true; - while (($file = readdir($handle))!==false) - { - if (substr($file, 0, 8) == 'paiement') - { - $var=!$var; - $tfile = $dir . '/'.$year.'/'.$file; - $relativepath = $year.'/'.$file; - print "".''; - print ''; - print ''; - } + if (is_dir($dir.'/'.$year)) { + $handle=opendir($dir.'/'.$year); + print '
'; + print '
Rapport'.$langs->trans("Size").''.$langs->trans("Date").'
'.img_pdf().' '.$file.''.filesize($tfile). ' bytes'.strftime("%d %b %Y %H:%M:%S",filemtime($tfile)).'
'; + print ''; + $var=true; + while (($file = readdir($handle))!==false) + { + if (substr($file, 0, 8) == 'paiement') + { + $var=!$var; + $tfile = $dir . '/'.$year.'/'.$file; + $relativepath = $year.'/'.$file; + print "".''; + print ''; + print ''; + } + } + print '
Rapport'.$langs->trans("Size").''.$langs->trans("Date").'
'.img_pdf().' '.$file.''.filesize($tfile). ' bytes'.strftime("%d %b %Y %H:%M:%S",filemtime($tfile)).'
'; } - print ''; } $db->close();