From f831be7f03c6070075015462161e6dcdc098b89c Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Fri, 3 Dec 2004 11:00:36 +0000 Subject: [PATCH] Nouveau fichier --- htdocs/telephonie/client/index.php | 175 ++++ htdocs/telephonie/client/liste.php | 145 ++++ htdocs/telephonie/client/pre.inc.php | 63 ++ htdocs/telephonie/facture/index.php | 129 +++ htdocs/telephonie/facture/pre.inc.php | 66 ++ htdocs/telephonie/fournisseurs.php | 108 +++ htdocs/telephonie/ligne/fiche.php | 981 ++++++++++++++++++++++ htdocs/telephonie/ligne/index.php | 201 +++++ htdocs/telephonie/ligne/liste.php | 179 ++++ htdocs/telephonie/ligne/listecommande.php | 159 ++++ htdocs/telephonie/ligne/pre.inc.php | 68 ++ htdocs/telephonie/tarifs/index.php | 153 ++++ htdocs/telephonie/tarifs/pre.inc.php | 68 ++ 13 files changed, 2495 insertions(+) create mode 100644 htdocs/telephonie/client/index.php create mode 100644 htdocs/telephonie/client/liste.php create mode 100644 htdocs/telephonie/client/pre.inc.php create mode 100644 htdocs/telephonie/facture/index.php create mode 100644 htdocs/telephonie/facture/pre.inc.php create mode 100644 htdocs/telephonie/fournisseurs.php create mode 100644 htdocs/telephonie/ligne/fiche.php create mode 100644 htdocs/telephonie/ligne/index.php create mode 100644 htdocs/telephonie/ligne/liste.php create mode 100644 htdocs/telephonie/ligne/listecommande.php create mode 100644 htdocs/telephonie/ligne/pre.inc.php create mode 100644 htdocs/telephonie/tarifs/index.php create mode 100644 htdocs/telephonie/tarifs/pre.inc.php diff --git a/htdocs/telephonie/client/index.php b/htdocs/telephonie/client/index.php new file mode 100644 index 00000000000..b3603e36cb8 --- /dev/null +++ b/htdocs/telephonie/client/index.php @@ -0,0 +1,175 @@ + + * + * 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 ''; + +print ''; + + + +print ''; + + +print '
'; + +print '
'; +print ''; +print ''; +print "\n"; +print ""; +print ''; +print '
Recherche client
Nom
'; + +print '
'; + + +$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 ''; + print ''; + print "\n"; + $var=True; + + $row = $db->fetch_row(0); + + print ""; + print "\n"; + print "\n"; + print "\n"; + + print "
ClientsNb
Nombre de clients".$num."
"; + $db->free(); +} +else +{ + print $db->error() . ' ' . $sql; +} + +print '
'; + +print '
'; + + +/* + * 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 ''; + print ''; + print ''; + print "\n"; + + $var=True; + + $ligne = new LigneTel($db); + + while ($i < $num) + { + $obj = $db->fetch_object($i); + $var=!$var; + + print "'; + print '\n"; + + + print "\n"; + $i++; + } + print "
15 derniers clientsNb Lignes'; + print '
"; + + print ''; + print img_file(); + print ' '; + + print ''.$obj->nom.''.$obj->ligne."
"; + $db->free(); +} +else +{ + print $db->error() . ' ' . $sql; +} + + +print '
'; + + + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/telephonie/client/liste.php b/htdocs/telephonie/client/liste.php new file mode 100644 index 00000000000..a02078ff9ce --- /dev/null +++ b/htdocs/telephonie/client/liste.php @@ -0,0 +1,145 @@ + + * + * 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= "&statut=".$_GET["statut"]; + + print_barre_liste("Clients", $page, "liste.php", $urladd, $sortfield, $sortorder, '', $num); + + print ''; + print ''; + print_liste_field_titre("Client","liste.php","s.nom","","",' width="50%"'); + print ''; + print "\n"; + + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + + + $var=True; + + $ligne = new LigneTel($db); + + while ($i < min($num,$conf->liste_limit)) + { + $obj = $db->fetch_object($i); + $var=!$var; + + print "'; + print '\n"; + + print '\n"; + + + print "\n"; + $i++; + } + print "
Nb Lignes'; + print 'CA
 
