2012-08-22 21:27:53 +00:00
|
|
|
<?php
|
2012-07-11 16:13:41 +00:00
|
|
|
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
|
|
|
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
2012-12-30 14:13:49 +00:00
|
|
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
2012-07-11 16:13:41 +00:00
|
|
|
* Copyright (C) 2012 Vinicius Nogueira <viniciusvgn@gmail.com>
|
2004-11-29 16:07:35 +00: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
|
2013-01-16 14:36:08 +00:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2004-11-29 16:07:35 +00: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-07-31 23:45:11 +00:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2004-11-29 16:07:35 +00:00
|
|
|
*/
|
2005-01-09 17:35:22 +00:00
|
|
|
|
2005-06-11 11:34:38 +00:00
|
|
|
/**
|
2008-10-28 20:05:23 +00:00
|
|
|
* \file htdocs/fourn/commande/index.php
|
2011-08-08 15:28:00 +00:00
|
|
|
* \ingroup commande fournisseur
|
|
|
|
|
* \brief Home page of supplier's orders area
|
2008-10-28 20:05:23 +00:00
|
|
|
*/
|
2005-01-09 17:35:22 +00:00
|
|
|
|
2012-08-22 21:24:21 +00:00
|
|
|
require '../../main.inc.php';
|
2012-08-22 21:11:24 +00:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
2004-11-29 16:07:35 +00:00
|
|
|
|
2008-02-25 16:30:43 +00:00
|
|
|
// Security check
|
2012-07-11 16:13:41 +00:00
|
|
|
$orderid = GETPOST('orderid');
|
2008-02-25 20:03:21 +00:00
|
|
|
if ($user->societe_id) $socid=$user->societe_id;
|
2013-03-24 20:06:45 +00:00
|
|
|
$result = restrictedArea($user, 'fournisseur', $orderid, '', 'commande');
|
2010-11-13 17:37:22 +00:00
|
|
|
|
|
|
|
|
$langs->load("suppliers");
|
|
|
|
|
$langs->load("orders");
|
2008-02-25 16:30:43 +00:00
|
|
|
|
2008-02-24 23:29:30 +00:00
|
|
|
|
|
|
|
|
/*
|
2011-05-21 22:58:09 +00:00
|
|
|
* View
|
2012-07-11 16:13:41 +00:00
|
|
|
*/
|
2008-02-24 23:29:30 +00:00
|
|
|
|
|
|
|
|
llxHeader('',$langs->trans("SuppliersOrdersArea"));
|
2004-11-29 16:07:35 +00:00
|
|
|
|
2010-12-01 21:16:28 +00:00
|
|
|
$commandestatic = new CommandeFournisseur($db);
|
2008-10-28 20:05:23 +00:00
|
|
|
$userstatic=new User($db);
|
2010-12-01 21:16:28 +00:00
|
|
|
$formfile = new FormFile($db);
|
2004-11-30 19:26:30 +00:00
|
|
|
|
2012-07-11 16:13:41 +00:00
|
|
|
print_fiche_titre($langs->trans("SuppliersOrdersArea"));
|
2004-11-29 16:07:35 +00:00
|
|
|
|
2008-02-24 23:29:30 +00:00
|
|
|
print '<table class="notopnoleftnoright" width="100%">';
|
|
|
|
|
print '<tr valign="top"><td class="notopnoleft" width="30%">';
|
2004-11-29 16:07:35 +00:00
|
|
|
|
2009-07-08 10:10:35 +00:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Search form
|
2012-04-04 15:43:32 +00:00
|
|
|
*/
|
2009-07-08 10:10:35 +00:00
|
|
|
$var=false;
|
2012-09-09 11:13:24 +00:00
|
|
|
print '<table class="noborder nohover" width="100%">';
|
2009-07-08 10:10:35 +00:00
|
|
|
print '<form method="post" action="liste.php">';
|
|
|
|
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|
|
|
|
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchOrder").'</td></tr>';
|
|
|
|
|
print '<tr '.$bc[$var].'><td>';
|
|
|
|
|
print $langs->trans("Ref").':</td><td><input type="text" class="flat" name="search_ref" size=18></td><td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
|
2013-07-19 12:23:42 +00:00
|
|
|
print '<tr '.$bc[$var].'><td class="nowrap">'.$langs->trans("Other").':</td><td><input type="text" class="flat" name="search_all" size="18"></td>';
|
2009-07-08 10:10:35 +00:00
|
|
|
print '</tr>';
|
|
|
|
|
print "</form></table><br>\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2011-05-21 22:58:09 +00:00
|
|
|
* Statistics
|
2012-04-04 15:43:32 +00:00
|
|
|
*/
|
2009-07-08 10:10:35 +00:00
|
|
|
|
2007-09-19 14:56:55 +00:00
|
|
|
$sql = "SELECT count(cf.rowid), fk_statut";
|
2009-04-27 20:37:50 +00:00
|
|
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
|
|
|
|
$sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as cf";
|
|
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
|
|
$sql.= " WHERE cf.fk_soc = s.rowid";
|
2012-02-01 10:32:55 +00:00
|
|
|
$sql.= " AND cf.entity = ".$conf->entity;
|
2009-04-27 20:37:50 +00:00
|
|
|
if ($user->societe_id) $sql.=' AND cf.fk_soc = '.$user->societe_id;
|
|
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
2005-06-11 11:34:38 +00:00
|
|
|
$sql.= " GROUP BY cf.fk_statut";
|
2004-11-29 16:07:35 +00:00
|
|
|
|
2005-04-04 12:29:24 +00:00
|
|
|
$resql = $db->query($sql);
|
|
|
|
|
if ($resql)
|
2004-11-29 16:07:35 +00:00
|
|
|
{
|
2011-05-21 22:58:09 +00:00
|
|
|
$num = $db->num_rows($resql);
|
|
|
|
|
$i = 0;
|
|
|
|
|
|
|
|
|
|
$var=True;
|
|
|
|
|
|
|
|
|
|
$total=0;
|
|
|
|
|
$totalinprocess=0;
|
|
|
|
|
$dataseries=array();
|
|
|
|
|
$vals=array();
|
|
|
|
|
// 0=Draft -> 1=Validated -> 2=Approved -> 3=Process runing -> 4=Received partially -> 5=Received totally -> (reopen) 4=Received partially
|
|
|
|
|
// -> 7=Canceled/Never received -> (reopen) 3=Process runing
|
|
|
|
|
// -> 6=Canceled -> (reopen) 2=Approved
|
|
|
|
|
while ($i < $num)
|
2004-11-29 16:07:35 +00:00
|
|
|
{
|
2011-05-21 22:58:09 +00:00
|
|
|
$row = $db->fetch_row($resql);
|
|
|
|
|
if ($row)
|
|
|
|
|
{
|
|
|
|
|
if ($row[1]!=7 && $row[1]!=6 && $row[1]!=5)
|
|
|
|
|
{
|
|
|
|
|
$vals[$row[1]]=$row[0];
|
|
|
|
|
$totalinprocess+=$row[0];
|
|
|
|
|
}
|
|
|
|
|
$total+=$row[0];
|
|
|
|
|
}
|
|
|
|
|
$i++;
|
|
|
|
|
}
|
|
|
|
|
$db->free($resql);
|
2004-11-30 19:26:30 +00:00
|
|
|
|
2011-05-21 22:58:09 +00:00
|
|
|
print '<table class="noborder" width="100%">';
|
2011-05-22 00:42:37 +00:00
|
|
|
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("SuppliersOrders").'</td></tr>';
|
2011-05-21 22:58:09 +00:00
|
|
|
print "</tr>\n";
|
2011-05-22 00:42:37 +00:00
|
|
|
foreach (array(0,1,2,3,4,5,6) as $statut)
|
2011-05-21 22:58:09 +00:00
|
|
|
{
|
2011-12-01 21:58:32 +00:00
|
|
|
$dataseries[]=array('label'=>$commandestatic->LibStatut($statut,1),'data'=>(isset($vals[$statut])?(int) $vals[$statut]:0));
|
2011-05-21 22:58:09 +00:00
|
|
|
if (! $conf->use_javascript_ajax)
|
|
|
|
|
{
|
|
|
|
|
$var=!$var;
|
|
|
|
|
print "<tr ".$bc[$var].">";
|
|
|
|
|
print '<td>'.$commandestatic->LibStatut($statut,0).'</td>';
|
|
|
|
|
print '<td align="right"><a href="liste.php?statut='.$statut.'">'.(isset($vals[$statut])?$vals[$statut]:0).'</a></td>';
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
}
|
2004-11-29 16:07:35 +00:00
|
|
|
}
|
2011-05-21 22:58:09 +00:00
|
|
|
if ($conf->use_javascript_ajax)
|
|
|
|
|
{
|
|
|
|
|
print '<tr><td align="center" colspan="2">';
|
|
|
|
|
$data=array('series'=>$dataseries);
|
2011-06-06 22:23:24 +00:00
|
|
|
dol_print_graph('stats',300,180,$data,1,'pie',1);
|
2011-05-21 22:58:09 +00:00
|
|
|
print '</td></tr>';
|
|
|
|
|
}
|
|
|
|
|
//if ($totalinprocess != $total)
|
2011-05-22 00:42:37 +00:00
|
|
|
//print '<tr class="liste_total"><td>'.$langs->trans("Total").' ('.$langs->trans("SuppliersOrdersRunning").')</td><td align="right">'.$totalinprocess.'</td></tr>';
|
|
|
|
|
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">'.$total.'</td></tr>';
|
2011-05-21 22:58:09 +00:00
|
|
|
|
|
|
|
|
print "</table><br>";
|
2005-04-04 12:29:24 +00:00
|
|
|
}
|
2009-07-08 10:10:35 +00:00
|
|
|
else
|
2005-04-04 12:29:24 +00:00
|
|
|
{
|
2011-05-21 22:58:09 +00:00
|
|
|
dol_print_error($db);
|
2005-04-04 12:29:24 +00:00
|
|
|
}
|
2008-02-24 23:29:30 +00:00
|
|
|
|
2009-07-08 10:10:35 +00:00
|
|
|
/*
|
2012-03-31 15:49:32 +00:00
|
|
|
* Legends / Status
|
2012-04-04 15:43:32 +00:00
|
|
|
*
|
|
|
|
|
* Motivo: Mostrar todos os Status e dar a possibilidade de filtrar apenas um deles
|
|
|
|
|
* Reason: Show all Status and give the possibility to filter only one
|
2009-07-08 10:10:35 +00:00
|
|
|
*/
|
2012-03-31 15:49:32 +00:00
|
|
|
|
|
|
|
|
$sql = "SELECT count(cf.rowid), fk_statut";
|
|
|
|
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
|
|
|
|
$sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as cf";
|
|
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
|
|
$sql.= " WHERE cf.fk_soc = s.rowid";
|
|
|
|
|
$sql.= " AND s.entity = ".$conf->entity;
|
|
|
|
|
if ($user->societe_id) $sql.=' AND cf.fk_soc = '.$user->societe_id;
|
|
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
|
|
|
|
$sql.= " GROUP BY cf.fk_statut";
|
|
|
|
|
|
|
|
|
|
$resql = $db->query($sql);
|
|
|
|
|
if ($resql)
|
2009-07-08 10:10:35 +00:00
|
|
|
{
|
2012-04-04 15:43:32 +00:00
|
|
|
$num = $db->num_rows($resql);
|
|
|
|
|
$i = 0;
|
2009-07-08 10:10:35 +00:00
|
|
|
|
2012-04-04 15:43:32 +00:00
|
|
|
print '<table class="liste" width="100%">';
|
2012-03-31 15:49:32 +00:00
|
|
|
|
2012-04-04 15:43:32 +00:00
|
|
|
print '<tr class="liste_titre"><td>'.$langs->trans("Status").'</td>';
|
|
|
|
|
print '<td align="right">'.$langs->trans("Nb").'</td>';
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
$var=True;
|
2012-03-31 15:49:32 +00:00
|
|
|
|
2012-04-04 15:43:32 +00:00
|
|
|
while ($i < $num)
|
2011-05-21 22:58:09 +00:00
|
|
|
{
|
2012-04-04 15:43:32 +00:00
|
|
|
$row = $db->fetch_row($resql);
|
|
|
|
|
$var=!$var;
|
2012-03-31 15:49:32 +00:00
|
|
|
|
2013-06-20 07:18:12 +00:00
|
|
|
print "<tr ".$bc[$var].">";
|
2012-04-04 15:43:32 +00:00
|
|
|
print '<td>'.$langs->trans($commandestatic->statuts[$row[1]]).'</td>';
|
|
|
|
|
print '<td align="right"><a href="liste.php?statut='.$row[1].'">'.$row[0].' '.$commandestatic->LibStatut($row[1],3).'</a></td>';
|
2012-03-31 15:49:32 +00:00
|
|
|
|
2012-04-04 15:43:32 +00:00
|
|
|
print "</tr>\n";
|
|
|
|
|
$i++;
|
2011-05-21 22:58:09 +00:00
|
|
|
}
|
2012-04-04 15:43:32 +00:00
|
|
|
print "</table><br>";
|
|
|
|
|
$db->free($resql);
|
2012-03-31 15:49:32 +00:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2012-04-04 15:43:32 +00:00
|
|
|
dol_print_error($db);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Draft orders
|
|
|
|
|
*/
|
|
|
|
|
|
2012-07-11 16:13:41 +00:00
|
|
|
if (! empty($conf->fournisseur->enabled))
|
2012-04-04 15:43:32 +00:00
|
|
|
{
|
|
|
|
|
$sql = "SELECT c.rowid, c.ref, s.nom, s.rowid as socid";
|
|
|
|
|
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c";
|
|
|
|
|
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
|
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
|
|
$sql.= " WHERE c.fk_soc = s.rowid";
|
|
|
|
|
$sql.= " AND c.entity = ".$conf->entity;
|
|
|
|
|
$sql.= " AND c.fk_statut = 0";
|
2012-07-11 16:13:41 +00:00
|
|
|
if (! empty($socid)) $sql.= " AND c.fk_soc = ".$socid;
|
2012-04-04 15:43:32 +00:00
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
|
|
|
|
|
|
|
|
|
$resql=$db->query($sql);
|
|
|
|
|
if ($resql)
|
|
|
|
|
{
|
|
|
|
|
print '<table class="noborder" width="100%">';
|
|
|
|
|
print '<tr class="liste_titre">';
|
|
|
|
|
print '<td colspan="2">'.$langs->trans("DraftOrders").'</td></tr>';
|
|
|
|
|
$langs->load("orders");
|
|
|
|
|
$num = $db->num_rows($resql);
|
|
|
|
|
if ($num)
|
|
|
|
|
{
|
|
|
|
|
$i = 0;
|
|
|
|
|
$var = True;
|
|
|
|
|
while ($i < $num)
|
|
|
|
|
{
|
|
|
|
|
$var=!$var;
|
|
|
|
|
$obj = $db->fetch_object($resql);
|
2013-06-20 07:18:12 +00:00
|
|
|
print "<tr ".$bc[$var].">";
|
2013-04-24 23:13:13 +00:00
|
|
|
print '<td class="nowrap">';
|
2012-04-04 15:43:32 +00:00
|
|
|
print "<a href=\"fiche.php?id=".$obj->rowid."\">".img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref."</a></td>";
|
|
|
|
|
print '<td><a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->nom,24).'</a></td></tr>';
|
|
|
|
|
$i++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
print "</table><br>";
|
|
|
|
|
}
|
2009-07-08 10:10:35 +00:00
|
|
|
}
|
2008-02-24 23:29:30 +00:00
|
|
|
|
2012-04-04 15:43:32 +00:00
|
|
|
|
2010-12-01 21:16:28 +00:00
|
|
|
/*
|
|
|
|
|
* List of users allowed
|
|
|
|
|
*/
|
2013-02-23 16:40:28 +00:00
|
|
|
$sql = "SELECT u.rowid, u.lastname, u.firstname";
|
2008-10-28 20:05:23 +00:00
|
|
|
$sql.= " FROM ".MAIN_DB_PREFIX."user as u,";
|
2009-04-27 20:37:50 +00:00
|
|
|
$sql.= " ".MAIN_DB_PREFIX."user_rights as ur";
|
|
|
|
|
$sql.= ", ".MAIN_DB_PREFIX."rights_def as rd";
|
|
|
|
|
$sql.= " WHERE u.rowid = ur.fk_user";
|
|
|
|
|
$sql.= " AND (u.entity IN (0,".$conf->entity.")";
|
2009-04-30 16:14:50 +00:00
|
|
|
$sql.= " AND rd.entity = ".$conf->entity.")";
|
2009-04-27 20:37:50 +00:00
|
|
|
$sql.= " AND ur.fk_id = rd.id";
|
2009-04-30 16:14:50 +00:00
|
|
|
$sql.= " AND module = 'fournisseur'";
|
|
|
|
|
$sql.= " AND perms = 'commande'";
|
|
|
|
|
$sql.= " AND subperms = 'approuver'";
|
2005-04-04 12:29:24 +00:00
|
|
|
|
|
|
|
|
$resql = $db->query($sql);
|
|
|
|
|
if ($resql)
|
|
|
|
|
{
|
2011-05-21 22:58:09 +00:00
|
|
|
$num = $db->num_rows($resql);
|
|
|
|
|
$i = 0;
|
2009-07-08 10:10:35 +00:00
|
|
|
|
2011-05-21 22:58:09 +00:00
|
|
|
print '<table class="liste" width="100%">';
|
|
|
|
|
print '<tr class="liste_titre"><td>'.$langs->trans("UserWithApproveOrderGrant").'</td>';
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
$var=True;
|
2005-04-04 12:29:24 +00:00
|
|
|
|
2011-05-21 22:58:09 +00:00
|
|
|
while ($i < $num)
|
2005-04-04 12:29:24 +00:00
|
|
|
{
|
2011-05-21 22:58:09 +00:00
|
|
|
$obj = $db->fetch_object($resql);
|
|
|
|
|
$var=!$var;
|
|
|
|
|
|
2013-06-20 07:18:12 +00:00
|
|
|
print "<tr ".$bc[$var].">";
|
2011-05-21 22:58:09 +00:00
|
|
|
print '<td>';
|
|
|
|
|
$userstatic->id=$obj->rowid;
|
2013-03-09 19:34:38 +00:00
|
|
|
$userstatic->lastname=$obj->lastname;
|
2012-01-29 22:24:47 +00:00
|
|
|
$userstatic->firstname=$obj->firstname;
|
2011-05-21 22:58:09 +00:00
|
|
|
print $userstatic->getNomUrl(1);
|
|
|
|
|
print '</td>';
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
$i++;
|
2005-04-04 12:29:24 +00:00
|
|
|
}
|
2011-05-21 22:58:09 +00:00
|
|
|
print "</table><br>";
|
|
|
|
|
$db->free($resql);
|
2004-11-29 16:07:35 +00:00
|
|
|
}
|
2009-07-08 10:10:35 +00:00
|
|
|
else
|
2004-11-29 16:07:35 +00:00
|
|
|
{
|
2011-05-21 22:58:09 +00:00
|
|
|
dol_print_error($db);
|
2004-11-29 16:07:35 +00:00
|
|
|
}
|
|
|
|
|
|
2010-12-01 21:16:28 +00:00
|
|
|
|
2011-08-08 15:28:00 +00:00
|
|
|
print '</td><td width="70%" valign="top" class="notopnoleftnoright">';
|
2010-12-01 21:16:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Last modified orders
|
2012-04-04 15:43:32 +00:00
|
|
|
*/
|
2010-12-01 21:16:28 +00:00
|
|
|
$max=5;
|
|
|
|
|
|
2012-04-16 09:39:26 +00:00
|
|
|
$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.tms, s.nom, s.rowid as socid";
|
2010-12-01 21:16:28 +00:00
|
|
|
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c";
|
|
|
|
|
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
|
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
|
|
$sql.= " WHERE c.fk_soc = s.rowid";
|
|
|
|
|
$sql.= " AND c.entity = ".$conf->entity;
|
|
|
|
|
//$sql.= " AND c.fk_statut > 2";
|
2012-07-11 16:13:41 +00:00
|
|
|
if (! empty($socid)) $sql .= " AND c.fk_soc = ".$socid;
|
2010-12-01 21:16:28 +00:00
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
|
|
|
|
$sql.= " ORDER BY c.tms DESC";
|
|
|
|
|
$sql.= $db->plimit($max, 0);
|
|
|
|
|
|
|
|
|
|
$resql=$db->query($sql);
|
|
|
|
|
if ($resql)
|
|
|
|
|
{
|
2011-05-21 22:58:09 +00:00
|
|
|
print '<table class="noborder" width="100%">';
|
|
|
|
|
print '<tr class="liste_titre">';
|
|
|
|
|
print '<td colspan="4">'.$langs->trans("LastModifiedOrders",$max).'</td></tr>';
|
|
|
|
|
|
|
|
|
|
$num = $db->num_rows($resql);
|
|
|
|
|
if ($num)
|
|
|
|
|
{
|
|
|
|
|
$i = 0;
|
|
|
|
|
$var = True;
|
|
|
|
|
while ($i < $num)
|
|
|
|
|
{
|
|
|
|
|
$var=!$var;
|
|
|
|
|
$obj = $db->fetch_object($resql);
|
|
|
|
|
|
2013-06-20 07:18:12 +00:00
|
|
|
print "<tr ".$bc[$var].">";
|
2013-04-24 23:13:13 +00:00
|
|
|
print '<td width="20%" class="nowrap">';
|
2011-05-21 22:58:09 +00:00
|
|
|
|
|
|
|
|
$commandestatic->id=$obj->rowid;
|
|
|
|
|
$commandestatic->ref=$obj->ref;
|
|
|
|
|
|
|
|
|
|
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
2013-04-24 23:13:13 +00:00
|
|
|
print '<td width="96" class="nobordernopadding nowrap">';
|
2011-05-21 22:58:09 +00:00
|
|
|
print $commandestatic->getNomUrl(1);
|
|
|
|
|
print '</td>';
|
|
|
|
|
|
2013-04-24 23:13:13 +00:00
|
|
|
print '<td width="16" class="nobordernopadding nowrap">';
|
2011-05-21 22:58:09 +00:00
|
|
|
print ' ';
|
|
|
|
|
print '</td>';
|
|
|
|
|
|
2013-04-25 18:27:45 +00:00
|
|
|
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
|
2011-05-21 22:58:09 +00:00
|
|
|
$filename=dol_sanitizeFileName($obj->ref);
|
|
|
|
|
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
|
|
|
|
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
|
2012-09-15 07:02:20 +00:00
|
|
|
print $formfile->getDocumentsLink($commandestatic->element, $filename, $filedir);
|
2011-05-21 22:58:09 +00:00
|
|
|
print '</td></tr></table>';
|
|
|
|
|
|
|
|
|
|
print '</td>';
|
|
|
|
|
|
|
|
|
|
print '<td><a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.'</a></td>';
|
2012-04-16 09:39:26 +00:00
|
|
|
print '<td>'.dol_print_date($db->jdate($obj->tms),'day').'</td>';
|
2011-05-21 22:58:09 +00:00
|
|
|
print '<td align="right">'.$commandestatic->LibStatut($obj->fk_statut,5).'</td>';
|
|
|
|
|
print '</tr>';
|
|
|
|
|
$i++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
print "</table><br>";
|
2010-12-01 21:16:28 +00:00
|
|
|
}
|
|
|
|
|
else dol_print_error($db);
|
|
|
|
|
|
2012-04-04 15:43:32 +00:00
|
|
|
|
2012-03-31 15:49:32 +00:00
|
|
|
/*
|
2012-04-04 15:43:32 +00:00
|
|
|
* Orders to process
|
|
|
|
|
*/
|
|
|
|
|
/*
|
|
|
|
|
$sql = "SELECT c.rowid, c.ref, c.fk_statut, s.nom, s.rowid as socid";
|
|
|
|
|
$sql.=" FROM ".MAIN_DB_PREFIX."commande_fournisseur as c";
|
|
|
|
|
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
|
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
|
|
$sql.= " WHERE c.fk_soc = s.rowid";
|
|
|
|
|
$sql.= " AND c.entity = ".$conf->entity;
|
|
|
|
|
$sql.= " AND c.fk_statut = 1";
|
|
|
|
|
if ($socid) $sql.= " AND c.fk_soc = ".$socid;
|
|
|
|
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
|
|
|
|
$sql.= " ORDER BY c.rowid DESC";
|
|
|
|
|
|
|
|
|
|
$resql=$db->query($sql);
|
|
|
|
|
if ($resql)
|
2012-03-31 15:49:32 +00:00
|
|
|
{
|
2012-04-04 15:43:32 +00:00
|
|
|
$num = $db->num_rows($resql);
|
2012-03-31 15:49:32 +00:00
|
|
|
|
2012-04-04 15:43:32 +00:00
|
|
|
print '<table class="noborder" width="100%">';
|
|
|
|
|
print '<tr class="liste_titre">';
|
|
|
|
|
print '<td colspan="3">'.$langs->trans("OrdersToProcess").' <a href="'.DOL_URL_ROOT.'/commande/liste.php?viewstatut=1">('.$num.')</a></td></tr>';
|
|
|
|
|
|
|
|
|
|
if ($num)
|
|
|
|
|
{
|
|
|
|
|
$i = 0;
|
|
|
|
|
$var = True;
|
|
|
|
|
while ($i < $num)
|
|
|
|
|
{
|
|
|
|
|
$var=!$var;
|
|
|
|
|
$obj = $db->fetch_object($resql);
|
2013-06-20 07:18:12 +00:00
|
|
|
print "<tr ".$bc[$var].">";
|
2013-04-24 23:13:13 +00:00
|
|
|
print '<td class="nowrap">';
|
2012-04-04 15:43:32 +00:00
|
|
|
|
|
|
|
|
$commandestatic->id=$obj->rowid;
|
|
|
|
|
$commandestatic->ref=$obj->ref;
|
|
|
|
|
|
|
|
|
|
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
2013-04-24 23:13:13 +00:00
|
|
|
print '<td width="96" class="nobordernopadding nowrap">';
|
2012-04-04 15:43:32 +00:00
|
|
|
print $commandestatic->getNomUrl(1);
|
|
|
|
|
print '</td>';
|
|
|
|
|
|
2013-04-24 23:13:13 +00:00
|
|
|
print '<td width="16" class="nobordernopadding nowrap">';
|
2012-04-04 15:43:32 +00:00
|
|
|
print ' ';
|
|
|
|
|
print '</td>';
|
|
|
|
|
|
2013-04-25 18:27:45 +00:00
|
|
|
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
|
2012-04-04 15:43:32 +00:00
|
|
|
$filename=dol_sanitizeFileName($obj->ref);
|
|
|
|
|
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
|
|
|
|
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
|
2012-09-15 07:02:20 +00:00
|
|
|
print $formfile->getDocumentsLink($commandestatic->element, $filename, $filedir);
|
2012-04-04 15:43:32 +00:00
|
|
|
print '</td></tr></table>';
|
|
|
|
|
|
|
|
|
|
print '</td>';
|
|
|
|
|
|
|
|
|
|
print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->nom,24).'</a></td>';
|
|
|
|
|
|
|
|
|
|
print '<td align="right">'.$commandestatic->LibStatut($obj->fk_statut,$obj->facture,5).'</td>';
|
|
|
|
|
|
|
|
|
|
print '</tr>';
|
|
|
|
|
$i++;
|
|
|
|
|
}
|
2012-03-31 15:49:32 +00:00
|
|
|
}
|
2010-12-01 21:16:28 +00:00
|
|
|
|
2012-04-04 15:43:32 +00:00
|
|
|
print "</table><br>";
|
|
|
|
|
}
|
|
|
|
|
*/
|
2010-12-01 21:16:28 +00:00
|
|
|
|
2004-11-29 16:07:35 +00:00
|
|
|
print '</td></tr></table>';
|
|
|
|
|
|
2011-08-27 14:24:16 +00:00
|
|
|
llxFooter();
|
2012-04-16 10:03:33 +00:00
|
|
|
|
|
|
|
|
$db->close();
|
2004-11-29 16:07:35 +00:00
|
|
|
?>
|