Public Member Functions | |
poste ($p_cn, $p_id) | |
GetRow ($p_from, $p_to) | |
Get dat for poste. | |
GetName () | |
Return the name of a account it doesn't change any data member. | |
get () | |
Get all the value for this object from the database the data member are set. | |
GetSolde ($p_cond="") | |
give the balance of an account | |
GetSoldeDetail ($p_cond="") | |
give the balance of an account | |
Data Fields | |
$db | |
$id | |
$label | |
$parent | |
$row |
Definition at line 28 of file class_poste.php.
|
Definition at line 34 of file class_poste.php. References $p_id. 00034 { 00035 $this->db=$p_cn; 00036 $this->id=$p_id; 00037 }
|
|
Get all the value for this object from the database the data member are set.
Definition at line 100 of file class_poste.php. References $r, $ret, ExecSql(), and label. 00101 { 00102 $ret=ExecSql($this->db,"select pcm_lib,pcm_val_parent from 00103 tmp_pcmn where pcm_val=".$this->id); 00104 $r=pg_fetch_all($ret); 00105 00106 if ( ! $r ) return false; 00107 $this->label=$r[0]['pcm_lib']; 00108 $this->parent=$r[0]['pcm_val_parent']; 00109 return true; 00110 }
|
|
Return the name of a account it doesn't change any data member.
Definition at line 84 of file class_poste.php. References $r, $ret, and name. 00084 { 00085 $ret=pg_exec($this->db, 00086 "select pcm_lib from tmp_pcmn where 00087 pcm_val=".$this->id); 00088 if ( pg_NumRows($ret) != 0) { 00089 $r=pg_fetch_array($ret); 00090 $this->name=$r['pcm_lib']; 00091 } else { 00092 $this->name="Poste inconnu"; 00093 } 00094 return $this->name; 00095 }
|
|
Get dat for poste.
Definition at line 48 of file class_poste.php. References $array, $i, $Max, $Res, and ExecSql(). 00049 { 00050 if ( $p_from == $p_to ) 00051 $periode=" jr_tech_per = $p_from "; 00052 else 00053 $periode = "(jr_tech_per >= $p_from and jr_tech_per <= $p_to) "; 00054 00055 $Res=ExecSql($this->db,"select to_char(j_date,'DD.MM.YYYY') as j_date,". 00056 "case when j_debit='t' then j_montant else 0 end as deb_montant,". 00057 "case when j_debit='f' then j_montant else 0 end as cred_montant,". 00058 " jr_comment as description,jrn_def_name as jrn_name,". 00059 "j_debit, jr_internal ". 00060 " from jrnx left join jrn_def on jrn_def_id=j_jrn_def ". 00061 " left join jrn on jr_grpt_id=j_grpt". 00062 " where j_poste=".$this->id." and ".$periode. 00063 " order by j_date::date"); 00064 $array=array(); 00065 $tot_cred=0.0; 00066 $tot_deb=0.0; 00067 $Max=pg_NumRows($Res); 00068 if ( $Max == 0 ) return null; 00069 for ($i=0;$i<$Max;$i++) { 00070 $array[]=pg_fetch_array($Res,$i); 00071 if ($array[$i]['j_debit']=='t') { 00072 $tot_deb+=$array[$i]['deb_montant'] ; 00073 } else { 00074 $tot_cred+=$array[$i]['cred_montant'] ; 00075 } 00076 } 00077 $this->row=$array; 00078 return array($array,$tot_deb,$tot_cred); 00079 }
|
|
give the balance of an account
Definition at line 119 of file class_poste.php. References $Max, $r, $Res, and ExecSql(). 00119 { 00120 $Res=ExecSql($this->db,"select sum(deb) as sum_deb, sum(cred) as sum_cred from 00121 ( select j_poste, 00122 case when j_debit='t' then j_montant else 0 end as deb, 00123 case when j_debit='f' then j_montant else 0 end as cred 00124 from jrnx join tmp_pcmn on j_poste=pcm_val 00125 where 00126 j_poste like ('$this->id'::text) and 00127 $p_cond 00128 ) as m "); 00129 $Max=pg_NumRows($Res); 00130 if ($Max==0) return 0; 00131 $r=pg_fetch_array($Res,0); 00132 00133 return abs($r['sum_deb']-$r['sum_cred']); 00134 }
|
|
give the balance of an account
Definition at line 141 of file class_poste.php. References $Max, $r, $Res, and ExecSql(). 00141 { 00142 if ( $p_cond != "") $p_cond=" and ".$p_cond; 00143 $Res=ExecSql($this->db,"select sum(deb) as sum_deb, sum(cred) as sum_cred from 00144 ( select j_poste, 00145 case when j_debit='t' then j_montant else 0 end as deb, 00146 case when j_debit='f' then j_montant else 0 end as cred 00147 from jrnx join tmp_pcmn on j_poste=pcm_val 00148 where 00149 j_poste like ('$this->id'::text) 00150 $p_cond 00151 ) as m "); 00152 $Max=pg_NumRows($Res); 00153 if ($Max==0) return 0; 00154 $r=pg_fetch_array($Res,0); 00155 00156 return array('debit'=>$r['sum_deb'], 00157 'credit'=>$r['sum_cred'], 00158 'solde'=>abs($r['sum_deb']-$r['sum_cred'])); 00159 }
|
|
database connection Definition at line 29 of file class_poste.php. |
|
poste_id Definition at line 30 of file class_poste.php. |
|
label of the poste Definition at line 31 of file class_poste.php. |
|
parent account Definition at line 32 of file class_poste.php. |
|
double array see GetRow Definition at line 33 of file class_poste.php. |