Mise aux normes W3C

This commit is contained in:
Rodolphe Quiedeville 2006-12-23 10:48:26 +00:00
parent a399e0369d
commit 1901f4c8c9
2 changed files with 83 additions and 96 deletions

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (c) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (c) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -21,10 +21,10 @@
*/ */
/** /**
\file htdocs/compta/facture/stats/index.php \file htdocs/compta/facture/stats/index.php
\ingroup facture \ingroup facture
\brief Page des stats factures \brief Page des stats factures
\version $Revision$ \version $Revision$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
@ -51,62 +51,60 @@ $data = $stats->getNbByMonthWithPrevYear($year);
create_exdir($conf->facture->dir_temp); create_exdir($conf->facture->dir_temp);
$filename = $conf->facture->dir_temp."/nbfacture2year-".$year.".png"; $filename = $conf->facture->dir_temp."/nbfacture2year-".$year.".png";
$fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=nbfacture2year-'.$year.'.png'; $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&amp;file=nbfacture2year-'.$year.'.png';
$px = new DolGraph(); $px = new DolGraph();
$mesg = $px->isGraphKo(); $mesg = $px->isGraphKo();
if (! $mesg) if (! $mesg)
{ {
$px->SetData($data); $px->SetData($data);
$px->SetPrecisionY(0); $px->SetPrecisionY(0);
$px->SetMaxValue($px->GetCeilMaxValue()); $px->SetMaxValue($px->GetCeilMaxValue());
$px->SetLegend(array($year - 1, $year)); $px->SetLegend(array($year - 1, $year));
$px->SetWidth($WIDTH); $px->SetWidth($WIDTH);
$px->SetHeight($HEIGHT); $px->SetHeight($HEIGHT);
$px->SetShading(5); $px->SetShading(5);
$px->SetHorizTickIncrement(1); $px->SetHorizTickIncrement(1);
$px->SetPrecisionY(0); $px->SetPrecisionY(0);
$px->draw($filename); $px->draw($filename);
} }
$sql = "SELECT count(*) as nb, date_format(datef,'%Y') as dm, sum(total) as total FROM ".MAIN_DB_PREFIX."facture WHERE fk_statut > 0 "; $sql = "SELECT count(*) as nb, date_format(datef,'%Y') as dm, sum(total) as total FROM ".MAIN_DB_PREFIX."facture WHERE fk_statut > 0 ";
if ($socid) if ($socid)
{ {
$sql .= " AND fk_soc = $socid"; $sql .= " AND fk_soc=$socid";
} }
$sql .= " GROUP BY dm DESC "; $sql.= " GROUP BY dm DESC;";
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td align="center">'.$langs->trans("Year").'</td><td width="10%" align="center">'.$langs->trans("NumberOfBills").'</td><td align="center">'.$langs->trans("AmountTotal").'</td>'; print '<tr><td align="center">'.$langs->trans("Year").'</td><td width="10%" align="center">'.$langs->trans("NumberOfBills").'</td><td align="center">'.$langs->trans("AmountTotal").'</td>';
print '<td align="center" valign="top" rowspan="'.($num + 1).'">'; print '<td align="center" valign="top" rowspan="'.($num + 1).'">';
if ($mesg) { print $mesg; } if ($mesg) { print $mesg; }
else { print '<img src="'.$fileurl.'" alt="Nombre de factures par mois">'; } else { print '<img src="'.$fileurl.'" alt="Nombre de factures par mois">'; }
print '</td></tr>'; print '</td></tr>';
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$nbproduct = $obj->nb;
$year = $obj->dm;
$total = price($obj->total);
print "<tr>";
print '<td align="center"><a href="month.php?year='.$year.'">'.$year.'</a></td><td align="center">'.$nbproduct.'</td><td align="center">'.$total.'</td></tr>';
$i++;
}
print '</table>'; while ($obj = $db->fetch_object($resql))
$db->free(); {
$nbproduct = $obj->nb;
$year = $obj->dm;
$total = price($obj->total);
print "<tr>";
print '<td align="center"><a href="month.php?year='.$year.'">'.$year.'</a></td><td align="center">'.$nbproduct.'</td><td align="center">'.$total.'</td></tr>';
}
print '</table>';
$db->free($resql);
} }
else else
{ {
dolibarr_print_error($db); dolibarr_print_error($db);
} }
$db->close(); $db->close();
llxFooter('$Date$ - $Revision$'); llxFooter('$Date$ - $Revision$');

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -20,10 +20,11 @@
* $Source$ * $Source$
*/ */
/** \file htdocs/compta/paiement/rapport.php /**
\ingroup facture \file htdocs/compta/paiement/rapport.php
\brief Rapports de paiements \ingroup facture
\version $Revision$ \brief Rapports de paiements
\version $Revision$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
@ -31,7 +32,6 @@ require_once(DOL_DOCUMENT_ROOT."/includes/modules/rapport/pdf_paiement.class.php
$user->getrights("facture"); $user->getrights("facture");
// Sécurité accés // Sécurité accés
if (! $user->rights->facture->lire) if (! $user->rights->facture->lire)
accessforbidden(); accessforbidden();
@ -41,19 +41,14 @@ $dir = $conf->compta->dir_output;
$socid=0; $socid=0;
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
$action = ''; $action = '';
$socid = $user->societe_id; $socid = $user->societe_id;
$dir = DOL_DATA_ROOT.'/private/'.$user->id.'/compta'; $dir = DOL_DATA_ROOT.'/private/'.$user->id.'/compta';
} }
$year = $_GET["year"]; $year = $_GET["year"];
if (! $year) { $year=date("Y"); } if (! $year) { $year=date("Y"); }
/* /*
* Action générer fichier rapport paiements * Action générer fichier rapport paiements
*/ */
@ -65,8 +60,6 @@ if ($_POST["action"] == 'gen')
$year = $_POST["reyear"]; $year = $_POST["reyear"];
} }
llxHeader(); llxHeader();
/* /*
@ -82,21 +75,19 @@ print '<input type="hidden" name="action" value="gen">';
$cmonth = date("n", time()); $cmonth = date("n", time());
$syear = date("Y", time()); $syear = date("Y", time());
print '<select name="remonth">'; print '<select name="remonth">';
for ($month = 1 ; $month < 13 ; $month++) for ($month = 1 ; $month < 13 ; $month++)
{ {
if ($month == $cmonth) if ($month == $cmonth)
{ {
print "<option value=\"$month\" selected=\"true\">" . dolibarr_print_date(mktime(0,0,0,$month),"%B"); print "<option value=\"$month\" selected=\"true\">" . dolibarr_print_date(mktime(0,0,0,$month),"%B");
} }
else else
{ {
print "<option value=\"$month\">" . dolibarr_print_date(mktime(0,0,0,$month),"%B"); print "<option value=\"$month\">" . dolibarr_print_date(mktime(0,0,0,$month),"%B");
} }
} }
print "</select>"; print "</select>";
print '<select name="reyear">'; print '<select name="reyear">';
for ($formyear = $syear - 2; $formyear < $syear +1 ; $formyear++) for ($formyear = $syear - 2; $formyear < $syear +1 ; $formyear++)
@ -113,7 +104,6 @@ for ($formyear = $syear - 2; $formyear < $syear +1 ; $formyear++)
print "</select>\n"; print "</select>\n";
print '<input type="submit" class="button" value="'.$langs->trans("Create").'">'; print '<input type="submit" class="button" value="'.$langs->trans("Create").'">';
print '</form>'; print '</form>';
print '<br>'; print '<br>';
clearstatcache(); clearstatcache();
@ -123,47 +113,46 @@ clearstatcache();
$found=0; $found=0;
if (is_dir($dir)) if (is_dir($dir))
{ {
$handle=opendir($dir); $handle=opendir($dir);
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (is_dir($dir.'/'.$file) && ! eregi('^\.',$file)) if (is_dir($dir.'/'.$file) && ! eregi('^\.',$file))
{ {
$found=1; $found=1;
print '<a href="rapport.php?year='.$file.'">'.$file.'</a> '; print '<a href="rapport.php?year='.$file.'">'.$file.'</a> ';
} }
} }
} }
if ($year) if ($year)
{ {
if (is_dir($dir.'/'.$year)) if (is_dir($dir.'/'.$year))
{
$handle=opendir($dir.'/'.$year);
if ($found) print '<br>';
print '<br>';
print '<table width="100%" class="noborder">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Reporting").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="right">'.$langs->trans("Date").'</td>';
print '</tr>';
$var=true;
while (($file = readdir($handle))!==false)
{ {
$handle=opendir($dir.'/'.$year); if (eregi('^payment',$file))
{
if ($found) print '<br>'; $var=!$var;
print '<br>'; $tfile = $dir . '/'.$year.'/'.$file;
$relativepath = $year.'/'.$file;
print '<table width="100%" class="noborder">'; print "<tr $bc[$var]>".'<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=facture_paiement&amp;file='.urlencode($relativepath).'">'.img_pdf().' '.$file.'</a></td>';
print '<tr class="liste_titre">'; print '<td align="right">'.filesize($tfile). ' '.$langs->trans("Bytes").'</td>';
print '<td>'.$langs->trans("Reporting").'</td>'; print '<td align="right">'.dolibarr_print_date(filemtime($tfile),"%d %b %Y %H:%M:%S").'</td></tr>';
print '<td align="right">'.$langs->trans("Size").'</td>'; }
print '<td align="right">'.$langs->trans("Date").'</td>';
print '</tr>';
$var=true;
while (($file = readdir($handle))!==false)
{
if (eregi('^payment',$file))
{
$var=!$var;
$tfile = $dir . '/'.$year.'/'.$file;
$relativepath = $year.'/'.$file;
print "<tr $bc[$var]>".'<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart=facture_paiement&file='.urlencode($relativepath).'">'.img_pdf().' '.$file.'</a></td>';
print '<td align="right">'.filesize($tfile). ' '.$langs->trans("Bytes").'</td>';
print '<td align="right">'.dolibarr_print_date(filemtime($tfile),"%d %b %Y %H:%M:%S").'</td></tr>';
}
}
print '</table>';
} }
print '</table>';
}
} }
$db->close(); $db->close();