From 5f71cfe8fe7be2c605673dbd596231bcfd11966b Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Wed, 4 May 2005 08:59:15 +0000 Subject: [PATCH] Nouveau fichier --- .../sql/llx_telephonie_distributeur.sql | 27 +++ .../stats/distributeurs/commercial.php | 124 ++++++++++++ .../stats/distributeurs/commercialca.php | 78 ++++++++ .../telephonie/stats/distributeurs/index.php | 180 ++++++++++++++++++ .../telephonie/stats/distributeurs/lignes.php | 75 ++++++++ .../stats/distributeurs/pre.inc.php | 42 ++++ 6 files changed, 526 insertions(+) create mode 100644 htdocs/telephonie/sql/llx_telephonie_distributeur.sql create mode 100644 htdocs/telephonie/stats/distributeurs/commercial.php create mode 100644 htdocs/telephonie/stats/distributeurs/commercialca.php create mode 100644 htdocs/telephonie/stats/distributeurs/index.php create mode 100644 htdocs/telephonie/stats/distributeurs/lignes.php create mode 100644 htdocs/telephonie/stats/distributeurs/pre.inc.php diff --git a/htdocs/telephonie/sql/llx_telephonie_distributeur.sql b/htdocs/telephonie/sql/llx_telephonie_distributeur.sql new file mode 100644 index 00000000000..5d13f8ec76e --- /dev/null +++ b/htdocs/telephonie/sql/llx_telephonie_distributeur.sql @@ -0,0 +1,27 @@ +-- ======================================================================== +-- Copyright (C) 2005 Rodolphe Quiedeville +-- +-- 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$ +-- +-- ======================================================================== +-- +create table llx_telephonie_distributeur ( + rowid integer AUTO_INCREMENT PRIMARY KEY, + nom varchar(50) NOT NULL + +)type=innodb; diff --git a/htdocs/telephonie/stats/distributeurs/commercial.php b/htdocs/telephonie/stats/distributeurs/commercial.php new file mode 100644 index 00000000000..73ff223e96c --- /dev/null +++ b/htdocs/telephonie/stats/distributeurs/commercial.php @@ -0,0 +1,124 @@ + + * + * 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/stats/distributeurs/index.php'; +$head[$h][1] = "Global"; +$h++; + +if ($_GET["commid"]) +{ + $comm = new User($db, $_GET["commid"]); + $comm->fetch(); + + $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/commercial.php?commid='.$comm->id; + $head[$h][1] = $comm->fullname; + $hselected = $h; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/commercialca.php?commid='.$comm->id; + $head[$h][1] = "CA"; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/lignes.php?commid='.$comm->id; + $head[$h][1] = "Lignes"; + $h++; + + dolibarr_fiche_head($head, $hselected, "Distributeurs"); + + print ''; + + print ''; + + print '
'; + + print ''; + + print ''; + + $sql = "SELECT count(*) as cc,date_format(date_commande,'%m %Y')"; + $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; + $sql .= " WHERE l.fk_commercial = ".$comm->id; + $sql .= " AND date_commande IS NOT NULL"; + $sql .= " AND l.statut <> 7"; + $sql .= " GROUP BY date_format(date_commande,'%Y/%m') DESC"; + + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows(); + $i = 0; + $datas = array(); + $legends = array(); + + while ($i < $num) + { + $row = $db->fetch_row($i); + $var=!$var; + + print ""; + print ''; + $i++; + } + $db->free(); + } + else + { + print $db->error() . ' ' . $sql; + } + + print '
NomNb Lignes
'; + print $row[2]." ". $row[1].''.$row[0].'
'; + + print '
'; + + print 'Commandes de lignes par semaine

'."\n"; + + print 'Commandes de lignes par semaine

'."\n"; + + print 'Commandes de lignes par semaine

'."\n"; + + print 'Commandes de ligne par mois

