New: Add statistics on contract area
Minor look enhancements
This commit is contained in:
parent
69dba45590
commit
814b1acd43
@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
@ -15,18 +15,15 @@
|
||||
* 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/comm/remise.php
|
||||
\ingroup commercial
|
||||
\brief Onglet remise de la societe
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
* \file htdocs/comm/remise.php
|
||||
* \ingroup societe
|
||||
* \brief Onglet remise de la societe
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require_once("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
||||
@ -35,17 +32,24 @@ $langs->load("companies");
|
||||
$langs->load("orders");
|
||||
$langs->load("bills");
|
||||
|
||||
$_socid = $_GET["id"];
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$_socid = $user->societe_id;
|
||||
}
|
||||
|
||||
|
||||
if ($_POST["action"] == 'setremise')
|
||||
{
|
||||
$soc = New Societe($db);
|
||||
$soc->fetch($_GET["id"]);
|
||||
$result=$soc->set_remise_client($_POST["remise"],$_POST["note"],$user);
|
||||
$soc = New Societe($db);
|
||||
$soc->fetch($_GET["id"]);
|
||||
$result=$soc->set_remise_client($_POST["remise"],$_POST["note"],$user);
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
Header("Location: remise.php?id=".$_GET["id"]);
|
||||
exit;
|
||||
{
|
||||
Header("Location: remise.php?id=".$_GET["id"]);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -54,120 +58,123 @@ if ($_POST["action"] == 'setremise')
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
llxHeader();
|
||||
|
||||
$_socid = $_GET["id"];
|
||||
|
||||
|
||||
// Sécurité si un client essaye d'accéder à une autre fiche que la sienne
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$_socid = $user->societe_id;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************
|
||||
*
|
||||
* Mode fiche
|
||||
*
|
||||
*********************************************************************************/
|
||||
*********************************************************************************/
|
||||
if ($_socid > 0)
|
||||
{
|
||||
// On recupere les donnees societes par l'objet
|
||||
$objsoc = new Societe($db);
|
||||
$objsoc->id=$_socid;
|
||||
$objsoc->fetch($_socid,$to);
|
||||
|
||||
|
||||
if ($errmesg)
|
||||
{
|
||||
print '<div class="error">'.$errmesg.'</div><br>';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
$head = societe_prepare_head($objsoc);
|
||||
|
||||
dol_fiche_head($head, 'relativediscount', $objsoc->nom);
|
||||
dol_fiche_head($head, 'relativediscount', $langs->trans("ThirdParty"));
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
print '<form method="POST" action="remise.php?id='.$objsoc->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="setremise">';
|
||||
print '<table width="100%" border="0">';
|
||||
print '<tr><td valign="top">';
|
||||
print '<table class="border" width="100%">';
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
print '<form method="POST" action="remise.php?id='.$objsoc->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="setremise">';
|
||||
print '<table width="100%" border="0">';
|
||||
print '<tr><td valign="top">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Remise
|
||||
print '<tr><td colspan="2" width="25%">';
|
||||
print $langs->trans("CustomerRelativeDiscount").'</td><td colspan="2">'.$objsoc->remise_client."%</td></tr>";
|
||||
// Name
|
||||
print '<tr><td colspan="2" width="25%">'.$langs->trans('Name').'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $form->showrefnav($objsoc,'id','',1,'rowid','nom');
|
||||
print '</td></tr>';
|
||||
|
||||
// Nouvelle valeur
|
||||
print '<tr><td colspan="2">';
|
||||
print $langs->trans("NewValue").'</td><td colspan="2"><input type="text" size="5" name="remise" value="'.$objsoc->remise_client.'">%</td></tr>';
|
||||
// Remise
|
||||
print '<tr><td colspan="2" width="25%">';
|
||||
print $langs->trans("CustomerRelativeDiscount").'</td><td colspan="2">'.$objsoc->remise_client."%</td></tr>";
|
||||
|
||||
// Motif/Note
|
||||
print '<tr><td colspan="2" width="25%">';
|
||||
print $langs->trans("NoteReason").'</td><td colspan="2"><input type="text" size="60" name="note" value=""></td></tr>';
|
||||
// Nouvelle valeur
|
||||
print '<tr><td colspan="2">';
|
||||
print $langs->trans("NewValue").'</td><td colspan="2"><input type="text" size="5" name="remise" value="'.$objsoc->remise_client.'">%</td></tr>';
|
||||
|
||||
print '<tr><td colspan="4" align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td></tr>';
|
||||
// Motif/Note
|
||||
print '<tr><td colspan="2" width="25%">';
|
||||
print $langs->trans("NoteReason").'</td><td colspan="2"><input type="text" size="60" name="note" value=""></td></tr>';
|
||||
|
||||
print "</table>";
|
||||
print "</td></tr>";
|
||||
print '</table>';
|
||||
print "</form>";
|
||||
|
||||
print "</div>\n";
|
||||
print '<br>';
|
||||
print '<tr><td colspan="4" align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td></tr>';
|
||||
|
||||
|
||||
/*
|
||||
* Liste de l'historique des avoirs
|
||||
*/
|
||||
$sql = "SELECT rc.rowid,rc.remise_client,rc.note,".$db->pdate("rc.datec")." as dc,";
|
||||
$sql.= " u.login, u.rowid as user_id";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe_remise as rc, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE rc.fk_soc =". $objsoc->id;
|
||||
$sql.= " AND u.rowid = rc.fk_user_author";
|
||||
$sql.= " ORDER BY rc.datec DESC";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
$tag = !$tag;
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="160">'.$langs->trans("Date").'</td>';
|
||||
print '<td width="160" align="center">'.$langs->trans("CustomerRelativeDiscountShort").'</td>';
|
||||
print '<td align="left">'.$langs->trans("NoteReason").'</td>';
|
||||
print '<td align="center">'.$langs->trans("User").'</td>';
|
||||
print '</tr>';
|
||||
$i = 0 ;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ($i < $num )
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$tag = !$tag;
|
||||
print '<tr '.$bc[$tag].'>';
|
||||
print '<td>'.dol_print_date($obj->dc,"dayhour").'</td>';
|
||||
print '<td align="center">'.$obj->remise_client.' %</td>';
|
||||
print '<td align="left">'.$obj->note.'</td>';
|
||||
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
print "</table>";
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
print "</td></tr>";
|
||||
print '</table>';
|
||||
print "</form>";
|
||||
|
||||
print "</div>\n";
|
||||
print '<br>';
|
||||
|
||||
|
||||
/*
|
||||
* Liste de l'historique des avoirs
|
||||
*/
|
||||
$sql = "SELECT rc.rowid,rc.remise_client,rc.note,".$db->pdate("rc.datec")." as dc,";
|
||||
$sql.= " u.login, u.rowid as user_id";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe_remise as rc, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE rc.fk_soc =". $objsoc->id;
|
||||
$sql.= " AND u.rowid = rc.fk_user_author";
|
||||
$sql.= " ORDER BY rc.datec DESC";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
$tag = !$tag;
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="160">'.$langs->trans("Date").'</td>';
|
||||
print '<td width="160" align="center">'.$langs->trans("CustomerRelativeDiscountShort").'</td>';
|
||||
print '<td align="left">'.$langs->trans("NoteReason").'</td>';
|
||||
print '<td align="center">'.$langs->trans("User").'</td>';
|
||||
print '</tr>';
|
||||
$i = 0 ;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ($i < $num )
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$tag = !$tag;
|
||||
print '<tr '.$bc[$tag].'>';
|
||||
print '<td>'.dol_print_date($obj->dc,"dayhour").'</td>';
|
||||
print '<td align="center">'.$obj->remise_client.' %</td>';
|
||||
print '<td align="left">'.$obj->note.'</td>';
|
||||
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
print "</table>";
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/comm/remx.php
|
||||
* \ingroup commercial, invoice
|
||||
* \ingroup societe
|
||||
* \brief Page to edit absolute discounts for a customer
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
@ -61,7 +61,7 @@ print '<table width="100%" class="notopnoleftnoright">';
|
||||
print '<tr><td valign="top" width="30%" class="notopnoleft">';
|
||||
|
||||
/*
|
||||
* Zone recherche
|
||||
* Search form
|
||||
*/
|
||||
$var=false;
|
||||
print '<table class="noborder" width="100%">';
|
||||
@ -69,7 +69,7 @@ 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="sf_ref" size=18></td><td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
|
||||
print $langs->trans("Ref").':</td><td><input type="text" class="flat" name="sref" size=18></td><td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
|
||||
print '<tr '.$bc[$var].'><td nowrap>'.$langs->trans("Other").':</td><td><input type="text" class="flat" name="sall" size="18"></td>';
|
||||
print '</tr>';
|
||||
print "</form></table><br>\n";
|
||||
@ -116,69 +116,6 @@ if ($conf->commande->enabled)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Orders to process
|
||||
*/
|
||||
if ($conf->commande->enabled)
|
||||
{
|
||||
$sql = "SELECT c.rowid, c.ref, s.nom, s.rowid as socid";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."commande 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";
|
||||
|
||||
if ( $db->query($sql) )
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans("OrdersToProcess").'</td></tr>';
|
||||
|
||||
$num = $db->num_rows();
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
$var = True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$var=!$var;
|
||||
$obj = $db->fetch_object();
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td nowrap="nowrap">';
|
||||
|
||||
$commandestatic->id=$obj->rowid;
|
||||
$commandestatic->ref=$obj->ref;
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td width="90" class="nobordernopadding" nowrap="nowrap">';
|
||||
print $commandestatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print '<td width="16" class="nobordernopadding" nowrap="nowrap">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
|
||||
print '<td width="16" align="right" class="nobordernopadding">';
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
|
||||
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
|
||||
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></tr>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
print "</table><br>";
|
||||
}
|
||||
}
|
||||
|
||||
print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
|
||||
|
||||
|
||||
@ -253,7 +190,76 @@ if ($resql)
|
||||
|
||||
|
||||
/*
|
||||
* Commandes en cours
|
||||
* Orders to process
|
||||
*/
|
||||
if ($conf->commande->enabled)
|
||||
{
|
||||
$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, s.nom, s.rowid as socid";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."commande 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";
|
||||
|
||||
if ( $db->query($sql) )
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
|
||||
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();
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td nowrap="nowrap">';
|
||||
|
||||
$commandestatic->id=$obj->rowid;
|
||||
$commandestatic->ref=$obj->ref;
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td width="90" class="nobordernopadding" nowrap="nowrap">';
|
||||
print $commandestatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print '<td width="16" class="nobordernopadding" nowrap="nowrap">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
|
||||
print '<td width="16" align="right" class="nobordernopadding">';
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
|
||||
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','','','',1);
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
||||
print "</table><br>";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Commandes en cours d'expedition
|
||||
*/
|
||||
if ($conf->commande->enabled)
|
||||
{
|
||||
@ -274,7 +280,7 @@ if ($conf->commande->enabled)
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">'.$langs->trans("OnProcessOrders").' <a href="'.DOL_URL_ROOT.'/commandes/liste.php?viewstatut=2">('.$num.')</a></td></tr>';
|
||||
print '<td colspan="3">'.$langs->trans("OnProcessOrders").' <a href="'.DOL_URL_ROOT.'/commande/liste.php?viewstatut=2">('.$num.')</a></td></tr>';
|
||||
|
||||
if ($num)
|
||||
{
|
||||
@ -309,7 +315,9 @@ if ($conf->commande->enabled)
|
||||
print '</td>';
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.'</a></td>';
|
||||
|
||||
print '<td align="right">'.$commandestatic->LibStatut($obj->fk_statut,$obj->facture,5).'</td>';
|
||||
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -113,10 +113,6 @@ if ($_GET['year'] > 0)
|
||||
{
|
||||
$sql.= " AND date_format(c.date_commande, '%Y') = $year";
|
||||
}
|
||||
if (strlen($_POST['sf_ref']) > 0)
|
||||
{
|
||||
$sql.= " AND c.ref like '%".addslashes($_POST['sf_ref']) . "%'";
|
||||
}
|
||||
if (!empty($snom))
|
||||
{
|
||||
$sql.= ' AND s.nom like \'%'.addslashes($snom).'%\'';
|
||||
|
||||
@ -210,22 +210,29 @@ class Contrat extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->statut == 0)
|
||||
{
|
||||
$result=$this->validate($user,$langs,$conf);
|
||||
if ($result < 0) $ok=false;
|
||||
}
|
||||
|
||||
if ($ok)
|
||||
{
|
||||
$this->db->commit();
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db,'Failed to update contrat_det');
|
||||
dol_print_error($db,'Error in cloture function');
|
||||
$this->db->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Valide un contrat
|
||||
* \param user Objet User qui valide
|
||||
* \param langs Environnement langue de l'utilisateur
|
||||
* \param conf Environnement de configuration lors de l'op<EFBFBD>ration
|
||||
* \brief Validate a contract
|
||||
* \param user Objet User
|
||||
* \param langs Environnement langue de l'utilisateur
|
||||
* \param conf Environnement de configuration lors de l'operation
|
||||
* \return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function validate($user,$langs,$conf)
|
||||
{
|
||||
@ -1072,8 +1079,8 @@ class Contrat extends CommonObject
|
||||
$text.=' '.$langs->trans("Services");
|
||||
$text.=': ';
|
||||
$text.=$this->nbofserviceswait.' '.$line->LibStatut(0,3).' ';
|
||||
$text.=$this->nbofservicesopened.' '.$line->LibStatut(4,3,false).' ';
|
||||
$text.=$this->nbofservicesexpired.' '.$line->LibStatut(4,3,true).' ';
|
||||
$text.=$this->nbofservicesopened.' '.$line->LibStatut(4,3,0).' ';
|
||||
$text.=$this->nbofservicesexpired.' '.$line->LibStatut(4,3,1).' ';
|
||||
$text.=$this->nbofservicesclosed.' '.$line->LibStatut(5,3);
|
||||
return $text;
|
||||
}
|
||||
@ -1417,60 +1424,66 @@ class ContratLigne
|
||||
*/
|
||||
function getLibStatut($mode)
|
||||
{
|
||||
return $this->LibStatut($this->statut,$mode,(isset($this->date_fin_validite) && $this->date_fin_validite < gmmktime()));
|
||||
return $this->LibStatut($this->statut,$mode,(isset($this->date_fin_validite)?($this->date_fin_validite < dol_now('tzref')?1:0):-1));
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Return label of a contract line status
|
||||
* \param statut id statut
|
||||
* \param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* \param expired true=Expired
|
||||
* \param expired 0=Not expired, 1=Expired, -1=Both or unknown
|
||||
* \return string Libelle
|
||||
*/
|
||||
function LibStatut($statut,$mode,$expired=false)
|
||||
function LibStatut($statut,$mode,$expired=-1)
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("contracts");
|
||||
if ($mode == 0)
|
||||
{
|
||||
if ($statut == 0) { return $langs->trans("ServiceStatusInitial"); }
|
||||
if ($statut == 4 && ! $expired) { return $langs->trans("ServiceStatusRunning"); }
|
||||
if ($statut == 4 && $expired) { return $langs->trans("ServiceStatusLate"); }
|
||||
if ($statut == 4 && $expired == -1) { return $langs->trans("ServiceStatusRunning"); }
|
||||
if ($statut == 4 && $expired == 0) { return $langs->trans("ServiceStatusNotLate"); }
|
||||
if ($statut == 4 && $expired == 1) { return $langs->trans("ServiceStatusLate"); }
|
||||
if ($statut == 5) { return $langs->trans("ServiceStatusClosed"); }
|
||||
}
|
||||
if ($mode == 1)
|
||||
{
|
||||
if ($statut == 0) { return $langs->trans("ServiceStatusInitial"); }
|
||||
if ($statut == 4 && ! $expired) { return $langs->trans("ServiceStatusRunning"); }
|
||||
if ($statut == 4 && $expired) { return $langs->trans("ServiceStatusLateShort"); }
|
||||
if ($statut == 4 && $expired == -1) { return $langs->trans("ServiceStatusRunning"); }
|
||||
if ($statut == 4 && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort"); }
|
||||
if ($statut == 4 && $expired == 1) { return $langs->trans("ServiceStatusLateShort"); }
|
||||
if ($statut == 5) { return $langs->trans("ServiceStatusClosed"); }
|
||||
}
|
||||
if ($mode == 2)
|
||||
{
|
||||
if ($statut == 0) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0').' '.$langs->trans("ServiceStatusInitial"); }
|
||||
if ($statut == 4 && ! $expired) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4').' '.$langs->trans("ServiceStatusRunning"); }
|
||||
if ($statut == 4 && $expired) { return img_picto($langs->trans('ServiceStatusLate'),'statut3').' '.$langs->trans("ServiceStatusLateShort"); }
|
||||
if ($statut == 4 && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4').' '.$langs->trans("ServiceStatusRunning"); }
|
||||
if ($statut == 4 && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4').' '.$langs->trans("ServiceStatusNotLateShort"); }
|
||||
if ($statut == 4 && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3').' '.$langs->trans("ServiceStatusLateShort"); }
|
||||
if ($statut == 5) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6') .' '.$langs->trans("ServiceStatusClosed"); }
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($statut == 0) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0'); }
|
||||
if ($statut == 4 && ! $expired) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4'); }
|
||||
if ($statut == 4 && $expired) { return img_picto($langs->trans('ServiceStatusLate'),'statut3'); }
|
||||
if ($statut == 4 && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4'); }
|
||||
if ($statut == 4 && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4'); }
|
||||
if ($statut == 4 && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3'); }
|
||||
if ($statut == 5) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6'); }
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($statut == 0) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0').' '.$langs->trans("ServiceStatusInitial"); }
|
||||
if ($statut == 4 && ! $expired) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4').' '.$langs->trans("ServiceStatusRunning"); }
|
||||
if ($statut == 4 && $expired) { return img_picto($langs->trans('ServiceStatusLate'),'statut3').' '.$langs->trans("ServiceStatusLate"); }
|
||||
if ($statut == 4 && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4').' '.$langs->trans("ServiceStatusRunning"); }
|
||||
if ($statut == 4 && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4').' '.$langs->trans("ServiceStatusNotLate"); }
|
||||
if ($statut == 4 && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3').' '.$langs->trans("ServiceStatusLate"); }
|
||||
if ($statut == 5) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6') .' '.$langs->trans("ServiceStatusClosed"); }
|
||||
}
|
||||
if ($mode == 5)
|
||||
{
|
||||
if ($statut == 0) { return $langs->trans("ServiceStatusInitial").' '.img_picto($langs->trans('ServiceStatusInitial'),'statut0'); }
|
||||
if ($statut == 4 && ! $expired) { return $langs->trans("ServiceStatusRunning").' '.img_picto($langs->trans('ServiceStatusRunning'),'statut4'); }
|
||||
if ($statut == 4 && $expired) { return $langs->trans("ServiceStatusLateShort").' '.img_picto($langs->trans('ServiceStatusLate'),'statut3'); }
|
||||
if ($statut == 4 && $expired == -1) { return $langs->trans("ServiceStatusRunning").' '.img_picto($langs->trans('ServiceStatusRunning'),'statut4'); }
|
||||
if ($statut == 4 && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort").' '.img_picto($langs->trans('ServiceStatusNotLateShort'),'statut4'); }
|
||||
if ($statut == 4 && $expired == 1) { return $langs->trans("ServiceStatusLateShort").' '.img_picto($langs->trans('ServiceStatusLate'),'statut3'); }
|
||||
if ($statut == 5) { return $langs->trans("ServiceStatusClosed").' '.img_picto($langs->trans('ServiceStatusClosed'),'statut6'); }
|
||||
}
|
||||
}
|
||||
|
||||
@ -367,6 +367,7 @@ if ($_REQUEST["action"] == 'confirm_valid' && $_REQUEST["confirm"] == 'yes' && $
|
||||
$result = $contrat->validate($user,$langs,$conf);
|
||||
}
|
||||
|
||||
// Close all lines
|
||||
if ($_REQUEST["action"] == 'confirm_close' && $_REQUEST["confirm"] == 'yes' && $user->rights->contrat->creer)
|
||||
{
|
||||
$contrat = new Contrat($db);
|
||||
@ -751,7 +752,7 @@ else
|
||||
echo '<br>';
|
||||
|
||||
$servicepos=(isset($_REQUEST["servicepos"])?$_REQUEST["servicepos"]:1);
|
||||
$colorb='333333';
|
||||
$colorb='666666';
|
||||
|
||||
$arrayothercontracts=$contrat->getListOfContracts('others');
|
||||
|
||||
@ -760,7 +761,7 @@ else
|
||||
*/
|
||||
|
||||
// Title line for service
|
||||
print '<table class="noborder" width="100%">'; // Array with (n*2)+1 lines
|
||||
print '<table class="notopnoleft" width="100%">'; // Array with (n*2)+1 lines
|
||||
$cursorline=1;
|
||||
while ($cursorline <= $nbofservices)
|
||||
{
|
||||
@ -771,7 +772,7 @@ else
|
||||
print '<td class="tab" style="border-right: 1px solid #'.$colorb.'; border-top: 1px solid #'.$colorb.'; border-bottom: 1px solid #'.$colorb.';" rowspan="2">';
|
||||
|
||||
// Area with common detail of line
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<table class="notopnoleft" width="100%">';
|
||||
|
||||
$sql = "SELECT cd.rowid, cd.statut, cd.label as label_det, cd.fk_product, cd.description, cd.price_ht, cd.qty,";
|
||||
$sql.= " cd.tva_tx, cd.remise_percent, cd.info_bits, cd.subprice,";
|
||||
@ -959,7 +960,7 @@ else
|
||||
if ($_REQUEST["action"] == 'deleteline' && ! $_REQUEST["cancel"] && $user->rights->contrat->creer && $contrat->lignes[$cursorline-1]->id == $_GET["rowid"])
|
||||
{
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$contrat->id."&lineid=".$_GET["rowid"],$langs->trans("DeleteContractLine"),$langs->trans("ConfirmDeleteContractLine"),"confirm_deleteline",'',0,1);
|
||||
if ($ret == 'html') print '<table class="noborder" width="100%"><tr '.$bc[false].' height="6"><td></td></tr></table>';
|
||||
if ($ret == 'html') print '<table class="notopnoleftnoright" width="100%"><tr '.$bc[false].' height="6"><td></td></tr></table>';
|
||||
}
|
||||
|
||||
/*
|
||||
@ -980,7 +981,7 @@ else
|
||||
array('type' => 'select', 'name' => 'newcid', 'values' => $arraycontractid));
|
||||
|
||||
$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$contrat->id."&lineid=".$_GET["rowid"],$langs->trans("MoveToAnotherContract"),$langs->trans("ConfirmMoveToAnotherContract"),"confirm_move",$formquestion);
|
||||
print '<table class="noborder" width="100%"><tr '.$bc[false].' height="6"><td></td></tr></table>';
|
||||
print '<table class="notopnoleftnoright" width="100%"><tr '.$bc[false].' height="6"><td></td></tr></table>';
|
||||
}
|
||||
|
||||
/*
|
||||
@ -993,7 +994,7 @@ else
|
||||
$dateactend = dol_mktime(12, 0 , 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]);
|
||||
$comment = $_POST["comment"];
|
||||
$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$contrat->id."&ligne=".$_GET["ligne"]."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment),$langs->trans("ActivateService"),$langs->trans("ConfirmActivateService",dol_print_date($dateactstart,"%A %d %B %Y")),"confirm_active", '', 0, 1);
|
||||
print '<table class="noborder" width="100%"><tr '.$bc[false].' height="6"><td></td></tr></table>';
|
||||
print '<table class="notopnoleftnoright" width="100%"><tr '.$bc[false].' height="6"><td></td></tr></table>';
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1006,14 +1007,14 @@ else
|
||||
$dateactend = dol_mktime(12, 0 , 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]);
|
||||
$comment = $_POST["comment"];
|
||||
$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$contrat->id."&ligne=".$_GET["ligne"]."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment), $langs->trans("CloseService"), $langs->trans("ConfirmCloseService",dol_print_date($dateactend,"%A %d %B %Y")), "confirm_closeline", '', 0, 1);
|
||||
print '<table class="noborder" width="100%"><tr '.$bc[false].' height="6"><td></td></tr></table>';
|
||||
print '<table class="notopnoleftnoright" width="100%"><tr '.$bc[false].' height="6"><td></td></tr></table>';
|
||||
}
|
||||
|
||||
|
||||
// Area with status and activation info of line
|
||||
if ($contrat->statut > 0)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<table class="notopnoleft" width="100%">';
|
||||
|
||||
print '<tr '.$bc[false].'>';
|
||||
print '<td>'.$langs->trans("ServiceStatus").': '.$contrat->lignes[$cursorline-1]->getLibStatut(4).'</td>';
|
||||
|
||||
@ -63,23 +63,10 @@ print '<table class="notopnoleftnoright" width="100%">';
|
||||
|
||||
print '<tr><td width="30%" valign="top" class="notopnoleft">';
|
||||
|
||||
// Legend
|
||||
$var=false;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("ServicesLegend").'</td></tr>';
|
||||
print '<tr '.$bc[$var].'><td nowrap>';
|
||||
print $staticcontratligne->LibStatut(0,4).'<br />';
|
||||
print $staticcontratligne->LibStatut(4,4,false).'<br />';
|
||||
print $staticcontratligne->LibStatut(4,4,true).'<br />';
|
||||
print $staticcontratligne->LibStatut(5,4).'<br />';
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
print "<br>";
|
||||
|
||||
// Search contract
|
||||
if ($conf->contrat->enabled)
|
||||
{
|
||||
$var=false;
|
||||
$var=false;
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/contrat/liste.php">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
@ -93,6 +80,86 @@ if ($conf->contrat->enabled)
|
||||
print "<br>";
|
||||
}
|
||||
|
||||
/*
|
||||
* Legends / Status
|
||||
*/
|
||||
$nb=array();
|
||||
// Search by status (except expired)
|
||||
$sql = "SELECT count(cd.rowid), cd.statut";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE cd.fk_contrat = c.rowid AND c.fk_soc = s.rowid";
|
||||
$sql.= " AND (cd.statut != 4 OR (cd.statut = 4 AND (cd.date_fin_validite is null or cd.date_fin_validite >= ".$db->idate(dol_now('tzref')).')))';
|
||||
$sql.= " AND s.entity = ".$conf->entity;
|
||||
if ($user->societe_id) $sql.=' AND c.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 cd.statut";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
$nb[$row[1]]=$row[0];
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
// Search by status (only expired)
|
||||
$sql = "SELECT count(cd.rowid), cd.statut";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE cd.fk_contrat = c.rowid AND c.fk_soc = s.rowid";
|
||||
$sql.= " AND (cd.statut = 4 AND cd.date_fin_validite < ".$db->idate(dol_now('tzref')).')';
|
||||
$sql.= " AND s.entity = ".$conf->entity;
|
||||
if ($user->societe_id) $sql.=' AND c.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 cd.statut";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
$nb[$row[1].true]=$row[0];
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Status").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Nb").'</td>';
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
$listofstatus=array(0,4,4,5); $bool=false;
|
||||
foreach($listofstatus as $status)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td>'.$staticcontratligne->LibStatut($status,0,($bool?1:0)).'</td>';
|
||||
print '<td align="right"><a href="services.php?mode='.$status.($bool?'&filter=expired':'').'">'.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).'</a></td>';
|
||||
if ($status==4 && $bool==false) $bool=true;
|
||||
else $bool=false;
|
||||
}
|
||||
print "</tr>\n";
|
||||
print "</table><br>";
|
||||
|
||||
/**
|
||||
* Draft contratcs
|
||||
*/
|
||||
@ -186,52 +253,52 @@ dol_syslog("contrat/index.php sql=".$sql, LOG_DEBUG);
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("LastContracts",5).'</td>';
|
||||
print '<td align="center">'.$langs->trans("DateModification").'</td>';
|
||||
//print '<td align="left">'.$langs->trans("Status").'</td>';
|
||||
print '<td align="right" width="80" colspan="4">'.$langs->trans("Services").'</td>';
|
||||
print "</tr>\n";
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("LastContracts",5).'</td>';
|
||||
print '<td align="center">'.$langs->trans("DateModification").'</td>';
|
||||
//print '<td align="left">'.$langs->trans("Status").'</td>';
|
||||
print '<td align="right" width="80" colspan="4">'.$langs->trans("Services").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td width="80" nowrap="nowrap">';
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td width="80" nowrap="nowrap">';
|
||||
$staticcontrat->ref=($obj->ref?$obj->ref:$obj->cid);
|
||||
$staticcontrat->id=$obj->cid;
|
||||
print $staticcontrat->getNomUrl(1,16);
|
||||
if ($obj->nb_late) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($obj->nb_late) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$staticcompany->id=$obj->socid;
|
||||
$staticcompany->nom=$obj->nom;
|
||||
print $staticcompany->getNomUrl(1,'',20);
|
||||
print '</td>';
|
||||
print '<td align="center">'.dol_print_date($obj->tms,'dayhour').'</td>';
|
||||
//print '<td align="left">'.$staticcontrat->LibStatut($obj->statut,2).'</td>';
|
||||
print '<td align="right" width="32">'.($obj->nb_initial>0 ? $obj->nb_initial.$staticcontratligne->LibStatut(0,3):'').'</td>';
|
||||
print '<td align="right" width="32">'.($obj->nb_running>0 ? $obj->nb_running.$staticcontratligne->LibStatut(4,3,false):'').'</td>';
|
||||
print '<td align="right" width="32">'.($obj->nb_expired>0 ? $obj->nb_expired.$staticcontratligne->LibStatut(4,3,true):'').'</td>';
|
||||
print '<td align="right" width="32">'.($obj->nb_closed>0 ? $obj->nb_closed.$staticcontratligne->LibStatut(5,3):'').'</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free($result);
|
||||
print '<td align="center">'.dol_print_date($obj->tms,'dayhour').'</td>';
|
||||
//print '<td align="left">'.$staticcontrat->LibStatut($obj->statut,2).'</td>';
|
||||
print '<td align="right" width="32">'.($obj->nb_initial>0 ? $obj->nb_initial.$staticcontratligne->LibStatut(0,3):'').'</td>';
|
||||
print '<td align="right" width="32">'.($obj->nb_running>0 ? $obj->nb_running.$staticcontratligne->LibStatut(4,3,0):'').'</td>';
|
||||
print '<td align="right" width="32">'.($obj->nb_expired>0 ? $obj->nb_expired.$staticcontratligne->LibStatut(4,3,1):'').'</td>';
|
||||
print '<td align="right" width="32">'.($obj->nb_closed>0 ? $obj->nb_closed.$staticcontratligne->LibStatut(5,3):'').'</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free($result);
|
||||
|
||||
print "</table>";
|
||||
print "</table>";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
@ -254,49 +321,49 @@ $sql.= " ORDER BY cd.tms DESC";
|
||||
|
||||
if ( $db->query($sql) )
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
$num = $db->num_rows();
|
||||
$i = 0;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("NotActivatedServices").'</td>';
|
||||
print "</tr>\n";
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("NotActivatedServices").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object();
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td width="80" nowrap="nowrap">';
|
||||
print '<td width="80" nowrap="nowrap">';
|
||||
$staticcontrat->ref=($obj->ref?$obj->ref:$obj->fk_contrat);
|
||||
$staticcontrat->id=$obj->fk_contrat;
|
||||
print $staticcontrat->getNomUrl(1,16);
|
||||
print '</td>';
|
||||
print '<td nowrap="1">';
|
||||
print '<td nowrap="1">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$obj->fk_contrat.'">'.img_object($langs->trans("ShowService"),"service");
|
||||
if ($obj->label) print ' '.dol_trunc($obj->label,20).'</a></td>';
|
||||
else print '</a> '.dol_trunc($obj->note,20).'</td>';
|
||||
print '<td>';
|
||||
if ($obj->label) print ' '.dol_trunc($obj->label,20).'</a></td>';
|
||||
else print '</a> '.dol_trunc($obj->note,20).'</td>';
|
||||
print '<td>';
|
||||
$staticcompany->id=$obj->fk_soc;
|
||||
$staticcompany->nom=$obj->nom;
|
||||
print $staticcompany->getNomUrl(1,'',20);
|
||||
print '</td>';
|
||||
print '<td width="16" align="right"><a href="ligne.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
|
||||
print $staticcontratligne->LibStatut($obj->statut,3);
|
||||
print '</a></td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
print '<td width="16" align="right"><a href="ligne.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
|
||||
print $staticcontratligne->LibStatut($obj->statut,3);
|
||||
print '</a></td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
|
||||
print "</table>";
|
||||
print "</table>";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
@ -321,49 +388,49 @@ $sql.= " ORDER BY cd.tms DESC";
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("LastModifiedServices",min($num,$max)).'</td>';
|
||||
print "</tr>\n";
|
||||
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("LastModifiedServices",min($num,$max)).'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var=True;
|
||||
while ($i < min($num,$max))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td width="80" nowrap="nowrap">';
|
||||
$var=True;
|
||||
while ($i < min($num,$max))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td width="80" nowrap="nowrap">';
|
||||
$staticcontrat->ref=($obj->ref?$obj->ref:$obj->fk_contrat);
|
||||
$staticcontrat->id=$obj->fk_contrat;
|
||||
print $staticcontrat->getNomUrl(1,16);
|
||||
//if (1 == 1) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$obj->fk_contrat.'">'.img_object($langs->trans("ShowService"),"service");
|
||||
if ($obj->label) print ' '.dol_trunc($obj->label,20).'</a></td>';
|
||||
else print '</a> '.dol_trunc($obj->note,20).'</td>';
|
||||
print '<td>';
|
||||
//if (1 == 1) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$obj->fk_contrat.'">'.img_object($langs->trans("ShowService"),"service");
|
||||
if ($obj->label) print ' '.dol_trunc($obj->label,20).'</a></td>';
|
||||
else print '</a> '.dol_trunc($obj->note,20).'</td>';
|
||||
print '<td>';
|
||||
$staticcompany->id=$obj->fk_soc;
|
||||
$staticcompany->nom=$obj->nom;
|
||||
print $staticcompany->getNomUrl(1,'',20);
|
||||
print '</td>';
|
||||
print '<td nowrap="nowrap" align="right"><a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
|
||||
$dateend=$db->jdate($obj->date_fin_validite);
|
||||
print $staticcontratligne->LibStatut($obj->statut, 3, ($dateend && $dateend < $now));
|
||||
print '</a></td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
print '<td nowrap="nowrap" align="right"><a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
|
||||
$dateend=$db->jdate($obj->date_fin_validite);
|
||||
print $staticcontratligne->LibStatut($obj->statut, 3, ($dateend && $dateend < $now)?1:0);
|
||||
print '</a></td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
|
||||
print "</table>";
|
||||
print "</table>";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '</td></tr></table>';
|
||||
|
||||
@ -107,8 +107,8 @@ if ($resql)
|
||||
print_liste_field_titre($langs->trans("DateContract"), $_SERVER["PHP_SELF"], "c.date_contrat","","$param",'align="center"',$sortfield,$sortorder);
|
||||
//print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"], "c.statut","","$param",'align="center"',$sortfield,$sortorder);
|
||||
print '<td class="liste_titre" width="16">'.$staticcontratligne->LibStatut(0,3).'</td>';
|
||||
print '<td class="liste_titre" width="16">'.$staticcontratligne->LibStatut(4,3,false).'</td>';
|
||||
print '<td class="liste_titre" width="16">'.$staticcontratligne->LibStatut(4,3,true).'</td>';
|
||||
print '<td class="liste_titre" width="16">'.$staticcontratligne->LibStatut(4,3,0).'</td>';
|
||||
print '<td class="liste_titre" width="16">'.$staticcontratligne->LibStatut(4,3,1).'</td>';
|
||||
print '<td class="liste_titre" width="16">'.$staticcontratligne->LibStatut(5,3).'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@ -19,11 +19,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/contrat/services.php
|
||||
\ingroup contrat
|
||||
\brief Page liste des contrats en service
|
||||
\version $Id$
|
||||
*/
|
||||
* \file htdocs/contrat/services.php
|
||||
* \ingroup contrat
|
||||
* \brief Page liste des contrats en service
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once (DOL_DOCUMENT_ROOT."/contrat/contrat.class.php");
|
||||
@ -64,7 +64,7 @@ $companystatic=new Societe($db);
|
||||
* View
|
||||
*/
|
||||
|
||||
$now=gmmktime();
|
||||
$now=dol_now('tzref');
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
@ -91,7 +91,7 @@ if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc
|
||||
if ($mode == "0") $sql.= " AND cd.statut = 0";
|
||||
if ($mode == "4") $sql.= " AND cd.statut = 4";
|
||||
if ($mode == "5") $sql.= " AND cd.statut = 5";
|
||||
if ($filter == "expired") $sql.= " AND date_fin_validite < ".$db->idate(mktime());
|
||||
if ($filter == "expired") $sql.= " AND date_fin_validite < ".$now;
|
||||
if ($search_nom) $sql.= " AND s.nom like '%".addslashes($search_nom)."%'";
|
||||
if ($search_contract) $sql.= " AND c.rowid = '".addslashes($search_contract)."'";
|
||||
if ($search_service) $sql.= " AND (p.ref like '%".addslashes($search_service)."%' OR p.description like '%".addslashes($search_service)."%')";
|
||||
@ -108,143 +108,143 @@ dol_syslog("contrat/services.php sql=".$sql);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$param='';
|
||||
if ($search_contract) $param.='&search_contract='.urlencode($search_contract);
|
||||
if ($search_nom) $param.='&search_nom='.urlencode($search_nom);
|
||||
if ($search_service) $param.='&search_service='.urlencode($search_service);
|
||||
if ($mode) $param.='&mode='.$mode;
|
||||
if ($filter) $param.='&filter='.$filter;
|
||||
if (! empty($_REQUEST['filter_op1']) && $_REQUEST['filter_op1'] != -1) $param.='&filter_op1='.urlencode($_REQUEST['filter_op1']);
|
||||
if (! empty($_REQUEST['filter_op2']) && $_REQUEST['filter_op2'] != -1) $param.='&filter_op2='.urlencode($_REQUEST['filter_op2']);
|
||||
if ($filter_date1 != '') $param.='&op1day='.$_REQUEST['op1day'].'&op1month='.$_REQUEST['op1month'].'&op1year='.$_REQUEST['op1year'];
|
||||
if ($filter_date2 != '') $param.='&op2day='.$_REQUEST['op2day'].'&op2month='.$_REQUEST['op2month'].'&op2year='.$_REQUEST['op2year'];
|
||||
$param='';
|
||||
if ($search_contract) $param.='&search_contract='.urlencode($search_contract);
|
||||
if ($search_nom) $param.='&search_nom='.urlencode($search_nom);
|
||||
if ($search_service) $param.='&search_service='.urlencode($search_service);
|
||||
if ($mode) $param.='&mode='.$mode;
|
||||
if ($filter) $param.='&filter='.$filter;
|
||||
if (! empty($_REQUEST['filter_op1']) && $_REQUEST['filter_op1'] != -1) $param.='&filter_op1='.urlencode($_REQUEST['filter_op1']);
|
||||
if (! empty($_REQUEST['filter_op2']) && $_REQUEST['filter_op2'] != -1) $param.='&filter_op2='.urlencode($_REQUEST['filter_op2']);
|
||||
if ($filter_date1 != '') $param.='&op1day='.$_REQUEST['op1day'].'&op1month='.$_REQUEST['op1month'].'&op1year='.$_REQUEST['op1year'];
|
||||
if ($filter_date2 != '') $param.='&op2day='.$_REQUEST['op2day'].'&op2month='.$_REQUEST['op2month'].'&op2year='.$_REQUEST['op2year'];
|
||||
|
||||
print_barre_liste($langs->trans("ListOfServices"), $page, "services.php", $param, $sortfield, $sortorder,'',$num);
|
||||
print_barre_liste($langs->trans("ListOfServices"), $page, "services.php", $param, $sortfield, $sortorder,'',$num);
|
||||
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<table class="liste" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Contract"),"services.php", "c.rowid",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Service"),"services.php", "p.description",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Company"),"services.php", "s.nom",$param,"","",$sortfield,$sortorder);
|
||||
// Date debut
|
||||
if ($mode == "0") print_liste_field_titre($langs->trans("DateStartPlannedShort"),"services.php", "cd.date_ouverture_prevue",$param,'',' align="center"',$sortfield,$sortorder);
|
||||
if ($mode == "" || $mode > 0) print_liste_field_titre($langs->trans("DateStartRealShort"),"services.php", "cd.date_ouverture",$param,'',' align="center"',$sortfield,$sortorder);
|
||||
// Date fin
|
||||
if ($mode == "" || $mode < 5) print_liste_field_titre($langs->trans("DateEndPlannedShort"),"services.php", "cd.date_fin_validite",$param,'',' align="center"',$sortfield,$sortorder);
|
||||
else print_liste_field_titre($langs->trans("DateEndRealShort"),"services.php", "cd.date_cloture",$param,'',' align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),"services.php", "cd.statut,c.statut",$param,"","align=\"right\"",$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Contract"),"services.php", "c.rowid",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Service"),"services.php", "p.description",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Company"),"services.php", "s.nom",$param,"","",$sortfield,$sortorder);
|
||||
// Date debut
|
||||
if ($mode == "0") print_liste_field_titre($langs->trans("DateStartPlannedShort"),"services.php", "cd.date_ouverture_prevue",$param,'',' align="center"',$sortfield,$sortorder);
|
||||
if ($mode == "" || $mode > 0) print_liste_field_titre($langs->trans("DateStartRealShort"),"services.php", "cd.date_ouverture",$param,'',' align="center"',$sortfield,$sortorder);
|
||||
// Date fin
|
||||
if ($mode == "" || $mode < 5) print_liste_field_titre($langs->trans("DateEndPlannedShort"),"services.php", "cd.date_fin_validite",$param,'',' align="center"',$sortfield,$sortorder);
|
||||
else print_liste_field_titre($langs->trans("DateEndRealShort"),"services.php", "cd.date_cloture",$param,'',' align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),"services.php", "cd.statut,c.statut",$param,"","align=\"right\"",$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
print '<form method="POST" action="services.php">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="hidden" name="filter" value="'.$filter.'">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
print '<input type="text" class="flat" size="3" name="search_contract" value="'.stripslashes($search_contract).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="18" name="search_service" value="'.stripslashes($search_service).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="24" name="search_nom" value="'.stripslashes($search_nom).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$arrayofoperators=array('<'=>'<','>'=>'>');
|
||||
print '<form method="POST" action="services.php">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="hidden" name="filter" value="'.$filter.'">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
print '<input type="text" class="flat" size="3" name="search_contract" value="'.stripslashes($search_contract).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="18" name="search_service" value="'.stripslashes($search_service).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="24" name="search_nom" value="'.stripslashes($search_nom).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$arrayofoperators=array('<'=>'<','>'=>'>');
|
||||
print $form->select_array('filter_op1',$arrayofoperators,$_REQUEST['filter_op1'],1);
|
||||
print ' ';
|
||||
$filter_date1=dol_mktime(0,0,0,$_REQUEST['op1month'],$_REQUEST['op1day'],$_REQUEST['"op1year']);
|
||||
print $form->select_date($filter_date1,'op1',0,0,1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$arrayofoperators=array('<'=>'<','>'=>'>');
|
||||
print $form->select_array('filter_op2',$arrayofoperators,$_REQUEST['filter_op2'],1);
|
||||
print ' ';
|
||||
$filter_date2=dol_mktime(0,0,0,$_REQUEST['op2month'],$_REQUEST['op2day'],$_REQUEST['op2year']);
|
||||
print $form->select_date($filter_date2,'op2',0,0,1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
print '</form>';
|
||||
print ' ';
|
||||
$filter_date1=dol_mktime(0,0,0,$_REQUEST['op1month'],$_REQUEST['op1day'],$_REQUEST['"op1year']);
|
||||
print $form->select_date($filter_date1,'op1',0,0,1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$arrayofoperators=array('<'=>'<','>'=>'>');
|
||||
print $form->select_array('filter_op2',$arrayofoperators,$_REQUEST['filter_op2'],1);
|
||||
print ' ';
|
||||
$filter_date2=dol_mktime(0,0,0,$_REQUEST['op2month'],$_REQUEST['op2day'],$_REQUEST['op2year']);
|
||||
print $form->select_date($filter_date2,'op2',0,0,1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
print '</form>';
|
||||
|
||||
$var=True;
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td>';
|
||||
$contractstatic=new Contrat($db);
|
||||
$contractstatic->id=$obj->cid;
|
||||
$contractstatic->ref=$obj->ref?$obj->ref:$obj->cid;
|
||||
print $contractstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
$var=True;
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td>';
|
||||
$contractstatic=new Contrat($db);
|
||||
$contractstatic->id=$obj->cid;
|
||||
$contractstatic->ref=$obj->ref?$obj->ref:$obj->cid;
|
||||
print $contractstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
// Service
|
||||
print '<td>';
|
||||
if ($obj->pid)
|
||||
{
|
||||
print '<a href="../product/fiche.php?id='.$obj->pid.'">'.img_object($langs->trans("ShowService"),"service").' '.dol_trunc($obj->label,20).'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print dol_trunc($obj->description,20);
|
||||
}
|
||||
print '</td>';
|
||||
// Service
|
||||
print '<td>';
|
||||
if ($obj->pid)
|
||||
{
|
||||
print '<a href="../product/fiche.php?id='.$obj->pid.'">'.img_object($langs->trans("ShowService"),"service").' '.dol_trunc($obj->label,20).'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print dol_trunc($obj->description,20);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Third party
|
||||
print '<td>';
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->nom=$obj->nom;
|
||||
$companystatic->client=1;
|
||||
// Third party
|
||||
print '<td>';
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->nom=$obj->nom;
|
||||
$companystatic->client=1;
|
||||
print $companystatic->getNomUrl(1,'customer',32);
|
||||
print '</td>';
|
||||
|
||||
// Start date
|
||||
if ($mode == "0") {
|
||||
print '<td align="center">';
|
||||
print ($obj->date_ouverture_prevue?dol_print_date($obj->date_ouverture_prevue):' ');
|
||||
if ($obj->date_ouverture_prevue && ($obj->date_ouverture_prevue < ($now - $conf->contrat->services->inactifs->warning_delay)))
|
||||
print img_picto($langs->trans("Late"),"warning");
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
if ($mode == "" || $mode > 0) print '<td align="center">'.($obj->date_ouverture?dol_print_date($obj->date_ouverture):' ').'</td>';
|
||||
// Date fin
|
||||
if ($mode == "" || $mode < 5) print '<td align="center">'.($obj->date_fin_validite?dol_print_date($obj->date_fin_validite):' ');
|
||||
else print '<td align="center">'.dol_print_date($obj->date_cloture);
|
||||
// Icone warning
|
||||
if ($obj->date_fin_validite && $obj->date_fin_validite < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5) print img_warning($langs->trans("Late"));
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
print '<td align="right" nowrap="nowrap">';
|
||||
if ($obj->cstatut == 0)
|
||||
{
|
||||
print $contractstatic->LibStatut(0,5,($obj->date_fin_validite && $obj->date_fin_validite < $now));
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$obj->cid.'&line='.$obj->rowid.'">';
|
||||
print $staticcontratligne->LibStatut($obj->statut,5,($obj->date_fin_validite && $obj->date_fin_validite < $now));
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
// Start date
|
||||
if ($mode == "0") {
|
||||
print '<td align="center">';
|
||||
print ($obj->date_ouverture_prevue?dol_print_date($obj->date_ouverture_prevue):' ');
|
||||
if ($obj->date_ouverture_prevue && ($obj->date_ouverture_prevue < ($now - $conf->contrat->services->inactifs->warning_delay)))
|
||||
print img_picto($langs->trans("Late"),"warning");
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
if ($mode == "" || $mode > 0) print '<td align="center">'.($obj->date_ouverture?dol_print_date($obj->date_ouverture):' ').'</td>';
|
||||
// Date fin
|
||||
if ($mode == "" || $mode < 5) print '<td align="center">'.($obj->date_fin_validite?dol_print_date($obj->date_fin_validite):' ');
|
||||
else print '<td align="center">'.dol_print_date($obj->date_cloture);
|
||||
// Icone warning
|
||||
if ($obj->date_fin_validite && $obj->date_fin_validite < ($now - $conf->contrat->services->expires->warning_delay) && $obj->statut < 5) print img_warning($langs->trans("Late"));
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
print '<td align="right" nowrap="nowrap">';
|
||||
if ($obj->cstatut == 0)
|
||||
{
|
||||
print $contractstatic->LibStatut(0,5,($obj->date_fin_validite && $obj->date_fin_validite < $now));
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/contrat/fiche.php?id='.$obj->cid.'&line='.$obj->rowid.'">';
|
||||
print $staticcontratligne->LibStatut($obj->statut,5,($obj->date_fin_validite && $obj->date_fin_validite < $now)?1:0);
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
print "</table>";
|
||||
print "</table>";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -48,6 +48,26 @@ print_barre_liste($langs->trans("SuppliersOrdersArea"), $page, "index.php", "",
|
||||
print '<table class="notopnoleftnoright" width="100%">';
|
||||
print '<tr valign="top"><td class="notopnoleft" width="30%">';
|
||||
|
||||
|
||||
/*
|
||||
* Search form
|
||||
*/
|
||||
$var=false;
|
||||
print '<table class="noborder" width="100%">';
|
||||
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>';
|
||||
print '<tr '.$bc[$var].'><td nowrap>'.$langs->trans("Other").':</td><td><input type="text" class="flat" name="search_all" size="18"></td>';
|
||||
print '</tr>';
|
||||
print "</form></table><br>\n";
|
||||
|
||||
|
||||
/*
|
||||
* Legends / Status
|
||||
*/
|
||||
|
||||
$sql = "SELECT count(cf.rowid), fk_statut";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as cf";
|
||||
@ -63,9 +83,9 @@ if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
|
||||
print '<table class="liste" width="100%">';
|
||||
|
||||
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Status").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Nb").'</td>';
|
||||
print "</tr>\n";
|
||||
@ -83,14 +103,55 @@ if ($resql)
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
print "</table><br>";
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
/*
|
||||
* Commandes brouillons
|
||||
*/
|
||||
if ($conf->fournisseur->enabled)
|
||||
{
|
||||
$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";
|
||||
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;
|
||||
|
||||
if ( $db->query($sql) )
|
||||
{
|
||||
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();
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
$var = True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$var=!$var;
|
||||
$obj = $db->fetch_object();
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td nowrap="nowrap">';
|
||||
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.'/comm/fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->nom,24).'</a></td></tr>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print '</td><td width="70%" valign="top" class="notopnoleft">';
|
||||
|
||||
@ -112,7 +173,7 @@ if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("UserWithApproveOrderGrant").'</td>';
|
||||
print "</tr>\n";
|
||||
@ -136,7 +197,7 @@ if ($resql)
|
||||
print "</table>";
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
/**
|
||||
\file htdocs/fourn/commande/liste.php
|
||||
\ingroup fournisseur
|
||||
\brief Liste des commandes fournisseurs
|
||||
@ -29,6 +29,10 @@ require("./pre.inc.php");
|
||||
|
||||
$langs->load("orders");
|
||||
|
||||
$sref=isset($_GET['search_ref'])?$_GET['search_ref']:$_POST['search_ref'];
|
||||
$snom=isset($_GET['search_nom'])?$_GET['search_nom']:$_POST['search_nom'];
|
||||
$sall=isset($_GET['search_all'])?$_GET['search_all']:$_POST['search_all'];
|
||||
|
||||
$page = ( is_numeric($_GET["page"]) ? $_GET["page"] : 0 );
|
||||
$socid = ( is_numeric($_GET["socid"]) ? $_GET["socid"] : 0 );
|
||||
$sortorder = $_GET["sortorder"];
|
||||
@ -74,6 +78,18 @@ if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX
|
||||
$sql.= " WHERE cf.fk_soc = s.rowid ";
|
||||
$sql.= " AND s.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($sref)
|
||||
{
|
||||
$sql.= " AND cf.ref like '%".addslashes($sref)."%'";
|
||||
}
|
||||
if ($snom)
|
||||
{
|
||||
$sql.= " AND s.nom like '%".addslashes($snom)."%'";
|
||||
}
|
||||
if ($sall)
|
||||
{
|
||||
$sql.= " AND (cf.ref like '%".addslashes($sall)."%' OR cf.note like '%".addslashes($sall)."%')";
|
||||
}
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
|
||||
if (strlen($_GET["statut"]))
|
||||
@ -81,22 +97,12 @@ if (strlen($_GET["statut"]))
|
||||
$sql .= " AND fk_statut =".$_GET["statut"];
|
||||
}
|
||||
|
||||
if (strlen($_GET["search_ref"]))
|
||||
{
|
||||
$sql .= " AND cf.ref LIKE '%".$_GET["search_ref"]."%'";
|
||||
}
|
||||
|
||||
if (strlen($_GET["search_nom"]))
|
||||
{
|
||||
$sql .= " AND s.nom LIKE '%".$_GET["search_nom"]."%'";
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
@ -113,8 +119,8 @@ if ($resql)
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
print '<td><input type="text" class="flat" name="search_ref" value="'.$_GET["search_ref"].'"></td>';
|
||||
print '<td><input type="text" class="flat" name="search_nom" value="'.$_GET["search_nom"].'"></td>';
|
||||
print '<td><input type="text" class="flat" name="search_ref" value="'.$sref.'"></td>';
|
||||
print '<td><input type="text" class="flat" name="search_nom" value="'.$snom.'"></td>';
|
||||
print '<td colspan="2" class="liste_titre" align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
|
||||
print '</td>';
|
||||
@ -132,7 +138,7 @@ if ($resql)
|
||||
// Ref
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/fourn/commande/fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowOrder"),"order").' '.$obj->ref.'</a></td>'."\n";
|
||||
|
||||
// Société
|
||||
// Soci<EFBFBD>t<EFBFBD>
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/fourn/fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' ';
|
||||
print $obj->nom.'</a></td>'."\n";
|
||||
|
||||
|
||||
@ -1568,7 +1568,7 @@ class Form
|
||||
if ($formquestion)
|
||||
{
|
||||
$more.='<tr class="valid"><td class="valid" colspan="3">';
|
||||
$more.='<table class="notopnoleftnoright" width="100%">';
|
||||
$more.='<table class="nobordernopadding" width="100%">';
|
||||
$more.='<tr><td colspan="3" valign="top">'.$formquestion['text'].'</td></tr>';
|
||||
foreach ($formquestion as $key => $input)
|
||||
{
|
||||
@ -1691,7 +1691,7 @@ class Form
|
||||
print '<form method="post" action="'.$page.'">';
|
||||
print '<input type="hidden" name="action" value="classin">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="noborder" cellpadding="0" cellspacing="0">';
|
||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
select_projects($socid,$selected,$htmlname);
|
||||
print '</td>';
|
||||
@ -1726,7 +1726,7 @@ class Form
|
||||
print '<form method="post" action="'.$page.'">';
|
||||
print '<input type="hidden" name="action" value="setconditions">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="noborder" cellpadding="0" cellspacing="0">';
|
||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
$this->select_conditions_paiements($selected,$htmlname,-1,$addempty);
|
||||
print '</td>';
|
||||
@ -1761,7 +1761,7 @@ class Form
|
||||
print '<form method="post" action="'.$page.'" name="form'.$htmlname.'">';
|
||||
print '<input type="hidden" name="action" value="set'.$htmlname.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="noborder" cellpadding="0" cellspacing="0">';
|
||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
print $this->select_date($selected,$htmlname,0,0,1,'form'.$htmlname);
|
||||
print '</td>';
|
||||
@ -1795,7 +1795,7 @@ class Form
|
||||
print '<form method="post" action="'.$page.'">';
|
||||
print '<input type="hidden" name="action" value="setmode">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="noborder" cellpadding="0" cellspacing="0">';
|
||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
$this->select_types_paiements($selected,$htmlname);
|
||||
print '</td>';
|
||||
@ -1881,7 +1881,7 @@ class Form
|
||||
print '<form method="post" action="'.$page.'">';
|
||||
print '<input type="hidden" name="action" value="set_contact">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="noborder" cellpadding="0" cellspacing="0">';
|
||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
$num=$this->select_contacts($societe->id, $selected, $htmlname);
|
||||
if ($num==0)
|
||||
@ -1925,7 +1925,7 @@ class Form
|
||||
print '<form method="post" action="'.$page.'">';
|
||||
print '<input type="hidden" name="action" value="setdeliveryadress">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="noborder" cellpadding="0" cellspacing="0">';
|
||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
$this->select_adresse_livraison($selected, $socid, $htmlname, 1);
|
||||
print '</td>';
|
||||
|
||||
@ -13,6 +13,8 @@ ContractStatusValidated=Validated
|
||||
ContractStatusClosed=Closed
|
||||
ServiceStatusInitial=Not running
|
||||
ServiceStatusRunning=Running
|
||||
ServiceStatusNotLate=Running, not expired
|
||||
ServiceStatusNotLateShort=Not expired
|
||||
ServiceStatusLate=Running, expired
|
||||
ServiceStatusLateShort=Expired
|
||||
ServiceStatusClosed=Closed
|
||||
|
||||
@ -13,6 +13,8 @@ ContractStatusValidated=Validé
|
||||
ContractStatusClosed=Clôturé
|
||||
ServiceStatusInitial=Inactif
|
||||
ServiceStatusRunning=En service
|
||||
ServiceStatusNotLate=En service, non expiré
|
||||
ServiceStatusNotLateShort=Non expiré
|
||||
ServiceStatusLate=En service, expiré
|
||||
ServiceStatusLateShort=Expiré
|
||||
ServiceStatusClosed=Fermé
|
||||
|
||||
Loading…
Reference in New Issue
Block a user