Nouveau fichier
This commit is contained in:
parent
0c7c2f1240
commit
f3a315b6e7
129
htdocs/compta/prelevement/fiche-stat.php
Normal file
129
htdocs/compta/prelevement/fiche-stat.php
Normal file
@ -0,0 +1,129 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
require("./pre.inc.php");
|
||||
|
||||
/*
|
||||
* Sécurité accés client
|
||||
*/
|
||||
if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
llxHeader('','Statistique Bon de prélèvement');
|
||||
|
||||
$h = 0;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Fiche");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Factures");
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"];
|
||||
$head[$h][1] = $langs->trans("Statistiques");
|
||||
$hselected = $h;
|
||||
$h++;
|
||||
|
||||
$prev_id = $_GET["id"];
|
||||
|
||||
if ($prev_id)
|
||||
{
|
||||
$bon = new BonPrelevement($db,"");
|
||||
|
||||
if ($bon->fetch($_GET["id"]) == 0)
|
||||
{
|
||||
dolibarr_fiche_head($head, $hselected, 'Prélèvement : '. $bon->ref);
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="20%">Référence</td><td>'.$bon->ref.'</td></tr>';
|
||||
|
||||
print '</table><br />';
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Erreur";
|
||||
}
|
||||
|
||||
/*
|
||||
* Stats
|
||||
*
|
||||
*/
|
||||
$sql = "SELECT sum(f.total_ttc), pf.statut";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " WHERE pf.fk_prelevement = ".$prev_id;
|
||||
$sql .= " AND pf.fk_facture = f.rowid";
|
||||
$sql .= " GROUP BY pf.statut";
|
||||
|
||||
if ($db->query($sql))
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
|
||||
print"\n<!-- debut table -->\n";
|
||||
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>Statut</td><td align="right">Montant</td><td align="right">%</td></tr>';
|
||||
|
||||
$var=True;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row();
|
||||
|
||||
print "<tr $bc[$var]><td>";
|
||||
|
||||
if ($row[1] == 1)
|
||||
{
|
||||
print 'Crédité';
|
||||
}
|
||||
elseif ($row[1] == 2)
|
||||
{
|
||||
print 'Rejeté';
|
||||
}
|
||||
|
||||
print '</td><td align="right">';
|
||||
print price($row[0]);
|
||||
|
||||
print '</td><td align="right">';
|
||||
print round($row[0]/$bon->amount*100,2)." %";
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$var=!$var;
|
||||
$i++;
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
$db->free();
|
||||
}
|
||||
else
|
||||
{
|
||||
print $db->error() . ' ' . $sql;
|
||||
}
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user