db=$p_cn; $this->id=$p_id; } /* function GetRow * Purpose : Get dat for poste * * parm : * - connection * - condition * -. position * gen : * - none * return: * - none * */ function GetRow($p_from,$p_to) { if ( $p_from == $p_to ) $periode=" jr_tech_per = $p_from "; else $periode = "(jr_tech_per >= $p_from and jr_tech_per <= $p_to) "; $Res=ExecSql($this->db,"select to_char(j_date,'DD.MM.YYYY') as j_date,". "case when j_debit='t' then to_char(j_montant,'999999999.99') else ' ' end as deb_montant,". "case when j_debit='f' then to_char(j_montant,'999999999.99') else ' ' end as cred_montant,". " jr_comment as description,jrn_def_name as jrn_name,". "j_debit, jr_internal ". " from jrnx left join jrn_def on jrn_def_id=j_jrn_def ". " left join jrn on jr_grpt_id=j_grpt". " where j_poste=".$this->id." and ".$periode. " order by j_date::date"); $array=array(); $tot_cred=0; $tot_deb=0; $Max=pg_NumRows($Res); if ( $Max == 0 ) return null; for ($i=0;$i<$Max;$i++) { $array[]=pg_fetch_array($Res,$i); if ($array[$i]['j_debit']=='t') { $tot_deb+=$array[$i]['deb_montant'] ; } else { $tot_cred+=$array[$i]['cred_montant'] ; } } $this->row=$array; return array($array,$tot_deb,$tot_cred); } function GetName() { $ret=pg_exec($this->db, "select pcm_lib from tmp_pcmn where pcm_val=".$this->id); if ( pg_NumRows($ret) != 0) { $r=pg_fetch_array($ret); $this->name=$r['pcm_lib']; } else { $this->name="Poste inconnu"; } return $this->name; } }