noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
recherche.php
Go to the documentation of this file.
00001 <?php
00002 /*
00003  *   This file is part of NOALYSS.
00004  *
00005  *   NOALYSS is free software; you can redistribute it and/or modify
00006  *   it under the terms of the GNU General Public License as published by
00007  *   the Free Software Foundation; either version 2 of the License, or
00008  *   (at your option) any later version.
00009  *
00010  *   NOALYSS is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with NOALYSS; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00020 /*! \file
00021  * \brief Search module
00022  */
00023 require_once '../include/constant.php';
00024 require_once('class_dossier.php');
00025 include_once("ac_common.php");
00026 include_once ("constant.php");
00027 require_once('class_acc_ledger.php');
00028 require_once('class_ipopup.php');
00029 html_page_start($_SESSION['g_theme']);
00030 
00031 load_all_script();
00032 
00033 
00034 $gDossier=dossier::id();
00035 
00036 require_once('class_database.php');
00037 /* Admin. Dossier */
00038 
00039 $cn=new Database($gDossier);
00040 include_once ('class_user.php');
00041 global $g_user;
00042 $g_user=new User($cn);
00043 $g_user->Check();
00044 $act=$g_user->check_dossier($gDossier);
00045 // AC CODE = SEARCH
00046 if ($act =='P')
00047 {
00048     redirect("extension.php?".dossier::get(),0);
00049     exit();
00050 }
00051 if ( $act=='X')
00052   {
00053      alert(_('Accès interdit'));
00054      exit();
00055   }
00056 // display a search box
00057 
00058 $ledger=new Acc_Ledger($cn,0);
00059 $ledger->type='ALL';
00060 $search_box=$ledger->search_form('ALL',1);
00061 echo '<div class="content">';
00062 
00063 echo '<form method="GET">';
00064 echo $search_box;
00065 echo HtmlInput::submit("viewsearch",_("Recherche"));
00066 ?>
00067 <input type="button" class="button" onclick="window.close()" value="<?php echo _('Fermer')?>">
00068 
00069 <?php
00070 echo '</form>';
00071 
00072 //-----------------------------------------------------
00073 // Display search result
00074 //-----------------------------------------------------
00075 if ( isset ($_GET['viewsearch']))
00076 {
00077 
00078     // Navigation bar
00079     $step=$_SESSION['g_pagesize'];
00080     $page=(isset($_GET['offset']))?$_GET['page']:1;
00081     $offset=(isset($_GET['offset']))?$_GET['offset']:0;
00082     if (count ($_GET) == 0)
00083         $array=null;
00084     else
00085         $array=$_GET;
00086     $array['p_action']='ALL';
00087     list($sql,$where)=$ledger->build_search_sql($array);
00088     // Count nb of line
00089     $max_line=$cn->count_sql($sql);
00090 
00091     list($count,$a)=$ledger->list_operation($sql,$offset,0);
00092     $bar=navigation_bar($offset,$max_line,$step,$page);
00093 
00094     echo $bar;
00095     echo $a;
00096     echo $bar;
00097     /*
00098      * Export to csv
00099      */
00100     $r=HtmlInput::get_to_hidden(array('l','date_start','date_end','desc','amount_min','amount_max','qcode','accounting','unpaid','gDossier','ledger_type'));
00101     if (isset($_GET['r_jrn'])) {
00102       foreach ($_GET['r_jrn'] as $k=>$v)
00103         $r.=HtmlInput::hidden('r_jrn['.$k.']',$v);
00104     }
00105     echo '<form action="export.php" method="get">';
00106     echo $r;
00107     echo HtmlInput::hidden('act','CSV:histo');
00108     echo HtmlInput::submit('viewsearch','Export vers CSV');
00109     echo HtmlInput::hidden('p_action','ALL');
00110     ?>
00111     <input type="button" class="button" onclick="window.close()" value="<?php echo _('Fermer')?>">
00112 
00113 <?php
00114     echo '</form>';
00115 }
00116 echo '</div>';
00117 ?>
 All Data Structures Namespaces Files Functions Variables Enumerations