Nouveau fichier

This commit is contained in:
Rodolphe Quiedeville 2004-12-03 11:00:36 +00:00
parent cfbbe15c5c
commit f831be7f03
13 changed files with 2495 additions and 0 deletions

View File

@ -0,0 +1,175 @@
<?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');
/*
* 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">';
print '<form method="GET" action="'.DOL_URL_ROOT.'/telephonie/client/liste.php">';
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre"><td>Recherche client</td>';
print "</tr>\n";
print "<tr $bc[1]>";
print '<td>Nom <input name="search_client" size="12"></td></tr>';
print '</table>';
print '<br />';
$sql = "SELECT distinct s.idp ";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
$sql .= " , ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE s.idp = l.fk_client_comm ";
if ($db->query($sql))
{
$num = $db->num_rows();
$i = 0;
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre"><td>Clients</td><td valign="center">Nb</td>';
print "</tr>\n";
$var=True;
$row = $db->fetch_row(0);
print "<tr $bc[$var]>";
print "<td>Nombre de clients</td>\n";
print "<td>".$num."</td>\n";
print "</tr>\n";
print "</table>";
$db->free();
}
else
{
print $db->error() . ' ' . $sql;
}
print '<br />';
print '</td>';
print '</td><td valign="top" width="70%" rowspan="3">';
/*
* Liste
*
*/
$sql = "SELECT s.idp as socidp, s.nom, count(l.ligne) as ligne";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
$sql .= " WHERE l.fk_client_comm = s.idp ";
if ($_GET["search_client"])
{
$sel = urldecode($_GET["search_client"]);
$sql .= " AND s.nom LIKE '%".$sel."%'";
}
$sql .= " GROUP BY s.idp";
$sql .= " ORDER BY s.datec DESC LIMIT 15";
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows();
$i = 0;
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre"><td>15 derniers clients</td>';
print '<td width="25%" align="center">Nb Lignes';
print '</td>';
print "</tr>\n";
$var=True;
$ligne = new LigneTel($db);
while ($i < $num)
{
$obj = $db->fetch_object($i);
$var=!$var;
print "<tr $bc[$var]><td>";
print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->socidp.'">';
print img_file();
print '</a>&nbsp;';
print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->socidp.'">'.$obj->nom.'</a></td>';
print '<td align="center">'.$obj->ligne."</td>\n";
print "</tr>\n";
$i++;
}
print "</table>";
$db->free();
}
else
{
print $db->error() . ' ' . $sql;
}
print '</td></tr>';
print '</table>';
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,145 @@
<?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"];
llxHeader('','Telephonie - Ligne - Liste');
/*
* Sécurité accés client
*/
if ($user->societe_id > 0)
{
$action = '';
$socidp = $user->societe_id;
}
if ($sortorder == "") {
$sortorder="ASC";
}
if ($sortfield == "") {
$sortfield="s.nom";
}
/*
* Recherche
*
*
*/
if ($page == -1) { $page = 0 ; }
$offset = $conf->liste_limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
/*
* Mode Liste
*
*
*
*/
$sql = "SELECT s.idp as socidp, s.nom, count(l.ligne) as ligne, cs.ca";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."telephonie_client_stats as cs ON s.idp=cs.fk_client_comm";
$sql .= " WHERE l.fk_client_comm = s.idp ";
if ($_GET["search_client"])
{
$sel = urldecode($_GET["search_client"]);
$sql .= " AND s.nom LIKE '%".$sel."%'";
}
$sql .= " GROUP BY s.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;
$urladd= "&amp;statut=".$_GET["statut"];
print_barre_liste("Clients", $page, "liste.php", $urladd, $sortfield, $sortorder, '', $num);
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">';
print_liste_field_titre("Client","liste.php","s.nom","","",' width="50%"');
print '<td width="25%" align="center">Nb Lignes';
print '</td><td width="25%" align="right">CA</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
print '<form action="liste.php" method="GET">';
print '<td><input type="text" name="search_client" value="'. $_GET["search_client"].'" size="12"></td>';
print '<td><input type="submit" value="Chercher"></td><td>&nbsp;</td>';
print '</form>';
print '</tr>';
$var=True;
$ligne = new LigneTel($db);
while ($i < min($num,$conf->liste_limit))
{
$obj = $db->fetch_object($i);
$var=!$var;
print "<tr $bc[$var]><td>";
print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->socidp.'">';
print img_file();
print '</a>&nbsp;';
print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->socidp.'">'.$obj->nom.'</a></td>';
print '<td align="center">'.$obj->ligne."</td>\n";
print '<td align="right">'.price($obj->ca)." euros HT</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,63 @@
<?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");
$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_submenu(DOL_URL_ROOT."/telephonie/client/liste.php", "Liste");
$menu->add_submenu(DOL_URL_ROOT."/telephonie/client/rapports", "Rapports");
$menu->add(DOL_URL_ROOT."/telephonie/ligne/index.php", "Lignes");
$menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/", "Commandes");
$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,129 @@
<?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');
/*
* 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">';
print '<form method="GET" action="'.DOL_URL_ROOT.'/telephonie/ligne/liste.php">';
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre"><td>Recherche ligne</td>';
print "</tr>\n";
print "<tr $bc[1]>";
print '<td>Numéro <input name="search_ligne" size="12"></td></tr>';
print '</table>';
print '</td><td valign="top" width="70%" rowspan="3">';
print '<img src="./graphca.php">';
print '</td></tr>';
print '<tr><td width="30%" valign="top">';
/*
*
*
*/
$sql = "SELECT date_format(f.datef,'%Y%m'),sum(f.total_ttc)";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as tf";
$sql .= " , ".MAIN_DB_PREFIX."facture as f";
$sql .= " WHERE tf.fk_facture = f.rowid";
$sql .= " GROUP BY date_format(f.datef,'%Y%m')";
if ($db->query($sql))
{
$num = $db->num_rows();
$i = 0;
$ligne = new LigneTel($db);
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre"><td>Factures</td><td valign="center">Nb</td>';
print "</tr>\n";
$var=True;
while ($i < $num)
{
$row = $db->fetch_row($i);
$var=!$var;
print "<tr $bc[$var]>";
print "<td>".$row[0]."</td>\n";
print "<td>".$row[1]."</td>\n";
print "</tr>\n";
$i++;
}
print "</table>";
$db->free();
}
else
{
print $db->error() . ' ' . $sql;
}
/*
*
*
*/
print '</td></tr>';
print '</table>';
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,66 @@
<?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/facturetel.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/", "Commande");
$menu->add(DOL_URL_ROOT."/telephonie/facture/index.php", "Factures");
$menu->add_submenu(DOL_URL_ROOT."/telephonie/facture/liste.php", "Liste");
// $menu->add_submenu(DOL_URL_ROOT."/telephonie/facture/xls.php", "Excel");
//$menu->add_submenu(DOL_URL_ROOT."/telephonie/facture/stat.php", "Statistiques");
$menu->add_submenu(DOL_URL_ROOT."/telephonie/facture/check.php", "Verif");
$menu->add_submenu(DOL_URL_ROOT."/telephonie/facture/stats.php", "Stats");
$menu->add(DOL_URL_ROOT."/telephonie/fournisseurs.php", "Fournisseurs");
$menu->add(DOL_URL_ROOT."/telephonie/statca/", "Chiffre d'affaire");
left_menu($menu->liste);
}
?>

