mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-30 13:21:30 +01:00
163 lines
3.8 KiB
PHP
163 lines
3.8 KiB
PHP
<?PHP
|
|
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
|
*
|
|
* 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.
|
|
*/
|
|
|
|
/**
|
|
* \file htdocs/compta/prelevement/fiche-stat.php
|
|
* \brief Prelevement
|
|
* \version $Id$
|
|
*/
|
|
|
|
require('../../main.inc.php');
|
|
require_once(DOL_DOCUMENT_ROOT."/compta/prelevement/class/bon-prelevement.class.php");
|
|
|
|
// Security check
|
|
if ($user->societe_id > 0) accessforbidden();
|
|
|
|
$langs->load("withdrawals");
|
|
$langs->load("categories");
|
|
|
|
|
|
/*
|
|
* View
|
|
*/
|
|
|
|
llxHeader('',$langs->trans("WithdrawalReceipt"));
|
|
|
|
$h = 0;
|
|
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"];
|
|
$head[$h][1] = $langs->trans("Card");
|
|
$h++;
|
|
|
|
if ($conf->use_preview_tabs)
|
|
{
|
|
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$_GET["id"];
|
|
$head[$h][1] = $langs->trans("Preview");
|
|
$h++;
|
|
}
|
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$_GET["id"];
|
|
$head[$h][1] = $langs->trans("Lines");
|
|
$h++;
|
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"];
|
|
$head[$h][1] = $langs->trans("Bills");
|
|
$h++;
|
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"];
|
|
$head[$h][1] = $langs->trans("Rejects");
|
|
$h++;
|
|
|
|
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"];
|
|
$head[$h][1] = $langs->trans("Statistics");
|
|
$hselected = $h;
|
|
$h++;
|
|
|
|
$prev_id = $_GET["id"];
|
|
|
|
if ($prev_id)
|
|
{
|
|
$bon = new BonPrelevement($db,"");
|
|
|
|
if ($bon->fetch($_GET["id"]) == 0)
|
|
{
|
|
dol_fiche_head($head, $hselected, $langs->trans("WithdrawalReceipt"), '', 'payment');
|
|
|
|
print '<table class="border" width="100%">';
|
|
|
|
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td>'.$bon->getNomUrl(1).'</td></tr>';
|
|
|
|
print '</table>';
|
|
|
|
print '</div>';
|
|
}
|
|
else
|
|
{
|
|
print "Erreur";
|
|
}
|
|
|
|
/*
|
|
* Stats
|
|
*
|
|
*/
|
|
$sql = "SELECT sum(pl.amount), pl.statut";
|
|
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
|
$sql.= " WHERE pl.fk_prelevement_bons = ".$prev_id;
|
|
$sql.= " GROUP BY pl.statut";
|
|
|
|
$resql=$db->query($sql);
|
|
if ($resql)
|
|
{
|
|
$num = $db->num_rows($resql);
|
|
$i = 0;
|
|
|
|
print"\n<!-- debut table -->\n";
|
|
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
|
|
print '<tr class="liste_titre">';
|
|
print '<td>'.$langs->trans("Status").'</td><td align="right">'.$langs->trans("Amount").'</td><td align="right">%</td></tr>';
|
|
|
|
$var=false;
|
|
|
|
while ($i < $num)
|
|
{
|
|
$row = $db->fetch_row($resql);
|
|
|
|
print "<tr $bc[$var]><td>";
|
|
|
|
if ($row[1] == 2)
|
|
{
|
|
print $langs->trans("StatusCredited");
|
|
}
|
|
elseif ($row[1] == 3)
|
|
{
|
|
print $langs->trans("StatusRefused");
|
|
}
|
|
elseif ($row[1] == 1)
|
|
{
|
|
print $langs->trans("StatusWaiting");
|
|
}
|
|
else print $langs->trans("StatusUnknown");
|
|
|
|
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($resql);
|
|
}
|
|
else
|
|
{
|
|
print $db->error() . ' ' . $sql;
|
|
}
|
|
}
|
|
|
|
$db->close();
|
|
|
|
llxFooter('$Date$ - $Revision$');
|
|
?>
|