From 6c5126cd08da52b5cffced15976f3b88b16d6357 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Wed, 28 Mar 2007 12:23:43 +0000 Subject: [PATCH] Suppression page comparatif --- htdocs/telephonie/tarifs/grille-export.php | 185 +-------------------- 1 file changed, 2 insertions(+), 183 deletions(-) diff --git a/htdocs/telephonie/tarifs/grille-export.php b/htdocs/telephonie/tarifs/grille-export.php index 0e1bdd2fe02..648b8312f79 100644 --- a/htdocs/telephonie/tarifs/grille-export.php +++ b/htdocs/telephonie/tarifs/grille-export.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2007 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 @@ -54,7 +54,6 @@ $worksheet->write(2, 1, "Tarif"); $worksheet->write(2, 2, "/min"); $worksheet->write(2, 3, "Fixe"); $worksheet->write(2, 4, "Type", $formatcc); -$worksheet->write(2, 6, "ID", $formatcc); $types = array('NAT','MOB','INT'); @@ -90,8 +89,6 @@ foreach ($types as $type) $worksheet->write($j, 2, $obj->temporel, $num1_format); $worksheet->write($j, 3, $obj->fixe, $num1_format); $worksheet->write($j, 4, $obj->type, $formatcc); - $worksheet->write($j, 6, $obj->rowid, $formatcc); - $j++; $i++; } @@ -105,186 +102,8 @@ foreach ($types as $type) $j++; } -/* - * Comparatif - * - */ - - -$sheetcomp = &$workbook->addworksheet("Comparatif"); - -$sheetcomp->set_column('A:A', 40); -$sheetcomp->set_column('B:F', 10); - - -$num1_format =& $workbook->addformat(array(num_format => '#0.0000')); -$num1_format->set_align('center'); -$num1_format->set_align('vcenter'); - -$num2_format =& $workbook->addformat(array(num_format => '#0.0000')); -$num2_format->set_right(1); -$num2_format->set_align('center'); -$num2_format->set_align('vcenter'); - -$num3_format =& $workbook->addformat(array(num_format => '#0.0000')); -$num3_format->set_left(1); -$num3_format->set_align('center'); -$num3_format->set_align('vcenter'); - - -$formatcc =& $workbook->addformat(); -$formatcc->set_align('center'); -$formatcc->set_align('vcenter'); -$formatcc->set_border(1); - -$sql = "SELECT d.libelle as grille"; -$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d"; -$sql .= " WHERE d.rowid IN (1,".$_GET["id"].")"; -$sql .= " ORDER BY d.rowid ASC"; -$resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - $i = 0; - $a = 1; - - while ($i < $num) - { - $obj = $db->fetch_object($resql); - - $sheetcomp->write(1, $a, $obj->grille); - - $a = $a + 2; - $i++; - } -} -else -{ - print $db->error(); -} - - -$sheetcomp->write(2, 0, "Tarif"); -$sheetcomp->write(2, 1, "/min", $formatcc); -$sheetcomp->write(2, 2, "Fixe", $formatcc); -$sheetcomp->write(2, 3, "/min", $formatcc); -$sheetcomp->write(2, 4, "Fixe", $formatcc); - -$types = array('NAT','MOB','INT'); - -$j = 3; - -foreach ($types as $type) -{ - $tarifs = array(); - - - $sql = "SELECT t.libelle, d.libelle as grille, t.rowid, t.type"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d"; - $sql .= "," . MAIN_DB_PREFIX."telephonie_tarif as t"; - - $sql .= " WHERE d.rowid = '".$_GET["id"]."'"; - $sql .= " AND t.type = '".$type."'"; - $sql .= " ORDER BY d.libelle ASC"; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $obj = $db->fetch_object($i); - - $tid = $obj->rowid; - - $tarifs[$tid][0] = $obj->libelle; - $i++; - } - } - - $sql = "SELECT t.libelle, d.libelle as grille, m.temporel, m.fixe, t.rowid, t.type"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d"; - $sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_montant as m"; - $sql .= "," . MAIN_DB_PREFIX."telephonie_tarif as t"; - $sql .= " WHERE d.rowid = m.fk_tarif_desc"; - $sql .= " AND m.fk_tarif = t.rowid"; - $sql .= " AND d.rowid = 1"; - $sql .= " AND t.type = '".$type."'"; - $sql .= " ORDER BY d.libelle ASC"; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $obj = $db->fetch_object($i); - - $tid = $obj->rowid; - - $tarifs[$tid][1] = $obj->temporel; - $tarifs[$tid][2] = $obj->fixe; - $i++; - } - } - - - $sql = "SELECT t.rowid, m.temporel, m.fixe"; - $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_tarif_grille as d"; - $sql .= "," . MAIN_DB_PREFIX."telephonie_tarif_montant as m"; - $sql .= "," . MAIN_DB_PREFIX."telephonie_tarif as t"; - $sql .= " WHERE d.rowid = m.fk_tarif_desc"; - $sql .= " AND m.fk_tarif = t.rowid"; - $sql .= " AND d.rowid = ".$_GET["id"]; - $sql .= " AND t.type = '".$type."'"; - $sql .= " ORDER BY d.libelle ASC"; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $obj = $db->fetch_object($i); - - $tid = $obj->rowid; - - $tarifs[$tid][3] = $obj->temporel; - $tarifs[$tid][4] = $obj->fixe; - $i++; - } - } - - - foreach($tarifs as $tarif) - { - $sheetcomp->write($j, 0, $tarif[0]); - $sheetcomp->write($j, 1, $tarif[1], $num3_format); - $sheetcomp->write($j, 2, $tarif[2], $num2_format); - $sheetcomp->write($j, 3, $tarif[3], $num1_format); - $sheetcomp->write($j, 4, $tarif[4], $num2_format); - - $j++; - } - - $sheetcomp->write_blank($j, 1, $num3_format); - $sheetcomp->write_blank($j, 2, $num2_format); - $sheetcomp->write_blank($j, 4, $num2_format); - - $j++; -} - - -$sheetcomp->write(0, 0, "Tarifs comparés au ".strftime("%d %m %Y",$date) ); $worksheet->write(0, 0, "Tarifs au ".strftime("%d %m %Y",$date) ); - $workbook->close(); $db->close(); @@ -292,5 +111,5 @@ Header("Content-Disposition: attachment; filename=$fname"); header("Content-Type: application/x-msexcel"); $fh=fopen($fname, "rb"); fpassthru($fh); -//unlink($fname); +@unlink($fname); ?>