Nouveau fichier & Copyright

This commit is contained in:
Rodolphe Quiedeville 2004-12-03 11:22:49 +00:00
parent 15d361324b
commit 03065731bc
17 changed files with 1909 additions and 0 deletions

View File

@ -0,0 +1,70 @@
<?PHP
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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$
*
*/
class FournisseurTelephonie {
var $db;
var $id;
function FournisseurTelephonie($DB, $id=0)
{
$this->db = $DB;
$this->id = $id;
return 1;
}
/*
*
*
*/
function fetch()
{
$sql = "SELECT f.rowid, f.nom, f.email_commande, f.commande_active";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_fournisseur as f";
$sql .= " WHERE f.rowid = ".$this->id;
if ($this->db->query($sql))
{
if ($this->db->num_rows())
{
$obj = $this->db->fetch_object(0);
$this->email_commande = $obj->email_commande;
$this->commande_enable = $obj->commande_active;
return 0;
}
else
{
dolibarr_syslog("FournisseurTelephonie::Fetch Erreur id=".$this->id);
return -1;
}
}
else
{
dolibarr_syslog("FournisseurTelephonie::Fetch Erreur SQL id=".$this->id);
return -2;
}
}
}
?>

View File

@ -0,0 +1,119 @@
<?PHP
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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");
$page = $_GET["page"];
$sortorder = $_GET["sortorder"];
$sortfield = $_GET["sortfield"];
if ($_GET["action"] == "create")
{
$ct = new CommandeTableur($db, $user);
$ct->create();
}
llxHeader("","Telephonie - Commande - Archives");
/*
* Sécurité accés client
*/
if ($user->societe_id > 0)
{
$action = '';
$socidp = $user->societe_id;
}
/* ***************************************** */
$sql = "SELECT c.filename, u.name, u.firstname, f.nom,".$db->pdate("c.datec"). " as datec";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commande as c";
$sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f";
$sql .= " ,".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE c.fk_user_creat = u.rowid AND c.fk_fournisseur = f.rowid";
if ($_GET["search_ligne"])
{
$sql .= " AND l.ligne LIKE '%".$_GET["search_ligne"]."%'";
}
$sql .= " ORDER BY c.datec DESC";//$sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows();
$i = 0;
print_barre_liste("Commandes archives", $page, "liste.php", "", $sortfield, $sortorder, '', $num);
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre"><td valign="center">Date</td>';
print '<td>Utilisateur</td>';
print '<td>Fournisseur</td>';
print '<td>Fichier</td>';
print "</tr>\n";
/* print '<tr class="liste_titre">';
print '<form action="liste.php" method="GET">';
print '<td><input type="text" name="search_ligne" value="'. $_GET["search_ligne"].'" size="20"></td>';
print '<td><input type="submit" value="Chercher"></td>';
print '</form>';
*/
print '</tr>';
$var=True;
while ($i < min($num,$conf->liste_limit))
{
$obj = $db->fetch_object($i);
$var=!$var;
print "<tr $bc[$var]>";
print "<td>".strftime("%a %d %b %Y %HH%M",$obj->datec)."</td>\n";
print "<td>".$obj->firstname . " ".$obj->name."</td>\n";
print "<td>".$obj->nom."</td>\n";
$dir = DOL_DATA_ROOT . "/telephonie/ligne/commande/";
$encfile = urlencode($dir.$obj->filename);
print '<td><a href="'.DOL_URL_ROOT . '/document.php?file='.$encfile.'&amp;type=application/msexcel">'.$obj->filename.'</a></td>';
print "</tr>\n";
$i++;
}
print "</table>";
$db->free();
}
else
{
print $db->error() . ' ' . $sql;
}
/* ******************************************** */
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,342 @@
<?PHP
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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_once DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php";
require_once DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php";
require_once DOL_DOCUMENT_ROOT."/lib/dolibarrmail.class.php";
define ('COMMANDETABLEUR_NOEMAIL', -3);
class CommandeTableur
{
function CommandeTableur ($DB, $USER, $fourn)
{
$this->db = $DB;
$this->user = $USER;
$this->fournisseur = $fourn;
}
function Create()
{
$this->date = time();
$this->datef = "commande-".strftime("%d%b%y-%HH%M", $this->date);
$fname = DOL_DATA_ROOT ."/telephonie/ligne/commande/".$this->datef.".xls";
if (strlen(trim($this->fournisseur->email_commande)) == 0)
{
return -3;
}
if (file_exists($fname))
{
return 2;
}
else
{
$res = $this->CreateFile($fname);
$res = $res + $this->LogSql();
$res = $res + $this->MailFile($fname);
return $res;
}
}
/**
*
*
*
*
*/
function MailFile($filename)
{
$sql = "SELECT l.ligne";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
$sql .= " WHERE l.statut = 2";
$result = $this->db->query($sql);
if ($result)
{
$num = $this->db->num_rows();
}
$subject = "Commande Société iBreizh";
$sendto = $this->fournisseur->email_commande;
$from = TELEPHONIE_LIGNE_COMMANDE_EMAIL_BCC;
$message = "Bonjour,\n\nVeuillez trouver ci-joint notre dernière commande.\n\n";
$message .= "Nous avons à ce jour $num ligne(s) commandée(s) pour lesquelles nous attendons la confirmation de présélection.\n\nMerci de nous envoyer les confirmations de présélection à l'adresse comstragex@ibreizh.net\n";
$message .= "\n\nCordialement,\n\n";
$message .= "-- \n";
$message .= $this->user->fullname."\n";
$message .= "iBreizh\n";
$message .= "Tél : 02 90 92 26 00\n";
$mailfile = new DolibarrMail($subject,
$sendto,
$from,
$message);
$mailfile->addr_bcc = TELEPHONIE_LIGNE_COMMANDE_EMAIL_BCC;
$mailfile->PrepareFile(array($filename),
array("application/msexcel"),
array($this->datef.".xls"));
if ( $mailfile->sendfile() )
{
return 0;
}
}
function LogSql()
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_commande";
$sql .= " (datec, fk_user_creat, fk_fournisseur, filename)";
$sql .= " VALUES (now(),".$this->user->id.",".$this->fournisseur->id.",'".$this->datef.".xls')";
$result = $this->db->query($sql);
if ($result)
{
return 0;
}
}
function CreateFile($fname)
{
$ligne = new LigneTel($db);
$workbook = &new writeexcel_workbook($fname);
$worksheet = &$workbook->addworksheet();
$worksheet->write(0, 0, "Commande du ".strftime("%d %B %Y %HH%M", $this->date));
$worksheet->set_column('A:A', 20);
$worksheet->set_column('B:B', 40);
$worksheet->set_column('C:C', 15);
$worksheet->set_column('D:D', 9);
$worksheet->set_column('E:E', 16);
$worksheet->set_column('F:F', 18);
$worksheet->set_column('G:G', 20);
$formatcc =& $workbook->addformat();
$formatcc->set_align('center');
$formatcc->set_align('vcenter');
$formatccb =& $workbook->addformat();
$formatccb->set_align('center');
$formatccb->set_align('vcenter');
$formatccb->set_bold();
$formatccbr =& $workbook->addformat();
$formatccbr->set_align('center');
$formatccbr->set_align('vcenter');
$formatccbr->set_color('red');
$formatccbr->set_bold();
$formatc =& $workbook->addformat();
$formatc->set_align('vcenter');
$formatcb =& $workbook->addformat();
$formatcb->set_align('vcenter');
$formatcb->set_bold();
$i = 0;
$ligneids = array();
$sqlall = "SELECT s.nom, s.idp as socid, l.ligne, f.nom as fournisseur, l.statut, l.rowid";
$sqlall .= " , comm.name, comm.firstname, l.remise";
$sqlall .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sqlall .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
$sqlall .= " , ".MAIN_DB_PREFIX."societe as r";
$sqlall .= " , ".MAIN_DB_PREFIX."user as comm";
$sqlall .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f";
$sqlall .= " WHERE l.fk_soc = s.idp AND l.fk_fournisseur = f.rowid";
$sqlall .= " AND l.fk_soc_facture = r.idp ";
$sqlall .= " AND l.fk_commercial = comm.rowid ";
/*
*
*/
$sql = $sqlall;
$sql .= " AND l.statut in (1,4)";
$sql .= " ORDER BY l.statut ASC";
$result = $this->db->query($sql);
if ($result)
{
$num = $this->db->num_rows();
$worksheet->write(1, 0, "Clients", $formatc);
$worksheet->write(1, 1, "Adresses", $formatc);
$worksheet->write(1, 2, "CLI", $formatcc);
$worksheet->write(1, 3, "Préfixe", $formatcc);
$worksheet->write(1, 4, "Présélection", $formatcc);
$worksheet->write(1, 5, "Connexion", $formatcc);
$worksheet->write(1, 6, "Date de la demande", $formatcc);
while ($i < $num)
{
$obj = $this->db->fetch_object();
if (strlen($obj->ligne)== 10)
{
$j = $i + 2;
$k = $j + 1;
$soc = new Societe($this->db);
$soc->fetch($obj->socid);
$worksheet->write($j, 0, $obj->nom, $formatc);
$worksheet->write($j, 1, $soc->adresse. " " . $soc->cp . " " . $soc->ville, $formatc);
$worksheet->write_string($j, 2, "$obj->ligne", $formatcc);
$worksheet->write_string($j, 3, "Non", $formatcc);
$worksheet->write_string($j, 4, "Oui", $formatcc);
if ($obj->statut == 1)
{
$worksheet->write($j, 5, "Ajouter", $formatccb);
$worksheet->write($j, 6, strftime("%d/%m/%y",$this->date), $formatcc);
}
elseif($obj->statut == 4)
{
$worksheet->write($j, 5, "A Résilier", $formatccbr);
$worksheet->write($j, 6, strftime("%d/%m/%y",$this->date), $formatcc);
}
else
{
$worksheet->write($j, 5, "", $formatccb);
$worksheet->write($j, 6, "", $formatccb);
}
array_push($ligneids, $obj->rowid);
}
$i++;
}
$this->db->free();
}
else
{
print $this->db->error() . ' ' . $sql;
}
/*
* Archives
* Insertion des anciennes lignes dans le fichier Excell
*/
$sql = $sqlall;
$sql .= "AND l.statut > 0 AND l.statut <> 1 AND l.statut <> 4";
$sql .= " ORDER BY l.statut ASC";
$result = $this->db->query($sql);
if ($result)
{
$num = $this->db->num_rows();
$i = 0;
while ($i < $num)
{
$obj = $this->db->fetch_object($i);
$jj = $i + $j + 2;
$k = $jj + 1;
$soc = new Societe($this->db);
$soc->fetch($obj->socid);
$worksheet->write($jj, 0, $obj->nom, $formatc);
$worksheet->write($jj, 1, $soc->adresse. " " . $soc->cp . " " . $soc->ville, $formatc);
$worksheet->write_string($jj, 2, "$obj->ligne", $formatcc);
$worksheet->write_string($jj, 3, "Non", $formatcc);
$worksheet->write_string($jj, 4, "Oui", $formatcc);
$worksheet->write($jj, 5, "", $formatccb);
$worksheet->write($jj, 6, "", $formatccb);
array_push($ligneids, $obj->rowid);
$i++;
}
$this->db->free();
}
else
{
print $this->db->error() . ' ' . $sql;
}
/*
*
*
*/
foreach ($ligneids as $lid)
{
$lint = new LigneTel($this->db);
$lint->fetch_by_id($lid);
if ($lint->statut == 1)
{
$lint->set_statut($this->user, 2);
}
if ($lint->statut == 4)
{
$lint->set_statut($this->user, 5);
}
}
$workbook->close();
return 0;
}
}

