noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
search.inc.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 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
00024 require_once('class_dossier.php');
00025 include_once("ac_common.php");
00026 require_once('class_acc_ledger.php');
00027 
00028 
00029 $gDossier=dossier::id();
00030 
00031 require_once('class_database.php');
00032 /* Admin. Dossier */
00033 
00034 $cn=new Database($gDossier);
00035 include_once ('class_user.php');
00036 // display a search box
00037 
00038 
00039 $base=basename($_SERVER['SCRIPT_NAME']);
00040 $inside=false;
00041 $ledger=new Acc_Ledger($cn,0);
00042 $ledger->type='ALL';
00043 if (isset($_GET['amount_id']))
00044 {
00045         put_global(array(
00046                                 array("key"=>'amount_min','value'=>$_GET['amount_id']),
00047                                 array("key"=>'amount_max','value'=>$_GET['amount_id'])
00048                                 ));
00049 }
00050 
00051 $search_box=$ledger->search_form('ALL',1,'search_op');
00052 
00053 if ($base == 'recherche.php' || $base == 'do.php')
00054         {
00055         echo '<div class="content" >';
00056         echo     '<form method="GET">';
00057         }
00058         else
00059         {
00060                 $div='search_op';
00061                 $action="";
00062                 $callback="";
00063                 require 'template/search_top.php';
00064                 echo '<form name="search_form_ajx" id="search_form_ajx" onsubmit="search_operation(this);return false">';
00065                 echo HtmlInput::get_to_hidden(array('ctlc','ledger'));
00066                 $inside=true;
00067         }
00068 
00069 echo $search_box;
00070 echo HtmlInput::submit("viewsearch",_("Recherche"));
00071 echo HtmlInput::button_close('search_op');
00072 echo '</form>';
00073 
00074 if ( isset ($_GET['amount_min'])&& isset($_GET['amount_max'])&& ($_GET['amount_max']!=0 ||$_GET['amount_min']!=0 ))
00075 {
00076         $_GET['viewsearch']=1;
00077         put_global(
00078                         array
00079                                 (
00080                                 array('key'=>'ledger_type','value'=>'ALL')
00081                                 )
00082 
00083                         );
00084 
00085 }
00086 //-----------------------------------------------------
00087 // Display search result
00088 //-----------------------------------------------------
00089 if ( isset ($_GET['viewsearch']) )
00090 {
00091 
00092     // Navigation bar
00093     $step=MAX_RECONCILE;
00094     $page=(isset($_GET['offset']))?$_GET['page']:1;
00095     $offset=(isset($_GET['offset']))?$_GET['offset']:0;
00096     if (count ($_GET) == 0)
00097         $array=null;
00098     else
00099         $array=$_GET;
00100     $array['p_action']='ALL';
00101         if ( ! isset ($array['date_start']) || ! isset ($array['date_end']))
00102         {
00103                 // get first date of current exercice
00104                 list($array['date_start'],$array['date_end'])=$g_user->get_limit_current_exercice();
00105         }
00106 
00107     list($sql,$where)=$ledger->build_search_sql($array);
00108     // Count nb of line
00109     $max_line=$cn->count_sql($sql);
00110     list($count,$content)=$ledger->list_operation_to_reconcile($sql);
00111     $bar=navigation_bar($offset,$max_line,$step,$page);
00112 
00113    if (! $inside ) {
00114            echo $bar;
00115 
00116    }   else
00117    {
00118             if ($step<$max_line ) echo '<h2 class="notice">Liste limitée à '.$step.' enregistrements. Le nombre d\'enregistrements trouvés est de ' .$max_line.'</h2>';
00119    }
00120         echo '<form method="get" onsubmit="set_reconcile(this);return false">';
00121         echo HtmlInput::submit("upd_rec","Mettre à jour");
00122         echo HtmlInput::get_to_hidden(array('ctlc','amount_id','ledger'));
00123         echo HtmlInput::get_to_hidden(array('l','date_start','date_end','desc','amount_min','amount_max','qcodesearch_op','accounting','unpaid','gDossier','ledger_type'));
00124         echo $content;
00125         echo HtmlInput::submit("upd_rec","Mettre à jour");
00126     if (! $inside )echo $bar;
00127 
00128     if (isset($_GET[$op.'r_jrn'])) {
00129       foreach ($_GET[$op.'r_jrn'] as $k=>$v)
00130                 echo HtmlInput::hidden($op.'r_jrn['.$k.']',$v);
00131     }
00132     echo '</form>';
00133 }
00134 echo '</div>';
00135 ?>
 All Data Structures Namespaces Files Functions Variables Enumerations