diff --git a/htdocs/telephonie/distributeurs/distributeur.php b/htdocs/telephonie/distributeurs/distributeur.php index 8f42c737c58..e76cfe0fb9c 100644 --- a/htdocs/telephonie/distributeurs/distributeur.php +++ b/htdocs/telephonie/distributeurs/distributeur.php @@ -20,7 +20,7 @@ * */ require("./pre.inc.php"); -require DOL_DOCUMENT_ROOT.'/telephonie/distributeurtel.class.php'; + if (!$user->rights->telephonie->lire) accessforbidden(); @@ -31,13 +31,8 @@ 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"]); @@ -46,36 +41,19 @@ if ($_GET["id"]) $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++; - } - } + $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/commissions.php?id='.$distri->id; + $head[$h][1] = "Commissions"; + $h++; + $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/po.php?id='.$distri->id; + $head[$h][1] = "Prises d'ordre"; + $h++; dolibarr_fiche_head($head, $hselected, "Distributeur"); print ''; - print ''; print '
'; + print '
'; print ''; print ''; @@ -119,8 +97,50 @@ if ($_GET["id"]) print '

'; - print '
'; + print ''; + /* Commissions */ + + print ''; + print ''; + print ''; + + $sql = "SELECT c.date, c.montant"; + $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commission as c"; + + $sql .= " WHERE c.fk_distributeur = ".$_GET["id"]; + + $sql .= " ORDER BY c.date DESC"; + + $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 '
DateMontant
'.$row[0].''.price($row[1]).'

'; + + print '
'; diff --git a/htdocs/telephonie/distributeurs/po.php b/htdocs/telephonie/distributeurs/po.php index 3d8cd393c14..d2223fbe8b4 100644 --- a/htdocs/telephonie/distributeurs/po.php +++ b/htdocs/telephonie/distributeurs/po.php @@ -60,6 +60,10 @@ if ($_GET["id"]) $head[$h][1] = $distri->nom; $h++; + $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/commissions.php?id='.$distri->id; + $head[$h][1] = "Commissions"; + $h++; + $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/po.php?id='.$distri->id; $head[$h][1] = "Prises d'ordre"; $hselected = $h;