/[phpcompta]/phpcompta/include/user_common.php
ViewVC logotype

Diff of /phpcompta/include/user_common.php

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

revision 1.47 by sparkyx, Sun Oct 23 18:56:16 2005 UTC revision 1.48 by sparkyx, Wed Oct 26 13:18:23 2005 UTC
# Line 219  comment = $p_comment"); Line 219  comment = $p_comment");
219   * return:   * return:
220   *   *
221   */   */
222  function ListJrn($p_cn,$p_jrn,$p_where="",$p_array=null)  function ListJrn($p_cn,$p_jrn,$p_where="",$p_array=null,$p_value=0)
223  {  {
224    
225    include_once("central_inc.php");    include_once("central_inc.php");
226      $limit=($_SESSION['g_pagesize']!=-1)?" LIMIT ".$_SESSION['g_pagesize']:"";
227      $offset=($_SESSION['g_pagesize']!=-1)?" OFFSET ".$p_value:"";
228    if ( $p_array == null ) {    if ( $p_array == null ) {
229     $sql="select jr_id   ,     $sql="select jr_id   ,
230                          jr_montant,                          jr_montant,
# Line 321  function ListJrn($p_cn,$p_jrn,$p_where=" Line 323  function ListJrn($p_cn,$p_jrn,$p_where="
323      }      }
324      $sql.=" order by jr_date_order asc";      $sql.=" order by jr_date_order asc";
325    }// p_array != null    }// p_array != null
326      // Count
327      $count=CountSql($p_cn,$sql);
328      // Add the limit
329      $sql.=$limit.$offset;
330    
331      // Execute SQL stmt
332    $Res=ExecSql($p_cn,$sql);    $Res=ExecSql($p_cn,$sql);
333    $r="";    $r="";
334    $r.=JS_VIEW_JRN_DETAIL;    $r.=JS_VIEW_JRN_DETAIL;
# Line 330  function ListJrn($p_cn,$p_jrn,$p_where=" Line 338  function ListJrn($p_cn,$p_jrn,$p_where="
338    $Max=pg_NumRows($Res);    $Max=pg_NumRows($Res);
339    
340    if ($Max==0) return "No row selected";    if ($Max==0) return "No row selected";
341    
342    $r.="<TABLE width=\"100%\">";    $r.="<TABLE width=\"100%\">";
343    $l_sessid=$_REQUEST['PHPSESSID'];    $l_sessid=$_REQUEST['PHPSESSID'];
344    $r.="<tr class=\"even\">";    $r.="<tr class=\"even\">";
# Line 422  function ListJrn($p_cn,$p_jrn,$p_where=" Line 431  function ListJrn($p_cn,$p_jrn,$p_where="
431          }          }
432  $r.="</table>";  $r.="</table>";
433    
434  return $r;  return array ($count,$r);
435  }  }
436    
437    
438    
439  /* function InsertStockGoods($p_cn,$j_id,$a_good[$i],$a_quant[$i],'c');  /* function InsertStockGoods($p_cn,$j_id,$a_good[$i],$a_quant[$i],'c');
440   **************************************************   **************************************************
441   * Purpose : Insert data into stock_goods,   * Purpose : Insert data into stock_goods,
# Line 439  return $r; Line 451  return $r;
451   * return:   * return:
452   *       none   *       none
453   */   */
   
   
454  function InsertStockGoods($p_cn,$p_j_id,$p_good,$p_quant,$p_type)  function InsertStockGoods($p_cn,$p_j_id,$p_good,$p_quant,$p_type)
455  {  {
456    // Retrieve the good account for stock    // Retrieve the good account for stock
# Line 701  function isValid ($p_cn,$p_grpt_id) { Line 711  function isValid ($p_cn,$p_grpt_id) {
711    
712    
713  }  }
714    
715    /* function  jrn_navigation_bar
716     **************************************************
717     * Purpose :
718     *     Create a navigation_bar (pagesize)
719     *        
720     * parm :
721     *      - p_current first record number
722     *      - p_line total of returned row
723     *      - p_size current g_pagesize
724     *      - p_page number of the page
725     * gen :
726     *      -none
727     * return:
728     *     string
729     */
730    function jrn_navigation_bar($p_offset,$p_line,$p_size,$p_page=1)
731    {
732      // if the pagesize is unlimited return ""
733      // in that case there is no nav. bar
734      if ( $_SESSION['g_pagesize'] == -1 ) return "";
735    
736      // Compute the url
737      $url="";
738      $and="";
739      $get=$_GET;
740      if ( isset ($get) ) {
741        foreach ($get as $name=>$value ) {
742          // we clean the parameter offset, step, page and size
743          if (  ! in_array($name,array('offset','step','page','size'))) {
744            $url.=$and.$name."=".$value;
745            $and="&";
746          }// if
747        }//foreach
748      }// if
749      // compute max of page
750      $nb_page=($p_line-($p_line%$p_size))/$p_size;
751      // if something remains
752      if ( $p_line % $p_size != 0 ) $nb_page+=1;
753      $r="";
754      // previous
755      if ($p_page !=1) {
756        $e=$p_page-1;
757        $step=$_SESSION['g_pagesize'];
758        $offset=($e-1)*$step;
759    
760        $r='<A class="one" href="'.$_SERVER['PHP_SELF']."?".$url."&offset=$offset&step=$step&page=$e&size=$step".'">';
761        $r.="Pr&eacute;c&eacute;dent";
762        $r.="</A>&nbsp;&nbsp;";
763      }
764    
765      // Create the bar
766      for ($e=1;$e<=$nb_page;$e++) {
767        // do not included current page
768        if ( $e != $p_page ) {
769        $step=$_SESSION['g_pagesize'];
770        $offset=($e-1)*$step;
771        $go=sprintf($_SERVER['PHP_SELF']."?".$url."&offset=$offset&step=$step&page=$e&size=$step");
772        $r.=sprintf('<A HREF="%s" CLASS="one">%d</A>&nbsp;',$go,$e);
773        } else {
774          $r.="<b> $e </b>";
775        } //else
776        // add a break if e > 80
777        if ( $e % 57 == 0 ) {
778          $r.="<br>";
779        }
780      } //for
781      // next
782      if ($p_page !=$nb_page) {
783        $e=$p_page+1;
784        $step=$_SESSION['g_pagesize'];
785        $offset=($e-1)*$step;
786    
787        $r.='&nbsp;<A class="one" href="'.$_SERVER['PHP_SELF']."?".$url."&offset=$offset&step=$step&page=$e&size=$step".'">';
788        $r.="Suivant";
789        $r.="</A>";
790      }
791    
792    
793      return $r;
794      
795    }

Legend:
Removed from v.1.47  
changed lines
  Added in v.1.48

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