altocompta/doc/developper/html/class__jrn_8php-source.html
2006-06-25 21:10:41 +00:00

304 lines
30 KiB
HTML
Raw Blame History

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>phpcompta: /home/dany/developpement/phpcompta-dev/phpcompta/include/class_jrn.php Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.4 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
<div class="nav">
<a class="el" href="dir_000000.html">developpement</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_000001.html">phpcompta-dev</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_000002.html">phpcompta</a>&nbsp;&raquo&nbsp;<a class="el" href="dir_000006.html">include</a></div>
<h1>class_jrn.php</h1><a href="class__jrn_8php.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 &lt;?
<a name="l00002"></a>00002 <span class="comment">/*</span>
<a name="l00003"></a>00003 <span class="comment"> * This file is part of PhpCompta.</span>
<a name="l00004"></a>00004 <span class="comment"> *</span>
<a name="l00005"></a>00005 <span class="comment"> * PhpCompta is free software; you can redistribute it and/or modify</span>
<a name="l00006"></a>00006 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
<a name="l00007"></a>00007 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
<a name="l00008"></a>00008 <span class="comment"> * (at your option) any later version.</span>
<a name="l00009"></a>00009 <span class="comment"> *</span>
<a name="l00010"></a>00010 <span class="comment"> * PhpCompta is distributed in the hope that it will be useful,</span>
<a name="l00011"></a>00011 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00012"></a>00012 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
<a name="l00013"></a>00013 <span class="comment"> * GNU General Public License for more details.</span>
<a name="l00014"></a>00014 <span class="comment"> *</span>
<a name="l00015"></a>00015 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
<a name="l00016"></a>00016 <span class="comment"> * along with PhpCompta; if not, write to the Free Software</span>
<a name="l00017"></a>00017 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
<a name="l00018"></a>00018 <span class="comment">*/</span>
<a name="l00019"></a>00019 <span class="comment">/* $Revision$ */</span>
<a name="l00020"></a>00020 <span class="comment">// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr</span>
<a name="l00024"></a><a class="code" href="classjrn.html">00024</a> <span class="comment"></span><span class="keyword">class </span><a class="code" href="classjrn.html">jrn</a> {
<a name="l00025"></a><a class="code" href="classjrn.html#o0">00025</a> var <a class="code" href="classjrn.html#o0">$id</a>;
<a name="l00026"></a><a class="code" href="classjrn.html#o1">00026</a> var <a class="code" href="classjrn.html#o1">$name</a>;
<a name="l00027"></a><a class="code" href="classjrn.html#o2">00027</a> var <a class="code" href="classjrn.html#o2">$db</a>;
<a name="l00028"></a><a class="code" href="classjrn.html#o3">00028</a> var <a class="code" href="classjrn.html#o3">$row</a>;
<a name="l00029"></a><a class="code" href="classjrn.html#a0">00029</a> function <a class="code" href="classjrn.html#a0">jrn</a> ($p_cn,$p_id){
<a name="l00030"></a>00030 $this-&gt;<span class="keywordtype">id</span>=<a class="code" href="user__update_8php.html#a1">$p_id</a>;
<a name="l00031"></a>00031 $this-&gt;db=$p_cn;
<a name="l00032"></a>00032 $this-&gt;row=null;
<a name="l00033"></a>00033 }
<a name="l00034"></a><a class="code" href="classjrn.html#a1">00034</a> function <a class="code" href="classjrn.html#a1">GetName</a>() {
<a name="l00035"></a>00035 <span class="keywordflow">if</span> ( $this-&gt;id==0 ) {
<a name="l00036"></a>00036 $this-&gt;<a class="code" href="action_8inc_8php.html#a4">name</a>=<span class="stringliteral">" Grand Livre "</span>;
<a name="l00037"></a>00037 <span class="keywordflow">return</span> $this-&gt;<a class="code" href="action_8inc_8php.html#a4">name</a>;
<a name="l00038"></a>00038 }
<a name="l00039"></a>00039
<a name="l00040"></a>00040 <a class="code" href="depense_8inc_8php.html#a3">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($this-&gt;db,<span class="stringliteral">"select jrn_def_name from "</span>.
<a name="l00041"></a>00041 <span class="stringliteral">" jrn_def where jrn_def_id="</span>.
<a name="l00042"></a>00042 $this-&gt;id);
<a name="l00043"></a>00043 <a class="code" href="setup_8php.html#a11">$Max</a>=pg_NumRows($Res);
<a name="l00044"></a>00044 <span class="keywordflow">if</span> ($Max==0) <span class="keywordflow">return</span> null;
<a name="l00045"></a>00045 <a class="code" href="impress__bilan_8php.html#a0">$ret</a>=pg_fetch_array($Res,0);
<a name="l00046"></a>00046 $this-&gt;<a class="code" href="action_8inc_8php.html#a4">name</a>=<a class="code" href="impress__bilan_8php.html#a0">$ret</a>['jrn_def_name'];
<a name="l00047"></a>00047 <span class="keywordflow">return</span> <a class="code" href="impress__bilan_8php.html#a0">$ret</a>['jrn_def_name'];
<a name="l00048"></a>00048 }
<a name="l00049"></a>00049
<a name="l00065"></a><a class="code" href="classjrn.html#a2">00065</a> function <a class="code" href="classjrn.html#a2">GetRow</a>($p_from,$p_to,$cent='off',$p_limit=-1,$p_offset=-1) {
<a name="l00066"></a>00066
<a name="l00067"></a>00067 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_jrn.php',__LINE__,<span class="stringliteral">"GetRow ( $p_from,$p_to,$cent,$p_limit,$p_offset)"</span>);
<a name="l00068"></a>00068
<a name="l00069"></a>00069 <span class="keywordflow">if</span> ( $p_from == $p_to )
<a name="l00070"></a>00070 $periode=<span class="stringliteral">" jr_tech_per = $p_from "</span>;
<a name="l00071"></a>00071 <span class="keywordflow">else</span>
<a name="l00072"></a>00072 $periode = <span class="stringliteral">"(jr_tech_per &gt;= $p_from and jr_tech_per &lt;= $p_to) "</span>;
<a name="l00073"></a>00073 $cond_limite=($p_limit!=-1)?<span class="stringliteral">" limit "</span>.$p_limit.<span class="stringliteral">" offset "</span>.$p_offset:<span class="stringliteral">""</span>;
<a name="l00074"></a>00074
<a name="l00075"></a>00075 <span class="comment">// Grand livre == 0</span>
<a name="l00076"></a>00076 <span class="keywordflow">if</span> ( $this-&gt;id != 0 ) {
<a name="l00077"></a>00077
<a name="l00078"></a>00078 <span class="keywordflow">if</span> ( $cent=='off' ) {
<a name="l00079"></a>00079 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_jrn.php',__LINE__,<span class="stringliteral">"journaux non centralis<69>"</span>);
<a name="l00080"></a>00080 <span class="comment">// Journaux non centralis<69>s</span>
<a name="l00081"></a>00081 <a class="code" href="depense_8inc_8php.html#a3">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($this-&gt;db,<span class="stringliteral">"select j_id,j_id as int_j_id,to_char(j_date,'DD.MM.YYYY') as j_date,</span>
<a name="l00082"></a>00082 <span class="stringliteral"> jr_internal,</span>
<a name="l00083"></a>00083 <span class="stringliteral"> case j_debit when 't' then j_montant::text else ' ' end as deb_montant,</span>
<a name="l00084"></a>00084 <span class="stringliteral"> case j_debit when 'f' then j_montant::text else ' ' end as cred_montant,</span>
<a name="l00085"></a>00085 <span class="stringliteral"> j_debit as debit,j_poste as poste,jr_montant , "</span>.
<a name="l00086"></a>00086 <span class="stringliteral">"pcm_lib as description,j_grpt as grp,jr_comment||' ('||jr_internal||')' as jr_comment ,</span>
<a name="l00087"></a>00087 <span class="stringliteral"> jr_rapt as oc, j_tech_per as periode from jrnx left join jrn on "</span>.
<a name="l00088"></a>00088 <span class="stringliteral">"jr_grpt_id=j_grpt "</span>.
<a name="l00089"></a>00089 <span class="stringliteral">" left join tmp_pcmn on pcm_val=j_poste "</span>.
<a name="l00090"></a>00090 <span class="stringliteral">" where j_jrn_def="</span>.$this-&gt;id.
<a name="l00091"></a>00091 <span class="stringliteral">" and "</span>.$periode.<span class="stringliteral">" order by j_date::date asc,jr_internal,j_debit desc "</span>.
<a name="l00092"></a>00092 $cond_limite);
<a name="l00093"></a>00093 }<span class="keywordflow">else</span> {
<a name="l00094"></a>00094 <span class="comment">// Journaux centralis<69>s</span>
<a name="l00095"></a>00095 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_jrn.php',__LINE__,<span class="stringliteral">"journaux centralis<69>"</span>);
<a name="l00096"></a>00096 <a class="code" href="eub__be_8inc_8php.html#a4">$Sql</a>=<span class="stringliteral">"select jr_opid as j_id,</span>
<a name="l00097"></a>00097 <span class="stringliteral"> c_order as int_j_id,</span>
<a name="l00098"></a>00098 <span class="stringliteral"> to_char (c_date,'DD.MM.YYYY') as j_date ,</span>
<a name="l00099"></a>00099 <span class="stringliteral"> c_internal as jr_internal,</span>
<a name="l00100"></a>00100 <span class="stringliteral"> case c_debit when 't' then c_montant::text else ' ' end as deb_montant,</span>
<a name="l00101"></a>00101 <span class="stringliteral"> case c_debit when 'f' then c_montant::text else ' ' end as cred_montant,</span>
<a name="l00102"></a>00102 <span class="stringliteral"> c_debit as j_debit,</span>
<a name="l00103"></a>00103 <span class="stringliteral"> c_poste as poste,</span>
<a name="l00104"></a>00104 <span class="stringliteral"> pcm_lib as description,</span>
<a name="l00105"></a>00105 <span class="stringliteral"> jr_comment||' ('||c_internal||')' as jr_comment,</span>
<a name="l00106"></a>00106 <span class="stringliteral"> jr_montant,</span>
<a name="l00107"></a>00107 <span class="stringliteral"> c_grp as grp,</span>
<a name="l00108"></a>00108 <span class="stringliteral"> c_comment as comment,</span>
<a name="l00109"></a>00109 <span class="stringliteral"> c_rapt as oc,</span>
<a name="l00110"></a>00110 <span class="stringliteral"> c_periode as periode </span>
<a name="l00111"></a>00111 <span class="stringliteral"> from centralized left join jrn on "</span>.
<a name="l00112"></a>00112 <span class="stringliteral">"jr_grpt_id=c_grp left join tmp_pcmn on pcm_val=c_poste where "</span>.
<a name="l00113"></a>00113 <span class="stringliteral">" c_jrn_def="</span>.$this-&gt;id.<span class="stringliteral">" and "</span>.
<a name="l00114"></a>00114 $periode.<span class="stringliteral">" order by c_order "</span>;
<a name="l00115"></a>00115 <a class="code" href="depense_8inc_8php.html#a3">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($this-&gt;db,$Sql.$cond_limite);
<a name="l00116"></a>00116
<a name="l00117"></a>00117 }
<a name="l00118"></a>00118 } <span class="keywordflow">else</span> {
<a name="l00119"></a>00119 <span class="comment">// Grand Livre</span>
<a name="l00120"></a>00120 <span class="keywordflow">if</span> ( $cent == 'off') {
<a name="l00121"></a>00121 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_jrn.php',__LINE__,<span class="stringliteral">"Grand livre non centralis<69>"</span>);
<a name="l00122"></a>00122 <span class="comment">// Non centralis<69></span>
<a name="l00123"></a>00123 <a class="code" href="depense_8inc_8php.html#a3">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($this-&gt;db,<span class="stringliteral">"select j_id,j_id as int_j_id,to_char(j_date,'DD.MM.YYYY') as j_date,</span>
<a name="l00124"></a>00124 <span class="stringliteral"> jr_internal,</span>
<a name="l00125"></a>00125 <span class="stringliteral"> case j_debit when 't' then j_montant::text else ' ' end as deb_montant,</span>
<a name="l00126"></a>00126 <span class="stringliteral"> case j_debit when 'f' then j_montant::text else ' ' end as cred_montant,</span>
<a name="l00127"></a>00127 <span class="stringliteral"> j_debit as debit,j_poste as poste,"</span>.
<a name="l00128"></a>00128 <span class="stringliteral">"pcm_lib as description,j_grpt as grp,</span>
<a name="l00129"></a>00129 <span class="stringliteral"> jr_comment||' ('||jr_internal||')' as jr_comment,</span>
<a name="l00130"></a>00130 <span class="stringliteral"> jr_montant,</span>
<a name="l00131"></a>00131 <span class="stringliteral"> jr_rapt as oc, j_tech_per as periode from jrnx left join jrn on "</span>.
<a name="l00132"></a>00132 <span class="stringliteral">"jr_grpt_id=j_grpt left join tmp_pcmn on pcm_val=j_poste where "</span>.
<a name="l00133"></a>00133 <span class="stringliteral">" "</span>.$periode.<span class="stringliteral">" order by j_date::date,j_grpt,j_debit desc "</span>.
<a name="l00134"></a>00134 $cond_limite);
<a name="l00135"></a>00135
<a name="l00136"></a>00136 } <span class="keywordflow">else</span> {
<a name="l00137"></a>00137 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_jrn.php',__LINE__,<span class="stringliteral">"Grand livre centralis<69>"</span>);
<a name="l00138"></a>00138 <span class="comment">// Centralis<69></span>
<a name="l00139"></a>00139 <a class="code" href="eub__be_8inc_8php.html#a4">$Sql</a>=<span class="stringliteral">"select jr_c_opid as j_id,</span>
<a name="l00140"></a>00140 <span class="stringliteral"> c_order as int_j_id,</span>
<a name="l00141"></a>00141 <span class="stringliteral"></span>
<a name="l00142"></a>00142 <span class="stringliteral"> c_j_id,</span>
<a name="l00143"></a>00143 <span class="stringliteral"> to_char (c_date,'DD.MM.YYYY') as j_date ,</span>
<a name="l00144"></a>00144 <span class="stringliteral"> c_internal as jr_internal,</span>
<a name="l00145"></a>00145 <span class="stringliteral"> case c_debit when 't' then c_montant::text else ' ' end as deb_montant,</span>
<a name="l00146"></a>00146 <span class="stringliteral"> case c_debit when 'f' then c_montant::text else ' ' end as cred_montant,</span>
<a name="l00147"></a>00147 <span class="stringliteral"> c_debit as j_debit,</span>
<a name="l00148"></a>00148 <span class="stringliteral"> c_poste as poste,</span>
<a name="l00149"></a>00149 <span class="stringliteral"> pcm_lib as description,</span>
<a name="l00150"></a>00150 <span class="stringliteral"> jr_comment||' ('||c_internal||')' as jr_comment,</span>
<a name="l00151"></a>00151 <span class="stringliteral"> jr_montant,</span>
<a name="l00152"></a>00152 <span class="stringliteral"> c_grp as grp,</span>
<a name="l00153"></a>00153 <span class="stringliteral"> c_comment||' ('||c_internal||')' as comment,</span>
<a name="l00154"></a>00154 <span class="stringliteral"> c_rapt as oc,</span>
<a name="l00155"></a>00155 <span class="stringliteral"> c_periode as periode </span>
<a name="l00156"></a>00156 <span class="stringliteral"> from centralized left join jrn on "</span>.
<a name="l00157"></a>00157 <span class="stringliteral">"jr_grpt_id=c_grp left join tmp_pcmn on pcm_val=c_poste where "</span>.
<a name="l00158"></a>00158 $periode.<span class="stringliteral">" order by c_order "</span>;
<a name="l00159"></a>00159 <a class="code" href="depense_8inc_8php.html#a3">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($this-&gt;db,$Sql.$cond_limite);
<a name="l00160"></a>00160 } <span class="comment">// Grand Livre</span>
<a name="l00161"></a>00161 }
<a name="l00162"></a>00162
<a name="l00163"></a>00163
<a name="l00164"></a>00164 <a class="code" href="recherche_8php.html#a4">$array</a>=array();
<a name="l00165"></a>00165 <a class="code" href="setup_8php.html#a11">$Max</a>=pg_NumRows($Res);
<a name="l00166"></a>00166 <span class="keywordflow">if</span> ($Max==0) <span class="keywordflow">return</span> null;
<a name="l00167"></a>00167 $case=<span class="stringliteral">""</span>;
<a name="l00168"></a>00168 $tot_deb=0;
<a name="l00169"></a>00169 $tot_cred=0;
<a name="l00170"></a>00170 <span class="keywordflow">for</span> ($i=0;$i&lt;$Max;$i++) {
<a name="l00171"></a>00171 $line=pg_fetch_array($Res,$i);
<a name="l00172"></a>00172 $mont_deb=($line['deb_montant']!=0)?sprintf(<span class="stringliteral">"% 8.2f"</span>,$line['deb_montant']):<span class="stringliteral">""</span>;
<a name="l00173"></a>00173 $mont_cred=($line['cred_montant']!=0)?sprintf(<span class="stringliteral">"% 8.2f"</span>,$line['cred_montant']):<span class="stringliteral">""</span>;
<a name="l00174"></a>00174 $jr_montant=($line['jr_montant']!=0)?sprintf(<span class="stringliteral">"% 8.2f"</span>,$line['jr_montant']):<span class="stringliteral">""</span>;
<a name="l00175"></a>00175 $tot_deb+=$line['deb_montant'];
<a name="l00176"></a>00176 $tot_cred+=$line['cred_montant'];
<a name="l00177"></a>00177 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_jrn.php',__LINE__,<span class="stringliteral">" GetRow : mont_Deb "</span>.$mont_deb);
<a name="l00178"></a>00178 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_jrn.php',__LINE__,<span class="stringliteral">" GetRow : mont_cred "</span>.$mont_cred);
<a name="l00179"></a>00179
<a name="l00180"></a>00180 <span class="keywordflow">if</span> ( $<span class="keywordflow">case</span> != $line['grp'] ) {
<a name="l00181"></a>00181 $case=$line['grp'];
<a name="l00182"></a>00182 <a class="code" href="recherche_8php.html#a4">$array</a>[]=array (
<a name="l00183"></a>00183 'int_j_id' =&gt; $line['int_j_id'],
<a name="l00184"></a>00184 'j_id'=&gt;$line['j_id'],
<a name="l00185"></a>00185 'j_date' =&gt; $line['j_date'],
<a name="l00186"></a>00186 'internal'=&gt;$line['jr_internal'],
<a name="l00187"></a>00187 'deb_montant'=&gt;'',
<a name="l00188"></a>00188 'cred_montant'=&gt;'&lt;b&gt;&lt;i&gt;'.$jr_montant.'&lt;/i&gt;&lt;/b&gt;',
<a name="l00189"></a>00189 'description'=&gt;'&lt;b&gt;&lt;i&gt;'.$line['jr_comment'].'&lt;/i&gt;&lt;/b&gt;',
<a name="l00190"></a>00190 '<a class="code" href="classposte.html">poste</a>' =&gt; $line['oc'],
<a name="l00191"></a>00191 'periode' =&gt;$line['periode'] );
<a name="l00192"></a>00192
<a name="l00193"></a>00193 <a class="code" href="recherche_8php.html#a4">$array</a>[]=array (
<a name="l00194"></a>00194 'int_j_id' =&gt; $line['int_j_id'],
<a name="l00195"></a>00195 'j_id'=&gt;'',
<a name="l00196"></a>00196 'j_date' =&gt; '',
<a name="l00197"></a>00197 'internal'=&gt;'',
<a name="l00198"></a>00198 'deb_montant'=&gt;$mont_deb,
<a name="l00199"></a>00199 'cred_montant'=&gt;$mont_cred,
<a name="l00200"></a>00200 'description'=&gt;$line['description'],
<a name="l00201"></a>00201 '<a class="code" href="classposte.html">poste</a>' =&gt; $line['<a class="code" href="classposte.html">poste</a>'],
<a name="l00202"></a>00202 'periode' =&gt; $line['periode']
<a name="l00203"></a>00203 );
<a name="l00204"></a>00204
<a name="l00205"></a>00205 }<span class="keywordflow">else</span> {
<a name="l00206"></a>00206 <a class="code" href="recherche_8php.html#a4">$array</a>[]=array (
<a name="l00207"></a>00207 'int_j_id' =&gt; $line['int_j_id'],
<a name="l00208"></a>00208 'j_id'=&gt;'',
<a name="l00209"></a>00209 'j_date' =&gt; '',
<a name="l00210"></a>00210 'internal'=&gt;'',
<a name="l00211"></a>00211 'deb_montant'=&gt;$mont_deb,
<a name="l00212"></a>00212 'cred_montant'=&gt;$mont_cred,
<a name="l00213"></a>00213 'description'=&gt;$line['description'],
<a name="l00214"></a>00214 '<a class="code" href="classposte.html">poste</a>' =&gt; $line['<a class="code" href="classposte.html">poste</a>'],
<a name="l00215"></a>00215 'periode' =&gt; $line['periode']);
<a name="l00216"></a>00216
<a name="l00217"></a>00217 }
<a name="l00218"></a>00218
<a name="l00219"></a>00219
<a name="l00220"></a>00220 }
<a name="l00221"></a>00221 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_jrn.php',__LINE__,<span class="stringliteral">"Total debit $tot_deb,credit $tot_cred"</span>);
<a name="l00222"></a>00222 $this-&gt;row=<a class="code" href="recherche_8php.html#a4">$array</a>;
<a name="l00223"></a>00223 <a class="code" href="action_8inc_8php.html#a16">$a</a>=array($array,$tot_deb,$tot_cred);
<a name="l00224"></a>00224 <span class="keywordflow">return</span> <a class="code" href="action_8inc_8php.html#a16">$a</a>;
<a name="l00225"></a>00225 }
<a name="l00243"></a><a class="code" href="classjrn.html#a3">00243</a> function <a class="code" href="classjrn.html#a3">GetRowSimple</a>($p_from,$p_to,$cent='off',$p_limit=-1,$p_offset=-1)
<a name="l00244"></a>00244 {
<a name="l00245"></a>00245
<a name="l00246"></a>00246 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_jrn.php',__LINE__,<span class="stringliteral">"GetRowSimple ( $p_from,$p_to,$cent,$p_limit,$p_offset)"</span>);
<a name="l00247"></a>00247 <span class="comment">// Periode check</span>
<a name="l00248"></a>00248 <span class="comment">//---</span>
<a name="l00249"></a>00249 <span class="keywordflow">if</span> ( $p_from == $p_to )
<a name="l00250"></a>00250 $periode=<span class="stringliteral">" jr_tech_per = $p_from "</span>;
<a name="l00251"></a>00251 <span class="keywordflow">else</span>
<a name="l00252"></a>00252 $periode = <span class="stringliteral">"(jr_tech_per &gt;= $p_from and jr_tech_per &lt;= $p_to) "</span>;
<a name="l00253"></a>00253 $cond_limite=($p_limit!=-1)?<span class="stringliteral">" limit "</span>.$p_limit.<span class="stringliteral">" offset "</span>.$p_offset:<span class="stringliteral">""</span>;
<a name="l00254"></a>00254 <span class="comment">// Grand-livre : id= 0</span>
<a name="l00255"></a>00255 <span class="comment">//---</span>
<a name="l00256"></a>00256 <a class="code" href="show__pj_8php.html#a6">$jrn</a>=($this-&gt;<span class="keywordtype">id</span> == 0 )?<span class="stringliteral">""</span>:<span class="stringliteral">"and jrn_def_id = "</span>.$this-&gt;id;
<a name="l00257"></a>00257 <span class="comment">// Non Centralise si cent=off</span>
<a name="l00258"></a>00258 <span class="comment">//--</span>
<a name="l00259"></a>00259 <span class="keywordflow">if</span> ($cent=='off')
<a name="l00260"></a>00260 {<span class="comment">// Non centralis<69></span>
<a name="l00261"></a>00261 <span class="comment">//---</span>
<a name="l00262"></a>00262 <a class="code" href="bank_8inc_8php.html#a10">$sql</a>=<span class="stringliteral">" </span>
<a name="l00263"></a>00263 <span class="stringliteral"> SELECT jrn.jr_id as jr_id ,</span>
<a name="l00264"></a>00264 <span class="stringliteral"> jrn.jr_id as num , </span>
<a name="l00265"></a>00265 <span class="stringliteral"> jrn.jr_def_id as jr_def_id, </span>
<a name="l00266"></a>00266 <span class="stringliteral"> jrn.jr_montant as montant, </span>
<a name="l00267"></a>00267 <span class="stringliteral"> jrn.jr_comment as comment, </span>
<a name="l00268"></a>00268 <span class="stringliteral"> to_char(jrn.jr_date,'DD-MM-YYYY') as date, </span>
<a name="l00269"></a>00269 <span class="stringliteral"> jr_internal,</span>
<a name="l00270"></a>00270 <span class="stringliteral"> jrn.jr_grpt_id as grpt_id, </span>
<a name="l00271"></a>00271 <span class="stringliteral"> jrn.jr_pj_name as pj,</span>
<a name="l00272"></a>00272 <span class="stringliteral"> jrn_def_type</span>
<a name="l00273"></a>00273 <span class="stringliteral"> FROM jrn join jrn_def on (jrn_def_id=jr_def_id)</span>
<a name="l00274"></a>00274 <span class="stringliteral">where $periode $jrn order by jr_date"</span>;
<a name="l00275"></a>00275
<a name="l00276"></a>00276
<a name="l00277"></a>00277
<a name="l00278"></a>00278 }
<a name="l00279"></a>00279 <span class="keywordflow">else</span>
<a name="l00280"></a>00280 {
<a name="l00281"></a>00281 <span class="comment">//Centralis<69></span>
<a name="l00282"></a>00282 <span class="comment">//---</span>
<a name="l00283"></a>00283 <a class="code" href="classjrn.html#o0">$id</a>=($this-&gt;<span class="keywordtype">id</span> == 0 ) ?<span class="stringliteral">"jr_c_opid as num"</span>:<span class="stringliteral">"jr_opid as num"</span>;
<a name="l00284"></a>00284 <a class="code" href="bank_8inc_8php.html#a10">$sql</a>=<span class="stringliteral">"</span>
<a name="l00285"></a>00285 <span class="stringliteral"> SELECT jrn.jr_id as jr_id ,</span>
<a name="l00286"></a>00286 <span class="stringliteral"> $id , </span>
<a name="l00287"></a>00287 <span class="stringliteral"> jrn.jr_def_id as jr_def_id, </span>
<a name="l00288"></a>00288 <span class="stringliteral"> jrn.jr_montant as montant, </span>
<a name="l00289"></a>00289 <span class="stringliteral"> jrn.jr_comment as comment, </span>
<a name="l00290"></a>00290 <span class="stringliteral"> to_char(jrn.jr_date,'DD-MM-YYYY') as date, </span>
<a name="l00291"></a>00291 <span class="stringliteral"> jr_internal,</span>
<a name="l00292"></a>00292 <span class="stringliteral"> jrn.jr_grpt_id as grpt_id, </span>
<a name="l00293"></a>00293 <span class="stringliteral"> jrn.jr_pj_name as pj,</span>
<a name="l00294"></a>00294 <span class="stringliteral"> jrn_def_type</span>
<a name="l00295"></a>00295 <span class="stringliteral"> FROM jrn join jrn_def on (jrn_def_id=jr_def_id)</span>
<a name="l00296"></a>00296 <span class="stringliteral"> where </span>
<a name="l00297"></a>00297 <span class="stringliteral"> $periode $jrn and </span>
<a name="l00298"></a>00298 <span class="stringliteral"> jr_opid is not null</span>
<a name="l00299"></a>00299 <span class="stringliteral"> order by jr_date"</span>;
<a name="l00300"></a>00300 }<span class="comment">// end else $cent=='off'</span>
<a name="l00301"></a>00301 <span class="comment">//load all data into an array</span>
<a name="l00302"></a>00302 <span class="comment">//---</span>
<a name="l00303"></a>00303 <a class="code" href="depense_8inc_8php.html#a3">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($this-&gt;db,$sql);
<a name="l00304"></a>00304 <span class="keywordflow">if</span> ( pg_NumRows($Res) == 0 )
<a name="l00305"></a>00305 {
<a name="l00306"></a>00306 <span class="keywordflow">return</span> null;
<a name="l00307"></a>00307 }
<a name="l00308"></a>00308
<a name="l00309"></a>00309
<a name="l00310"></a>00310 <a class="code" href="recherche_8php.html#a4">$array</a>=pg_fetch_all($Res);
<a name="l00311"></a>00311
<a name="l00312"></a>00312 <span class="keywordflow">return</span> <a class="code" href="recherche_8php.html#a4">$array</a>;
<a name="l00313"></a>00313 }<span class="comment">// end function GetRowSimple</span>
<a name="l00314"></a>00314
<a name="l00321"></a><a class="code" href="classjrn.html#a4">00321</a> function <a class="code" href="classjrn.html#a4">GetDefLine</a>($p_cred)
<a name="l00322"></a>00322 {
<a name="l00323"></a>00323 $sql_cred=($p_cred=='cred')?'jrn_cred_max_line<span class="charliteral">':'</span>jrn_deb_max_line';
<a name="l00324"></a>00324 <a class="code" href="bank_8inc_8php.html#a10">$sql</a>=<span class="stringliteral">"select $sql_cred as value from jrn_def where jrn_def_id="</span>.$this-&gt;id;
<a name="l00325"></a>00325 <a class="code" href="user__action__ach_8php.html#a2">$r</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($this-&gt;db,$sql);
<a name="l00326"></a>00326 <a class="code" href="depense_8inc_8php.html#a3">$Res</a>=pg_fetch_all($r);
<a name="l00327"></a>00327 <a class="code" href="debug_8php.html#a0">echo_debug</a>('class_jrn',__LINE__,$Res);
<a name="l00328"></a>00328 <span class="keywordflow">if</span> ( <span class="keyword">sizeof</span>($Res) == 0 ) <span class="keywordflow">return</span> 1;
<a name="l00329"></a>00329 <span class="keywordflow">return</span> <a class="code" href="depense_8inc_8php.html#a3">$Res</a>[0]['<a class="code" href="action_8inc_8php.html#a5">value</a>'];
<a name="l00330"></a>00330 }
<a name="l00331"></a>00331 }
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Jun 25 23:09:58 2006 for phpcompta by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.4 </small></address>
</body>
</html>