View File

@ -0,0 +1,108 @@
<?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");
$user->getrights('telephonie');
$page = $_GET["page"];
$sortorder = $_GET["sortorder"];
llxHeader();
if (!$user->rights->telephonie->lire)
accessforbidden();
/*
* Sécurité accés client
*/
if ($user->societe_id > 0)
{
$action = '';
$socidp = $user->societe_id;
}
if ($sortorder == "") {
$sortorder="ASC";
}
if ($sortfield == "") {
$sortfield="f.nom";
}
if ($page == -1) { $page = 0 ; }
$offset = $conf->liste_limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
/*
* Mode Liste
*
*
*
*/
$sql = "SELECT f.nom, f.email_commande";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_fournisseur as f";
$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("Fournisseurs", $page, "fournisseurs.php", "", $sortfield, $sortorder, '', $num);
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">';
print_liste_field_titre("Société","fournisseurs.php","s.nom");
print '<td>Email de commande</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>".$obj->nom."</td>\n";
print "<td>".$obj->email_commande."</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,981 @@
<?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 = '';
$dt = time();
$h = strftime("%H",$dt);
$m = strftime("%M",$dt);
$s = strftime("%S",$dt);
if ($_POST["action"] == 'add')
{
$ligne = new LigneTel($db);
$ligne->numero = $_POST["numero"];
$ligne->client_comm = $_POST["client_comm"];
$ligne->client = $_POST["client"];
$ligne->client_facture = $_POST["client_facture"];
$ligne->fournisseur = $_POST["fournisseur"];
$ligne->commercial = $_POST["commercial"];
$ligne->concurrent = $_POST["concurrent"];
$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->fetch_by_id($_GET["id"]);
$datea = $db->idate(mktime($h, $m , $s,
$_POST["remonth"],
$_POST["reday"],
$_POST["reyear"]));
if ( $ligne->set_statut($user, 3, $datea) == 0)
{
Header("Location: fiche.php?id=".$ligne->id);
}
}
if ($_GET["action"] == 'refuse')
{
$ligne = new LigneTel($db);
$ligne->fetch_by_id($_GET["id"]);
$datea = $db->idate(mktime($h, $m , $s,
$_POST["remonth"],
$_POST["reday"],
$_POST["reyear"]));
if ( $ligne->set_statut($user, 7, $datea, $_POST["commentaire"]) == 0)
{
Header("Location: fiche.php?id=".$ligne->id);
}
}
if ($_GET["action"] == 'resilier')
{
$ligne = new LigneTel($db);
$ligne->fetch_by_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->fetch_by_id($_GET["id"]);
if ( $ligne->set_statut($user, 3) == 0)
{
Header("Location: fiche.php?id=".$ligne->id);
}
}
if ($_GET["action"] == 'confirmresilier')
{
$ligne = new LigneTel($db);
$ligne->fetch_by_id($_GET["id"]);
$datea = $db->idate(mktime($h, $m , $s,
$_POST["remonth"],
$_POST["reday"],
$_POST["reyear"]));
if ( $ligne->set_statut($user, 6, $datea, $_POST["commentaire"]) == 0)
{
Header("Location: fiche.php?id=".$ligne->id);
}
}
if ($_GET["action"] == 'acommander')
{
$ligne = new LigneTel($db);
$ligne->fetch_by_id($_GET["id"]);
if ( $ligne->set_statut($user, 1, '', $_POST["commentaire"]) == 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_comm = $_POST["client_comm"];
$ligne->client = $_POST["client"];
$ligne->client_facture = $_POST["client_facture"];
$ligne->fournisseur = $_POST["fournisseur"];
$ligne->commercial = $_POST["commercial"];
$ligne->concurrent = $_POST["concurrent"];
$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%">Client</td><td colspan="2">';
print '<select name="client_comm">';
$sql = "SELECT idp, nom, ville 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] . " (".$row[2].")";
$i++;
}
}
$db->free();
}
print '</select></td></tr>';
print '<tr><td width="20%">Numéro</td><td><input name="numero" size="12" value=""></td></tr>';
print '<tr><td width="20%">Client (Agence/Filiale)</td><td colspan="2">';
print '<select name="client">';
$sql = "SELECT idp, nom, ville 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] . " (".$row[2].")";
$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, ville 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] . " (".$row[2].")";
$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 LMN</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");
$hselected = $h;
$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');
$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">';
$client_comm = new Societe($db, $ligne->client_comm_id);
$client_comm->fetch($ligne->client_comm_id);
print '<tr><td width="20%">Client</td><td colspan="2">';
print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$client_comm->id.'">';
print $client_comm->nom.'</a> '.$client_comm->code_client;
print '</td></tr>';
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 (Agence/Filiale)</td><td colspan="2">';
print $client->nom.'<br />';
print $client->cp . " " .$client->ville;
print '</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/fiche.php?socid=';
print $client_facture->id.'">';
print $client_facture->nom.'</a><br />';
print $client_facture->cp . " " .$client_facture->ville;
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>';
$commercial = new User($db, $ligne->commercial_id);
$commercial->fetch();
print '<tr><td width="20%">Commercial</td>';
print '<td colspan="2">'.$commercial->fullname.'</td></tr>';
print '<tr><td width="20%">Fournisseur précédent</td>';
print '<td colspan="2">'.$ligne->print_concurrent_nom().'</td></tr>';
print '<tr><td width="20%">Statut</td><td colspan="2">';
print '<img src="./graph'.$ligne->statut.'.png">&nbsp;';
print $ligne->statuts[$ligne->statut];
print '</td></tr>';
print '<tr><td width="20%">Communications</td><td colspan="2">';
print '<a href="communications.php?ligne='.$ligne->numero.'">liste</a>';
print '</td></tr>';
print '<tr><td width="20%">Factures</td><td colspan="2">';
print '<a href="'.DOL_URL_ROOT.'/telephonie/facture/liste.php?search_ligne='.$ligne->numero.'">liste</a>';
print '</td></tr>';
/* Contacts */
$sql = "SELECT c.idp, c.name, c.firstname, c.email ";
$sql .= "FROM ".MAIN_DB_PREFIX."socpeople as c";
$sql .= ",".MAIN_DB_PREFIX."telephonie_contact_facture as cf";
$sql .= " WHERE c.idp = cf.fk_contact AND cf.fk_ligne = ".$ligne->id." 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 '<tr><td valign="top" width="20%">Contact facture '.$i.'</td>';
print '<td valign="top" colspan="2">'.$row[1] . " " . $row[2] . " &lt;".$row[3]."&gt;</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>";
}
/*
* Edition
*
*
*
*/
if ($_GET["action"] == 'edit' || $action == 're-edit')
{
$h=0;
$head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/fiche.php?id=".$ligne->id;
$head[$h][1] = $langs->trans("Ligne");
$hselected = $h;
$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');
$h++;
dolibarr_fiche_head($head, $hselected, 'Ligne : '.$ligne->numero);
print_fiche_titre('Edition de la ligne', $mesg);
print "<form action=\"fiche.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%">Client</td><td colspan="2">';
print '<select name="client_comm">';
$sql = "SELECT idp, nom, ville 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] .'"';
if ($row[0] == $ligne->client_comm_id)
{
print " SELECTED";
}
print '>'.$row[1]. " (".$row[2].")";
$i++;
}
}
$db->free();
}
print '</select></td></tr>';
print '<tr><td width="20%">Numéro</td><td><input name="numero" size="12" value="'.$ligne->numero.'"></td></tr>';
print '<tr><td width="20%">Client (Agence/Filiale)</td><td colspan="2">';
print '<select name="client">';
$sql = "SELECT idp, nom, ville 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] .'"';
if ($row[0] == $ligne->client_id)
{
print " SELECTED";
}
print '>'.$row[1]. " (".$row[2].")";
$i++;
}
}
$db->free();
}
print '</select></td></tr>';
print '<tr><td width="20%">Client à facturer</td><td colspan="2">'."\n";
print '<select name="client_facture">'."\n";
$sql = "SELECT idp, nom,ville 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] .'"';
if ($row[0] == $ligne->client_facture_id)
{
print " SELECTED";
}
print '>'.$row[1]. " (".$row[2].")";
$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] .'"';
if ($row[0] == $ligne->fournisseur_id)
{
print " SELECTED";
}
print '>'.$row[1];
$i++;
}
}
$db->free();
}
print '</select></td></tr>';
print "\n".'<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] .'"';
if ($row[0] == $ligne->commercial_id)
{
print " SELECTED";
}
print '>'.$row[1]." ".$row[2];
$i++;
}
}
$db->free();
}
print '</select></td></tr>';
/*
* Commercial
*/
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 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].'"';
if ($row[0] == $ligne->concurrent_id)
{
print " SELECTED";
}
print '>'.$row[1];
$i++;
}
}
$db->free();
}
print '</select></td></tr>'."\n";
/*
*
*
*/
print '<tr><td width="20%">Remise LMN</td><td><input name="remise" size="3" maxlength="2" value="'.$ligne->remise.'">&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="Mettre à jour">';
print '<a href="fiche.php?id='.$ligne->id.'">Annuler</a></td></tr>';
print '</table>'."\n";
print '</form>'."\n";
}
/*
* Contact
*
*
*/
if ($_GET["action"] == 'contact')
{
print_fiche_titre('Ajouter un contact', $mesg);
print "<form action=\"fiche.php?id=$ligne->id\" method=\"post\">\n";
print '<input type="hidden" name="action" value="addcontact">';
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
$sql = "SELECT c.idp, c.name, c.firstname, c.email ";
$sql .= "FROM ".MAIN_DB_PREFIX."socpeople as c";
$sql .= ",".MAIN_DB_PREFIX."telephonie_contact_facture as cf";
$sql .= " WHERE c.idp = cf.fk_contact AND cf.fk_ligne = ".$ligne->id." 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 '<tr><td valign="top" width="20%">Contact facture '.$i.'</td>';
print '<td valign="top">'.$row[1] . " " . $row[2] . " &lt;".$row[3]."&gt;";
print '</td><td>';
print '<a href="fiche.php?id='.$ligne->id.'&amp;action=delcontact&amp;contact_id='.$row[0].'">';
print img_delete();
print "</a></td></tr>";
$i++;
}
}
$db->free();
}
else
{
print $sql;
}
print '<tr><td valign="top" width="20%">Contact</td><td valign="top" colspan="2">';
$sql = "SELECT idp, name, firstname, email FROM ".MAIN_DB_PREFIX."socpeople WHERE fk_soc = ".$ligne->client_facture_id." ORDER BY name ";
if ( $db->query( $sql) )
{
print '<select name="contact_id">';
$num = $db->num_rows();
if ( $num > 0 )
{
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row($i);
print '<option value="'.$row[0] .'"';
print '>'.$row[1] . " " . $row[2] . " &lt;".$row[3]."&gt;";
$i++;
}
}
$db->free();
print '</select>';
}
else
{
print $sql;
}
print '<p>Contact auquel est envoyé la facture par email</p></td></tr>';
print '<tr><td>&nbsp;</td><td>';
if ($num > 0)
{
print '<input type="submit" value="Ajouter">';
}
print '<a href="fiche.php?id='.$ligne->id.'">Annuler</a></td></tr>';
print '</table>';
print '</form>';
}
/*
*
*
*
*/
print '</div>';
}
}
else
{
print "Error";
}
}
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 valign="top">';
print '<form action="fiche.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="fiche.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 '<tr><td colspan="3">Commentaire <input size="30" type="text" name="commentaire"></td></tr>';
print '</table>';
print '</form></td></tr></table>';
}
if ( $user->rights->telephonie->ligne_activer && ( $ligne->statut == 5 || $ligne->statut == 3))
{
/**
* Résiliation demandée
*/
$form = new Form($db);
print '<table class="noborder" cellpadding="2" cellspacing="0" width="100%"><tr><td>';
print '<form action="fiche.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 '<tr><td colspan="3">Commentaire <input size="30" type="text" name="commentaire"></td></tr>';
print '</table>';
print '</form></td><td>';
print '&nbsp;</td></tr></table>';
}
if ( $user->rights->telephonie->ligne_activer && $ligne->statut == 6)
{
/**
* A commander
*/
$form = new Form($db);
print '<table class="noborder" cellpadding="2" cellspacing="0" width="100%"><tr><td>';
print '<form action="fiche.php?id='.$ligne->id.'&amp;action=acommander" method="post">';
print '<table class="noborder" cellpadding="2" cellspacing="0">';
print '<tr class="liste_titre"><td colspan="2">Commander la ligne</td><td>';
print '<tr><td>Date</td><td>';
print $form->select_date();
print '</td>';
print '<td colspan="2"><input type="submit" name="Commander"></td></tr>';
print '<tr><td colspan="3">Commentaire <input size="30" type="text" name="commentaire"></td></tr>';
print '</table>';
print '</form></td><td>';
print '&nbsp;</td></tr></table>';
}
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
print "\n<br>\n<div class=\"tabsAction\">\n";
if ($_GET["action"] == '')
{
if ( $user->rights->telephonie->ligne_activer && $ligne->statut == 3)
{
print "<a class=\"tabAction\" href=\"fiche.php?action=resilier&amp;id=$ligne->id\">".$langs->trans("Resilier")."</a>";
}
if ( $user->rights->telephonie->ligne_activer && $ligne->statut == 4)
{
print "<a class=\"tabAction\" href=\"fiche.php?action=annuleresilier&amp;id=$ligne->id\">".$langs->trans("Annuler la demande de résiliation")."</a>";
}
print "<a class=\"tabAction\" href=\"fiche.php?action=contact&amp;id=$ligne->id\">".$langs->trans("Contact")."</a>";
print "<a class=\"tabAction\" href=\"fiche.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>");
?>