View File

@ -0,0 +1,132 @@
<?PHP
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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");
$page = $_GET["page"];
$sortorder = $_GET["sortorder"];
if (!$user->rights->telephonie->lire)
accessforbidden();
llxHeader('','Telephonie - Ligne - Commande');
/*
* Sécurité accés client
*/
if ($user->societe_id > 0)
{
$action = '';
$socidp = $user->societe_id;
}
/*
* Mode Liste
*
*
*
*/
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr><td width="30%" valign="top">';
$sql = "SELECT distinct statut, count(*) as cc";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
$sql .= " GROUP BY statut";
if ($db->query($sql))
{
$num = $db->num_rows();
$i = 0;
$ligne = new LigneTel($db);
print_barre_liste("Commande", $page, "index.php", "", $sortfield, $sortorder, '', $num);
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre"><td>Lignes Statuts</td><td valign="center">Nb</td>';
print "</tr>\n";
$var=True;
while ($i < min($num,$conf->liste_limit))
{
$obj = $db->fetch_object($i);
$var=!$var;
print "<tr $bc[$var]>";
print "<td>".$ligne->statuts[$obj->statut]."</td>\n";
print "<td>".$obj->cc."</td>\n";
print "</tr>\n";
$i++;
}
print "</table>";
$db->free();
}
else
{
print $db->error() . ' ' . $sql;
}
print '<br>';
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre"><td>Nouvelle commande</td>';
print "</tr>\n";
print "<tr $bc[1]>";
print '<td><a href="fiche.php">'.img_edit().'</a>';
print '&nbsp;<a href="fiche.php">Créer une nouvelle commande</a></td>';
print "</tr>\n";
print '</table>';
print '</td><td valign="top">';
/*
* Seconde colonne
*
*/
print_barre_liste("Commande", $page, "liste.php", "", $sortfield, $sortorder, '', $num);
print '<img src="./graphcommande.php"><br /><br />';
print '</td></tr>';
print '</table>';
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,189 @@
<?PHP
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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");
$page = $_GET["page"];
$sortorder = $_GET["sortorder"];
$sortfield = $_GET["sortfield"];
if ($_GET["action"] == "commande" && $user->rights->telephonie->ligne_commander)
{
$ltel = new LigneTel($db);
$ltel->id = $_GET["lid"];
$ltel->set_statut($user, $_GET["statut"]);
Header("Location: liste.php");
}
llxHeader("","Telephonie - Ligne - Commande");
/*
* Sécurité accés client
*/
if ($user->societe_id > 0)
{
$action = '';
$socidp = $user->societe_id;
}
if ($sortorder == "") {
$sortorder="DESC";
}
if ($sortfield == "") {
$sortfield="l.statut";
}
/*
* Recherche
*
*
*/
if ($mode == 'search') {
if ($mode-search == 'soc') {
$sql = "SELECT s.idp FROM ".MAIN_DB_PREFIX."societe as s ";
$sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'";
}
if ( $db->query($sql) ) {
if ( $db->num_rows() == 1) {
$obj = $db->fetch_object(0);
$socid = $obj->idp;
}
$db->free();
}
}
if ($page == -1) { $page = 0 ; }
$offset = $conf->liste_limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
/*
* Mode Liste
*
*
*
*/
$sql = "SELECT sf.idp as sfidp, sf.nom as sfnom, s.idp as socidp, s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, f.rowid as fournid, l.mode_paiement";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
$sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f";
$sql .= " , ".MAIN_DB_PREFIX."societe as sf";
$sql .= " WHERE l.fk_soc = s.idp AND l.fk_fournisseur = f.rowid AND l.statut IN (-1,1,4) ";
$sql .= " AND l.fk_soc_facture = sf.idp";
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows();
$i = 0;
print_barre_liste("Commande", $page, "liste.php", "", $sortfield, $sortorder, '', $num);
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">';
print_liste_field_titre("Ligne","liste.php","l.ligne");
print '<td align="center">Statut</td>';
print_liste_field_titre("Client","liste.php","s.nom");
print '<td>Client Facturé</td><td align="center">Rib OK</td><td>Fournisseur</td>';
print "</tr>\n";
$var=True;
$ligne = new LigneTel($db);
while ($i < min($num,$conf->liste_limit))
{
$obj = $db->fetch_object($i);
$var=!$var;
$fourntels = array();
if (!array_key_exists($obj->fournid, $fourntels))
{
$ft = new FournisseurTelephonie($db, $obj->fournid);
$ft->fetch();
$fourntels[$obj->fournid] = $ft;
}
$socf = new Societe($db);
$socf->fetch($obj->sfidp);
print "<tr $bc[$var]>";
print '<td><img src="../graph'.$obj->statut.'.png">';
print '&nbsp;<a href="../fiche.php?id='.$obj->rowid.'">';
if (strlen($obj->ligne) <> 10)
{
print "Erreur";
$ok_commande = 0;
}
else
{
print dolibarr_print_phone($obj->ligne);
$ok_commande = 1;
}
print "</a></td>\n";
$ftx = $fourntels[$obj->fournid];
if ($ok_commande && $ftx->commande_enable && $user->rights->telephonie->ligne_commander && ($obj->statut == 1 or $obj->statut == -1) && ( $socf->verif_rib() or $obj->mode_paiement == 'vir'))
{
$nst = ($obj->statut * -1);
print '<td align="center"><a href="liste.php?lid='.$obj->rowid.'&amp;action=commande&amp;statut='.$nst.'">';
print img_edit();
print '</a>&nbsp;<a href="liste.php?lid='.$obj->rowid.'&amp;action=commande&amp;statut='.$nst.'">';
print $ligne->statuts[$obj->statut];
print "</a></td>\n";
}
else
{
print '<td align="center">'.$ligne->statuts[$obj->statut]."</td>\n";
}
print '<td><a href="'.DOL_URL_ROOT.'/soc.php?socid='.$obj->socidp.'">'.$obj->nom.'</a></td>';
print '<td><a href="'.DOL_URL_ROOT.'/soc.php?socid='.$obj->sfidp.'">'.$obj->sfnom.'</a></td>';
print '<td align="center">'.$socf->verif_rib().'</a></td>';
print "<td>".$obj->fournisseur."</td>\n";
print "</tr>\n";
$i++;
}
print "</table>";
$db->free();
}
else
{
print $db->error() . ' ' . $sql;
}
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,69 @@
<?PHP
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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("../../../main.inc.php");
require(DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php");
require(DOL_DOCUMENT_ROOT."/telephonie/fournisseurtel.class.php");
require(DOL_DOCUMENT_ROOT."/telephonie/ligne/commande/commandetableur.class.php");
$user->getrights('telephonie');
function llxHeader($head = "", $title="") {
global $user, $conf;
/*
*
*
*/
top_menu($head, $title);
$menu = new Menu();
$menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie");
$menu->add(DOL_URL_ROOT."/telephonie/simulation/fiche.php", "Simulation");
$menu->add_submenu(DOL_URL_ROOT."/telephonie/simulation/fiche.php?action=create", "Nouvelle");
$menu->add(DOL_URL_ROOT."/telephonie/tarifs/", "Tarifs");
$menu->add(DOL_URL_ROOT."/telephonie/client/index.php", "Clients");
$menu->add(DOL_URL_ROOT."/telephonie/ligne/index.php", "Lignes");
$menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/", "Commandes");
$menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/commande/liste.php", "Lignes");
if ($user->rights->telephonie->ligne_commander)
{
$menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/commande/fiche.php", "Nouvelle");
}
$menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/commande/archives.php", "Archives");
$menu->add(DOL_URL_ROOT."/telephonie/facture/", "Factures");
$menu->add(DOL_URL_ROOT."/telephonie/stats/", "Statistiques");
$menu->add(DOL_URL_ROOT."/telephonie/fournisseurs.php", "Fournisseurs");
left_menu($menu->liste);
}
?>

View File

@ -0,0 +1,170 @@
<?PHP
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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");
$mesg = '';
llxHeader("","","Fiche Ligne");
if ($_GET["id"] or $_GET["numero"])
{
if ($_GET["action"] <> 're-edit')
{
$ligne = new LigneTel($db);
if ($_GET["id"])
{
$result = $ligne->fetch_by_id($_GET["id"]);
}
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/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/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++;
dolibarr_fiche_head($head, $hselected, 'Ligne : '.$ligne->numero);
print_fiche_titre('Fiche Ligne', $mesg);
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>';
$client = new Societe($db, $ligne->client_id);
$client->fetch($ligne->client_id);
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>';
$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 '<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) )
{
$num = $db->num_rows();
if ( $num > 0 )
{
$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++;
}
}
$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>";
}
}
/*
*
*
*
*/
}
else
{
print "Error";
}
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