'."\n"; + + + + print '
'; + + $db->close(); + +} + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/telephonie/stats/distributeurs/commercialca.php b/htdocs/telephonie/stats/distributeurs/commercialca.php new file mode 100644 index 00000000000..6f2f4a7dc57 --- /dev/null +++ b/htdocs/telephonie/stats/distributeurs/commercialca.php @@ -0,0 +1,78 @@ + + * + * 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/stats/distributeurs/index.php'; +$head[$h][1] = "Global"; +$h++; + +if ($_GET["commid"]) +{ + $comm = new User($db, $_GET["commid"]); + $comm->fetch(); + + $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/commercial.php?commid='.$comm->id; + $head[$h][1] = $comm->fullname; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/commercialca.php?commid='.$comm->id; + $head[$h][1] = "CA"; + $hselected = $h; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/lignes.php?commid='.$comm->id; + $head[$h][1] = "Lignes"; + $h++; + + dolibarr_fiche_head($head, $hselected, "Distributeurs"); + + print ''; + + print ''; + print '
'; + + + print 'Gain mensuel

'."\n"; + + print 'Chiffre d\'affaire mensuel

'."\n"; + + print '
'; + + $db->close(); + +} + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/telephonie/stats/distributeurs/index.php b/htdocs/telephonie/stats/distributeurs/index.php new file mode 100644 index 00000000000..6bf91c799a2 --- /dev/null +++ b/htdocs/telephonie/stats/distributeurs/index.php @@ -0,0 +1,180 @@ + + * + * 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/stats/distributeurs/index.php'; +$head[$h][1] = "Global"; +$hselected = $h; +$h++; + +dolibarr_fiche_head($head, $hselected, "Distributeurs"); + +print ''; + +print ''; + +print ''; +print '
'; + +print ''; +print ''; + +$sql = "SELECT rowid, nom"; +$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_distributeur"; +$sql .= " ORDER BY nom ASC"; + +$resql = $db->query($sql); +if ($resql) +{ + $num = $db->num_rows(); + $i = 0; + while ($i < $num) + { + $row = $db->fetch_row($resql); + + $var=!$var; + + print ""; + + print ''; + + $i++; + } + $db->free(); +} +else +{ + print $db->error() . ' ' . $sql; +} +print '
Nom
'; + print ''.$row[2]." ". $row[1].'

'; + +/* */ + +print ''; +print ''; +print ''; + +$sql = "SELECT count(*) as cc , c.name, c.firstname, c.rowid"; +$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; +$sql .= " , ".MAIN_DB_PREFIX."user as c"; +$sql .= " , ".MAIN_DB_PREFIX."telephonie_distributeur_commerciaux as dc"; +$sql .= " WHERE c.rowid = l.fk_commercial_suiv"; +$sql .= " AND c.rowid = dc.fk_user"; +$sql .= " AND l.statut <> 7"; +$sql .= " GROUP BY c.name ORDER BY cc DESC"; + +$resql = $db->query($sql); +if ($resql) +{ + $num = $db->num_rows(); + $i = 0; + $datas = array(); + $legends = array(); + + while ($i < $num) + { + $row = $db->fetch_row($i); + + $var=!$var; + + print ""; + + print ''; + print ''; + $i++; + } + $db->free(); +} +else +{ + print $db->error() . ' ' . $sql; +} +print '
Lignes suivies
NomNb Lignes 
'; + print ''.$row[2]." ". $row[1].''.$row[0].'Voir

'; + +print ''; +print ''; +print ''; + +$sql = "SELECT count(*) as cc , c.name, c.firstname, c.rowid"; +$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; +$sql .= " , ".MAIN_DB_PREFIX."user as c"; +$sql .= " , ".MAIN_DB_PREFIX."telephonie_distributeur_commerciaux as dc"; +$sql .= " WHERE c.rowid = l.fk_commercial_sign"; +$sql .= " AND c.rowid = dc.fk_user"; +$sql .= " AND l.statut <> 7"; +$sql .= " GROUP BY c.name ORDER BY cc DESC"; + +$resql = $db->query($sql); +if ($resql) +{ + $num = $db->num_rows(); + $i = 0; + $datas = array(); + $legends = array(); + + while ($i < $num) + { + $row = $db->fetch_row($i); + + $var=!$var; + + print ""; + + print ''; + print ''; + $i++; + } + $db->free(); +} +else +{ + print $db->error() . ' ' . $sql; +} +print '
Lignes signées
NomNb Lignes 
'; + print ''.$row[2]." ". $row[1].''.$row[0].'Voir
'; + +print '
'; + + +print '
'; + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/telephonie/stats/distributeurs/lignes.php b/htdocs/telephonie/stats/distributeurs/lignes.php new file mode 100644 index 00000000000..a42c1590190 --- /dev/null +++ b/htdocs/telephonie/stats/distributeurs/lignes.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("./pre.inc.php"); + +if (!$user->rights->telephonie->lire) accessforbidden(); + +llxHeader('','Telephonie - Statistiques - Distributeurs'); + +/* + * + * + * + */ + + +$h = 0; + +$head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/index.php'; +$head[$h][1] = "Global"; +$h++; + +if ($_GET["commid"]) +{ + $comm = new User($db, $_GET["commid"]); + $comm->fetch(); + + $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/commercial.php?commid='.$comm->id; + $head[$h][1] = $comm->fullname; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/commercialca.php?commid='.$comm->id; + $head[$h][1] = "CA"; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/telephonie/stats/distributeurs/lignes.php?commid='.$comm->id; + $head[$h][1] = "Lignes"; + $hselected = $h; + $h++; + + dolibarr_fiche_head($head, $hselected, "Distributeurs"); + + print ''; + + print ''; + print '
'; + + print 'Statuts des lignes

'."\n"; + + print '
'; + + $db->close(); + +} + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?> diff --git a/htdocs/telephonie/stats/distributeurs/pre.inc.php b/htdocs/telephonie/stats/distributeurs/pre.inc.php new file mode 100644 index 00000000000..0113ceba653 --- /dev/null +++ b/htdocs/telephonie/stats/distributeurs/pre.inc.php @@ -0,0 +1,42 @@ + + * + * 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(); + + include "../menus.php"; + + left_menu($menu->liste); +} + +?>