From 6cdc13c60d0d21e9c01fa83c83784bb3e98f01af Mon Sep 17 00:00:00 2001
From: Rodolphe Quiedeville <rodolphe@quiedeville.org>
Date: Wed, 8 Feb 2006 15:49:43 +0000
Subject: [PATCH] Nouveau fichier

---
 .../script/tools/export-adsl-actives.php      | 81 +++++++++++++++++++
 1 file changed, 81 insertions(+)
 create mode 100644 htdocs/telephonie/script/tools/export-adsl-actives.php

diff --git a/htdocs/telephonie/script/tools/export-adsl-actives.php b/htdocs/telephonie/script/tools/export-adsl-actives.php
new file mode 100644
index 00000000000..26730412f33
--- /dev/null
+++ b/htdocs/telephonie/script/tools/export-adsl-actives.php
@@ -0,0 +1,81 @@
+<?PHP
+/* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
+ *
+ * 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$
+ *
+ * V�rifie les lignes ayant le statut d'attente
+ *
+ */
+require ("../../../master.inc.php");
+require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php");
+require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php");
+/*
+ *
+ */
+
+$sql = "SELECT la.numero_ligne, s.nom as nom,  la.prix, t.intitule";
+
+$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_adsl_ligne as la";
+$sql .= " ,  ".MAIN_DB_PREFIX."societe as s";
+$sql .= " ,  ".MAIN_DB_PREFIX."telephonie_adsl_type as t";
+$sql .= " WHERE la.fk_client_facture = s.idp";
+$sql .= " AND t.rowid = la.fk_type";
+
+
+
+$resql = $db->query($sql);
+if ( $resql )
+{
+  $fname = "/tmp/export-adsl-active.xls";
+
+  $workbook = &new writeexcel_workbook($fname);
+	
+  $page = &$workbook->addworksheet("Lignes ADSL");
+		
+  $page->write(0, 0,  "Ligne", $format_titre_agence1);
+  $page->write(0, 1,  "Client", $format_titre);
+  $page->write(0, 2,  "Prix", $format_titre);
+  $page->write(0, 3,  "Type", $format_titre);
+  
+  $fnb =& $workbook->addformat();
+  $fnb->set_align('vcenter');
+  $fnb->set_align('left');
+
+  $i = 1;
+  while ($row = $db->fetch_row($resql))
+    {
+      $xx = $i + 1;
+      
+      $page->write_string($xx, 0,  $row[0], $fnb);
+      $page->write_string($xx, 1,  $row[1], $fnb);
+      $page->write_number($xx, 2,  $row[2], $fnb);
+      $page->write_string($xx, 3,  $row[3], $fnb);
+
+      $i++;
+    }
+
+  $workbook->close();
+}
+
+else
+{
+  print $db->error();
+}
+
+$db->close();
+?>
-- 
GitLab