Nettoyage du code

This commit is contained in:
Rodolphe Quiedeville
2003-08-26 09:58:14 +00:00
parent fd33e3e76b
commit e1fdb60f4d
18 changed files with 9 additions and 152 deletions

View File

@@ -34,9 +34,6 @@ if ($user->societe_id > 0)
$socidp = $user->societe_id;
}
$db = new Db();
/*
*
*

View File

@@ -38,8 +38,6 @@ if ($user->societe_id > 0)
llxHeader();
$db = new Db();
/*
*
*

View File

@@ -1,122 +0,0 @@
<?PHP
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* $Id$
* $Source$
*
* 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.
*
*/
require("./pre.inc.php3");
require("../lib/functions.inc.php3");
require("$GLJ_WWW_ROOT/../www/lib/CMailFile.class.php3");
$author = $GLOBALS["REMOTE_USER"];
llxHeader();
print "<table width=\"100%\">";
print "<tr><td>Propositions commerciales</td>";
print "<td align=\"right\"><a href=\"propal.php3\">Liste</a></td>";
print "<td align=\"right\"><a href=\"/compta/prev.php3\">CA Pr<50>visionnel</a></td>";
print "<td align=\"right\"><a href=\"$PHP_SELF?viewstatut=2\">Propal Sign<67>es</a></td></tr>";
print "</table>";
$bc[0]="bgcolor=\"#90c090\"";
$bc[1]="bgcolor=\"#b0e0b0\"";
$db = new Db();
if ($sortfield == "") {
$sortfield="lower(p.label)";
}
if ($sortorder == "") {
$sortorder="ASC";
}
$yn["t"] = "oui";
$yn["f"] = "non";
if ($page == -1) { $page = 0 ; }
$limit = 26;
$offset = $limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
function calc($st) {
global $db;
$sum = 0;
$sql = "SELECT sum(price-remise) as sum FROM llx_propal WHERE fk_statut = $st";
if ( $db->query($sql) ) {
if ($db->num_rows()) {
$arr = $db->fetch_array(0);
$sum = $arr[0];
}
}
return $sum ;
}
function calcf($st) {
global $db;
$sum = 0;
$sql = "SELECT sum(amount) as sum FROM llx_facture WHERE fk_statut = 1 and paye = $st";
if ( $db->query($sql) ) {
if ($db->num_rows()) {
$arr = $db->fetch_array(0);
$sum = $arr[0];
}
}
return $sum ;
}
/*
*
*
* Liste des propals
*
*
*/
print "<p><TABLE border=\"1\" cellspacing=\"0\" cellpadding=\"2\">";
echo '<tr><td colspan="2">Propales</td></tr>';
$po = calc(1);
$ps = calc(2);
$pns = calc(3);
print "<tr><td>Propales ouvertes</td><td align=\"right\">".price($po)."</td></tr>";
print "<tr><td>Propales sign<67>es</td><td align=\"right\">".price($ps)."</td></tr>";
print "<tr><td>Total</td><td align=\"right\">".price($ps + $po )."</td></tr>";
print "<tr><td>Propales non sign<67>es</td><td align=\"right\">".price($pns)."</td></tr>";
print "<tr><td>Total</td><td align=\"right\">".price($ps + $po + $pns)."</td></tr>";
print "</table>";
print "<p><TABLE border=\"1\" cellspacing=\"0\" cellpadding=\"2\">";
echo '<tr><td colspan="2">Factures</td></tr>';
$fnp = calcf(0);
$fp = calcf(1);
print "<tr><td>Factures non pay<61>es</td><td align=\"right\">".price($fnp)."</td></tr>";
print "<tr><td>Factures pay<61>es</td><td align=\"right\">".price($fp)."</td></tr>";
print "<tr><td>Total</td><td align=\"right\">".price($fnp + $fp )."</td></tr>";
print "</table>";
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@@ -22,8 +22,6 @@ require("./pre.inc.php3");
llxHeader();
$db = new Db();
$upload_dir = SOCIETE_OUTPUTDIR . "/" . $socid ;
if (! is_dir($upload_dir))

View File

@@ -28,7 +28,6 @@ require("../actioncomm.class.php3");
llxHeader();
$user->getrights('propale');
$user->getrights('projet');
//$db = new Db();
if ($sortorder == "") {
$sortorder="ASC";

View File

@@ -22,7 +22,6 @@
require("./pre.inc.php3");
require("../contact.class.php3");
$db = new Db();
if ($sortorder == "")
{
$sortfield="lower(s.nom)";

View File

@@ -42,7 +42,6 @@ if($socidp && $user->societe_id == 0)
}
print '</tr></table>';
$db = new Db();
/*
* Traitements des actions
*

View File

@@ -1,8 +1,5 @@
<?PHP
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* $Id$
* $Source$
/* Copyright (C) 2001-2003 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
@@ -18,6 +15,9 @@
* 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.php3");
@@ -26,7 +26,7 @@ require("./pre.inc.php3");
*
*/
llxHeader();
$db = new Db();
if ($sortorder == "") {
$sortfield="lower(s.nom)";
$sortorder="ASC";

View File

@@ -23,8 +23,6 @@ require("./pre.inc.php3");
llxHeader();
$db = new Db();
function valeur($sql) {
global $db;
if ( $db->query($sql) ) {
@@ -38,8 +36,6 @@ function valeur($sql) {
/*
*
*/
$db = new Db();
if ($action == 'add_bookmark') {
$sql = "INSERT INTO llx_bookmark (fk_soc, dateb, fk_user) VALUES ($socidp, now(),".$user->id.");";

View File

@@ -23,7 +23,6 @@ require("./pre.inc.php3");
llxHeader();
$db = new Db();
if ($action == 'add') {

View File

@@ -26,7 +26,7 @@ print "Factures";
$bc[0]="bgcolor=\"#90c090\"";
$bc[1]="bgcolor=\"#b0e0b0\"";
$db = new Db();
if ($sortfield == "") {
$sortfield="lower(p.label)";
}

View File

@@ -22,7 +22,7 @@
require("./pre.inc.php3");
require("../lib/functions.inc.php3");
llxHeader();
$db = new Db();
if ($sortorder == "") {
$sortfield="lower(s.nom)";
$sortorder="ASC";

View File

@@ -23,7 +23,6 @@ require("./pre.inc.php3");
llxHeader();
$db = new Db();
$sql = "SELECT rowid, number, label FROM llx_compta_account ORDER BY number";
if ( $db->query($sql) ) {

View File

@@ -23,7 +23,6 @@ require("./pre.inc.php3");
require("../paiement.class.php");
require("./bank/account.class.php");
$db = new Db();
/*
* S<>curit<69> acc<63>s client

View File

@@ -30,7 +30,7 @@ llxHeader();
print "Point mort";
$db = new Db();
if ($action == 'update') {
$datepm = mktime(12, 0 , 0, $pmonth, 1, $pyear);

View File

@@ -169,7 +169,7 @@ llxHeader();
print "<b>Point mort</b>";
$db = new Db();
ppt($db, 0);

View File

@@ -34,8 +34,6 @@ require("../actioncomm.class.php3");
llxHeader();
$db = new Db();
if ($action == 'setstatut')
{
/*

View File

@@ -66,8 +66,6 @@ function pt ($db, $sql, $date) {
llxHeader();
$db = new Db();
$yearc = strftime("%Y",time());