dolibarr/htdocs/commande/index.php

203 lines
5.6 KiB
PHP
Raw Normal View History

<?php
2004-02-13 16:23:06 +01:00
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
2003-03-14 01:17:54 +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 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$
*
*/
/*!
\file htdocs/commande/index.php
\ingroup compta
\brief Page acceuil zone comptabilit<EFBFBD>
\version $Revision$
*/
2003-03-14 01:17:54 +01:00
require("./pre.inc.php");
$langs->load("orders");
2003-03-14 01:17:54 +01:00
llxHeader("",$langs->trans("Orders"),"Commande");
2003-11-07 10:47:49 +01:00
print_titre($langs->trans("OrdersArea"));
print '<table class="noborder" width="100%">';
2003-11-03 09:40:18 +01:00
print '<tr><td valign="top" width="30%">';
2003-11-03 09:40:18 +01:00
/*
* Zone recherche
2003-11-03 09:40:18 +01:00
*/
print '<form method="post" action="liste.php">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("SearchOrder").'</td></tr>';
print "<tr $bc[1]><td>";
print $langs->trans("Ref").' : <input type="text" name="sf_ref"> <input type="submit" value="'.$langs->trans("Search").'" class="flat"></td></tr>';
print "</table></form><br>\n";
2003-11-03 09:40:18 +01:00
2003-11-07 10:47:49 +01:00
/*
* Commandes <EFBFBD> valider
*/
$sql = "SELECT c.rowid, c.ref, s.nom, s.idp FROM ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s";
2003-11-07 10:47:49 +01:00
$sql .= " WHERE c.fk_soc = s.idp AND c.fk_statut = 0";
if ($socidp)
{
$sql .= " AND c.fk_soc = $socidp";
}
if ( $db->query($sql) )
{
$langs->load("orders");
2003-11-07 10:47:49 +01:00
$num = $db->num_rows();
if ($num)
{
$i = 0;
print '<table class="noborder" width="100%">';
2003-11-07 10:47:49 +01:00
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("OrdersToValid").'</td></tr>';
2004-02-13 16:23:06 +01:00
$var = True;
2003-11-07 10:47:49 +01:00
while ($i < $num)
{
$var=!$var;
$obj = $db->fetch_object();
2004-02-13 16:23:06 +01:00
print "<tr $bc[$var]><td width=\"30%\"><a href=\"fiche.php?id=$obj->rowid\">".img_file()."</a>&nbsp;";
print "<a href=\"fiche.php?id=$obj->rowid\">$obj->ref</a></td>";
2003-11-09 19:00:27 +01:00
print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$obj->idp.'">'.$obj->nom.'</a></td></tr>';
2003-11-07 10:47:49 +01:00
$i++;
}
print "</table><br>";
}
}
2003-11-07 10:47:49 +01:00
/*
2003-11-27 13:58:45 +01:00
* Commandes <EFBFBD> traiter
2003-11-07 10:47:49 +01:00
*/
$sql = "SELECT c.rowid, c.ref, s.nom, s.idp FROM ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s";
2003-11-07 10:47:49 +01:00
$sql .= " WHERE c.fk_soc = s.idp AND c.fk_statut = 1";
if ($socidp)
{
$sql .= " AND c.fk_soc = $socidp";
}
2003-11-19 16:05:03 +01:00
$sql .= " ORDER BY c.rowid DESC";
2003-11-07 10:47:49 +01:00
if ( $db->query($sql) )
{
$num = $db->num_rows();
if ($num)
{
$i = 0;
print '<table class="noborder" width="100%">';
2003-11-07 10:47:49 +01:00
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("OrdersToProcess").'</td></tr>';
2004-02-13 16:23:06 +01:00
$var = True;
2003-11-19 16:05:03 +01:00
while ($i < $num)
{
$var=!$var;
$obj = $db->fetch_object();
2004-02-13 16:23:06 +01:00
print "<tr $bc[$var]><td width=\"30%\"><a href=\"fiche.php?id=$obj->rowid\">".img_file()."</a>";
print "&nbsp;<a href=\"fiche.php?id=$obj->rowid\">$obj->ref</a></td>";
2003-11-19 16:05:03 +01:00
print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$obj->idp.'">'.$obj->nom.'</a></td></tr>';
$i++;
}
print "</table><br>";
}
}
2003-11-27 13:58:45 +01:00
2003-11-27 13:58:45 +01:00
print '</td><td valign="top" width="70%">';
2003-11-19 16:05:03 +01:00
/*
* Commandes en cours
2003-11-19 16:05:03 +01:00
*/
$sql = "SELECT c.rowid, c.ref, s.nom, s.idp FROM ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s";
2003-11-19 16:05:03 +01:00
$sql .= " WHERE c.fk_soc = s.idp AND c.fk_statut = 2 ";
if ($socidp)
{
$sql .= " AND c.fk_soc = $socidp";
}
$sql .= " ORDER BY c.rowid DESC";
if ( $db->query($sql) )
{
$num = $db->num_rows();
if ($num)
{
$i = 0;
print '<table class="noborder" width="100%">';
2003-11-19 16:05:03 +01:00
print '<tr class="liste_titre">';
print '<td colspan="2">Commandes en traitement ('.$num.')</td></tr>';
2004-02-13 16:23:06 +01:00
$var = True;
2003-11-07 10:47:49 +01:00
while ($i < $num)
{
$var=!$var;
$obj = $db->fetch_object();
2004-02-13 16:23:06 +01:00
print "<tr $bc[$var]><td width=\"30%\"><a href=\"fiche.php?id=$obj->rowid\">".img_file()."</a>&nbsp;";
print "<a href=\"fiche.php?id=$obj->rowid\">$obj->ref</a></td>";
2003-11-07 10:47:49 +01:00
print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$obj->idp.'">'.$obj->nom.'</a></td></tr>';
$i++;
}
print "</table><br>";
}
}
2003-11-03 09:40:18 +01:00
/*
* Commandes <EFBFBD> traiter
2003-11-03 09:40:18 +01:00
*/
$sql = "SELECT c.rowid, c.ref, s.nom, s.idp FROM ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s";
2003-11-19 16:05:03 +01:00
$sql .= " WHERE c.fk_soc = s.idp AND c.fk_statut > 2 ";
if ($socidp)
2003-11-03 09:40:18 +01:00
{
$sql .= " AND c.fk_soc = $socidp";
}
$sql .= " ORDER BY c.rowid DESC";
$sql .= $db->plimit(5, 0);
if ( $db->query($sql) )
{
$num = $db->num_rows();
if ($num)
2003-11-03 09:40:18 +01:00
{
$i = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="2">5 derni<6E>res commandes</td></tr>';
2004-02-13 16:23:06 +01:00
$var = True;
while ($i < $num)
2003-11-03 09:40:18 +01:00
{
$var=!$var;
$obj = $db->fetch_object();
2004-02-13 16:23:06 +01:00
print "<tr $bc[$var]><td width=\"30%\"><a href=\"fiche.php?id=$obj->rowid\">".img_file()."</a>&nbsp;";
print "<a href=\"fiche.php?id=$obj->rowid\">$obj->ref</a></td>";
print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$obj->idp.'">'.$obj->nom.'</a></td></tr>';
$i++;
2003-11-03 09:40:18 +01:00
}
print "</table><br>";
2003-11-03 09:40:18 +01:00
}
}
2003-03-14 01:17:54 +01:00
2003-11-03 09:40:18 +01:00
print '</td></tr></table>';
2003-03-14 01:17:54 +01:00
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>