Ajout date de dernire communication

This commit is contained in:
Rodolphe Quiedeville 2005-07-06 13:09:33 +00:00
parent ece3760e66
commit 7d74e6d988

View File

@ -28,137 +28,123 @@ llxHeader("","","Fiche Ligne");
if ($_GET["id"] or $_GET["numero"])
if ($_GET["id"] or $_GET["numero"])
{
if ($_GET["action"] <> 're-edit')
{
if ($_GET["action"] <> 're-edit')
$ligne = new LigneTel($db);
if ($_GET["id"])
{
$ligne = new LigneTel($db);
if ($_GET["id"])
{
$result = $ligne->fetch_by_id($_GET["id"]);
}
if ($_GET["numero"])
{
$result = $ligne->fetch($_GET["numero"]);
}
$result = $ligne->fetch_by_id($_GET["id"]);
}
if ( $result )
{
if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
{
$h=0;
$head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/fiche.php?id=".$ligne->id;
$head[$h][1] = $langs->trans("Ligne");
$h++;
$head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/factures.php?id=".$ligne->id;
$head[$h][1] = $langs->trans('Factures');
$h++;
$head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/infoc.php?id=".$ligne->id;
$head[$h][1] = $langs->trans('Infos');
$h++;
if ($_GET["numero"])
{
$result = $ligne->fetch($_GET["numero"]);
}
}
if ( $result )
{
if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
{
$h=0;
$head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/fiche.php?id=".$ligne->id;
$head[$h][1] = $langs->trans("Ligne");
$h++;
$head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/factures.php?id=".$ligne->id;
$head[$h][1] = $langs->trans('Factures');
$h++;
$head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/infoc.php?id=".$ligne->id;
$head[$h][1] = $langs->trans('Infos');
$h++;
$head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/history.php?id=".$ligne->id;
$head[$h][1] = $langs->trans('Historique');
$h++;
$head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/history.php?id=".$ligne->id;
$head[$h][1] = $langs->trans('Historique');
$h++;
$head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/conso.php?id=".$ligne->id;
$head[$h][1] = $langs->trans('Conso');
$hselected = $h;
$h++;
$head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/conso.php?id=".$ligne->id;
$head[$h][1] = $langs->trans('Conso');
$hselected = $h;
$h++;
$head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/stat.php?id=".$ligne->id;
$head[$h][1] = $langs->trans('Stats');
$h++;
$head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/stat.php?id=".$ligne->id;
$head[$h][1] = $langs->trans('Stats');
$h++;
dolibarr_fiche_head($head, $hselected, 'Ligne : '.$ligne->numero);
dolibarr_fiche_head($head, $hselected, 'Ligne : '.$ligne->numero);
print_fiche_titre('Fiche Ligne', $mesg);
print_fiche_titre('Fiche Ligne', $mesg);
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
print '<tr><td width="25%">Numéro</td><td>'.dolibarr_print_phone($ligne->numero).'</td>';
print '<td>Facturée : '.$ligne->facturable.'</td><td>&nbsp;</td></tr>';
print '<tr><td width="25%">Numéro</td><td>'.dolibarr_print_phone($ligne->numero).'</td>';
print '<td>Facturée : '.$ligne->facturable.'</td><td>&nbsp;</td></tr>';
$client = new Societe($db, $ligne->client_id);
$client->fetch($ligne->client_id);
$client = new Societe($db, $ligne->client_id);
$client->fetch($ligne->client_id);
print '<tr><td width="25%">Client</td><td>';
print '<tr><td width="25%">Client</td><td>';
print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$ligne->client_id.'">';
print $client->nom.'</a></td>';
print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$ligne->client_id.'">';
print $client->nom.'</a></td>';
$client_facture = new Societe($db);
$client_facture->fetch($ligne->client_facture_id);
$client_facture = new Societe($db);
$client_facture->fetch($ligne->client_facture_id);
print '<td width="25%">Client Facturé</td><td>'.$client_facture->nom.'</td></tr>';
print '<td width="25%">Client Facturé</td><td>'.$client_facture->nom.'</td></tr>';
print '<tr><td width="25%">Statut</td><td colspan="3">';
print '<img src="./graph'.$ligne->statut.'.png">&nbsp;';
print $ligne->statuts[$ligne->statut];
print '</td></tr>';
print '<tr><td width="25%">Statut</td><td colspan="3">';
print '<img src="./graph'.$ligne->statut.'.png">&nbsp;';
print $ligne->statuts[$ligne->statut];
print '</td></tr>';
/*
$sql = "SELECT f.cout_vente";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f";
$sql .= " WHERE f.fk_ligne = ".$ligne->id;
$sql .= " ORDER BY f.date ASC ";
if ( $db->query( $sql) )
$sql = "SELECT max(".$db->pdate("date").")";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details";
$sql .= " WHERE fk_ligne = ".$ligne->id;
$resql = $db->query( $sql);
if ( $resql )
{
$num = $db->num_rows($resql);
if ( $num > 0 )
{
$num = $db->num_rows();
if ( $num > 0 )
$i = 0;
while ($i < $num)
{
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row($i);
print '<tr><td valign="top" width="25%">'.strftime("%A %d %B %Y",$row[0]).'</td>';
print '<td><img src="./graph'.$row[1].'.png">&nbsp;';
print $ligne->statuts[$row[1]]."</td>";
print '<td colspan="2">'.$row[4] . " " . $row[3] . "</td></tr>";
$i++;
}
$row = $db->fetch_row($resql);
print '<tr><td colspan="2">Date de la dernière communication</td>';
print '<td colspan="2">'.strftime("%A %d %B %Y",$row[0]).'</td>';
print '</tr>';
$i++;
}
$db->free();
}
else
{
print $sql;
}
*/
print '<tr><td colspan="2" align="center">';
print '<img src="./graphconso.php?id='.$ligne->id.'"><br />';
print '<a href="'.DOL_URL_ROOT.'/telephonie/facture/liste.php?search_ligne='.$ligne->numero.'">liste</a><br />';
print '</td><td colspan="2" align="center">';
print '<img src="./graphconsominutes.php?ligne='.$ligne->numero.'">';
print "</td></tr></table>";
$db->free();
}
else
{
print $sql;
}
print '<tr><td colspan="2" align="center">';
print '<a href="'.DOL_URL_ROOT.'/telephonie/facture/liste.php?search_ligne='.$ligne->numero.'">liste</a><br />';
print '</td><td colspan="2" align="center">';
print "</td></tr></table>";
}
/*
*
*
*
*/
}
else
{
print "Error";
}
}
else
{
print "Error";
}
/* ************************************************************************** */