From 609ce3ac18287a35fedb5e3eac1171639b67653c Mon Sep 17 00:00:00 2001
From: Rodolphe Quiedeville <rodolphe@quiedeville.org>
Date: Tue, 11 Jan 2005 09:37:35 +0000
Subject: [PATCH] Nouveau fichier

---
 htdocs/compta/prelevement/bons.php     | 137 +++++++++++++++++++++++++
 htdocs/compta/prelevement/demandes.php | 114 ++++++++++++++++++++
 2 files changed, 251 insertions(+)
 create mode 100644 htdocs/compta/prelevement/bons.php
 create mode 100644 htdocs/compta/prelevement/demandes.php

diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php
new file mode 100644
index 00000000000..3388da1b735
--- /dev/null
+++ b/htdocs/compta/prelevement/bons.php
@@ -0,0 +1,137 @@
+<?PHP
+/* Copyright (C) 2005 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$
+ *
+ */
+require("./pre.inc.php");
+
+$page = $_GET["page"];
+$sortorder = $_GET["sortorder"];
+$sortfield = $_GET["sortfield"];
+
+llxHeader('','Telephonie - Ligne - Liste');
+/*
+ * S�curit� acc�s client
+ */
+if ($user->societe_id > 0) 
+{
+  $action = '';
+  $socidp = $user->societe_id;
+}
+
+if ($sortorder == "") {
+  $sortorder="DESC";
+}
+if ($sortfield == "") {
+  $sortfield="p.datec";
+}
+
+/*
+ * Recherche
+ *
+ *
+ */
+
+if ($page == -1) { $page = 0 ; }
+
+$offset = $conf->liste_limit * $page ;
+$pageprev = $page - 1;
+$pagenext = $page + 1;
+
+/*
+ * Mode Liste
+ *
+ *
+ *
+ */
+$sql = "SELECT p.rowid, p.ref, p.amount,".$db->pdate("p.datec")." as datec";
+$sql .= " FROM ".MAIN_DB_PREFIX."prelevement as p";
+
+if ($_GET["search_client"])
+{
+  $sel =urldecode($_GET["search_client"]);
+  $sql .= " AND s.nom LIKE '%".$sel."%'";
+}
+
+$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
+
+$result = $db->query($sql);
+if ($result)
+{
+  $num = $db->num_rows();
+  $i = 0;
+  
+  $urladd= "&amp;statut=".$_GET["statut"];
+
+  print_barre_liste("Pr�l�vements", $page, "bons.php", $urladd, $sortfield, $sortorder, '', $num);
+  print"\n<!-- debut table -->\n";
+  print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
+  print '<tr class="liste_titre">';
+
+  print_liste_field_titre("Bon","bons.php","p.ref");
+  print_liste_field_titre("Date","bons.php","p.datec","","",'align="center"');
+
+  print '<td align="right">Montant</td>';
+
+  print '</tr><tr class="liste_titre">';
+
+  print '<form action="bons.php" method="GET">';
+  print '<td><input type="text" name="search_ligne" value="'. $_GET["search_ligne"].'" size="10"></td>'; 
+  print '<td><input type="submit" value="Chercher"></td>';
+  print '<td>&nbsp;</td>';
+
+
+  print '</form>';
+  print '</tr>';
+
+
+  $var=True;
+
+  while ($i < min($num,$conf->liste_limit))
+    {
+      $obj = $db->fetch_object($i);	
+      $var=!$var;
+
+      print "<tr $bc[$var]><td>";
+
+      print '<a href="'.DOL_URL_ROOT.'/telephonie/ligne/fiche.php?id='.$obj->rowi.'">';
+      print img_file();      
+      print '</a>&nbsp;';
+
+      print '<a href="fiche.php?id='.$obj->rowid.'">'.$obj->ref."</a></td>\n";
+
+      print '<td align="center">'.strftime("%d/%m/%Y",$obj->datec)."</td>\n";
+
+      print '<td align="right">'.price($obj->amount)." euros</td>\n";
+
+      print "</tr>\n";
+      $i++;
+    }
+  print "</table>";
+  $db->free();
+}
+else 
+{
+  print $db->error() . ' ' . $sql;
+}
+
+$db->close();
+
+llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
+?>
diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php
new file mode 100644
index 00000000000..97a41938db6
--- /dev/null
+++ b/htdocs/compta/prelevement/demandes.php
@@ -0,0 +1,114 @@
+<?php
+/* Copyright (C) 2004-2005 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$
+ */
+
+/*!
+  \file       htdocs/compta/prelevement/index.php
+  \brief      Prelevement
+  \version    $Revision$
+*/
+
+require("./pre.inc.php");
+
+require_once DOL_DOCUMENT_ROOT."/includes/modules/modPrelevement.class.php";
+
+if ($user->societe_id > 0)
+{
+  $socidp = $user->societe_id;
+}
+
+llxHeader();
+
+print_titre($langs->trans("Demandes de pr�l�vement � traiter"));
+
+print '<br>';
+
+/*
+ * Demandes en attente
+ *
+ */
+
+
+if ($sortorder == "") $sortorder="DESC";
+
+if ($sortfield == "") $sortfield="f.facnumber";
+
+$sql = "SELECT f.facnumber, f.rowid, s.nom, s.idp";
+$sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s";
+$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
+$sql .= " WHERE s.idp = f.fk_soc";
+$sql .= " AND pfd.traite = 0 AND pfd.fk_facture = f.rowid";
+
+if (strlen(trim($_GET["search_societe"])))
+{
+  $sql .= " AND s.nom LIKE '%".$_GET["search_societe"]."%'";
+}
+
+if ($socidp)
+{
+  $sql .= " AND f.fk_soc = $socidp";
+}
+
+$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
+
+if ( $db->query($sql) )
+{
+  $num = $db->num_rows();
+  $i = 0;
+  
+  if ($num)
+    {
+      print '<table class="noborder" width="100%">';
+      print '<tr class="liste_titre">';
+      print '<td>Facture</td><td>Soci�t�</td></tr>';
+ 
+      print '<form action="demandes.php" method="GET">';
+
+      print '<tr class="liste_titre"><td>-</td><td>';
+      print '<input type="text" name="search_societe" size="12" value="'.$GET["search_societe"].'">&nbsp;';
+      print '<input type="submit" value="Chercher">';
+      print '</form>';
+
+
+
+     $var = True;
+
+      while ($i < min($num,$conf->liste_limit))
+	{
+	  $obj = $db->fetch_object();
+	  $var=!$var;
+	  print '<tr '.$bc[$var].'><td>';
+	  print '<a href="'.DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$obj->rowid.'">'.img_file().'</a>&nbsp;';
+	  print '<a href="'.DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$obj->rowid.'">'.$obj->facnumber.'</a></td>';
+	  print '<td>'.$obj->nom.'</td></tr>';
+	  $i++;
+	}
+      
+      print "</table><br>";
+
+    }
+}
+else
+{
+  dolibarr_print_error($db);
+}  
+
+llxFooter();
+?>
-- 
GitLab