diff --git a/htdocs/telephonie/distributeurs/distributeur.php b/htdocs/telephonie/distributeurs/distributeur.php new file mode 100644 index 00000000000..8f42c737c58 --- /dev/null +++ b/htdocs/telephonie/distributeurs/distributeur.php @@ -0,0 +1,131 @@ + + * + * 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"); +require DOL_DOCUMENT_ROOT.'/telephonie/distributeurtel.class.php'; + +if (!$user->rights->telephonie->lire) accessforbidden(); + +llxHeader('','Telephonie - Statistiques - Distributeur'); + +/* + * + */ +$h = 0; + +$head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/index.php'; +$head[$h][1] = "Liste"; +$h++; + +if ($_GET["id"]) +{ + + $distri = new DistributeurTelephonie($db); + $distri->fetch($_GET["id"]); + + $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/distributeur.php?id='.$distri->id; + $head[$h][1] = $distri->nom; + $hselected = $h; + $h++; + + $sql = "SELECT d.nom, d.rowid"; + $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur as d"; + $sql .= " WHERE d.rowid <> ".$distri->id; + $sql .= " ORDER BY d.nom ASC"; + + $resql = $db->query($sql); + + if ($resql) + { + $num = $db->num_rows(); + $i = 0; + $total = 0; + + while ($i < $num) + { + $row = $db->fetch_row($resql); + + $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/distributeur.php?id='.$row[1]; + $head[$h][1] = $row[0]; + $h++; + $i++; + } + } + + + dolibarr_fiche_head($head, $hselected, "Distributeur"); + + print ''; + + print ''; + print '
'; + + print ''; + print ''; + print ''; + + $sql = "SELECT u.firstname, u.name"; + $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; + $sql .= " , ".MAIN_DB_PREFIX."telephonie_distributeur_commerciaux as dc"; + + $sql .= " WHERE u.rowid = dc.fk_user "; + $sql .= " AND dc.fk_distributeur = ".$_GET["id"]; + + $sql .= " ORDER BY u.name ASC"; + + $resql = $db->query($sql); + + if ($resql) + { + $num = $db->num_rows(); + $i = 0; + $total = 0; + + while ($i < $num) + { + $row = $db->fetch_row($i); + + $var=!$var; + + print ""; + + print ''; + + $i++; + } + $db->free(); + } + else + { + print $db->error() . ' ' . $sql; + } + print '
Prénom Nom
'.$row[0].' '.$row[1].'

'; + + + print '
'; + + print '
'; + + $db->close(); +} + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/telephonie/distributeurs/index.php b/htdocs/telephonie/distributeurs/index.php new file mode 100644 index 00000000000..e38e908014c --- /dev/null +++ b/htdocs/telephonie/distributeurs/index.php @@ -0,0 +1,95 @@ + + * + * 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"); + +if (!$user->rights->telephonie->lire) accessforbidden(); + +llxHeader('','Telephonie - Statistiques - Distributeurs'); + +/* + * + * + * + */ + +$h = 0; + +$head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/index.php'; +$head[$h][1] = "Liste"; +$hselected = $h; +$h++; + +dolibarr_fiche_head($head, $hselected, "Distributeurs"); + +print ''; + +print ''; +print '
'; + +print ''; +print ''; +print ''; + +$sql = "SELECT d.nom, d.rowid"; +$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur as d"; + +$sql .= " ORDER BY d.nom ASC"; + +$resql = $db->query($sql); + +if ($resql) +{ + $num = $db->num_rows(); + $i = 0; + $total = 0; + + while ($i < $num) + { + $row = $db->fetch_row($i); + + $var=!$var; + + print ""; + + print ''; + + print ''; + $i++; + } + $db->free(); +} +else +{ + print $db->error() . ' ' . $sql; +} +print '
Distributeur
'.$row[0].'

'; + + + + + +print '
 

'; + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/telephonie/distributeurs/pre.inc.php b/htdocs/telephonie/distributeurs/pre.inc.php new file mode 100644 index 00000000000..cd90393ce9c --- /dev/null +++ b/htdocs/telephonie/distributeurs/pre.inc.php @@ -0,0 +1,75 @@ + + * + * 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(); + + if (TELEPHONIE_MODULE_ADSL == 1) + $menu->add(DOL_URL_ROOT."/telephonie/adsl/", "ADSL"); + + $menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie"); + + if (TELEPHONIE_MODULE_SIMULATION == 1) + { + $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/client/index.php", "Clients"); + + $menu->add(DOL_URL_ROOT."/telephonie/contrat/", "Contrats"); + + $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_submenu(DOL_URL_ROOT."/telephonie/stats/distributeurs/", "Distributeurs"); + $menu->add(DOL_URL_ROOT."/telephonie/tarifs/", "Tarifs"); + + $menu->add(DOL_URL_ROOT."/telephonie/distributeurs/", "Distributeurs"); + + $menu->add(DOL_URL_ROOT."/telephonie/fournisseur/index.php", "Fournisseurs"); + + $menu->add(DOL_URL_ROOT."/telephonie/service/", "Services"); + + $menu->add(DOL_URL_ROOT."/telephonie/ca/", "Chiffre d'affaire"); + + left_menu($menu->liste); +} + +?>