"; + + print ''; + print img_file(); + print ' '; + + print ''.$obj->nom.''.$obj->ligne."'.price($obj->ca)." euros HT
"; + $db->free(); +} +else +{ + print $db->error() . ' ' . $sql; +} + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/telephonie/client/pre.inc.php b/htdocs/telephonie/client/pre.inc.php new file mode 100644 index 00000000000..3cd845857e4 --- /dev/null +++ b/htdocs/telephonie/client/pre.inc.php @@ -0,0 +1,63 @@ + + * + * 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); +} + +?> diff --git a/htdocs/telephonie/facture/index.php b/htdocs/telephonie/facture/index.php new file mode 100644 index 00000000000..3a694edf7f8 --- /dev/null +++ b/htdocs/telephonie/facture/index.php @@ -0,0 +1,129 @@ + + * + * 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 ''; + +print ''; + + +print ''; + +print '
'; + +print '
'; +print ''; +print ''; +print "\n"; +print ""; +print ''; +print '
Recherche ligne
Numéro
'; + + +print '
'; + +print ''; + +print '
'; +/* + * + * + */ + +$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 ''; + print ''; + print "\n"; + $var=True; + + while ($i < $num) + { + $row = $db->fetch_row($i); + $var=!$var; + + print ""; + print "\n"; + print "\n"; + print "\n"; + $i++; + } + print "
FacturesNb
".$row[0]."".$row[1]."
"; + $db->free(); +} +else +{ + print $db->error() . ' ' . $sql; +} + + + + +/* + * + * + */ + + +print '
'; + + + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/telephonie/facture/pre.inc.php b/htdocs/telephonie/facture/pre.inc.php new file mode 100644 index 00000000000..6a52f0cc74b --- /dev/null +++ b/htdocs/telephonie/facture/pre.inc.php @@ -0,0 +1,66 @@ + + * + * 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); +} + +?> diff --git a/htdocs/telephonie/fournisseurs.php b/htdocs/telephonie/fournisseurs.php new file mode 100644 index 00000000000..789f6583440 --- /dev/null +++ b/htdocs/telephonie/fournisseurs.php @@ -0,0 +1,108 @@ + + * + * 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 ''; + print ''; + print_liste_field_titre("Société","fournisseurs.php","s.nom"); + print ''; + + print "\n"; + $var=True; + + while ($i < min($num,$conf->liste_limit)) + { + $obj = $db->fetch_object($i); + $var=!$var; + + print ""; + print "\n"; + print "\n"; + print "\n"; + $i++; + } + print "
Email de commande
".$obj->nom."".$obj->email_commande."
"; + $db->free(); +} +else +{ + print $db->error() . ' ' . $sql; +} + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/telephonie/ligne/fiche.php b/htdocs/telephonie/ligne/fiche.php new file mode 100644 index 00000000000..2ee3523df34 --- /dev/null +++ b/htdocs/telephonie/ligne/fiche.php @@ -0,0 +1,981 @@ + + * + * 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 !' . "
" . $entrepot->mesg_error; + } +} + + +llxHeader("","","Fiche Ligne"); + +if ($cancel == $langs->trans("Cancel")) +{ + $action = ''; +} +/* + * Affichage + * + */ +/* + * Création + * + */ + +if ($_GET["action"] == 'create') +{ + $ligne = new LigneTel($db); + print "\n"; + print ''; + print ''."\n"; + print_titre("Nouvelle ligne"); + + print ''; + + print ''; + + + + print ''; + + print ''; + + print ''; + + print ''; + + /* + * Commercial + */ + + print ''; + + /* + * Concurrents + */ + + print ''; + + + print ''; + + print '"; + + print ''; + print '
Client'; + print '
Numéro
Client (Agence/Filiale)'; + print '
Client à facturer'; + print '
Fournisseur'; + print '
Commercial'; + print '
Fournisseur précédent'; + print '
Remise LMN %
Note'; + print '
 
