Fix: La liste des rapport s'affiche par défaut sur l'année courante.

This commit is contained in:
Laurent Destailleur 2004-12-28 15:16:49 +00:00
parent caa59d43ee
commit 9e987b65e1

View File

@ -39,6 +39,7 @@ if (!$user->admin && $user->societe_id > 0)
$year = $_GET["year"]; $year = $_GET["year"];
if (! $year) { $year=date("Y"); }
require("../../includes/modules/rapport/pdf_paiement.class.php"); require("../../includes/modules/rapport/pdf_paiement.class.php");
@ -63,9 +64,10 @@ llxHeader();
* Affichage liste des paiements * Affichage liste des paiements
* *
*/ */
print_titre("Rapport paiements"); print_titre("Rapport paiements".($year?" $year":""));
print '<form method="post" action="rapport.php?year='.$year.'">'; // Formulaire de génération
print '<br><form method="post" action="rapport.php?year='.$year.'">';
print '<input type="hidden" name="action" value="gen">'; print '<input type="hidden" name="action" value="gen">';
$cmonth = date("n", time()); $cmonth = date("n", time());
$syear = date("Y", time()); $syear = date("Y", time());
@ -114,38 +116,43 @@ print "</select>\n";
print '<input type="submit" value="'.$langs->trans("Create").'">'; print '<input type="submit" value="'.$langs->trans("Create").'">';
print '</form>'; print '</form>';
clearstatcache(); clearstatcache();
$handle=opendir($dir);
while (($file = readdir($handle))!==false) if (is_dir($dir)) {
{ $handle=opendir($dir);
if (is_dir($dir.$file) && substr($file, 0, 1) <> '.') while (($file = readdir($handle))!==false)
{ {
print '<a href="rapport.php?year='.$file.'">'.$file.'</a> '; if (is_dir($dir.$file) && substr($file, 0, 1) <> '.')
{
print '<a href="rapport.php?year='.$file.'">'.$file.'</a> ';
}
} }
} }
if ($year) if ($year)
{ {
$handle=opendir($dir.'/'.$year); if (is_dir($dir.'/'.$year)) {
print '<br>'; $handle=opendir($dir.'/'.$year);
print '<table width="100%" class="noborder">'; print '<br>';
print '<tr class="liste_titre"><td>Rapport</td><td align="right">'.$langs->trans("Size").'</td><td align="right">'.$langs->trans("Date").'</td></tr>'; print '<table width="100%" class="noborder">';
$var=true; print '<tr class="liste_titre"><td>Rapport</td><td align="right">'.$langs->trans("Size").'</td><td align="right">'.$langs->trans("Date").'</td></tr>';
while (($file = readdir($handle))!==false) $var=true;
{ while (($file = readdir($handle))!==false)
if (substr($file, 0, 8) == 'paiement') {
{ if (substr($file, 0, 8) == 'paiement')
$var=!$var; {
$tfile = $dir . '/'.$year.'/'.$file; $var=!$var;
$relativepath = $year.'/'.$file; $tfile = $dir . '/'.$year.'/'.$file;
print "<tr $bc[$var]>".'<td><a href="/document.php?modulepart=facture_paiement&file='.urlencode($relativepath).'">'.img_pdf().' '.$file.'</a></td>'; $relativepath = $year.'/'.$file;
print '<td align="right">'.filesize($tfile). ' bytes</td>'; print "<tr $bc[$var]>".'<td><a href="/document.php?modulepart=facture_paiement&file='.urlencode($relativepath).'">'.img_pdf().' '.$file.'</a></td>';
print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($tfile)).'</td></tr>'; print '<td align="right">'.filesize($tfile). ' bytes</td>';
} print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($tfile)).'</td></tr>';
}
}
print '</table>';
} }
print '</table>';
} }
$db->close(); $db->close();