Main Page | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

class_rapport.php

Go to the documentation of this file.
00001 <?
00002 /*
00003  *   This file is part of PhpCompta.
00004  *
00005  *   PhpCompta 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  *   PhpCompta 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 PhpCompta; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 /* $Revision: 1.2 $ */
00020 // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
00028 class rapport {
00029   var $db;    
00030   var $id;    
00031   var $name;  
00033   function rapport($p_cn,$p_id) {
00034     $this->db=$p_cn;
00035     $this->id=$p_id;
00036     $this->name='UNDEF';
00037   }
00040   function GetName() {
00041     $ret=execSql($this->db,"select fr_label from formdef where fr_id=".$this->id);
00042     if (pg_NumRows($ret) == 0) return $this->name;
00043     $a=pg_fetch_array($ret,0);
00044     $this->name=$a['fr_label'];
00045     return $this->name;
00046   }
00053    function GetRow($p_start,$p_end) {
00054 
00055    $Res=ExecSql($this->db,"select fo_id ,
00056                      fo_fr_id,
00057                      fo_pos,
00058                      fo_label,
00059                      fo_formula,
00060                      fr_label from form
00061                       inner join formdef on fr_id=fo_fr_id
00062                      where fr_id =".$this->id.
00063                      "order by fo_pos");
00064     $Max=pg_NumRows($Res);
00065     if ($Max==0) {      $this->row=0;return null;}
00066     $col=array();
00067     for ($i=0;$i<$Max;$i++) {
00068       $l_line=pg_fetch_array($Res,$i);
00069         $col[]=ParseFormula($this->db,
00070                             $l_line['fo_label'],
00071                             $l_line['fo_formula'],
00072                             $p_start,
00073                             $p_end
00074                             );
00075      
00076     } //for ($i
00077     $this->row=$col;
00078     return $col;
00079   }
00080 }
00081 ?>