'; + print ''; +} +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 ''; + + $client_comm = new Societe($db, $ligne->client_comm_id); + $client_comm->fetch($ligne->client_comm_id); + + print ''; + + print ''; + print ''; + + $client = new Societe($db, $ligne->client_id); + $client->fetch($ligne->client_id); + + print ''; + + $client_facture = new Societe($db); + $client_facture->fetch($ligne->client_facture_id); + + print ''; + + print ''; + + $commercial = new User($db, $ligne->commercial_id); + $commercial->fetch(); + + print ''; + print ''; + + print ''; + print ''; + + print ''; + + print ''; + + print ''; + + /* 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 ''; + print '"; + $i++; + } + } + $db->free(); + + } + else + { + print $sql; + } + + /* Fin Contacts */ + + if ($_GET["action"] <> 'edit' && 0) + { + print ''; + } + + print "
Client'; + print ''; + + print $client_comm->nom.' '.$client_comm->code_client; + print '
Numéro'.dolibarr_print_phone($ligne->numero).'Facturée : '.$ligne->facturable.'
Client (Agence/Filiale)'; + print $client->nom.'
'; + + print $client->cp . " " .$client->ville; + print '
Client Facturé'; + print $client_facture->nom.'
'; + print $client_facture->cp . " " .$client_facture->ville; + + print '
'; + + if ($ligne->mode_paiement == 'pre') + { + print 'RIB : '.$client_facture->display_rib(); + } + else + { + print 'Paiement par virement'; + } + + print '
Remise LMN'.$ligne->remise.' %
Commercial'.$commercial->fullname.'
Fournisseur précédent'.$ligne->print_concurrent_nom().'
Statut'; + print ' '; + print $ligne->statuts[$ligne->statut]; + print '
Communications'; + print 'liste'; + print '
Factures'; + print 'liste'; + print '
Contact facture '.$i.''.$row[1] . " " . $row[2] . " <".$row[3].">
Point de rentabilité'; + + + print ''; + + print '
"; + } + + + /* + * 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 "
id\" method=\"post\">\n"; + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + + print "\n".''; + + + /* + * Commercial + */ + + print ''."\n"; + /* + * + * + */ + + + print ''; + + + print '"; + + print ''; + print '
Client'; + print '
Numéro
Client (Agence/Filiale)'; + print '
Client à facturer'."\n"; + print '
Fournisseur'; + print '
Commercial'; + print '
Fournisseur précédent'; + print '
Remise LMN %
Note'; + print '
 '; + print 'Annuler
'."\n"; + print '
'."\n"; + + } + + /* + * Contact + * + * + */ + if ($_GET["action"] == 'contact') + { + print_fiche_titre('Ajouter un contact', $mesg); + + print "
id\" method=\"post\">\n"; + print ''; + + print ''; + + + $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 ''; + print '"; + $i++; + } + } + $db->free(); + + } + else + { + print $sql; + } + + + print ''; + + print ''; + print '
Contact facture '.$i.''.$row[1] . " " . $row[2] . " <".$row[3].">"; + print ''; + print ''; + print img_delete(); + print "
Contact'; + + $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 ''; + } + else + { + print $sql; + } + + print '

Contact auquel est envoyé la facture par email

 '; + if ($num > 0) + { + print ''; + } + print 'Annuler