View File

@ -0,0 +1,201 @@
<?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');
/*
* 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">';
print '<form method="GET" action="'.DOL_URL_ROOT.'/telephonie/ligne/liste.php">';
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre"><td>Recherche ligne</td>';
print "</tr>\n";
print "<tr $bc[1]>";
print '<td>Numéro <input name="search_ligne" size="12"></td></tr>';
print '</table>';
print '<br />';
$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 '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre"><td>Lignes Statuts</td><td valign="center">Nb</td><td>&nbsp;</td>';
print "</tr>\n";
$var=True;
while ($i < min($num,$conf->liste_limit))
{
$obj = $db->fetch_object($i);
$values[$obj->statut] = $obj->cc;
$i++;
}
foreach ($ligne->statuts as $key => $statut)
{
$var=!$var;
print "<tr $bc[$var]>";
print "<td>".$statut."</td>\n";
print "<td>".$values[$key]."</td>\n";
print '<td><a href="'.DOL_URL_ROOT.'/telephonie/ligne/liste.php?statut='.$key.'"><img border="0" src="./graph'.$key.'.png"></a></td>';
print "</tr>\n";
}
print "</table>";
$db->free();
}
else
{
print $db->error() . ' ' . $sql;
}
print '<br />';
$sql = "SELECT distinct f.nom as fournisseur, count(*) as cc";
$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 .= " WHERE l.fk_soc = s.idp AND l.fk_fournisseur = f.rowid";
$sql .= " GROUP BY f.nom";
if ($db->query($sql))
{
$num = $db->num_rows();
$i = 0;
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre"><td>Fournisseur</td><td valign="center">Nb</td>';
print "</tr>\n";
$var=True;
while ($i < $num)
{
$obj = $db->fetch_object($i);
$var=!$var;
print "<tr $bc[$var]>";
print "<td>".$obj->fournisseur."</td>\n";
print "<td>".$obj->cc."</td>\n";
print "</tr>\n";
$i++;
}
print "</table>";
$db->free();
}
else
{
print $db->error() . ' ' . $sql;
}
/*
* Concurrents
*
*/
print '<br />';
$sql = "SELECT distinct c.nom as concurrent, count(*) as cc";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_concurrents as c,".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
$sql .= " WHERE l.fk_concurrent = c.rowid";
$sql .= " GROUP BY c.nom";
if ($db->query($sql))
{
$num = $db->num_rows();
$i = 0;
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre"><td>Concurrents</td><td valign="center">Nb</td>';
print "</tr>\n";
$var=True;
while ($i < $num)
{
$obj = $db->fetch_object($i);
$var=!$var;
print "<tr $bc[$var]>";
print "<td>".$obj->concurrent."</td>\n";
print "<td>".$obj->cc."</td>\n";
print "</tr>\n";
$i++;
}
print "</table>";
$db->free();
}
else
{
print $db->error() . ' ' . $sql;
}
print '</td>';
print '</td><td valign="top" width="70%" rowspan="3">';
print '<img src="./graphactive.php"><br /><br />';
print '<img src="./graphstat.php"><br /><br />';
print '<img src="./graphconcurrent.php">';
print '</td></tr>';
print '</table>';
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
?>