View File

@ -0,0 +1,410 @@
<?PHP
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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");
$mesg = '';
if ($_POST["action"] == 'add')
{
$ligne = new LigneTel($db);
$ligne->numero = $_POST["numero"];
$ligne->client = $_POST["client"];
$ligne->client_facture = $_POST["client_facture"];
$ligne->fournisseur = $_POST["fournisseur"];
$ligne->commercial = $_POST["commercial"];
$ligne->remise = $_POST["remise"];
$ligne->note = $_POST["note"];
if ( $ligne->create($user) )
{
Header("Location: fiche.php?id=".$ligne->id);
}
}
if ($_POST["action"] == 'addcontact')
{
$ligne = new LigneTel($db);
$ligne->id = $_GET["id"];
if ( $ligne->add_contact($_POST["contact_id"]) )
{
Header("Location: fiche.php?id=".$ligne->id);
}
}
if ($_GET["action"] == 'delcontact')
{
$ligne = new LigneTel($db);
$ligne->id = $_GET["id"];
if ( $ligne->del_contact($_GET["contact_id"]) )
{
Header("Location: fiche.php?id=".$ligne->id);
}
}
if ($_GET["action"] == 'active')
{
$ligne = new LigneTel($db);
$ligne->id = $_GET["id"];
if ( $ligne->set_statut($user, 3) == 0)
{
Header("Location: fiche.php?id=".$ligne->id);
}
}
if ($_GET["action"] == 'resilier')
{
$ligne = new LigneTel($db);
$ligne->id = $_GET["id"];
if ( $ligne->set_statut($user, 4) == 0)
{
Header("Location: fiche.php?id=".$ligne->id);
}
}
if ($_GET["action"] == 'annuleresilier')
{
$ligne = new LigneTel($db);
$ligne->id = $_GET["id"];
if ( $ligne->set_statut($user, 3) == 0)
{
Header("Location: fiche.php?id=".$ligne->id);
}
}
if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel"))
{
$ligne = new LigneTel($db);
$ligne->id = $_GET["id"];
$ligne->numero = $_POST["numero"];
$ligne->client = $_POST["client"];
$ligne->client_facture = $_POST["client_facture"];
$ligne->fournisseur = $_POST["fournisseur"];
$ligne->commercial = $_POST["commercial"];
$ligne->remise = $_POST["remise"];
$ligne->note = $_POST["note"];
if ( $ligne->update($user) )
{
$action = '';
$mesg = 'Fiche mise à jour';
}
else
{
$action = 're-edit';
$mesg = 'Fiche non mise à jour !' . "<br>" . $entrepot->mesg_error;
}
}
llxHeader("","","Fiche Ligne");
if ($cancel == $langs->trans("Cancel"))
{
$action = '';
}
/*
* Affichage
*
*/
/*
* Création
*
*/
if ($_GET["action"] == 'create')
{
$ligne = new LigneTel($db);
print "<form action=\"fiche.php\" method=\"post\">\n";
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="type" value="'.$type.'">'."\n";
print_titre("Nouvelle ligne");
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
print '<tr><td width="20%">Numéro</td><td><input name="numero" size="12" value=""></td></tr>';
print '<tr><td width="20%">Client</td><td colspan="2">';
print '<select name="client">';
$sql = "SELECT idp, nom FROM ".MAIN_DB_PREFIX."societe WHERE client=1 ORDER BY nom ";
if ( $db->query( $sql) )
{
$num = $db->num_rows();
if ( $num > 0 )
{
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row($i);
print '<option value="'.$row[0].'">'.$row[1];
$i++;
}
}
$db->free();
}
print '</select></td></tr>';
print '<tr><td width="20%">Client à facturer</td><td colspan="2">';
print '<select name="client_facture">';
$sql = "SELECT idp, nom FROM ".MAIN_DB_PREFIX."societe WHERE client=1 ORDER BY nom ";
if ( $db->query( $sql) )
{
$num = $db->num_rows();
if ( $num > 0 )
{
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row($i);
print '<option value="'.$row[0].'">'.$row[1];
$i++;
}
}
$db->free();
}
print '</select></td></tr>';
print '<tr><td width="20%">Fournisseur</td><td colspan="2">';
print '<select name="fournisseur">';
$sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."telephonie_fournisseur ORDER BY nom ";
if ( $db->query( $sql) )
{
$num = $db->num_rows();
if ( $num > 0 )
{
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row($i);
print '<option value="'.$row[0].'">'.$row[1];
$i++;
}
}
$db->free();
}
print '</select></td></tr>';
print '<tr><td width="20%">Commercial</td><td colspan="2">';
print '<select name="commercial">';
$sql = "SELECT rowid, name, firstname FROM ".MAIN_DB_PREFIX."user ORDER BY name ";
if ( $db->query( $sql) )
{
$num = $db->num_rows();
if ( $num > 0 )
{
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row($i);
print '<option value="'.$row[0].'">'.$row[1] . " " . $row[2];
$i++;
}
}
$db->free();
}
print '</select></td></tr>';
print '<tr><td width="20%">Remise</td><td><input name="remise" size="3" maxlength="2" value="">&nbsp;%</td></tr>';
print '<tr><td width="20%" valign="top">Note</td><td>';
print '<textarea name="note" rows="4" cols="50">';
print "</textarea></td></tr>";
print '<tr><td>&nbsp;</td><td><input type="submit" value="Créer"></td></tr>';
print '</table>';
print '</form>';
}
else
{
if ($_GET["id"] or $_GET["numero"])
{
if ($_GET["action"] <> 're-edit')
{
$ligne = new LigneTel($db);
if ($_GET["id"])
{
$result = $ligne->fetch_by_id($_GET["id"]);
}
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/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');
$hselected = $h;
$h++;
$head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/conso.php?id=".$ligne->id;
$head[$h][1] = $langs->trans('Conso');
$h++;
dolibarr_fiche_head($head, $hselected, 'Ligne : '.$ligne->numero);
print_fiche_titre('Fiche Ligne', $mesg);
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
print '<tr><td width="20%">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);
print '<tr><td width="20%">Client</td><td>'.$client->nom.'</td>';
$client_facture = new Societe($db);
$client_facture->fetch($ligne->client_facture_id);
print '<td width="20%">Client Facturé</td><td>'.$client_facture->nom.'</td></tr>';
print '<tr><td width="20%">Statut</td><td colspan="3">';
print '<img src="./graph'.$ligne->statut.'.png">&nbsp;';
print $ligne->statuts[$ligne->statut];
print '</td></tr>';
/* Contacts */
$sql = "SELECT ".$db->pdate("l.tms").", l.statut, l.fk_user, u.name, u.firstname, l.comment";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne_statut as l";
$sql .= ",".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE u.rowid = l.fk_user AND l.fk_ligne = ".$ligne->id;
$sql .= " ORDER BY l.tms DESC ";
if ( $db->query( $sql) )
{
$num = $db->num_rows();
if ( $num > 0 )
{
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row($i);
print '<tr><td valign="top" width="20%">'.strftime("%a %d %B %Y %H:%M:%S",$row[0]).'</td>';
print '<td><img src="./graph'.$row[1].'.png">&nbsp;';
print $ligne->statuts[$row[1]];
if ($row[5])
{
print '<br />'.$row[5];
}
print '</td><td colspan="2">'.$row[4] . " " . $row[3] . "</td></tr>";
$i++;
}
}
$db->free();
}
else
{
print $sql;
}
/* Fin Contacts */
if ($_GET["action"] <> 'edit' && 0)
{
print '<tr><td width="20%">Point de rentabilité</td><td colspan="2">';
print '<img src="./graphrent.php?remise='.$ligne->remise.'">';
print '</td></tr>';
}
print "</table>";
}
}
/*
*
*
*
*/
}
else
{
print "Error";
}
}
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,408 @@
<?PHP
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* 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");
$mesg = '';
if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel"))
{
$ligne = new LigneTel($db);
$ligne->id = $_GET["id"];
$ligne->code_analytique = $_POST["code_ana"];
if ( $ligne->update_infoc($user) )
{
$action = '';
$mesg = 'Fiche mise à jour';
Header("Location: infoc.php?id=".$ligne->id);
}
else
{
$action = 're-edit';
$mesg = 'Fiche non mise à jour !' . "<br>" . $entrepot->mesg_error;
}
}
llxHeader("","","Fiche Ligne");
if ($cancel == $langs->trans("Cancel"))
{
$action = '';
}
/*
* Affichage
*
*/
/*
* Création
*
*/
if ($_GET["action"] == 'create')
{
$ligne = new LigneTel($db);
print "<form action=\"infoc.php\" method=\"post\">\n";
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="type" value="'.$type.'">'."\n";
print_titre("Nouvelle ligne");
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
print '<tr><td width="20%">Numéro</td><td><input name="numero" size="12" value=""></td></tr>';
print '<tr><td width="20%">Client</td><td colspan="2">';
print '<select name="client">';
$sql = "SELECT idp, nom FROM ".MAIN_DB_PREFIX."societe WHERE client=1 ORDER BY nom ";
if ( $db->query( $sql) )
{
$num = $db->num_rows();
if ( $num > 0 )
{
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row($i);
print '<option value="'.$row[0].'">'.$row[1];
$i++;
}
}
$db->free();
}
print '</select></td></tr>';
print '<tr><td width="20%">Client à facturer</td><td colspan="2">';
print '<select name="client_facture">';
$sql = "SELECT idp, nom FROM ".MAIN_DB_PREFIX."societe WHERE client=1 ORDER BY nom ";
if ( $db->query( $sql) )
{
$num = $db->num_rows();
if ( $num > 0 )
{
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row($i);
print '<option value="'.$row[0].'">'.$row[1];
$i++;
}
}
$db->free();
}
print '</select></td></tr>';
print '<tr><td width="20%">Fournisseur</td><td colspan="2">';
print '<select name="fournisseur">';
$sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."telephonie_fournisseur WHERE commande_active = 1 ORDER BY nom ";
if ( $db->query( $sql) )
{
$num = $db->num_rows();
if ( $num > 0 )
{
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row($i);
print '<option value="'.$row[0].'">'.$row[1];
$i++;
}
}
$db->free();
}
print '</select></td></tr>';
/*
* Commercial
*/
print '<tr><td width="20%">Commercial</td><td colspan="2">';
print '<select name="commercial">';
$sql = "SELECT rowid, name, firstname FROM ".MAIN_DB_PREFIX."user ORDER BY name ";
if ( $db->query( $sql) )
{
$num = $db->num_rows();
if ( $num > 0 )
{
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row($i);
print '<option value="'.$row[0].'">'.$row[1] . " " . $row[2];
$i++;
}
}
$db->free();
}
print '</select></td></tr>';
/*
* Concurrents
*/
print '<tr><td width="20%">Fournisseur précédent</td><td colspan="2">';
print '<select name="concurrent">';
$sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."telephonie_concurrents ORDER BY rowid ";
if ( $db->query( $sql) )
{
$num = $db->num_rows();
if ( $num > 0 )
{
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row($i);
print '<option value="'.$row[0].'">'.$row[1];
$i++;
}
}
$db->free();
}
print '</select></td></tr>';
print '<tr><td width="20%">Remise</td><td><input name="remise" size="3" maxlength="2" value="">&nbsp;%</td></tr>';
print '<tr><td width="20%" valign="top">Note</td><td>';
print '<textarea name="note" rows="4" cols="50">';
print "</textarea></td></tr>";
print '<tr><td>&nbsp;</td><td><input type="submit" value="Créer"></td></tr>';
print '</table>';
print '</form>';
}
else
{
if ($_GET["id"] or $_GET["numero"])
{
if ($_GET["action"] <> 're-edit')
{
$ligne = new LigneTel($db);
if ($_GET["id"])
{
$result = $ligne->fetch_by_id($_GET["id"]);
}
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/infoc.php?id=".$ligne->id;
$head[$h][1] = $langs->trans('Infos');
$hselected = $h;
$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');
$h++;
dolibarr_fiche_head($head, $hselected, 'Ligne : '.$ligne->numero);
print_fiche_titre('Informations complémentaires', $mesg);
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
print '<tr><td width="20%">Numéro</td><td>'.dolibarr_print_phone($ligne->numero).'</td>';
print '<td>Facturée : '.$ligne->facturable.'</td></tr>';
$client = new Societe($db, $ligne->client_id);
$client->fetch($ligne->client_id);
print '<tr><td width="20%">Client</td><td colspan="2">'.$client->nom.'</td></tr>';
$client_facture = new Societe($db);
$client_facture->fetch($ligne->client_facture_id);
print '<tr><td width="20%">Client Facturé</td><td><a href="'.DOL_URL_ROOT.'/comm/infoc.php?socid=';
print $client->id.'">';
print $client_facture->nom.'</a>';
print '</td><td>';
if ($ligne->mode_paiement == 'pre')
{
print 'RIB : '.$client_facture->display_rib();
}
else
{
print 'Paiement par virement';
}
print '</td></tr>';
print '<tr><td width="20%">Remise LMN</td><td colspan="2">'.$ligne->remise.'&nbsp;%</td></tr>';
print '<tr><td width="20%">Code analytique</td><td colspan="2">'.$ligne->code_analytique.'&nbsp;</td></tr>';
print "</table>";
}
}
if ($_GET["action"] == 'edit' || $action == 're-edit')
{
print_fiche_titre('Edition des informations complémentaires de la ligne', $mesg);
print "<form action=\"infoc.php?id=$ligne->id\" method=\"post\">\n";
print '<input type="hidden" name="action" value="update">';
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
print '<tr><td width="20%">Numéro</td><td>'.$ligne->numero.'</td></tr>';
$client = new Societe($db, $ligne->client_id);
$client->fetch($ligne->client_id);
print '<tr><td width="20%">Client</td><td colspan="2">'.$client->nom;
print '</td></tr>';
print '<tr><td width="20%">Remise LMN</td><td>'.$ligne->remise.' %</td></tr>';
print '<tr><td width="20%">Code Analytique</td><td><input name="code_ana" size="13" maxlength="12" value="'.$ligne->code_analytique.'">&nbsp;</td></tr>';
print '<tr><td>&nbsp;</td><td><input type="submit" value="Mettre à jour">';
print '<a href="infoc.php?id='.$ligne->id.'">Annuler</a></td></tr>';
print '</table>';
print '</form>';
}
/*
*
*
*
*/
}
else
{
print "Error";
}
}
print '</div>';
if ( $user->rights->telephonie->ligne_activer && $ligne->statut == 2)
{
$form = new Form($db);
print '<table class="noborder" cellpadding="2" cellspacing="0" width="100%"><tr><td>';
print '<form action="infoc.php?id='.$ligne->id.'&amp;action=active" method="post">';
print '<table class="noborder" cellpadding="2" cellspacing="0">';
print '<tr class="liste_titre"><td colspan="2">Activer</td><td>';
print '<tr><td>Date</td><td>';
print $form->select_date();
print '</td>';
print '<td colspan="2"><input type="submit" name="Activer"></td></tr>';
print '</table>';
print '</form></td><td>';
print '<form action="infoc.php?id='.$ligne->id.'&amp;action=refuse" method="post">';
print '<table class="noborder" cellpadding="2" cellspacing="0">';
print '<tr class="liste_titre"><td colspan="2">Refuser</td><td>';
print '<tr><td>Date</td><td>';
print $form->select_date();
print '</td>';
print '<td colspan="2"><input type="submit" name="Activer"></td></tr>';
print '</table>';
print '</form></td></tr></table>';
}
if ( $user->rights->telephonie->ligne_activer && $ligne->statut == 5)
{
/**
* Résiliation demandée
*/
$form = new Form($db);
print '<table class="noborder" cellpadding="2" cellspacing="0" width="100%"><tr><td>';
print '<form action="infoc.php?id='.$ligne->id.'&amp;action=confirmresilier" method="post">';
print '<table class="noborder" cellpadding="2" cellspacing="0">';
print '<tr class="liste_titre"><td colspan="2">Confirmation de la résiliation</td><td>';
print '<tr><td>Date</td><td>';
print $form->select_date();
print '</td>';
print '<td colspan="2"><input type="submit" name="Activer"></td></tr>';
print '</table>';
print '</form></td><td>';
print '&nbsp;</td></tr></table>';
}
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
print "<br><div class=\"tabsAction\">\n";
if ($_GET["action"] == '')
{
print "<a class=\"tabAction\" href=\"infoc.php?action=edit&amp;id=$ligne->id\">".$langs->trans("Edit")."</a>";
}
print "</div>";
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>