'; + print '
'; + + } + + + /* + * + * + * + */ + + print ''; + + } + } + else + { + print "Error"; + } +} + + + +if ( $user->rights->telephonie->ligne_activer && $ligne->statut == 2) +{ + $form = new Form($db); + + print '
'; + + print '
'; + print ''; + print ''; + print ''; + print '
Activer'; + print '
Date'; + print $form->select_date(); + print '
'; + + print '
'; + + + print '
'; + print ''; + print ''; + print ''; + print ''; + print '
Refuser'; + print '
Date'; + print $form->select_date(); + print '
Commentaire
'; + + print '
'; +} + +if ( $user->rights->telephonie->ligne_activer && ( $ligne->statut == 5 || $ligne->statut == 3)) +{ + /** + * Résiliation demandée + */ + $form = new Form($db); + + print '
'; + + print '
'; + print ''; + print ''; + print ''; + print ''; + print '
Confirmation de la résiliation'; + print '
Date'; + print $form->select_date(); + print '
Commentaire
'; + + print '
'; + + print ' 
'; +} + + +if ( $user->rights->telephonie->ligne_activer && $ligne->statut == 6) +{ + /** + * A commander + */ + $form = new Form($db); + + print '
'; + + print '
'; + print ''; + print ''; + print ''; + print ''; + print '
Commander la ligne'; + print '
Date'; + print $form->select_date(); + print '
Commentaire
'; + + print '
'; + + print ' 
'; +} + +/* ************************************************************************** */ +/* */ +/* Barre d'action */ +/* */ +/* ************************************************************************** */ + +print "\n
\n
\n"; + +if ($_GET["action"] == '') +{ + + if ( $user->rights->telephonie->ligne_activer && $ligne->statut == 3) + { + print "id\">".$langs->trans("Resilier").""; + } + + if ( $user->rights->telephonie->ligne_activer && $ligne->statut == 4) + { + print "id\">".$langs->trans("Annuler la demande de résiliation").""; + } + + print "id\">".$langs->trans("Contact").""; + + print "id\">".$langs->trans("Edit").""; +} + +print "
"; + + + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/telephonie/ligne/index.php b/htdocs/telephonie/ligne/index.php new file mode 100644 index 00000000000..a0ef39bda9f --- /dev/null +++ b/htdocs/telephonie/ligne/index.php @@ -0,0 +1,201 @@ + + * + * 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 ''; + +print ''; + + + +print ''; + + +print '
'; + +print '
'; +print ''; +print ''; +print "\n"; +print ""; +print ''; +print '
Recherche ligne
Numéro
'; + +print '
'; + + +$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 ''; + print ''; + print "\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 ""; + print "\n"; + print "\n"; + print ''; + print "\n"; + } + + print "
Lignes StatutsNb 
".$statut."".$values[$key]."
"; + $db->free(); +} +else +{ + print $db->error() . ' ' . $sql; +} + +print '
'; + +$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 ''; + print ''; + print "\n"; + $var=True; + + while ($i < $num) + { + $obj = $db->fetch_object($i); + $var=!$var; + + print ""; + print "\n"; + print "\n"; + print "\n"; + $i++; + } + print "
FournisseurNb
".$obj->fournisseur."".$obj->cc."
"; + $db->free(); +} +else +{ + print $db->error() . ' ' . $sql; +} +/* + * Concurrents + * + */ + +print '
'; + +$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 ''; + print ''; + print "\n"; + $var=True; + + while ($i < $num) + { + $obj = $db->fetch_object($i); + $var=!$var; + + print ""; + print "\n"; + print "\n"; + print "\n"; + $i++; + } + print "
ConcurrentsNb
".$obj->concurrent."".$obj->cc."
"; + $db->free(); +} +else +{ + print $db->error() . ' ' . $sql; +} + + +print '
'; + +print '

'; +print '

