*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*
*/
require("./pre.inc.php");
llxHeader("","Téléphonie - Contrat");
/* Affichage */
if ($_GET["id"])
{
$client_comm = new Societe($db);
$contrat = new TelephonieContrat($db);
if ($contrat->fetch($_GET["id"]) == 0)
{
$result = 1;
}
$client_comm->fetch($contrat->client_comm_id, $user);
if (!$client_comm->perm_read)
{
print "Lecture non authorisée";
}
if ( $result && $client_comm->perm_read)
{
if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
{
$h=0;
$head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/fiche.php?id=".$contrat->id;
$head[$h][1] = $langs->trans("Contrat");
$h++;
$nser = $contrat->count_associated_services();
$head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/services.php?id=".$contrat->id;
if ($nser > 0)
{
$head[$h][1] = $langs->trans("Services")." (".$nser.")";
}
else
{
$head[$h][1] = $langs->trans("Services");
}
$h++;
$head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/stats.php?id=".$contrat->id;
$head[$h][1] = $langs->trans("Stats");
$hselected = $h;
$h++;
$head[$h][0] = DOL_URL_ROOT."/telephonie/contrat/info.php?id=".$contrat->id;
$head[$h][1] = $langs->trans("Infos");
$h++;
dolibarr_fiche_head($head, $hselected, 'Contrat : '.$contrat->ref);
print_fiche_titre('Fiche Contrat', $mesg);
print '
';
$client_comm = new Societe($db, $contrat->client_comm_id);
$client_comm->fetch($contrat->client_comm_id);
print '| Référence | '.$contrat->ref.' | ';
print 'Facturé : '.$contrat->facturable.' |
';
print '| Client | ';
print '';
print $client_comm->nom.' | '.$client_comm->code_client;
print ' |
';
$commercial = new User($db, $contrat->commercial_sign_id);
$commercial->fetch();
$commercial_suiv = new User($db, $contrat->commercial_suiv_id);
$commercial_suiv->fetch();
print '| Commercial Suivi/Signature | ';
print ''.$commercial_suiv->fullname.'/'.$commercial->fullname.' |
';
print "
";
print '';
print '';
$mesg_no_graph = 'Nous avons pas assez de données à ce jour pour générer ce graphique.';
$img_root = DOL_DATA_ROOT."/graph/".substr($contrat->id,-1)."/telephonie/contrat/";
$file = $img_root.$contrat->id."/graphca.png";
if (file_exists($file))
{
print ' ';
//print ' ';
}
else
{
print $mesg_no_graph;
}
print ' | ';
$file = $img_root.$contrat->id."/graphgain.png";
if (file_exists($file) && $user->rights->telephonie->ligne->gain)
{
print ' ';
}
else
{
print $mesg_no_graph;
}
print ' |
';
print '';
$file = $img_root.$contrat->id."/graphappelsdureemoyenne.png";
if (file_exists($file))
{
print ' ';
}
else
{
print $mesg_no_graph;
}
print ' | ';
print " ";
print ' |
';
print '';
$file = $img_root.$contrat->id."/nb-comm-mensuel.png";
if (file_exists($file))
{
print ' ';
}
else
{
print $mesg_no_graph;
}
print ' | ';
$file = $img_root.$contrat->id."/nb-minutes-mensuel.png";
if (file_exists($file))
{
print ' ';
}
else
{
print $mesg_no_graph;
}
print ' |
';
}
}
}
else
{
print "Erreur";
}
print '';
$db->close();
llxFooter("Dernière modification $Date$ révision $Revision$");
?>