View File

@ -0,0 +1,179 @@
<?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"];
llxHeader('','Telephonie - Ligne - Liste');
/*
* Sécurité accés client
*/
if ($user->societe_id > 0)
{
$action = '';
$socidp = $user->societe_id;
}
if ($sortorder == "") {
$sortorder="ASC";
}
if ($sortfield == "") {
$sortfield="l.statut";
}
/*
* Recherche
*
*
*/
if ($page == -1) { $page = 0 ; }
$offset = $conf->liste_limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
/*
* Mode Liste
*
*
*
*/
$sql = "SELECT s.idp as socidp, sf.idp as sfidp, sf.nom as nom_facture,s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, l.remise";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
$sql .= " , ".MAIN_DB_PREFIX."societe as sf";
$sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f";
$sql .= " WHERE l.fk_soc = s.idp AND l.fk_fournisseur = f.rowid";
$sql .= " AND l.fk_soc_facture = sf.idp";
if ($_GET["search_ligne"])
{
$sel =urldecode($_GET["search_ligne"]);
$sel = ereg_replace("\.","",$sel);
$sel = ereg_replace(" ","",$sel);
$sql .= " AND l.ligne LIKE '%".$sel."%'";
}
if ($_GET["search_client"])
{
$sel =urldecode($_GET["search_client"]);
$sql .= " AND s.nom LIKE '%".$sel."%'";
}
if ($_GET["search_client_facture"])
{
$sel =urldecode($_GET["search_client_facture"]);
$sql .= " AND sf.nom LIKE '%".$sel."%'";
}
if (strlen($_GET["statut"]))
{
$sql .= " AND l.statut = ".$_GET["statut"];
}
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows();
$i = 0;
$urladd= "&amp;statut=".$_GET["statut"];
print_barre_liste("Lignes", $page, "liste.php", $urladd, $sortfield, $sortorder, '', $num);
print"\n<!-- debut table -->\n";
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_liste_field_titre("Client (Agence/Filiale)","liste.php","s.nom");
print '<td>Client facturé</td>';
print '<td align="center">Statut</td>';
print_liste_field_titre("Remise LMN","liste.php","l.remise","","",' align="center"');
print '<td>Fournisseur</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="10"></td>';
print '<td><input type="text" name="search_client" value="'. $_GET["search_client"].'" size="10"></td>';
print '<td><input type="text" name="search_client_facture" value="'. $_GET["search_client_facture"].'" size="10"></td>';
print '<td><input type="submit" value="Chercher"></td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '</form>';
print '</tr>';
$var=True;
$ligne = new LigneTel($db);
while ($i < min($num,$conf->liste_limit))
{
$obj = $db->fetch_object($i);
$var=!$var;
print "<tr $bc[$var]><td>";
print '<img src="./graph'.$obj->statut.'.png">&nbsp;';
print '<a href="'.DOL_URL_ROOT.'/telephonie/ligne/fiche.php?id='.$obj->rowid.'">';
print img_file();
print '</a>&nbsp;';
print '<a href="fiche.php?id='.$obj->rowid.'">'.dolibarr_print_phone($obj->ligne)."</a></td>\n";
print '<td><a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->socidp.'">'.$obj->nom.'</a></td>';
print '<td><a href="'.DOL_URL_ROOT.'/soc.php?socid='.$obj->sfidp.'">'.$obj->nom_facture.'</a></td>';
print '<td align="center">'.$ligne->statuts[$obj->statut]."</td>\n";
print '<td align="center">'.$obj->remise." %</td>\n";
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,159 @@
<?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"];
llxHeader('','Telephonie - Ligne - Liste');
/*
* Sécurité accés client
*/
if ($user->societe_id > 0)
{
$action = '';
$socidp = $user->societe_id;
}
if ($sortorder == "") {
$sortorder="ASC";
}
if ($sortfield == "") {
$sortfield="l.date_commande";
}
/*
* Recherche
*
*
*/
if ($page == -1) { $page = 0 ; }
$offset = $conf->liste_limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
/*
* Mode Liste
*
*
*
*/
$sql = "SELECT s.idp as socidp, l.date_commande, s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, l.remise";
$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 .= " WHERE l.statut = 2 AND l.fk_soc = s.idp AND l.fk_fournisseur = f.rowid";
if ($_GET["search_ligne"])
{
$sel =urldecode($_GET["search_ligne"]);
$sel = ereg_replace("\.","",$sel);
$sel = ereg_replace(" ","",$sel);
$sql .= " AND l.ligne LIKE '%".$sel."%'";
}
if ($_GET["search_client"])
{
$sel =urldecode($_GET["search_client"]);
$sql .= " AND s.nom LIKE '%".$sel."%'";
}
$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("Lignes", $page, "listecommande.php", "", $sortfield, $sortorder, '', $num);
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">';
print_liste_field_titre("Ligne","listecommande.php","l.ligne");
print_liste_field_titre("Client (Agence/Filiale)","listecommande.php","s.nom");
print '<td align="center">Statut</td>';
print_liste_field_titre("Remise LMN","listecommande.php","l.remise",'','',' align="center"');
print '<td>Fournisseur</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
print '<form action="listecommande.php" method="GET">';
print '<td><input type="text" name="search_ligne" value="'. $_GET["search_ligne"].'" size="12"></td>'; print '<td><input type="text" name="search_client" value="'. $_GET["search_client"].'" size="20"></td>';
print '<td><input type="submit" value="Chercher"></td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '</form>';
print '</tr>';
$var=True;
$ligne = new LigneTel($db);
while ($i < min($num,$conf->liste_limit))
{
$obj = $db->fetch_object($i);
$var=!$var;
print "<tr $bc[$var]><td>";
print '<img src="./graph'.$obj->statut.'.png">&nbsp;';
print '<a href="'.DOL_URL_ROOT.'/telephonie/ligne/fiche.php?id='.$obj->rowid.'">';
print img_file();
print '</a>&nbsp;';
print '<a href="fiche.php?id='.$obj->rowid.'">'.dolibarr_print_phone($obj->ligne)."</a></td>\n";
print '<td><a href="'.DOL_URL_ROOT.'/soc.php?socid='.$obj->socidp.'">'.$obj->nom.'</a></td>';
print '<td align="center">'.$obj->date_commande."</td>\n";
print '<td align="center">'.$obj->remise." %</td>\n";
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,68 @@
<?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");
$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_submenu(DOL_URL_ROOT."/telephonie/ligne/liste.php", "Liste");
$menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/fiche.php?action=create", "Nouvelle ligne");
$menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/listecommande.php", "En commande");
$menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/communications.php", "Communications");
$menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/groupe.php", "Groupes");
$menu->add_submenu(DOL_URL_ROOT."/telephonie/ligne/numdata.php", "Numéros data");
$menu->add(DOL_URL_ROOT."/telephonie/ligne/commande/", "Commandes");
$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");
$menu->add(DOL_URL_ROOT."/telephonie/statca/", "Chiffre d'affaire");
left_menu($menu->liste);
}
?>

View File

@ -0,0 +1,153 @@
<?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"];
llxHeader();
if ($_GET["type"] == '')
{
$_GET["type"] = 'achat';
}
/*
* Sécurité accés client
*/
if ($user->societe_id > 0)
{
$action = '';
$socidp = $user->societe_id;
}
if ($sortorder == "")
{
$sortorder="ASC";
}
if ($sortfield == "")
{
$sortfield="libelle";
}
/*
* 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 distinct(t.libelle) as libelle, temporel ,t.fixe";
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_vente as t";
$sql .= " WHERE 1=1";
if ($_GET["search_libelle"])
{
$sqlc .=" AND t.libelle LIKE '%".$_GET["search_libelle"]."%'";
}
$sql = $sql . $sqlc . " 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("Tarifs à la vente", $page, "index.php", "&type=".$_GET["type"], $sortfield, $sortorder, '', $num);
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">';
print_liste_field_titre("Destination","index.php","libelle", "&type=".$_GET["type"]);
print_liste_field_titre("Coût / min","index.php","temporel", "&type=".$_GET["type"]);
print "<td>Coût fixe</td>";
print "</tr>\n";
print '<tr class="liste_titre">';
print '<form action="index.php" method="GET">';
print '<input type="hidden" name="type" value="'.$_GET["type"].'">';
print '<td><input type="text" name="search_libelle" size="20" value="'.$_GET["search_libelle"].'"></td>';
print '<td>&nbsp;</td>';
print '<td><input type="submit"></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>".$obj->libelle."</td>\n";
print "<td>".sprintf("%01.4f",$obj->temporel)."</td>\n";
print "<td>".sprintf("%01.4f",$obj->fixe)."</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,68 @@
<?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");
$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_submenu(DOL_URL_ROOT."/telephonie/tarifs/achat.php", "Achat");
$menu->add_submenu(DOL_URL_ROOT."/telephonie/tarifs/prefix.php", "Prefix");
/*
$menu->add_submenu(DOL_URL_ROOT."/telephonie/tarifs/liste.php?type=achat", "Achat");
*/
$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(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);
}
?>