dolibarr/htdocs/compta/ventilation/index.php

104 lines
3.2 KiB
PHP
Raw Normal View History

2004-12-06 15:00:29 +01:00
<?php
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
2005-10-19 07:12:45 +02:00
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
2004-12-06 15:00:29 +01:00
*
* 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 3 of the License, or
2004-12-06 15:00:29 +01:00
* (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
2011-08-03 02:45:22 +02:00
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2004-12-06 15:00:29 +01:00
*
*/
2005-01-02 18:23:44 +01:00
/**
* \file htdocs/compta/ventilation/index.php
* \ingroup compta
* \brief Page accueil ventilation
*/
2004-12-06 15:00:29 +01:00
require '../../main.inc.php';
2004-12-06 15:00:29 +01:00
2006-09-16 14:14:36 +02:00
$langs->load("compta");
2006-12-23 16:24:24 +01:00
$langs->load("bills");
2006-09-16 14:14:36 +02:00
2005-03-31 15:26:04 +02:00
llxHeader('','Compta - Ventilation');
2005-10-19 07:12:45 +02:00
print_fiche_titre("Ventilation Comptable");
2005-03-31 15:26:04 +02:00
//print '<table border="0" width="100%" class="notopnoleftnoright">';
//print '<tr><td valign="top" width="30%" class="notopnoleft">';
print '<div class="fichecenter"><div class="fichethirdleft">';
2005-03-31 15:26:04 +02:00
$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."facturedet as fd";
$sql.= " , ".MAIN_DB_PREFIX."facture as f";
$sql.= " WHERE fd.fk_code_ventilation = 0";
$sql.= " AND f.rowid = fd.fk_facture AND f.fk_statut = 1";
2005-03-31 15:26:04 +02:00
$result = $db->query($sql);
if ($result)
{
$row = $db->fetch_row($result);
$nbfac = $row[0];
$db->free($result);
}
2005-10-19 07:12:45 +02:00
$var=true;
2005-03-31 15:26:04 +02:00
print '<table class="noborder" width="100%">';
2006-09-16 14:14:36 +02:00
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Lines").'</tr>';
print '<tr class="liste_titre"><td>'.$langs->trans("Type").'</td><td align="right">'.$langs->trans("Nb").'</td></tr>';
2005-10-19 07:12:45 +02:00
$var=!$var;
print "<tr ".$bc[$var].">".'<td>'.$langs->trans("Invoices").'</td><td align="right">'.$nbfac.'</td></tr>';
2005-10-19 07:12:45 +02:00
$var=!$var;
2005-03-31 15:26:04 +02:00
print "</table>\n";
//print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
2005-03-31 15:26:04 +02:00
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Type").'</td><td align="center">'.$langs->trans("NbOfLines").'</td><td align="center">'.$langs->trans("AccountNumber").'</td><td align="center">'.$langs->trans("TransID").'</td></tr>';
2005-03-31 15:26:04 +02:00
2005-12-15 11:13:21 +01:00
$sql = "SELECT count(*), ccg.intitule, ccg.rowid,ccg.numero FROM ".MAIN_DB_PREFIX."facturedet as fd";
2005-10-19 07:12:45 +02:00
$sql.= " ,".MAIN_DB_PREFIX."compta_compte_generaux as ccg";
$sql.= " WHERE fd.fk_code_ventilation = ccg.rowid";
$sql.= " GROUP BY ccg.rowid";
2005-03-31 15:26:04 +02:00
$resql = $db->query($sql);
if ($resql)
{
2005-10-19 07:12:45 +02:00
$i = 0;
$num = $db->num_rows($resql);
$var=true;
2010-03-27 15:40:39 +01:00
2005-10-19 07:12:45 +02:00
while ($i < $num)
2005-03-31 15:26:04 +02:00
{
2005-10-19 07:12:45 +02:00
$row = $db->fetch_row($resql);
$var=!$var;
2005-12-15 11:13:21 +01:00
print '<tr '.$bc[$var].'><td>'.$row[1].'</td><td align="center">'.$row[0].'</td>';
print '<td align="center">'.$row[3].'</td><td align="center">'.$row[2].'</td></tr>';
2005-10-19 07:12:45 +02:00
$i++;
2005-03-31 15:26:04 +02:00
}
2005-10-19 07:12:45 +02:00
$db->free($resql);
2005-03-31 15:26:04 +02:00
}
print "</table>\n";
//print '</td></tr></table>';
2013-03-30 19:40:52 +01:00
print '</div></div></div>';
2004-12-06 15:00:29 +01:00
llxFooter();
2005-03-31 15:26:04 +02:00
$db->close();
2004-12-06 15:00:29 +01:00
?>