altocompta/doc/developper/html/impress__inc_8php-source.html

730 lines
75 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/impress_inc.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>impress_inc.php</h1><a href="impress__inc_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
<a name="l00020"></a>00020 <span class="comment">// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr</span>
<a name="l00021"></a>00021 <span class="comment">// $Revision$</span>
<a name="l00022"></a>00022
<a name="l00036"></a><a class="code" href="impress__inc_8php.html#a0">00036</a> function <a class="code" href="impress__inc_8php.html#a0">ViewImp</a>($p_array,$p_cn) {
<a name="l00037"></a>00037 include_once(<span class="stringliteral">"preference.php"</span>);
<a name="l00038"></a>00038 $periode=<a class="code" href="preference_8php.html#a0">FormPeriodeMult</a>($p_cn);
<a name="l00039"></a>00039 foreach ( $p_array as $key=&gt;$element) {
<a name="l00040"></a>00040 <a class="code" href="debug_8php.html#a0">echo_debug</a>('impress_inc.php',__LINE__,<span class="stringliteral">"VIEWIMP $key $element"</span>);
<a name="l00041"></a>00041 ${<span class="stringliteral">"$key"</span>}=$element;
<a name="l00042"></a>00042 }
<a name="l00043"></a>00043 <span class="keywordflow">if</span> ( ! isset($type) ) <span class="keywordflow">return</span>;
<a name="l00044"></a>00044 <a class="code" href="jrn__pdf_8php.html#a2">$centr</a>=<span class="stringliteral">""</span>;
<a name="l00045"></a>00045 <span class="keywordflow">if</span> ( $<a class="code" href="classaction.html">action</a>==<span class="stringliteral">"viewhtml"</span>) {
<a name="l00046"></a>00046 echo '&lt;<a class="code" href="constant_8php.html#a7">FORM</a> ACTION=impress.php <a class="code" href="pref_8inc_8php.html#a0">METHOD</a>=<span class="stringliteral">"GET"</span>&gt;';
<a name="l00047"></a>00047 <span class="keywordflow">if</span> ( $type==<span class="stringliteral">"jrn"</span>)
<a name="l00048"></a>00048 <a class="code" href="jrn__pdf_8php.html#a2">$centr</a>='&lt;BR&gt;Centralis<EFBFBD> :
<a name="l00049"></a>00049 &lt;INPUT TYPE=<span class="stringliteral">"CHECKBOX"</span> NAME=<span class="stringliteral">"central"</span> unchecked&gt;&lt;BR&gt;';
<a name="l00050"></a>00050 }
<a name="l00051"></a>00051 <span class="keywordflow">else</span> {
<a name="l00052"></a>00052 <span class="keywordflow">if</span> ( $type==<span class="stringliteral">"jrn"</span>) {
<a name="l00053"></a>00053 echo '&lt;<a class="code" href="constant_8php.html#a7">FORM</a> ACTION=send_jrn_pdf.php <a class="code" href="pref_8inc_8php.html#a0">METHOD</a>=<span class="stringliteral">"GET"</span>&gt;';
<a name="l00054"></a>00054 <a class="code" href="jrn__pdf_8php.html#a2">$centr</a>='&lt;BR&gt;Centralis<EFBFBD> :
<a name="l00055"></a>00055 &lt;INPUT TYPE=<span class="stringliteral">"CHECKBOX"</span> NAME=<span class="stringliteral">"central"</span> unchecked&gt;&lt;BR&gt;';
<a name="l00056"></a>00056 }
<a name="l00057"></a>00057 <span class="keywordflow">if</span> ( $type==<span class="stringliteral">"poste"</span>)
<a name="l00058"></a>00058 echo '&lt;<a class="code" href="constant_8php.html#a7">FORM</a> ACTION=send_poste_pdf.php <a class="code" href="pref_8inc_8php.html#a0">METHOD</a>=<span class="stringliteral">"GET"</span>&gt;';
<a name="l00059"></a>00059 }
<a name="l00060"></a>00060 echo $periode;
<a name="l00061"></a>00061 echo '&lt;INPUT TYPE=<span class="stringliteral">"HIDDEN"</span> NAME=<span class="stringliteral">"type"</span> <a class="code" href="client_8inc_8php.html#a6">value</a>=<span class="stringliteral">"'.$type.'"</span>&gt;';
<a name="l00062"></a>00062 echo '&lt;INPUT TYPE=<span class="stringliteral">"HIDDEN"</span> NAME=<span class="stringliteral">"action"</span> <a class="code" href="client_8inc_8php.html#a6">value</a>=<span class="stringliteral">"'.$action.'"</span>&gt;';
<a name="l00063"></a>00063
<a name="l00064"></a>00064 echo <a class="code" href="jrn__pdf_8php.html#a2">$centr</a>;
<a name="l00065"></a>00065
<a name="l00066"></a>00066 <span class="keywordflow">if</span> ( isset($filter))
<a name="l00067"></a>00067 echo '&lt;INPUT TYPE=<span class="stringliteral">"HIDDEN"</span> NAME=<span class="stringliteral">"filter"</span> <a class="code" href="client_8inc_8php.html#a6">value</a>=<span class="stringliteral">"'.$filter.'"</span>&gt;';
<a name="l00068"></a>00068 <span class="keywordflow">if</span> ( isset ($p_id)) {
<a name="l00069"></a>00069 echo '&lt;INPUT TYPE=<span class="stringliteral">"HIDDEN"</span> NAME=<span class="stringliteral">"p_id"</span> <a class="code" href="client_8inc_8php.html#a6">value</a>=<span class="stringliteral">"'.$p_id.'"</span>&gt;';
<a name="l00070"></a>00070 } <span class="keywordflow">else</span> {
<a name="l00071"></a>00071 include_once(<span class="stringliteral">"poste.php"</span>);
<a name="l00072"></a>00072 echo <span class="stringliteral">"&lt;BR&gt;"</span>;
<a name="l00073"></a>00073 echo <a class="code" href="poste_8php.html#a2">PosteForm</a>($p_cn);
<a name="l00074"></a>00074 echo ' &lt;BR&gt;Tous les postes ';
<a name="l00075"></a>00075 echo '&lt;INPUT TYPE=<span class="stringliteral">"checkbox"</span> NAME=<span class="stringliteral">"all_poste"</span>&gt;&lt;BR&gt;';
<a name="l00076"></a>00076 }
<a name="l00077"></a>00077 echo '&lt;INPUT TYPE=<span class="stringliteral">"SUBMIT"</span> <a class="code" href="client_8inc_8php.html#a5">name</a>=<span class="stringliteral">"print"</span> Value=<span class="stringliteral">"Executer"</span>&gt;';
<a name="l00078"></a>00078
<a name="l00079"></a>00079 echo '&lt;/<a class="code" href="constant_8php.html#a7">FORM</a>&gt;';
<a name="l00080"></a>00080 echo <span class="stringliteral">"&lt;/DIV&gt;"</span>;
<a name="l00081"></a>00081 }
<a name="l00095"></a><a class="code" href="impress__inc_8php.html#a1">00095</a> function <a class="code" href="impress__inc_8php.html#a1">Imp</a>($p_array,$p_cn) {
<a name="l00096"></a>00096 <span class="keywordflow">if</span> ( ! isset($p_array['<a class="code" href="classaction.html">action</a>'])) {
<a name="l00097"></a>00097 <a class="code" href="ac__common_8php.html#a0">echo_error</a> (<span class="stringliteral">"IMP no action specified"</span>); <span class="keywordflow">return</span>;
<a name="l00098"></a>00098 }
<a name="l00099"></a>00099 <span class="keywordflow">if</span> ( $p_array['action']==<span class="stringliteral">"viewhtml"</span>) {
<a name="l00100"></a>00100 <span class="keywordflow">return</span> <a class="code" href="impress__inc_8php.html#a2">ImpHtml</a>($p_array,$p_cn);
<a name="l00101"></a>00101 }
<a name="l00102"></a>00102 <a class="code" href="ac__common_8php.html#a0">echo_error</a> (<span class="stringliteral">"IMP no action specified"</span>); <span class="keywordflow">return</span>;
<a name="l00103"></a>00103 }
<a name="l00117"></a><a class="code" href="impress__inc_8php.html#a2">00117</a> function <a class="code" href="impress__inc_8php.html#a2">ImpHtml</a>($p_array,$p_cn)
<a name="l00118"></a>00118 {
<a name="l00119"></a>00119 foreach($p_array as $key=&gt;$element) {
<a name="l00120"></a>00120 ${<span class="stringliteral">"$key"</span>}=$element;
<a name="l00121"></a>00121 <a class="code" href="debug_8php.html#a0">echo_debug</a>('impress_inc.php',__LINE__,<span class="stringliteral">"ImpHtml $key =&gt; $element"</span>);
<a name="l00122"></a>00122 }
<a name="l00123"></a>00123
<a name="l00124"></a>00124
<a name="l00125"></a>00125 $colvide=<span class="stringliteral">"&lt;TD&gt;&lt;/TD&gt;"</span>;
<a name="l00126"></a>00126 <span class="comment">// formulaire</span>
<a name="l00127"></a>00127 <span class="keywordflow">if</span> ( $type == <span class="stringliteral">"form"</span> ) {
<a name="l00128"></a>00128 <span class="keywordflow">if</span> ( !isset ($periode)) <span class="keywordflow">return</span> <a class="code" href="constant_8php.html#a34">NO_PERIOD_SELECTED</a>;
<a name="l00129"></a>00129 <a class="code" href="send__poste__pdf_8php.html#a5">$cond</a>=<a class="code" href="impress__inc_8php.html#a5">CreatePeriodeCond</a>($periode);
<a name="l00130"></a>00130 <a class="code" href="eub__be_8inc_8php.html#a5">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"select fo_id , </span>
<a name="l00131"></a>00131 <span class="stringliteral"> fo_fr_id, </span>
<a name="l00132"></a>00132 <span class="stringliteral"> fo_pos, </span>
<a name="l00133"></a>00133 <span class="stringliteral"> fo_label, </span>
<a name="l00134"></a>00134 <span class="stringliteral"> fo_formula,</span>
<a name="l00135"></a>00135 <span class="stringliteral"> fr_label from form </span>
<a name="l00136"></a>00136 <span class="stringliteral"> inner join formdef on fr_id=fo_fr_id</span>
<a name="l00137"></a>00137 <span class="stringliteral"> where fo_fr_id=$p_id</span>
<a name="l00138"></a>00138 <span class="stringliteral"> order by fo_pos"</span>);
<a name="l00139"></a>00139 <a class="code" href="setup_8php.html#a11">$Max</a>=pg_NumRows($Res);
<a name="l00140"></a>00140 <span class="keywordflow">if</span> ($Max==0) <span class="keywordflow">return</span> <a class="code" href="class__operation_8php.html#a4">$ret</a>=<span class="stringliteral">""</span>;
<a name="l00141"></a>00141 <span class="keywordflow">for</span> ($i=0;$i&lt;$Max;$i++) {
<a name="l00142"></a>00142 <a class="code" href="jrn__detail_8php.html#a11">$l_line</a>=pg_fetch_array($Res,$i);
<a name="l00143"></a>00143 <a class="code" href="bilan_8php.html#a5">$col</a>=<a class="code" href="impress__inc_8php.html#a10">GetFormulaValue</a>($p_cn,
<a name="l00144"></a>00144 $l_line['fo_label'],
<a name="l00145"></a>00145 $l_line['fo_formula'],$cond);
<a name="l00146"></a>00146 echo <span class="stringliteral">"&lt;div&gt;"</span>;
<a name="l00147"></a>00147 foreach ($col as $key=&gt; $element) {
<a name="l00148"></a>00148 echo <span class="stringliteral">"$element "</span>;
<a name="l00149"></a>00149 }
<a name="l00150"></a>00150 echo <span class="stringliteral">"&lt;/div&gt;"</span>;
<a name="l00151"></a>00151 } <span class="comment">//for ($i</span>
<a name="l00152"></a>00152
<a name="l00153"></a>00153 }<span class="comment">//form</span>
<a name="l00154"></a>00154 <span class="keywordflow">if</span> ($type==<span class="stringliteral">"poste"</span>) {
<a name="l00155"></a>00155 <span class="keywordflow">if</span> ( ! isset ( $all_poste) &amp;&amp; ! isset ( $<a class="code" href="classposte.html">poste</a> )) <span class="keywordflow">return</span> <a class="code" href="constant_8php.html#a35">NO_POST_SELECTED</a>;
<a name="l00156"></a>00156 <span class="keywordflow">if</span> ( !isset ($periode)) <span class="keywordflow">return</span> <a class="code" href="constant_8php.html#a34">NO_PERIOD_SELECTED</a>;
<a name="l00157"></a>00157 include_once(<span class="stringliteral">"poste.php"</span>);
<a name="l00158"></a>00158 <a class="code" href="send__poste__pdf_8php.html#a5">$cond</a>=<a class="code" href="impress__inc_8php.html#a5">CreatePeriodeCond</a>($periode);
<a name="l00159"></a>00159 <a class="code" href="class__operation_8php.html#a4">$ret</a>=<span class="stringliteral">""</span> ;
<a name="l00160"></a>00160 <span class="keywordflow">if</span> ( isset ( $all_poste) ){ <span class="comment">//choisit de voir tous les postes</span>
<a name="l00161"></a>00161 $r_poste=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"select pcm_val from tmp_pcmn"</span>);
<a name="l00162"></a>00162 <a class="code" href="send__poste__pdf_8php.html#a1">$nPoste</a>=pg_numRows($r_poste);
<a name="l00163"></a>00163 <span class="keywordflow">for</span> ( $i=0;$i&lt;$nPoste;$i++) {
<a name="l00164"></a>00164 $t_poste=pg_fetch_array($r_poste,$i);
<a name="l00165"></a>00165 <a class="code" href="send__poste__pdf_8php.html#a2">$poste</a>[]=$t_poste['pcm_val'];
<a name="l00166"></a>00166 }
<a name="l00167"></a>00167 }
<a name="l00168"></a>00168 <span class="keywordflow">for</span> ( $i =0;$i&lt;count($poste);$i++) {
<a name="l00169"></a>00169 list ($array,$tot_deb,$tot_cred)=<a class="code" href="impress__inc_8php.html#a3">GetDataPoste</a>($p_cn,$poste[$i],$cond);
<a name="l00170"></a>00170 <span class="keywordflow">if</span> ( count($array) == 0) <span class="keywordflow">continue</span>;
<a name="l00171"></a>00171 <a class="code" href="class__operation_8php.html#a4">$ret</a>.=sprintf(<span class="stringliteral">"&lt;H2 class=\"info\"&gt;%d %s&lt;/H2&gt;"</span>,
<a name="l00172"></a>00172 $poste[$i],<a class="code" href="poste_8php.html#a0">GetPosteLibelle</a>($p_cn,$poste[$i],1));
<a name="l00173"></a>00173 <a class="code" href="class__operation_8php.html#a4">$ret</a>.=<span class="stringliteral">"&lt;TABLE style=\"border-bottom-style:solid; border-width:2px\" &gt;"</span>;
<a name="l00174"></a>00174 <a class="code" href="balance_8php.html#a11">$i</a>=0;
<a name="l00175"></a>00175 foreach ($array as $col=&gt;$element) {
<a name="l00176"></a>00176 <a class="code" href="balance_8php.html#a11">$i</a>++;
<a name="l00177"></a>00177 <span class="keywordflow">if</span> ( $i %2 == 0)
<a name="l00178"></a>00178 <a class="code" href="class__operation_8php.html#a4">$ret</a>.=<span class="stringliteral">"&lt;tr class=\"even\"&gt;"</span>;
<a name="l00179"></a>00179 <span class="keywordflow">else</span>
<a name="l00180"></a>00180 <a class="code" href="class__operation_8php.html#a4">$ret</a>.=<span class="stringliteral">"&lt;TR class=\"odd\"&gt;"</span>;
<a name="l00181"></a>00181 <a class="code" href="class__operation_8php.html#a4">$ret</a>.=sprintf(<span class="stringliteral">"&lt;TD&gt;%s&lt;/TD&gt;"</span>,$element['j_date']);
<a name="l00182"></a>00182 <a class="code" href="class__operation_8php.html#a4">$ret</a>.=sprintf(<span class="stringliteral">"&lt;TD&gt;%s&lt;/TD&gt;"</span>,$element['jr_internal']);
<a name="l00183"></a>00183 <span class="comment">// $ret.=sprintf("&lt;TD&gt;jrn:%s&lt;/TD&gt;",$element['jrn_name']);</span>
<a name="l00184"></a>00184 <a class="code" href="class__operation_8php.html#a4">$ret</a>.=sprintf(<span class="stringliteral">"&lt;TD&gt;%s&lt;/TD&gt;"</span>,$element['description']);
<a name="l00185"></a>00185 <span class="keywordflow">if</span> ( $element['j_debit']==<span class="charliteral">'t'</span>) {
<a name="l00186"></a>00186 <a class="code" href="class__operation_8php.html#a4">$ret</a>.=sprintf(<span class="stringliteral">"&lt;TD&gt; debit&lt;/TD&gt;&lt;TD ALIGN=\"right\"&gt; % 8.2f&lt;/TD&gt; $colvide"</span>,
<a name="l00187"></a>00187 $element['deb_montant']);
<a name="l00188"></a>00188 } <span class="keywordflow">else</span> {
<a name="l00189"></a>00189 <a class="code" href="class__operation_8php.html#a4">$ret</a>.=sprintf(<span class="stringliteral">"&lt;TD&gt;credit&lt;/TD&gt; $colvide &lt;TD ALIGN=\"right\"&gt; % 8.2f&lt;/TD&gt;"</span>,
<a name="l00190"></a>00190 $element['cred_montant']);
<a name="l00191"></a>00191
<a name="l00192"></a>00192 }
<a name="l00193"></a>00193 <a class="code" href="class__operation_8php.html#a4">$ret</a>.=<span class="stringliteral">"&lt;/TR&gt;"</span>;
<a name="l00194"></a>00194 }<span class="comment">//foreach</span>
<a name="l00195"></a>00195
<a name="l00196"></a>00196 <a class="code" href="class__operation_8php.html#a4">$ret</a>.=sprintf(<span class="stringliteral">"$colvide $colvide $colvide $colvide "</span>.
<a name="l00197"></a>00197 <span class="stringliteral">"&lt;TD ALIGN=\"right\"&gt;% 8.2f&lt;/TD&gt;"</span>.
<a name="l00198"></a>00198 <span class="stringliteral">"&lt;TD ALIGN=\"right\"&gt;% 8.2f&lt;/TD&gt;"</span>,
<a name="l00199"></a>00199 $tot_deb,
<a name="l00200"></a>00200 $tot_cred);
<a name="l00201"></a>00201 <a class="code" href="class__operation_8php.html#a4">$ret</a>.=<span class="stringliteral">"&lt;/TABLE&gt;"</span>;
<a name="l00202"></a>00202 <a class="code" href="class__operation_8php.html#a4">$ret</a>.=<span class="stringliteral">"&lt;p&gt;Total d<>bit :"</span>.$tot_deb.<span class="stringliteral">" Total Cr<43>dit:"</span>.$tot_cred.<span class="stringliteral">"&lt;/p&gt;"</span>;
<a name="l00203"></a>00203 <span class="keywordflow">if</span> ( $tot_deb &gt; $tot_cred ) {
<a name="l00204"></a>00204 $solde_t=<span class="stringliteral">"D"</span>;
<a name="l00205"></a>00205 <a class="code" href="impress__fiche_8php.html#a13">$solde</a>=$tot_deb-$tot_cred;
<a name="l00206"></a>00206 }<span class="keywordflow">else</span> {
<a name="l00207"></a>00207 $solde_t=<span class="stringliteral">"C"</span>;
<a name="l00208"></a>00208 <a class="code" href="impress__fiche_8php.html#a13">$solde</a>=$tot_cred-$tot_deb;
<a name="l00209"></a>00209 }
<a name="l00210"></a>00210 <a class="code" href="class__operation_8php.html#a4">$ret</a>.=<span class="stringliteral">" &lt;p&gt;&lt;B&gt; Solde $solde_t = "</span>.$solde.<span class="stringliteral">"&lt;/B&gt;&lt;/p&gt;"</span>;
<a name="l00211"></a>00211 }<span class="comment">// for i</span>
<a name="l00212"></a>00212 <span class="keywordflow">return</span> <a class="code" href="class__operation_8php.html#a4">$ret</a>;
<a name="l00213"></a>00213 }<span class="comment">//poste</span>
<a name="l00214"></a>00214 <span class="keywordflow">if</span> ($type==<span class="stringliteral">"jrn"</span>) {
<a name="l00215"></a>00215 <span class="keywordflow">if</span> ( !isset ($periode)) <span class="keywordflow">return</span> <a class="code" href="constant_8php.html#a34">NO_PERIOD_SELECTED</a>;
<a name="l00216"></a>00216
<a name="l00217"></a>00217 <a class="code" href="debug_8php.html#a0">echo_debug</a>('impress_inc.php',__LINE__,<span class="stringliteral">"imp html journaux"</span>);
<a name="l00218"></a>00218 <a class="code" href="class__operation_8php.html#a4">$ret</a>=<span class="stringliteral">""</span>;
<a name="l00219"></a>00219 <span class="keywordflow">if</span> (isset($filter)) {
<a name="l00220"></a>00220 <a class="code" href="recherche_8php.html#a4">$array</a>=<a class="code" href="impress__inc_8php.html#a4">GetDataJrn</a>($p_cn,$p_array,$filter);
<a name="l00221"></a>00221 }
<a name="l00222"></a>00222 $cass=<span class="stringliteral">""</span>;
<a name="l00223"></a>00223 <a class="code" href="balance_8php.html#a7">$c</a>=0;
<a name="l00224"></a>00224
<a name="l00225"></a>00225 foreach ($array as $a=&gt;$e2) {
<a name="l00226"></a>00226 <span class="comment">// echo_debug($ret);</span>
<a name="l00227"></a>00227
<a name="l00228"></a>00228 <span class="comment">//cassure entre op</span>
<a name="l00229"></a>00229 <span class="keywordflow">if</span> ( $cass!=$e2['grp'] ) {
<a name="l00230"></a>00230 $cass=$e2['grp'];
<a name="l00231"></a>00231 <a class="code" href="class__operation_8php.html#a4">$ret</a>.='&lt;TR style=<span class="stringliteral">"background-color:#89BEFF"</span>&gt;&lt;TD&gt;'.$e2['j_date'].<span class="stringliteral">"&lt;/TD&gt;"</span>;
<a name="l00232"></a>00232 <a class="code" href="class__operation_8php.html#a4">$ret</a>.=<span class="stringliteral">"&lt;TD&gt;"</span>.$e2['jr_internal'].<span class="stringliteral">"&lt;/TD&gt;&lt;TD COLSPAN=4&gt; "</span>.$e2['comment'].<span class="stringliteral">"&lt;/TD&gt;&lt;/TR&gt;"</span>;
<a name="l00233"></a>00233 }
<a name="l00234"></a>00234 <a class="code" href="class__operation_8php.html#a4">$ret</a>.=<span class="stringliteral">"&lt;TR&gt;"</span>;
<a name="l00235"></a>00235 <a class="code" href="class__operation_8php.html#a4">$ret</a>.=$colvide;
<a name="l00236"></a>00236
<a name="l00237"></a>00237 <span class="keywordflow">if</span> ($e2['debit']==<span class="charliteral">'f'</span>) <a class="code" href="class__operation_8php.html#a4">$ret</a>.=$colvide;
<a name="l00238"></a>00238 <a class="code" href="class__operation_8php.html#a4">$ret</a>.=<span class="stringliteral">"&lt;TD&gt;"</span>.$e2['<a class="code" href="classposte.html">poste</a>'].<span class="stringliteral">"&lt;/TD&gt;"</span>;
<a name="l00239"></a>00239 <span class="keywordflow">if</span> ($e2['debit']==<span class="charliteral">'t'</span>) <a class="code" href="class__operation_8php.html#a4">$ret</a>.=$colvide;
<a name="l00240"></a>00240 <a class="code" href="class__operation_8php.html#a4">$ret</a>.=<span class="stringliteral">"&lt;TD&gt;"</span>.$e2['description'].<span class="stringliteral">"&lt;/TD&gt;"</span>;
<a name="l00241"></a>00241 <span class="keywordflow">if</span> ($e2['debit']==<span class="charliteral">'f'</span>) <a class="code" href="class__operation_8php.html#a4">$ret</a>.=$colvide;
<a name="l00242"></a>00242 <a class="code" href="class__operation_8php.html#a4">$ret</a>.=<span class="stringliteral">"&lt;TD&gt;"</span>.$e2['montant'].<span class="stringliteral">"&lt;/TD&gt;"</span>;
<a name="l00243"></a>00243 <span class="keywordflow">if</span> ($e2['debit']==<span class="charliteral">'t'</span>) <a class="code" href="class__operation_8php.html#a4">$ret</a>.=$colvide;
<a name="l00244"></a>00244 <a class="code" href="class__operation_8php.html#a4">$ret</a>.=<span class="stringliteral">"&lt;/TR&gt;"</span>;
<a name="l00245"></a>00245 }
<a name="l00246"></a>00246 <a class="code" href="debug_8php.html#a0">echo_debug</a>($ret);
<a name="l00247"></a>00247
<a name="l00248"></a>00248 <span class="keywordflow">return</span> <a class="code" href="class__operation_8php.html#a4">$ret</a> ;
<a name="l00249"></a>00249 }<span class="comment">//jrn</span>
<a name="l00250"></a>00250
<a name="l00251"></a>00251 }
<a name="l00265"></a><a class="code" href="impress__inc_8php.html#a3">00265</a> function <a class="code" href="impress__inc_8php.html#a3">GetDataPoste</a>($p_cn,$p_poste,$p_condition)
<a name="l00266"></a>00266 {
<a name="l00267"></a>00267 <a class="code" href="eub__be_8inc_8php.html#a5">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"select to_char(j_date,'DD.MM.YYYY') as j_date,"</span>.
<a name="l00268"></a>00268 <span class="stringliteral">"case when j_debit='t' then to_char(j_montant,'999999999.99') else ' ' end as deb_montant,"</span>.
<a name="l00269"></a>00269 <span class="stringliteral">"case when j_debit='f' then to_char(j_montant,'999999999.99') else ' ' end as cred_montant,"</span>.
<a name="l00270"></a>00270 <span class="stringliteral">" jr_comment as description,jrn_def_name as jrn_name,"</span>.
<a name="l00271"></a>00271 <span class="stringliteral">"j_debit, jr_internal "</span>.
<a name="l00272"></a>00272 <span class="comment">// " case when j_debit='t' then 'debit' else 'credit' end as debit".</span>
<a name="l00273"></a>00273 <span class="stringliteral">" from jrnx left join jrn_def on jrn_def_id=j_jrn_def "</span>.
<a name="l00274"></a>00274 <span class="stringliteral">" left join jrn on jr_grpt_id=j_grpt"</span>.
<a name="l00275"></a>00275 <span class="stringliteral">" where j_poste="</span>.$p_poste.<span class="stringliteral">" and "</span>.$p_condition.
<a name="l00276"></a>00276 <span class="stringliteral">" order by j_date::date"</span>);
<a name="l00277"></a>00277 <a class="code" href="recherche_8php.html#a4">$array</a>=array();
<a name="l00278"></a>00278 $tot_cred=0;
<a name="l00279"></a>00279 $tot_deb=0;
<a name="l00280"></a>00280 <a class="code" href="setup_8php.html#a11">$Max</a>=pg_NumRows($Res);
<a name="l00281"></a>00281 <span class="keywordflow">if</span> ( $Max == 0 ) <span class="keywordflow">return</span> null;
<a name="l00282"></a>00282 <span class="keywordflow">for</span> ($i=0;$i&lt;$Max;$i++) {
<a name="l00283"></a>00283 <a class="code" href="recherche_8php.html#a4">$array</a>[]=pg_fetch_array($Res,$i);
<a name="l00284"></a>00284 <span class="keywordflow">if</span> ($array[$i]['j_debit']==<span class="charliteral">'t'</span>) {
<a name="l00285"></a>00285 $tot_deb+=<a class="code" href="recherche_8php.html#a4">$array</a>[<a class="code" href="balance_8php.html#a11">$i</a>]['deb_montant'] ;
<a name="l00286"></a>00286 } <span class="keywordflow">else</span> {
<a name="l00287"></a>00287 $tot_cred+=<a class="code" href="recherche_8php.html#a4">$array</a>[<a class="code" href="balance_8php.html#a11">$i</a>]['cred_montant'] ;
<a name="l00288"></a>00288 }
<a name="l00289"></a>00289 }
<a name="l00290"></a>00290 <span class="keywordflow">return</span> array($array,$tot_deb,$tot_cred);
<a name="l00291"></a>00291 }
<a name="l00306"></a><a class="code" href="impress__inc_8php.html#a4">00306</a> function <a class="code" href="impress__inc_8php.html#a4">GetDataJrn</a>($p_cn,$p_array,$filter=<a class="code" href="constant_8php.html#a39">YES</a>)
<a name="l00307"></a>00307 {
<a name="l00308"></a>00308 <span class="keywordflow">if</span> ( !isset ($p_array['periode']) ) <span class="keywordflow">return</span> <a class="code" href="constant_8php.html#a34">NO_PERIOD_SELECTED</a>;
<a name="l00309"></a>00309
<a name="l00310"></a>00310 <span class="keywordflow">if</span> ( $filter==<a class="code" href="constant_8php.html#a39">YES</a>) {
<a name="l00311"></a>00311 <span class="keywordflow">if</span> ( ! isset ( $p_array['central'])){
<a name="l00312"></a>00312 <a class="code" href="send__poste__pdf_8php.html#a5">$cond</a>=<a class="code" href="impress__inc_8php.html#a5">CreatePeriodeCond</a>($p_array['periode']);
<a name="l00313"></a>00313 <a class="code" href="eub__be_8inc_8php.html#a5">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"select to_char(j_date,'DD.MM.YYYY') as j_date,</span>
<a name="l00314"></a>00314 <span class="stringliteral"> j_montant as montant,j_debit as debit,j_poste as poste,"</span>.
<a name="l00315"></a>00315 <span class="stringliteral">"j_text as description,j_grpt as grp,jr_comment as comment,</span>
<a name="l00316"></a>00316 <span class="stringliteral"> j_rapt as oc,jr_internal from jrnx left join jrn on "</span>.
<a name="l00317"></a>00317 <span class="stringliteral">"jr_grpt_id=j_grpt where j_jrn_def="</span>.$p_array['p_id'].
<a name="l00318"></a>00318 <span class="stringliteral">" and "</span>.$cond.<span class="stringliteral">" order by j_date::date,j_grpt,j_debit desc"</span>);
<a name="l00319"></a>00319 } <span class="keywordflow">else</span> {
<a name="l00320"></a>00320 <span class="comment">// create </span>
<a name="l00321"></a>00321 <a class="code" href="send__poste__pdf_8php.html#a5">$cond</a>=<a class="code" href="impress__inc_8php.html#a5">CreatePeriodeCond</a>($p_array['periode'],<span class="stringliteral">"c_periode"</span>);
<a name="l00322"></a>00322
<a name="l00323"></a>00323 <a class="code" href="eub__be_8inc_8php.html#a5">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"select to_char(c_date,'DD.MM.YYYY') as j_date,</span>
<a name="l00324"></a>00324 <span class="stringliteral"> c_montant as montant,c_debit as debit,c_poste as poste,"</span>.
<a name="l00325"></a>00325 <span class="stringliteral">"c_description as description,c_grp as grp,c_comment as comment,</span>
<a name="l00326"></a>00326 <span class="stringliteral"> c_rapt as oc,c_internal as jr_internal from centralized left join jrn on "</span>.
<a name="l00327"></a>00327 <span class="stringliteral">"jr_grpt_id=c_grp where c_jrn_def="</span>.$p_array['p_id'].<span class="stringliteral">" and "</span>.
<a name="l00328"></a>00328 $cond.<span class="stringliteral">" order by c_id,c_date,c_grp,c_debit desc"</span>);
<a name="l00329"></a>00329 }
<a name="l00330"></a>00330
<a name="l00331"></a>00331 } <span class="comment">// if filter == YES</span>
<a name="l00332"></a>00332 <span class="keywordflow">if</span> ( $filter == <a class="code" href="constant_8php.html#a40">NO</a>) {
<a name="l00333"></a>00333 <span class="keywordflow">if</span> ( ! isset ($p_array['central']) ) {
<a name="l00334"></a>00334 <a class="code" href="send__poste__pdf_8php.html#a5">$cond</a>=<a class="code" href="impress__inc_8php.html#a5">CreatePeriodeCond</a>($p_array['periode']);
<a name="l00335"></a>00335 <a class="code" href="eub__be_8inc_8php.html#a5">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"select to_char(j_date,'DD.MM.YYYY') as j_date,</span>
<a name="l00336"></a>00336 <span class="stringliteral"> j_montant as montant,j_debit as debit,j_poste as poste,"</span>.
<a name="l00337"></a>00337 <span class="stringliteral">"j_text as description,j_grpt as grp,jr_comment as comment,</span>
<a name="l00338"></a>00338 <span class="stringliteral"> j_rapt as oc,jr_internal from jrnx left join jrn on "</span>.
<a name="l00339"></a>00339 <span class="stringliteral">"jr_grpt_id=j_grpt where "</span>.
<a name="l00340"></a>00340 $cond.<span class="stringliteral">" order by j_date::date,j_grpt,j_debit desc"</span>);
<a name="l00341"></a>00341 } <span class="keywordflow">else</span> {
<a name="l00342"></a>00342 <a class="code" href="send__poste__pdf_8php.html#a5">$cond</a>=<a class="code" href="impress__inc_8php.html#a5">CreatePeriodeCond</a>($p_array['periode'],<span class="stringliteral">"c_periode"</span>);
<a name="l00343"></a>00343
<a name="l00344"></a>00344 <a class="code" href="eub__be_8inc_8php.html#a5">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"select to_char(c_date,'DD.MM.YYYY') as j_date,</span>
<a name="l00345"></a>00345 <span class="stringliteral"> c_montant as montant,c_debit as debit,c_poste as poste,"</span>.
<a name="l00346"></a>00346 <span class="stringliteral">"c_description as description,c_grp as grp,c_comment as comment,</span>
<a name="l00347"></a>00347 <span class="stringliteral"> c_rapt as oc,c_internal as jr_internal from centralized left join jrn on "</span>.
<a name="l00348"></a>00348 <span class="stringliteral">"jr_grpt_id=c_grp where "</span>.
<a name="l00349"></a>00349 $cond.<span class="stringliteral">" order by c_id,c_date,c_grp,c_debit desc"</span>);
<a name="l00350"></a>00350
<a name="l00351"></a>00351 }
<a name="l00352"></a>00352 }<span class="comment">// filter == no</span>
<a name="l00353"></a>00353 <a class="code" href="recherche_8php.html#a4">$array</a>=array();
<a name="l00354"></a>00354 <a class="code" href="setup_8php.html#a11">$Max</a>=pg_NumRows($Res);
<a name="l00355"></a>00355 <span class="keywordflow">for</span> ($i=0;$i&lt;$Max;$i++) {
<a name="l00356"></a>00356 <a class="code" href="recherche_8php.html#a4">$array</a>[]=pg_fetch_array($Res,$i);
<a name="l00357"></a>00357 }
<a name="l00358"></a>00358 <span class="keywordflow">return</span> <a class="code" href="recherche_8php.html#a4">$array</a>;
<a name="l00359"></a>00359 }
<a name="l00372"></a><a class="code" href="impress__inc_8php.html#a5">00372</a> function <a class="code" href="impress__inc_8php.html#a5">CreatePeriodeCond</a>($p_periode,$p_field=<span class="stringliteral">" j_tech_per"</span>) {
<a name="l00373"></a>00373 <span class="keywordflow">if</span> ( count($p_periode) == 1) {
<a name="l00374"></a>00374 <span class="keywordflow">return</span> $p_field.<span class="stringliteral">"="</span>.$p_periode[0];
<a name="l00375"></a>00375 }
<a name="l00376"></a>00376
<a name="l00377"></a>00377 $cond_periode=<span class="stringliteral">" $p_field in ("</span>;
<a name="l00378"></a>00378 <span class="comment">// condition periode</span>
<a name="l00379"></a>00379 <a class="code" href="impress__fiche_8php.html#a12">$old</a>=0;
<a name="l00380"></a>00380 $follow=0;
<a name="l00381"></a>00381 foreach ( $p_periode as $per) {
<a name="l00382"></a>00382 <span class="keywordflow">if</span> ( $old == 0) {
<a name="l00383"></a>00383 <a class="code" href="impress__fiche_8php.html#a12">$old</a>=$per;
<a name="l00384"></a>00384 $follow=1;
<a name="l00385"></a>00385 <span class="keywordflow">continue</span>;
<a name="l00386"></a>00386 }
<a name="l00387"></a>00387 <span class="keywordflow">if</span> ( $per == $old+1 ) {
<a name="l00388"></a>00388 <a class="code" href="impress__fiche_8php.html#a12">$old</a>=$per;
<a name="l00389"></a>00389 $follow++;
<a name="l00390"></a>00390 }
<a name="l00391"></a>00391
<a name="l00392"></a>00392 }<span class="comment">// foreach</span>
<a name="l00393"></a>00393 <span class="keywordflow">if</span> ( count($p_periode) == $follow) {
<a name="l00394"></a>00394 <a class="code" href="send__poste__pdf_8php.html#a5">$cond</a>=$p_field.<span class="stringliteral">" &gt;= "</span>.$p_periode[0].' and '.$p_field.' &lt;= '.$p_periode[count($p_periode)-1];
<a name="l00395"></a>00395 <span class="keywordflow">return</span> <a class="code" href="send__poste__pdf_8php.html#a5">$cond</a>;
<a name="l00396"></a>00396 }
<a name="l00397"></a>00397
<a name="l00398"></a>00398 <span class="comment">// condition periode</span>
<a name="l00399"></a>00399 foreach ( $p_periode as $per) {
<a name="l00400"></a>00400 $cond_periode.=$per.<span class="stringliteral">","</span>;
<a name="l00401"></a>00401 }
<a name="l00402"></a>00402 $cond_periode=substr($cond_periode,0,strlen($cond_periode)-1);
<a name="l00403"></a>00403 $cond_periode.=<span class="stringliteral">")"</span>;
<a name="l00404"></a>00404 <span class="keywordflow">return</span> $cond_periode;
<a name="l00405"></a>00405 }
<a name="l00421"></a><a class="code" href="impress__inc_8php.html#a6">00421</a> function <a class="code" href="impress__inc_8php.html#a6">GetDataJrnPdf</a>($p_cn,$p_array,$p_limit,$p_offset)
<a name="l00422"></a>00422 {
<a name="l00423"></a>00423 <a class="code" href="debug_8php.html#a0">echo_debug</a>('impress_inc.php',__LINE__,<span class="stringliteral">"GetDataJrnPdf"</span>);
<a name="l00424"></a>00424
<a name="l00425"></a>00425 <span class="keywordflow">if</span> ( !isset ($p_array['periode']) ) <span class="keywordflow">return</span> <a class="code" href="constant_8php.html#a34">NO_PERIOD_SELECTED</a>;
<a name="l00426"></a>00426
<a name="l00427"></a>00427 <span class="keywordflow">if</span> ( $p_array['filter']==<a class="code" href="constant_8php.html#a39">YES</a>) {
<a name="l00428"></a>00428 <a class="code" href="send__poste__pdf_8php.html#a5">$cond</a>=<a class="code" href="impress__inc_8php.html#a5">CreatePeriodeCond</a>($p_array['periode']);
<a name="l00429"></a>00429 <span class="keywordflow">if</span> ( ! isset ($p_array['central']) ) {
<a name="l00430"></a>00430 <span class="comment">// Journaux non centralis<69>s</span>
<a name="l00431"></a>00431 <a class="code" href="eub__be_8inc_8php.html#a5">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"select j_id,to_char(j_date,'DD.MM.YYYY') as j_date,</span>
<a name="l00432"></a>00432 <span class="stringliteral"> jr_internal,</span>
<a name="l00433"></a>00433 <span class="stringliteral"> case j_debit when 't' then j_montant::text else ' ' end as deb_montant,</span>
<a name="l00434"></a>00434 <span class="stringliteral"> case j_debit when 'f' then j_montant::text else ' ' end as cred_montant,</span>
<a name="l00435"></a>00435 <span class="stringliteral"> j_debit as debit,j_poste as poste,jr_montant , "</span>.
<a name="l00436"></a>00436 <span class="stringliteral">"pcm_lib as description,j_grpt as grp,jr_comment ,</span>
<a name="l00437"></a>00437 <span class="stringliteral"> jr_rapt as oc, j_tech_per as periode from jrnx left join jrn on "</span>.
<a name="l00438"></a>00438 <span class="stringliteral">"jr_grpt_id=j_grpt "</span>.
<a name="l00439"></a>00439 <span class="stringliteral">" left join tmp_pcmn on pcm_val=j_poste "</span>.
<a name="l00440"></a>00440 <span class="stringliteral">" where j_jrn_def="</span>.$p_array['p_id'].
<a name="l00441"></a>00441 <span class="stringliteral">" and "</span>.$cond.<span class="stringliteral">" order by j_date::date asc,jr_internal,j_debit desc"</span>.
<a name="l00442"></a>00442 <span class="stringliteral">" limit "</span>.$p_limit.<span class="stringliteral">" offset "</span>.$p_offset);
<a name="l00443"></a>00443 }<span class="keywordflow">else</span> {
<a name="l00444"></a>00444 <span class="comment">// Journaux centralis<69>s</span>
<a name="l00445"></a>00445 <a class="code" href="send__poste__pdf_8php.html#a5">$cond</a>=<a class="code" href="impress__inc_8php.html#a5">CreatePeriodeCond</a>($p_array['periode'],<span class="stringliteral">"c_periode"</span>);
<a name="l00446"></a>00446 <a class="code" href="eub__be_8inc_8php.html#a4">$Sql</a>=<span class="stringliteral">"select c_id as j_id,</span>
<a name="l00447"></a>00447 <span class="stringliteral"> c_j_id,</span>
<a name="l00448"></a>00448 <span class="stringliteral"> to_char (c_date,'DD.MM.YYYY') as j_date ,</span>
<a name="l00449"></a>00449 <span class="stringliteral"> c_internal as jr_internal,</span>
<a name="l00450"></a>00450 <span class="stringliteral"> case c_debit when 't' then c_montant::text else ' ' end as deb_montant,</span>
<a name="l00451"></a>00451 <span class="stringliteral"> case c_debit when 'f' then c_montant::text else ' ' end as cred_montant,</span>
<a name="l00452"></a>00452 <span class="stringliteral"> c_debit as j_debit,</span>
<a name="l00453"></a>00453 <span class="stringliteral"> c_poste as poste,</span>
<a name="l00454"></a>00454 <span class="stringliteral"> pcm_lib as description,</span>
<a name="l00455"></a>00455 <span class="stringliteral"> jr_comment,</span>
<a name="l00456"></a>00456 <span class="stringliteral"> jr_montant,</span>
<a name="l00457"></a>00457 <span class="stringliteral"> c_grp as grp,</span>
<a name="l00458"></a>00458 <span class="stringliteral"> c_comment as comment,</span>
<a name="l00459"></a>00459 <span class="stringliteral"> c_rapt as oc,</span>
<a name="l00460"></a>00460 <span class="stringliteral"> c_periode as periode </span>
<a name="l00461"></a>00461 <span class="stringliteral"> from centralized left join jrn on "</span>.
<a name="l00462"></a>00462 <span class="stringliteral">"jr_grpt_id=c_grp left join tmp_pcmn on pcm_val=c_poste where "</span>.
<a name="l00463"></a>00463 <span class="stringliteral">" c_jrn_def="</span>.$p_array['p_id'].<span class="stringliteral">" and "</span>.
<a name="l00464"></a>00464 <a class="code" href="send__poste__pdf_8php.html#a5">$cond</a>.<span class="stringliteral">" order by c_id "</span>;
<a name="l00465"></a>00465 <a class="code" href="eub__be_8inc_8php.html#a5">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$Sql.<span class="stringliteral">" limit "</span>.$p_limit.<span class="stringliteral">" offset "</span>.$p_offset);
<a name="l00466"></a>00466
<a name="l00467"></a>00467 }
<a name="l00468"></a>00468 } <span class="keywordflow">else</span> {
<a name="l00469"></a>00469 <span class="comment">// Grand Livre</span>
<a name="l00470"></a>00470 <span class="keywordflow">if</span> (! isset($p_array['central'])) {
<a name="l00471"></a>00471 <span class="comment">// Non centralis<69></span>
<a name="l00472"></a>00472 <a class="code" href="send__poste__pdf_8php.html#a5">$cond</a>=<a class="code" href="impress__inc_8php.html#a5">CreatePeriodeCond</a>($p_array['periode']);
<a name="l00473"></a>00473 <a class="code" href="eub__be_8inc_8php.html#a5">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"select j_id,to_char(j_date,'DD.MM.YYYY') as j_date,</span>
<a name="l00474"></a>00474 <span class="stringliteral"> jr_internal,</span>
<a name="l00475"></a>00475 <span class="stringliteral"> case j_debit when 't' then j_montant::text else ' ' end as deb_montant,</span>
<a name="l00476"></a>00476 <span class="stringliteral"> case j_debit when 'f' then j_montant::text else ' ' end as cred_montant,</span>
<a name="l00477"></a>00477 <span class="stringliteral"> j_debit as debit,j_poste as poste,"</span>.
<a name="l00478"></a>00478 <span class="stringliteral">"pcm_lib as description,j_grpt as grp,jr_comment as jr_comment,</span>
<a name="l00479"></a>00479 <span class="stringliteral"> jr_montant,</span>
<a name="l00480"></a>00480 <span class="stringliteral"> jr_rapt as oc, j_tech_per as periode from jrnx left join jrn on "</span>.
<a name="l00481"></a>00481 <span class="stringliteral">"jr_grpt_id=j_grpt left join tmp_pcmn on pcm_val=j_poste where "</span>.
<a name="l00482"></a>00482 <span class="stringliteral">" "</span>.$cond.<span class="stringliteral">" order by j_date::date,j_grpt,j_debit desc"</span>.
<a name="l00483"></a>00483 <span class="stringliteral">" limit "</span>.$p_limit.<span class="stringliteral">" offset "</span>.$p_offset);
<a name="l00484"></a>00484
<a name="l00485"></a>00485 } <span class="keywordflow">else</span> {
<a name="l00486"></a>00486 <span class="comment">// Centralis<69></span>
<a name="l00487"></a>00487 <a class="code" href="send__poste__pdf_8php.html#a5">$cond</a>=<a class="code" href="impress__inc_8php.html#a5">CreatePeriodeCond</a>($p_array['periode'],<span class="stringliteral">"c_periode"</span>);
<a name="l00488"></a>00488 <a class="code" href="eub__be_8inc_8php.html#a4">$Sql</a>=<span class="stringliteral">"select c_id as j_id,</span>
<a name="l00489"></a>00489 <span class="stringliteral"> c_j_id,</span>
<a name="l00490"></a>00490 <span class="stringliteral"> to_char (c_date,'DD.MM.YYYY') as j_date ,</span>
<a name="l00491"></a>00491 <span class="stringliteral"> c_internal as jr_internal,</span>
<a name="l00492"></a>00492 <span class="stringliteral"> case c_debit when 't' then c_montant::text else ' ' end as deb_montant,</span>
<a name="l00493"></a>00493 <span class="stringliteral"> case c_debit when 'f' then c_montant::text else ' ' end as cred_montant,</span>
<a name="l00494"></a>00494 <span class="stringliteral"> c_debit as j_debit,</span>
<a name="l00495"></a>00495 <span class="stringliteral"> c_poste as poste,</span>
<a name="l00496"></a>00496 <span class="stringliteral"> pcm_lib as description,</span>
<a name="l00497"></a>00497 <span class="stringliteral"> jr_comment,</span>
<a name="l00498"></a>00498 <span class="stringliteral"> jr_montant,</span>
<a name="l00499"></a>00499 <span class="stringliteral"> c_grp as grp,</span>
<a name="l00500"></a>00500 <span class="stringliteral"> c_comment as comment,</span>
<a name="l00501"></a>00501 <span class="stringliteral"> c_rapt as oc,</span>
<a name="l00502"></a>00502 <span class="stringliteral"> c_periode as periode </span>
<a name="l00503"></a>00503 <span class="stringliteral"> from centralized left join jrn on "</span>.
<a name="l00504"></a>00504 <span class="stringliteral">"jr_grpt_id=c_grp left join tmp_pcmn on pcm_val=c_poste where "</span>.
<a name="l00505"></a>00505 <a class="code" href="send__poste__pdf_8php.html#a5">$cond</a>.<span class="stringliteral">" order by c_id "</span>;
<a name="l00506"></a>00506 <a class="code" href="eub__be_8inc_8php.html#a5">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$Sql.<span class="stringliteral">" limit "</span>.$p_limit.<span class="stringliteral">" offset "</span>.$p_offset);
<a name="l00507"></a>00507 } <span class="comment">// Grand Livre</span>
<a name="l00508"></a>00508 }
<a name="l00509"></a>00509
<a name="l00510"></a>00510
<a name="l00511"></a>00511 <a class="code" href="recherche_8php.html#a4">$array</a>=array();
<a name="l00512"></a>00512 <a class="code" href="setup_8php.html#a11">$Max</a>=pg_NumRows($Res);
<a name="l00513"></a>00513 <span class="keywordflow">if</span> ($Max==0) <span class="keywordflow">return</span> null;
<a name="l00514"></a>00514 $case=<span class="stringliteral">""</span>;
<a name="l00515"></a>00515 $tot_deb=0;
<a name="l00516"></a>00516 $tot_cred=0;
<a name="l00517"></a>00517 <span class="keywordflow">for</span> ($i=0;$i&lt;$Max;$i++) {
<a name="l00518"></a>00518 $line=pg_fetch_array($Res,$i);
<a name="l00519"></a>00519 $mont_deb=($line['deb_montant']!=0)?sprintf(<span class="stringliteral">"% 8.2f"</span>,$line['deb_montant']):<span class="stringliteral">""</span>;
<a name="l00520"></a>00520 $mont_cred=($line['cred_montant']!=0)?sprintf(<span class="stringliteral">"% 8.2f"</span>,$line['cred_montant']):<span class="stringliteral">""</span>;
<a name="l00521"></a>00521 $jr_montant=($line['jr_montant']!=0)?sprintf(<span class="stringliteral">"% 8.2f"</span>,$line['jr_montant']):<span class="stringliteral">""</span>;
<a name="l00522"></a>00522 $tot_deb+=$line['deb_montant'];
<a name="l00523"></a>00523 $tot_cred+=$line['cred_montant'];
<a name="l00524"></a>00524 <a class="code" href="debug_8php.html#a0">echo_debug</a>('impress_inc.php',__LINE__,<span class="stringliteral">" GetJrnDataPdf : mont_Deb "</span>.$mont_deb);
<a name="l00525"></a>00525 <a class="code" href="debug_8php.html#a0">echo_debug</a>('impress_inc.php',__LINE__,<span class="stringliteral">" GetJrnDataPdf : mont_cred "</span>.$mont_cred);
<a name="l00526"></a>00526
<a name="l00527"></a>00527 <span class="keywordflow">if</span> ( $<span class="keywordflow">case</span> != $line['grp'] ) {
<a name="l00528"></a>00528 $case=$line['grp'];
<a name="l00529"></a>00529 <a class="code" href="recherche_8php.html#a4">$array</a>[]=array (
<a name="l00530"></a>00530 'j_id'=&gt;$line['j_id'],
<a name="l00531"></a>00531 'j_date' =&gt; $line['j_date'],
<a name="l00532"></a>00532 'internal'=&gt;$line['jr_internal'],
<a name="l00533"></a>00533 'deb_montant'=&gt;'',
<a name="l00534"></a>00534 'cred_montant'=&gt;'&lt;b&gt;&lt;i&gt;'.$jr_montant.'&lt;/i&gt;&lt;/b&gt;',
<a name="l00535"></a>00535 'description'=&gt;'&lt;b&gt;&lt;i&gt;'.$line['jr_comment'].'&lt;/i&gt;&lt;/b&gt;',
<a name="l00536"></a>00536 '<a class="code" href="classposte.html">poste</a>' =&gt; $line['oc'],
<a name="l00537"></a>00537 'periode' =&gt;$line['periode'] );
<a name="l00538"></a>00538
<a name="l00539"></a>00539 <a class="code" href="recherche_8php.html#a4">$array</a>[]=array (
<a name="l00540"></a>00540 'j_id'=&gt;$line['j_id'],
<a name="l00541"></a>00541 'j_date' =&gt; '',
<a name="l00542"></a>00542 'internal'=&gt;'',
<a name="l00543"></a>00543 'deb_montant'=&gt;$mont_deb,
<a name="l00544"></a>00544 'cred_montant'=&gt;$mont_cred,
<a name="l00545"></a>00545 'description'=&gt;$line['description'],
<a name="l00546"></a>00546 '<a class="code" href="classposte.html">poste</a>' =&gt; $line['<a class="code" href="classposte.html">poste</a>'],
<a name="l00547"></a>00547 'periode' =&gt; $line['periode']
<a name="l00548"></a>00548 );
<a name="l00549"></a>00549
<a name="l00550"></a>00550 }<span class="keywordflow">else</span> {
<a name="l00551"></a>00551 <a class="code" href="recherche_8php.html#a4">$array</a>[]=array (
<a name="l00552"></a>00552 'j_id'=&gt;$line['j_id'],
<a name="l00553"></a>00553 'j_date' =&gt; '',
<a name="l00554"></a>00554 'internal'=&gt;'',
<a name="l00555"></a>00555 'deb_montant'=&gt;$mont_deb,
<a name="l00556"></a>00556 'cred_montant'=&gt;$mont_cred,
<a name="l00557"></a>00557 'description'=&gt;$line['description'],
<a name="l00558"></a>00558 '<a class="code" href="classposte.html">poste</a>' =&gt; $line['<a class="code" href="classposte.html">poste</a>'],
<a name="l00559"></a>00559 'periode' =&gt; $line['periode']);
<a name="l00560"></a>00560
<a name="l00561"></a>00561 }
<a name="l00562"></a>00562
<a name="l00563"></a>00563
<a name="l00564"></a>00564 }
<a name="l00565"></a>00565 <a class="code" href="debug_8php.html#a0">echo_debug</a>('impress_inc.php',__LINE__,<span class="stringliteral">"Total debit $tot_deb,credit $tot_cred"</span>);
<a name="l00566"></a>00566 <a class="code" href="balance_8php.html#a9">$a</a>=array($array,$tot_deb,$tot_cred);
<a name="l00567"></a>00567 <span class="keywordflow">return</span> <a class="code" href="balance_8php.html#a9">$a</a>;
<a name="l00568"></a>00568 }
<a name="l00580"></a><a class="code" href="impress__inc_8php.html#a7">00580</a> function <a class="code" href="impress__inc_8php.html#a7">GetDataGrpt</a>($p_cn,$p_array)
<a name="l00581"></a>00581 {
<a name="l00582"></a>00582 <span class="keywordflow">if</span> ( !isset ($p_array['periode']) ) <span class="keywordflow">return</span> <a class="code" href="constant_8php.html#a34">NO_PERIOD_SELECTED</a>;
<a name="l00583"></a>00583 <a class="code" href="send__poste__pdf_8php.html#a5">$cond</a>=<a class="code" href="impress__inc_8php.html#a5">CreatePeriodeCond</a>($p_array['periode']);
<a name="l00584"></a>00584 <a class="code" href="eub__be_8inc_8php.html#a5">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"select distinct "</span>.
<a name="l00585"></a>00585 <span class="stringliteral">" j_grpt as grp"</span>.
<a name="l00586"></a>00586 <span class="stringliteral">" from jrnx "</span>.
<a name="l00587"></a>00587 <span class="stringliteral">" where j_jrn_def="</span>.$p_array['p_id'].
<a name="l00588"></a>00588 <span class="stringliteral">" and "</span>.$cond.<span class="stringliteral">" order by j_grpt"</span>);
<a name="l00589"></a>00589 <a class="code" href="recherche_8php.html#a4">$array</a>=array();
<a name="l00590"></a>00590 <a class="code" href="setup_8php.html#a11">$Max</a>=pg_NumRows($Res);
<a name="l00591"></a>00591 $case=<span class="stringliteral">""</span>;
<a name="l00592"></a>00592 <span class="keywordflow">for</span> ($i=0;$i&lt;$Max;$i++) {
<a name="l00593"></a>00593 <a class="code" href="recherche_8php.html#a4">$array</a>[]=pg_fetch_array($Res,$i);
<a name="l00594"></a>00594 }
<a name="l00595"></a>00595 <span class="keywordflow">return</span> <a class="code" href="recherche_8php.html#a4">$array</a>;
<a name="l00596"></a>00596 }
<a name="l00597"></a>00597
<a name="l00614"></a><a class="code" href="impress__inc_8php.html#a8">00614</a> function <a class="code" href="impress__inc_8php.html#a8">GetRappel</a>($p_cn,$p_jrnx_id,$p_jrn_id,$p_exercice,$which,$p_type,$p_central)
<a name="l00615"></a>00615 {
<a name="l00616"></a>00616 include_once(<span class="stringliteral">"preference.php"</span>);
<a name="l00617"></a>00617
<a name="l00618"></a>00618 <span class="keywordflow">if</span> ( $which == <a class="code" href="constant_8php.html#a36">LAST</a>)
<a name="l00619"></a>00619 $cmp=<span class="stringliteral">"&lt;="</span>;
<a name="l00620"></a>00620 <span class="keywordflow">else</span>
<a name="l00621"></a>00621 $cmp=<span class="stringliteral">"&lt;"</span>;
<a name="l00622"></a>00622
<a name="l00623"></a>00623 <span class="keywordflow">if</span> ( $p_type == 1 ) {
<a name="l00624"></a>00624 <span class="comment">// Vue filtree =&gt; Journaux</span>
<a name="l00625"></a>00625 <span class="keywordflow">if</span> ( $p_central == 0 ) { <span class="comment">// Vue non centralis<69>e</span>
<a name="l00626"></a>00626 <span class="keywordflow">return</span> array(0,0);
<a name="l00627"></a>00627 } <span class="comment">// p_central == 0</span>
<a name="l00628"></a>00628
<a name="l00629"></a>00629 <span class="comment">// Vue filtree =&gt; Journaux &amp; Jrn centralis<69> </span>
<a name="l00630"></a>00630 <span class="keywordflow">if</span> ( $p_central == 1 ) {
<a name="l00631"></a>00631 $c_line=<a class="code" href="postgres_8php.html#a10">CountSql</a>($p_cn,<span class="stringliteral">"select * from centralized left join parm_periode on c_periode=p_id "</span>.
<a name="l00632"></a>00632 <span class="stringliteral">" where c_jrn_def=$p_jrn_id and p_exercice='"</span>.$p_exercice.<span class="stringliteral">"'"</span>.
<a name="l00633"></a>00633 <span class="stringliteral">" and c_order $cmp $p_jrnx_id "</span>);
<a name="l00634"></a>00634
<a name="l00635"></a>00635 <span class="keywordflow">if</span> ($c_line == 0 ) { <span class="keywordflow">return</span> array (0,0); }
<a name="l00636"></a>00636 <a class="code" href="facture_8inc_8php.html#a1">$sql</a>=<span class="stringliteral">"select sum(c_montant) as tot_amount "</span>.
<a name="l00637"></a>00637 <span class="stringliteral">" from centralized "</span>.
<a name="l00638"></a>00638 <span class="stringliteral">" left join parm_periode on c_periode=p_id "</span>.
<a name="l00639"></a>00639 <span class="stringliteral">" inner join jrn on jr_grpt_id=c_grp "</span>.
<a name="l00640"></a>00640 <span class="stringliteral">" where c_jrn_def=$p_jrn_id and "</span>.
<a name="l00641"></a>00641 <span class="stringliteral">" p_exercice='"</span>.$p_exercice.<span class="stringliteral">"'"</span>.
<a name="l00642"></a>00642 <span class="stringliteral">" and c_order $cmp $p_jrnx_id "</span> ;
<a name="l00643"></a>00643 <a class="code" href="eub__be_8inc_8php.html#a5">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$sql.<span class="stringliteral">" and c_debit='t' "</span>);
<a name="l00644"></a>00644 <span class="keywordflow">if</span> ( pg_NumRows($Res) == 0 )
<a name="l00645"></a>00645 $deb=0;
<a name="l00646"></a>00646 <span class="keywordflow">else</span> {
<a name="l00647"></a>00647 $line=pg_fetch_array($Res,0);
<a name="l00648"></a>00648 $deb=$line['tot_amount'];
<a name="l00649"></a>00649 }
<a name="l00650"></a>00650
<a name="l00651"></a>00651 <a class="code" href="eub__be_8inc_8php.html#a5">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$sql.<span class="stringliteral">" and c_debit='f' "</span>);
<a name="l00652"></a>00652 <span class="keywordflow">if</span> ( pg_NumRows($Res) == 0 )
<a name="l00653"></a>00653 $cred=0;
<a name="l00654"></a>00654 <span class="keywordflow">else</span> {
<a name="l00655"></a>00655
<a name="l00656"></a>00656 $line=pg_fetch_array($Res,0);
<a name="l00657"></a>00657 $cred=$line['tot_amount'];
<a name="l00658"></a>00658 }
<a name="l00659"></a>00659 <a class="code" href="debug_8php.html#a0">echo_debug</a>('impress_inc.php',__LINE__,<span class="stringliteral">"MONTANT $deb,$cred"</span>);
<a name="l00660"></a>00660 <a class="code" href="balance_8php.html#a9">$a</a>=array($deb,$cred);
<a name="l00661"></a>00661 <span class="keywordflow">return</span> <a class="code" href="balance_8php.html#a9">$a</a>;
<a name="l00662"></a>00662
<a name="l00663"></a>00663 }
<a name="l00664"></a>00664 } <span class="comment">// Type = jrn</span>
<a name="l00665"></a>00665 <span class="keywordflow">if</span> ($p_type==0 ) { <span class="comment">// Si Grand Livre, prendre donn<6E>e centralis<69>e{</span>
<a name="l00666"></a>00666 <span class="keywordflow">if</span> ( $p_central == 1) {
<a name="l00667"></a>00667 $c_line=<a class="code" href="postgres_8php.html#a10">CountSql</a>($p_cn,<span class="stringliteral">"select * from centralized left join parm_periode on c_periode=p_id "</span>.
<a name="l00668"></a>00668 <span class="stringliteral">"where p_exercice='"</span>.$p_exercice.<span class="stringliteral">"'"</span>.
<a name="l00669"></a>00669 <span class="stringliteral">" and c_id $cmp $p_jrnx_id "</span>);
<a name="l00670"></a>00670
<a name="l00671"></a>00671 <span class="keywordflow">if</span> ($c_line == 0 ) { <span class="keywordflow">return</span> array (0,0); }
<a name="l00672"></a>00672 <a class="code" href="facture_8inc_8php.html#a1">$sql</a>=<span class="stringliteral">"select sum(c_montant) as tot_amount "</span>.
<a name="l00673"></a>00673 <span class="stringliteral">" from centralized "</span>.
<a name="l00674"></a>00674 <span class="stringliteral">" left join parm_periode on c_periode=p_id "</span>.
<a name="l00675"></a>00675 <span class="stringliteral">" where "</span>.
<a name="l00676"></a>00676 <span class="stringliteral">" p_exercice='"</span>.$p_exercice.<span class="stringliteral">"'"</span>.
<a name="l00677"></a>00677 <span class="stringliteral">" and c_order $cmp $p_jrnx_id "</span> ;
<a name="l00678"></a>00678 <a class="code" href="eub__be_8inc_8php.html#a5">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$sql.<span class="stringliteral">" and c_debit='t' "</span>);
<a name="l00679"></a>00679 <span class="keywordflow">if</span> ( pg_NumRows($Res) == 0 )
<a name="l00680"></a>00680 $deb=0;
<a name="l00681"></a>00681 <span class="keywordflow">else</span> {
<a name="l00682"></a>00682 $line=pg_fetch_array($Res,0);
<a name="l00683"></a>00683 $deb=$line['tot_amount'];
<a name="l00684"></a>00684 }
<a name="l00685"></a>00685
<a name="l00686"></a>00686 <a class="code" href="eub__be_8inc_8php.html#a5">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,$sql.<span class="stringliteral">" and c_debit='f' "</span>);
<a name="l00687"></a>00687 <span class="keywordflow">if</span> ( pg_NumRows($Res) == 0 )
<a name="l00688"></a>00688 $cred=0;
<a name="l00689"></a>00689 <span class="keywordflow">else</span> {
<a name="l00690"></a>00690
<a name="l00691"></a>00691 $line=pg_fetch_array($Res,0);
<a name="l00692"></a>00692 $cred=$line['tot_amount'];
<a name="l00693"></a>00693 }
<a name="l00694"></a>00694 <a class="code" href="debug_8php.html#a0">echo_debug</a>('impress_inc.php',__LINE__,<span class="stringliteral">"MONTANT $deb,$cred"</span>);
<a name="l00695"></a>00695 <a class="code" href="balance_8php.html#a9">$a</a>=array($deb,$cred);
<a name="l00696"></a>00696 <span class="keywordflow">return</span> <a class="code" href="balance_8php.html#a9">$a</a>;
<a name="l00697"></a>00697 } <span class="comment">// central == 1</span>
<a name="l00698"></a>00698 <span class="keywordflow">else</span> <span class="comment">// Donn<6E>e non centralis<69>e =&gt; pas de rappel</span>
<a name="l00699"></a>00699 {
<a name="l00700"></a>00700 <span class="keywordflow">if</span> ($p_central== 0) { <span class="comment">// Si Grand Livre, prendre donn<6E>e non centralis<69>e{</span>
<a name="l00701"></a>00701 <span class="keywordflow">return</span> array(0,0);
<a name="l00702"></a>00702 }
<a name="l00703"></a>00703 }<span class="comment">//else</span>
<a name="l00704"></a>00704 } <span class="comment">// if type==0</span>
<a name="l00705"></a>00705
<a name="l00706"></a>00706 }
<a name="l00707"></a>00707
<a name="l00724"></a><a class="code" href="impress__inc_8php.html#a9">00724</a> function <a class="code" href="impress__inc_8php.html#a9">ParseFormula</a>($p_cn,$p_label,$p_formula,$p_start,$p_end,$p_eval=<span class="keyword">true</span>) {
<a name="l00725"></a>00725 <span class="keywordflow">if</span> ( <a class="code" href="impress__inc_8php.html#a11">CheckFormula</a>($p_formula) == <span class="keyword">false</span>) {
<a name="l00726"></a>00726 <span class="keywordflow">if</span> ( $p_eval == <span class="keyword">true</span>)
<a name="l00727"></a>00727 <span class="keywordflow">return</span> array('desc'=&gt;$p_label.' Erreur Formule!',
<a name="l00728"></a>00728 'montant'=&gt;0);
<a name="l00729"></a>00729 <span class="keywordflow">else</span>
<a name="l00730"></a>00730 <span class="keywordflow">return</span> $p_formula;
<a name="l00731"></a>00731
<a name="l00732"></a>00732 }
<a name="l00733"></a>00733
<a name="l00734"></a>00734 <span class="keywordflow">if</span> ( $p_start == $p_end )
<a name="l00735"></a>00735 <a class="code" href="send__poste__pdf_8php.html#a5">$cond</a>=<span class="stringliteral">" j_tech_per = $p_start "</span>;
<a name="l00736"></a>00736 <span class="keywordflow">else</span>
<a name="l00737"></a>00737 <a class="code" href="send__poste__pdf_8php.html#a5">$cond</a> = <span class="stringliteral">"(j_tech_per &gt;= $p_start and j_tech_per &lt;= $p_end) "</span>;
<a name="l00738"></a>00738
<a name="l00739"></a>00739 <span class="keywordflow">while</span> (ereg(<span class="stringliteral">"(\[[0-9]*%*\])"</span>,$p_formula,$e) == <span class="keyword">true</span>) {
<a name="l00740"></a>00740 include_once(<span class="stringliteral">"class_poste.php"</span>);
<a name="l00741"></a>00741 <span class="comment">// remove the [ ] </span>
<a name="l00742"></a>00742 <a class="code" href="ecrit__ouv_8php.html#a9">$x</a>=<a class="code" href="impress__fiche_8php.html#a10">$e</a>;
<a name="l00743"></a>00743 <a class="code" href="impress__fiche_8php.html#a10">$e</a>[0]=str_replace (<span class="stringliteral">"["</span>,<span class="stringliteral">""</span>,$e[0]);
<a name="l00744"></a>00744 <a class="code" href="impress__fiche_8php.html#a10">$e</a>[0]=str_replace (<span class="stringliteral">"]"</span>,<span class="stringliteral">""</span>,$e[0]);
<a name="l00745"></a>00745 <span class="comment">// If there is a FROM clause we must recompute </span>
<a name="l00746"></a>00746 <span class="comment">// the time cond</span>
<a name="l00747"></a>00747 <span class="keywordflow">if</span> ( ereg (<span class="stringliteral">"FROM=[0-9]+\.[0-9]+"</span>, $p_formula,$afrom) == <span class="keyword">true</span> ){
<a name="l00748"></a>00748 <span class="comment">// There is a FROM clause </span>
<a name="l00749"></a>00749 <span class="comment">// then we must modify the cond for the periode</span>
<a name="l00750"></a>00750 $from=str_replace(<span class="stringliteral">"FROM="</span>,<span class="stringliteral">""</span>,$afrom[0]);
<a name="l00751"></a>00751 <span class="comment">// Get the periode </span>
<a name="l00752"></a>00752 $from=<a class="code" href="ac__common_8php.html#a14">getPeriodeFromMonth</a>($p_cn,$from);
<a name="l00753"></a>00753
<a name="l00754"></a>00754 <span class="comment">// Compute the cond</span>
<a name="l00755"></a>00755 <span class="keywordflow">if</span> ( $from == $p_end )
<a name="l00756"></a>00756 <a class="code" href="send__poste__pdf_8php.html#a5">$cond</a>=<span class="stringliteral">" j_tech_per = $from "</span>;
<a name="l00757"></a>00757 <span class="keywordflow">else</span>
<a name="l00758"></a>00758 <a class="code" href="send__poste__pdf_8php.html#a5">$cond</a> = <span class="stringliteral">"(j_tech_per &gt;= $from and j_tech_per &lt;= $p_end) "</span>;
<a name="l00759"></a>00759 <span class="comment">// We remove FROM out of the p_formula</span>
<a name="l00760"></a>00760 $p_formula=substr_replace($p_formula,<span class="stringliteral">""</span>,strpos($p_formula,<span class="stringliteral">"FROM"</span>));
<a name="l00761"></a>00761 }
<a name="l00762"></a>00762 <span class="comment">// Get sum of account</span>
<a name="l00763"></a>00763 $P=<span class="keyword">new</span> <a class="code" href="user__impress_8php.html#a6">poste</a>($p_cn,$e[0]);
<a name="l00764"></a>00764 <a class="code" href="balance_8php.html#a11">$i</a>=$P-&gt;GetSolde($cond);
<a name="l00765"></a>00765 $p_formula=str_replace($x,$i,$p_formula);
<a name="l00766"></a>00766 }
<a name="l00767"></a>00767
<a name="l00768"></a>00768 <span class="comment">// $p_eval is true then we eval and returns result</span>
<a name="l00769"></a>00769 <span class="keywordflow">if</span> ( $p_eval == <span class="keyword">true</span>) {
<a name="l00770"></a>00770 $p_formula=<span class="stringliteral">"\$result="</span>.$p_formula.<span class="stringliteral">";"</span>;
<a name="l00771"></a>00771 <a class="code" href="debug_8php.html#a0">echo_debug</a>('impress_inc.php',__LINE__, $p_formula);
<a name="l00772"></a>00772
<a name="l00773"></a>00773 eval(<span class="stringliteral">"$p_formula"</span>);
<a name="l00774"></a>00774 $aret=array('desc'=&gt;$p_label,
<a name="l00775"></a>00775 'montant'=&gt;$result);
<a name="l00776"></a>00776 <span class="keywordflow">return</span> $aret;
<a name="l00777"></a>00777 } <span class="keywordflow">else</span> {
<a name="l00778"></a>00778 <span class="comment">// $p_eval is false we returns only the string</span>
<a name="l00779"></a>00779 <span class="keywordflow">return</span> $p_formula;
<a name="l00780"></a>00780 }
<a name="l00781"></a>00781 }
<a name="l00797"></a><a class="code" href="impress__inc_8php.html#a10">00797</a> function <a class="code" href="impress__inc_8php.html#a10">GetFormulaValue</a>($p_cn,$p_label,$p_formula,$p_cond)
<a name="l00798"></a>00798 {
<a name="l00799"></a>00799 $aret=array();
<a name="l00800"></a>00800 $l_debit=0;
<a name="l00801"></a>00801 $l_credit=0;
<a name="l00802"></a>00802 <span class="comment">// somme debit</span>
<a name="l00803"></a>00803 <a class="code" href="eub__be_8inc_8php.html#a5">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"select sum (j_montant) as montant from</span>
<a name="l00804"></a>00804 <span class="stringliteral"> jrnx where $p_cond and j_debit='t' and j_poste like '$p_formula'"</span>);
<a name="l00805"></a>00805 <span class="keywordflow">if</span> (pg_NumRows($Res)==0){
<a name="l00806"></a>00806 $l_debit=0;
<a name="l00807"></a>00807 } <span class="keywordflow">else</span> {
<a name="l00808"></a>00808 <a class="code" href="facture_8inc_8php.html#a15">$l</a>=pg_fetch_array($Res,0);
<a name="l00809"></a>00809 $l_debit=<a class="code" href="facture_8inc_8php.html#a15">$l</a>['montant'];
<a name="l00810"></a>00810 }
<a name="l00811"></a>00811 <span class="comment">// somme credit</span>
<a name="l00812"></a>00812 <a class="code" href="eub__be_8inc_8php.html#a5">$Res</a>=<a class="code" href="postgres_8php.html#a2">ExecSql</a>($p_cn,<span class="stringliteral">"select sum (j_montant) as montant from</span>
<a name="l00813"></a>00813 <span class="stringliteral"> jrnx where $p_cond and j_debit='f' and j_poste like '$p_formula'"</span>);
<a name="l00814"></a>00814 <span class="keywordflow">if</span> (pg_NumRows($Res)==0) {
<a name="l00815"></a>00815 $l_credit=0;
<a name="l00816"></a>00816 } <span class="keywordflow">else</span> {
<a name="l00817"></a>00817 <a class="code" href="facture_8inc_8php.html#a15">$l</a>=pg_fetch_array($Res,0);
<a name="l00818"></a>00818 $l_credit=<a class="code" href="facture_8inc_8php.html#a15">$l</a>['montant'];
<a name="l00819"></a>00819 }
<a name="l00820"></a>00820
<a name="l00821"></a>00821 <span class="keywordflow">if</span> ( $l_credit==$l_debit) {
<a name="l00822"></a>00822 $aret=array('desc' =&gt; $p_label,
<a name="l00823"></a>00823 'montant' =&gt; <span class="charliteral">'0'</span>,
<a name="l00824"></a>00824 'cmontant'=&gt;0);
<a name="l00825"></a>00825 }
<a name="l00826"></a>00826 <span class="keywordflow">if</span> ( $l_credit &lt; $l_debit) {
<a name="l00827"></a>00827 $l2=sprintf(<span class="stringliteral">"% .2f"</span>,$l_debit-$l_credit);
<a name="l00828"></a>00828 $aret=array('desc' =&gt; $p_label,
<a name="l00829"></a>00829 'montant' =&gt; $l2,
<a name="l00830"></a>00830 'cmontant'=&gt;$l2);
<a name="l00831"></a>00831 }
<a name="l00832"></a>00832 <span class="keywordflow">if</span> ( $l_credit&gt;$l_debit) {
<a name="l00833"></a>00833 $l2=sprintf(<span class="stringliteral">"(% .2f)"</span>,$l_credit-$l_debit);
<a name="l00834"></a>00834 $aret=array('desc' =&gt; $p_label,
<a name="l00835"></a>00835 'montant' =&gt; $l2,
<a name="l00836"></a>00836 'cmontant'=&gt; $l_debit-$l_credit);
<a name="l00837"></a>00837
<a name="l00838"></a>00838 }
<a name="l00839"></a>00839 <span class="keywordflow">return</span> $aret;
<a name="l00840"></a>00840 }
<a name="l00852"></a><a class="code" href="impress__inc_8php.html#a11">00852</a> function <a class="code" href="impress__inc_8php.html#a11">CheckFormula</a>($p_string) {
<a name="l00853"></a>00853 <span class="comment">// the ereg gets too complex if we want to add a test</span>
<a name="l00854"></a>00854 <span class="comment">// for parenthesis, math function...</span>
<a name="l00855"></a>00855 <span class="comment">// So I prefer remove them before testing</span>
<a name="l00856"></a>00856 $p_string=str_replace(<span class="stringliteral">"round"</span>,<span class="stringliteral">""</span>,$p_string);
<a name="l00857"></a>00857 $p_string=str_replace(<span class="stringliteral">"abs"</span>,<span class="stringliteral">""</span>,$p_string);
<a name="l00858"></a>00858 $p_string=str_replace(<span class="stringliteral">"("</span>,<span class="stringliteral">""</span>,$p_string);
<a name="l00859"></a>00859 $p_string=str_replace(<span class="stringliteral">")"</span>,<span class="stringliteral">""</span>,$p_string);
<a name="l00860"></a>00860 <span class="comment">// for the inline test like $a=(cond)?value:other;</span>
<a name="l00861"></a>00861 $p_string=str_replace(<span class="stringliteral">"?"</span>,<span class="stringliteral">"+"</span>,$p_string);
<a name="l00862"></a>00862 $p_string=str_replace(<span class="stringliteral">":"</span>,<span class="stringliteral">"+"</span>,$p_string);
<a name="l00863"></a>00863 $p_string=str_replace(<span class="stringliteral">"&gt;="</span>,<span class="stringliteral">"+"</span>,$p_string);
<a name="l00864"></a>00864 $p_string=str_replace(<span class="stringliteral">"&lt;="</span>,<span class="stringliteral">"+"</span>,$p_string);
<a name="l00865"></a>00865 $p_string=str_replace(<span class="stringliteral">"&gt;"</span>,<span class="stringliteral">"+"</span>,$p_string);
<a name="l00866"></a>00866 $p_string=str_replace(<span class="stringliteral">"&lt;"</span>,<span class="stringliteral">"+"</span>,$p_string);
<a name="l00867"></a>00867 <span class="comment">// eat Space </span>
<a name="l00868"></a>00868 $p_string=str_replace(<span class="stringliteral">" "</span>,<span class="stringliteral">""</span>,$p_string);
<a name="l00869"></a>00869
<a name="l00870"></a>00870 <span class="keywordflow">if</span> ( ereg (<span class="stringliteral">"^(\\$[a-zA-Z]*[0-9]*=){0,1}((\[{0,1}[0-9]+\.*[0-9]*%{0,1}\]{0,1})+ *([+-\*/])* *(\[{0,1}[0-9]+\.*[0-9]*%{0,1}\]{0,1})*)*(([+-\*/])*\\$([a-zA-Z])+[0-9]*([+-\*/])*)* *( *FROM=[0-9][0-0].20[0-9][0-9]){0,1}$"</span>,$p_string) == <span class="keyword">false</span>)
<a name="l00871"></a>00871 {
<a name="l00872"></a>00872 <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00873"></a>00873 } <span class="keywordflow">else</span> {
<a name="l00874"></a>00874 <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00875"></a>00875 }
<a name="l00876"></a>00876 }
<a name="l00877"></a>00877
<a name="l00878"></a>00878 ?&gt;
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Fri Jun 23 00:12:46 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>