'; +print ''; + +print '
'; + + + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/telephonie/ligne/liste.php b/htdocs/telephonie/ligne/liste.php new file mode 100644 index 00000000000..3580dfb7355 --- /dev/null +++ b/htdocs/telephonie/ligne/liste.php @@ -0,0 +1,179 @@ + + * + * 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= "&statut=".$_GET["statut"]; + + print_barre_liste("Lignes", $page, "liste.php", $urladd, $sortfield, $sortorder, '', $num); + print"\n\n"; + print ''; + print ''; + + print_liste_field_titre("Ligne","liste.php","l.ligne"); + print_liste_field_titre("Client (Agence/Filiale)","liste.php","s.nom"); + + print ''; + print ''; + + print_liste_field_titre("Remise LMN","liste.php","l.remise","","",' align="center"'); + + print ''; + + print "\n"; + + print ''; + print ''; + print ''; + print ''; + print ''; + + print ''; + + + print ''; + print ''; + + print ''; + print ''; + + + $var=True; + + $ligne = new LigneTel($db); + + while ($i < min($num,$conf->liste_limit)) + { + $obj = $db->fetch_object($i); + $var=!$var; + + print "\n"; + + print ''; + print ''; + + print '\n"; + + print '\n"; + print "\n"; + print "\n"; + $i++; + } + print "
Client facturéStatutFournisseur
  
"; + + print ' '; + + print ''; + print img_file(); + print ' '; + + print ''.dolibarr_print_phone($obj->ligne)."'.$obj->nom.''.$obj->nom_facture.''.$ligne->statuts[$obj->statut]."'.$obj->remise." %".$obj->fournisseur."
"; + $db->free(); +} +else +{ + print $db->error() . ' ' . $sql; +} + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/telephonie/ligne/listecommande.php b/htdocs/telephonie/ligne/listecommande.php new file mode 100644 index 00000000000..155552fc140 --- /dev/null +++ b/htdocs/telephonie/ligne/listecommande.php @@ -0,0 +1,159 @@ + + * + * 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 ''; + print ''; + print_liste_field_titre("Ligne","listecommande.php","l.ligne"); + + print_liste_field_titre("Client (Agence/Filiale)","listecommande.php","s.nom"); + + print ''; + + print_liste_field_titre("Remise LMN","listecommande.php","l.remise",'','',' align="center"'); + + print ''; + + print "\n"; + + print ''; + print ''; + print ''; print ''; + + print ''; + + print ''; + print ''; + + print ''; + print ''; + + + $var=True; + + $ligne = new LigneTel($db); + + while ($i < min($num,$conf->liste_limit)) + { + $obj = $db->fetch_object($i); + $var=!$var; + + print "\n"; + print ''; + print '\n"; + + print '\n"; + print "\n"; + print "\n"; + $i++; + } + print "
StatutFournisseur
  
"; + + print ' '; + + print ''; + print img_file(); + + print ' '; + + print ''.dolibarr_print_phone($obj->ligne)."'.$obj->nom.''.$obj->date_commande."'.$obj->remise." %".$obj->fournisseur."
"; + $db->free(); +} +else +{ + print $db->error() . ' ' . $sql; +} + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/telephonie/ligne/pre.inc.php b/htdocs/telephonie/ligne/pre.inc.php new file mode 100644 index 00000000000..25aea825175 --- /dev/null +++ b/htdocs/telephonie/ligne/pre.inc.php @@ -0,0 +1,68 @@ + + * + * 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); +} + +?> diff --git a/htdocs/telephonie/tarifs/index.php b/htdocs/telephonie/tarifs/index.php new file mode 100644 index 00000000000..67d6b369d0f --- /dev/null +++ b/htdocs/telephonie/tarifs/index.php @@ -0,0 +1,153 @@ + + * + * 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 ''; + print ''; + + 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 ""; + print "\n"; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + $var=True; + + while ($i < min($num,$conf->liste_limit)) + { + $obj = $db->fetch_object($i); + $var=!$var; + + print ""; + + print "\n"; + print "\n"; + print "\n"; + print "\n"; + $i++; + } + print "
Coût fixe
 
".$obj->libelle."".sprintf("%01.4f",$obj->temporel)."".sprintf("%01.4f",$obj->fixe)."
"; + $db->free(); +} +else +{ + print $db->error() . ' ' . $sql; +} + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/telephonie/tarifs/pre.inc.php b/htdocs/telephonie/tarifs/pre.inc.php new file mode 100644 index 00000000000..3b6873fc183 --- /dev/null +++ b/htdocs/telephonie/tarifs/pre.inc.php @@ -0,0 +1,68 @@ + + * + * 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); +} + +?>