/[phpcompta]/phpcompta/html/jrn_search.php
ViewVC logotype

Diff of /phpcompta/html/jrn_search.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.21 by stanpinte, Mon Jul 4 17:58:50 2005 UTC revision 1.22 by sparkyx, Thu Oct 27 13:36:55 2005 UTC
# Line 18  Line 18 
18  */  */
19  // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr  // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
20  /* $Revision$ */  /* $Revision$ */
21  include_once ("ac_common.php");  require_once ("ac_common.php");
22  include_once ("postgres.php");  require_once ("postgres.php");
23    require_once("user_common.php");
24  /* Admin. Dossier */  /* Admin. Dossier */
25  $rep=DbConnect();  $rep=DbConnect();
26  include_once ("class_user.php");  include_once ("class_user.php");
# Line 57  $condition=""; Line 58  $condition="";
58  $part=" where ";  $part=" where ";
59  $cn=DbConnect($_SESSION['g_dossier']);  $cn=DbConnect($_SESSION['g_dossier']);
60  // if search then build the condition  // if search then build the condition
61  if ( isset ($_POST["search"]) ) {  if ( isset ($_GET["search"]) ) {
62    $c1=0;    $c1=0;
63    foreach( $HTTP_POST_VARS as $key=>$element){    foreach( $_GET as $key=>$element){
64      echo_debug(__FILE__,__LINE__,"$key = $element");      echo_debug(__FILE__,__LINE__,"$key = $element");
65      ${"$key"}=$element;      ${"$key"}=$element;
66    }    }
# Line 100  if ( $User->admin != 1 ) { Line 101  if ( $User->admin != 1 ) {
101  ?>  ?>
102  <div style="font-size:11px;">  <div style="font-size:11px;">
103  <?  <?
104  echo '<FORM ACTION="jrn_search.php" METHOD="POST">';  echo '<FORM ACTION="jrn_search.php" METHOD="GET">';
105  echo '<TABLE>';  echo '<TABLE>';
106  echo '<TR>';  echo '<TR>';
107  if ( ! isset ($p_date)) $p_date="";  if ( ! isset ($p_date)) $p_date="";
# Line 131  echo '<INPUT TYPE="submit" name="search" Line 132  echo '<INPUT TYPE="submit" name="search"
132  echo '</FORM>';  echo '</FORM>';
133    
134  // if a search is asked otherwise don't show all the rows  // if a search is asked otherwise don't show all the rows
135  if ( isset ($_POST["search"]) ) {  if ( isset ($_GET["search"]) ) {
136    $Res=ExecSql($cn,"select j_id,to_char(j_date,'DD.MM.YYYY') as j_date,    $sql="select j_id,to_char(j_date,'DD.MM.YYYY') as j_date,
137                   j_montant,j_poste,j_debit,j_tech_per,jr_id,jr_comment,j_grpt,pcm_lib,jr_internal from jrnx inner join                   j_montant,j_poste,j_debit,j_tech_per,jr_id,jr_comment,j_grpt,pcm_lib,jr_internal from jrnx inner join
138                   jrn on jr_grpt_id=j_grpt inner join tmp_pcmn on j_poste=pcm_val ".                   jrn on jr_grpt_id=j_grpt inner join tmp_pcmn on j_poste=pcm_val ".
139                 " inner join user_sec_jrn on uj_jrn_id=j_jrn_def".      " inner join user_sec_jrn on uj_jrn_id=j_jrn_def".
140                 $condition." order by jr_date,jr_id,j_debit desc");      $condition." order by jr_date,jr_id,j_debit desc";
141      $Res=ExecSql($cn,$sql);
142    
143    $MaxLine=pg_NumRows($Res);    $MaxLine=pg_NumRows($Res);
144    if ( $MaxLine==0) {    $offset=(isset($_GET['offset']))?$_GET['offset']:0;
145      html_page_stop();    $limit=$_SESSION['g_pagesize'];
146      return;    $sql_limit="";
147    }    $sql_offset="";
148      if ( $limit != -1) {
149        $page=(isset($_GET['page']))?$_GET['page']:0;
150        $sql_limit=" LIMIT $limit ";
151        $sql_offset=" OFFSET $offset ";
152        $bar=jrn_navigation_bar($offset,$MaxLine,$limit,$page);
153    
154      }
155      $sql.=$sql_limit.$sql_offset;
156       if ( $MaxLine==0) {
157         html_page_stop();
158         return;
159       }
160      $Res=ExecSql($cn,$sql);
161      $MaxLine=pg_NumRows($Res);
162    
163    $col_vide="<TD></TD>";    $col_vide="<TD></TD>";
164      echo $bar;
165    echo '<TABLE ALIGN="center" BORDER="0" CELLSPACING="O">';    echo '<TABLE ALIGN="center" BORDER="0" CELLSPACING="O">';
166    $l_id="";    $l_id="";
167    if ( $MaxLine > 250 ) {  //   if ( $MaxLine > 250 ) {
168      echo "Trop de lignes redéfinir la recherche";  //     echo "Trop de lignes redéfinir la recherche";
169      html_page_stop();  //     html_page_stop();
170      return;  //     return;
171    }  //   }
172    for ( $i=0; $i < $MaxLine; $i++) {    for ( $i=0; $i < $MaxLine; $i++) {
173      $l_line=pg_fetch_array($Res,$i);      $l_line=pg_fetch_array($Res,$i);
174      if ( $l_id == $l_line['j_grpt'] ) {      if ( $l_id == $l_line['j_grpt'] ) {
# Line 203  if ( isset ($_POST["search"]) ) { Line 221  if ( isset ($_POST["search"]) ) {
221    }    }
222        
223    echo '</TABLE>';    echo '</TABLE>';
224      echo $bar;
225  }// if $_POST [search]  }// if $_POST [search]
226  ?>  ?>
227  </div>  </div>

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26