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

184 lines
20 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_rapport.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_rapport.php</h1><a href="impress__rapport_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 include_once(<span class="stringliteral">"class_widget.php"</span>);
<a name="l00025"></a>00025
<a name="l00026"></a>00026 <span class="comment">// If print is asked</span>
<a name="l00027"></a>00027 <span class="comment">// First time in html</span>
<a name="l00028"></a>00028 <span class="comment">// after in pdf or cvs</span>
<a name="l00030"></a>00030 <span class="comment"></span><span class="keywordflow">if</span> ( isset( $_POST['bt_html'] ) ) {
<a name="l00031"></a>00031 include(<span class="stringliteral">"class_rapport.php"</span>);
<a name="l00032"></a><a class="code" href="impress__rapport_8php.html#a0">00032</a> <a class="code" href="impress__rapport_8php.html#a0">$Form</a>=<span class="keyword">new</span> <a class="code" href="user__impress_8php.html#a7">rapport</a>($cn,$_POST['form_id']);
<a name="l00033"></a>00033 <a class="code" href="impress__rapport_8php.html#a0">$Form</a>-&gt;GetName();
<a name="l00034"></a>00034 <span class="comment">// step asked ?</span>
<a name="l00035"></a>00035 <span class="comment">//--</span>
<a name="l00036"></a>00036 <span class="keywordflow">if</span> ($_POST['p_step'] == 0 ) {
<a name="l00037"></a>00037 <a class="code" href="recherche_8php.html#a4">$array</a>=<a class="code" href="impress__rapport_8php.html#a0">$Form</a>-&gt;GetRow( $_POST['from_periode'],
<a name="l00038"></a>00038 $_POST['to_periode']
<a name="l00039"></a>00039 );
<a name="l00040"></a>00040 } <span class="keywordflow">else</span> {
<a name="l00041"></a>00041 <span class="comment">// step are asked</span>
<a name="l00042"></a>00042 <span class="comment">//--</span>
<a name="l00043"></a>00043 <span class="keywordflow">for</span> ($e=$_POST['from_periode'];$e&lt;=$_POST['to_periode'];$e+=$_POST['p_step'])
<a name="l00044"></a>00044 {
<a name="l00045"></a>00045
<a name="l00046"></a>00046 $periode=<a class="code" href="ac__common_8php.html#a13">getPeriodeName</a>($cn,$e);
<a name="l00047"></a>00047 <span class="keywordflow">if</span> ( $periode == null ) <span class="keywordflow">continue</span>;
<a name="l00048"></a>00048 <a class="code" href="recherche_8php.html#a4">$array</a>[]=<a class="code" href="impress__rapport_8php.html#a0">$Form</a>-&gt;GetRow($e,$e);
<a name="l00049"></a>00049 $periode_name[]=$periode;
<a name="l00050"></a>00050 }
<a name="l00051"></a>00051 }
<a name="l00052"></a>00052
<a name="l00053"></a>00053
<a name="l00054"></a>00054 <a class="code" href="impress__poste_8php.html#a1">$rep</a>=<span class="stringliteral">""</span>;
<a name="l00055"></a><a class="code" href="impress__rapport_8php.html#a1">00055</a> <a class="code" href="impress__fiche_8php.html#a1">$submit</a>=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>();
<a name="l00056"></a><a class="code" href="impress__rapport_8php.html#a2">00056</a> <a class="code" href="balance_8php.html#a1">$hid</a>=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>(<span class="stringliteral">"hidden"</span>);
<a name="l00057"></a>00057 echo '&lt;div <span class="keyword">class</span>=<span class="stringliteral">"u_content"</span>&gt;';
<a name="l00058"></a><a class="code" href="impress__rapport_8php.html#a3">00058</a> <a class="code" href="impress__rapport_8php.html#a3">$t</a>=($_POST['from_periode']==$_POST['to_periode'])?<span class="stringliteral">""</span>:<span class="stringliteral">" -&gt; "</span>.getPeriodeName($cn,$_POST['to_periode'],'p_end');
<a name="l00059"></a>00059 echo '&lt;h2 <span class="keyword">class</span>=<span class="stringliteral">"info"</span>&gt;'.$Form-&gt;id.<span class="stringliteral">" "</span>.<a class="code" href="impress__rapport_8php.html#a0">$Form</a>-&gt;name.
<a name="l00060"></a>00060 <span class="stringliteral">" - "</span>.getPeriodeName($cn,$_POST['from_periode'],'p_start').
<a name="l00061"></a>00061 <span class="stringliteral">" "</span>.$t.
<a name="l00062"></a>00062 '&lt;/h2&gt;';
<a name="l00063"></a>00063 echo '&lt;<a class="code" href="balance_8php.html#a3">table</a> &gt;';
<a name="l00064"></a>00064 echo '&lt;TR&gt;';
<a name="l00065"></a>00065 echo '&lt;TD&gt;&lt;form method=<span class="stringliteral">"GET"</span> ACTION=<span class="stringliteral">"user_impress.php"</span>&gt;'.
<a name="l00066"></a>00066 <a class="code" href="impress__fiche_8php.html#a1">$submit</a>-&gt;Submit('bt_other',<span class="stringliteral">"Autre Rapport"</span>).
<a name="l00067"></a>00067 <a class="code" href="balance_8php.html#a1">$hid</a>-&gt;IOValue(<span class="stringliteral">"type"</span>,<span class="stringliteral">"rapport"</span>).<span class="stringliteral">"&lt;/form&gt;&lt;/TD&gt;"</span>;
<a name="l00068"></a>00068
<a name="l00069"></a>00069 echo '&lt;TD&gt;&lt;form method=<span class="stringliteral">"POST"</span> ACTION=<span class="stringliteral">"form_pdf.php"</span>&gt;'.
<a name="l00070"></a>00070 <a class="code" href="impress__fiche_8php.html#a1">$submit</a>-&gt;Submit('bt_pdf',<span class="stringliteral">"Export PDF"</span>).
<a name="l00071"></a>00071 <a class="code" href="balance_8php.html#a1">$hid</a>-&gt;IOValue(<span class="stringliteral">"type"</span>,<span class="stringliteral">"rapport"</span>).
<a name="l00072"></a>00072 <a class="code" href="balance_8php.html#a1">$hid</a>-&gt;IOValue(<span class="stringliteral">"form_id"</span>,$Form-&gt;id).
<a name="l00073"></a>00073 <a class="code" href="balance_8php.html#a1">$hid</a>-&gt;IOValue(<span class="stringliteral">"from_periode"</span>,$_POST['from_periode']).
<a name="l00074"></a>00074 <a class="code" href="balance_8php.html#a1">$hid</a>-&gt;IOValue(<span class="stringliteral">"to_periode"</span>,$_POST['to_periode']).
<a name="l00075"></a>00075 <a class="code" href="balance_8php.html#a1">$hid</a>-&gt;IOValue(<span class="stringliteral">"p_step"</span>,$_POST['p_step']);
<a name="l00076"></a>00076
<a name="l00077"></a>00077
<a name="l00078"></a>00078 echo <span class="stringliteral">"&lt;/form&gt;&lt;/TD&gt;"</span>;
<a name="l00079"></a>00079 echo '&lt;TD&gt;&lt;form method=<span class="stringliteral">"POST"</span> ACTION=<span class="stringliteral">"form_csv.php"</span>&gt;'.
<a name="l00080"></a>00080 <a class="code" href="impress__fiche_8php.html#a1">$submit</a>-&gt;Submit('bt_csv',<span class="stringliteral">"Export CSV"</span>).
<a name="l00081"></a>00081 <a class="code" href="balance_8php.html#a1">$hid</a>-&gt;IOValue(<span class="stringliteral">"type"</span>,<span class="stringliteral">"form"</span>).
<a name="l00082"></a>00082 <a class="code" href="balance_8php.html#a1">$hid</a>-&gt;IOValue(<span class="stringliteral">"form_id"</span>,$Form-&gt;id).
<a name="l00083"></a>00083 <a class="code" href="balance_8php.html#a1">$hid</a>-&gt;IOValue(<span class="stringliteral">"from_periode"</span>,$_POST['from_periode']).
<a name="l00084"></a>00084 <a class="code" href="balance_8php.html#a1">$hid</a>-&gt;IOValue(<span class="stringliteral">"to_periode"</span>,$_POST['to_periode']).
<a name="l00085"></a>00085 <a class="code" href="balance_8php.html#a1">$hid</a>-&gt;IOValue(<span class="stringliteral">"p_step"</span>,$_POST['p_step']);
<a name="l00086"></a>00086
<a name="l00087"></a>00087 echo <span class="stringliteral">"&lt;/form&gt;&lt;/TD&gt;"</span>;
<a name="l00088"></a>00088
<a name="l00089"></a>00089 echo <span class="stringliteral">"&lt;/TR&gt;"</span>;
<a name="l00090"></a>00090
<a name="l00091"></a>00091 echo <span class="stringliteral">"&lt;/table&gt;"</span>;
<a name="l00092"></a>00092 <span class="keywordflow">if</span> ( count($Form-&gt;row ) == 0 )
<a name="l00093"></a>00093 <a class="code" href="balance_8php.html#a0">exit</a>;
<a name="l00094"></a>00094
<a name="l00095"></a>00095 <span class="keywordflow">if</span> ( $_POST['p_step'] == 0)
<a name="l00096"></a>00096 { <span class="comment">// check the step</span>
<a name="l00097"></a>00097 <span class="comment">// show tables</span>
<a name="l00098"></a>00098 <a class="code" href="impress__rapport_8php.html#a12">ShowReportResult</a>($Form-&gt;row);
<a name="l00099"></a>00099 }
<a name="l00100"></a>00100 <span class="keywordflow">else</span>
<a name="l00101"></a>00101 {
<a name="l00102"></a>00102 <a class="code" href="balance_8php.html#a9">$a</a>=0;
<a name="l00103"></a>00103 foreach ( $array as $e) {
<a name="l00104"></a>00104 echo '&lt;h2 <span class="keyword">class</span>=<span class="stringliteral">"info"</span>&gt;Periode : '.$periode_name[<a class="code" href="balance_8php.html#a9">$a</a>].<span class="stringliteral">"&lt;/h2&gt;"</span>;
<a name="l00105"></a>00105 <a class="code" href="balance_8php.html#a9">$a</a>++;
<a name="l00106"></a>00106 <a class="code" href="impress__rapport_8php.html#a12">ShowReportResult</a>($e);
<a name="l00107"></a>00107 }
<a name="l00108"></a>00108 }
<a name="l00109"></a>00109
<a name="l00110"></a><a class="code" href="impress__rapport_8php.html#a4">00110</a> echo <span class="stringliteral">"&lt;/div&gt;"</span>;
<a name="l00111"></a>00111 <a class="code" href="balance_8php.html#a0">exit</a>;
<a name="l00112"></a>00112 }
<a name="l00113"></a>00113
<a name="l00115"></a>00115 <span class="comment">// Show the jrn and date</span>
<a name="l00117"></a>00117 <span class="comment"></span>include_once(<span class="stringliteral">"postgres.php"</span>);
<a name="l00118"></a><a class="code" href="impress__rapport_8php.html#a5">00118</a> <a class="code" href="class__operation_8php.html#a4">$ret</a>=<a class="code" href="ac__common_8php.html#a12">make_array</a>($cn,<span class="stringliteral">"select fr_id,fr_label</span>
<a name="l00119"></a>00119 <span class="stringliteral"> from formdef</span>
<a name="l00120"></a>00120 <span class="stringliteral"> order by fr_label"</span>);
<a name="l00121"></a>00121 <span class="keywordflow">if</span> ( <span class="keyword">sizeof</span>($ret) == 0 ) {
<a name="l00122"></a>00122 echo <span class="stringliteral">"Aucun Rapport"</span>;
<a name="l00123"></a>00123 <span class="keywordflow">return</span>;
<a name="l00124"></a>00124 }
<a name="l00126"></a>00126 <span class="comment">// Form</span>
<a name="l00128"></a>00128 <span class="comment"></span>echo '&lt;div <span class="keyword">class</span>=<span class="stringliteral">"u_content"</span>&gt;';
<a name="l00129"></a>00129 echo '&lt;<a class="code" href="constant_8php.html#a7">FORM</a> ACTION=<span class="stringliteral">"?type=rapport"</span> <a class="code" href="pref_8inc_8php.html#a0">METHOD</a>=<span class="stringliteral">"POST"</span>&gt;';
<a name="l00130"></a>00130 echo '&lt;TABLE&gt;&lt;TR&gt;';
<a name="l00131"></a>00131 <a class="code" href="balance_8php.html#a2">$w</a>=<span class="keyword">new</span> <a class="code" href="classwidget.html">widget</a>(<span class="stringliteral">"select"</span>);
<a name="l00132"></a><a class="code" href="impress__rapport_8php.html#a6">00132</a> <a class="code" href="balance_8php.html#a2">$w</a>-&gt;table=1;
<a name="l00133"></a><a class="code" href="impress__rapport_8php.html#a7">00133</a> <a class="code" href="balance_8php.html#a2">$w</a>-&gt;label=<span class="stringliteral">"Choississez le rapport"</span>;
<a name="l00134"></a>00134 <a class="code" href="class__operation_8php.html#a8">print</a> <a class="code" href="balance_8php.html#a2">$w</a>-&gt;IOValue(<span class="stringliteral">"form_id"</span>,$ret);
<a name="l00135"></a><a class="code" href="impress__rapport_8php.html#a8">00135</a> <a class="code" href="class__operation_8php.html#a8">print</a> '&lt;/TR&gt;';
<a name="l00136"></a>00136 <a class="code" href="class__operation_8php.html#a8">print</a> '&lt;TR&gt;';
<a name="l00137"></a><a class="code" href="impress__rapport_8php.html#a9">00137</a> <a class="code" href="balance_8php.html#a4">$periode_start</a>=<a class="code" href="ac__common_8php.html#a12">make_array</a>($cn,<span class="stringliteral">"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode order by p_id"</span>);
<a name="l00138"></a>00138 <a class="code" href="balance_8php.html#a2">$w</a>-&gt;label=<span class="stringliteral">"Depuis"</span>;
<a name="l00139"></a>00139 <a class="code" href="class__operation_8php.html#a8">print</a> <a class="code" href="balance_8php.html#a2">$w</a>-&gt;IOValue('from_periode',$periode_start);
<a name="l00140"></a>00140 <a class="code" href="balance_8php.html#a2">$w</a>-&gt;label=<span class="stringliteral">" jusqu'<27> "</span>;
<a name="l00141"></a><a class="code" href="impress__rapport_8php.html#a10">00141</a> <a class="code" href="balance_8php.html#a6">$periode_end</a>=<a class="code" href="ac__common_8php.html#a12">make_array</a>($cn,<span class="stringliteral">"select p_id,to_char(p_end,'DD-MM-YYYY') from parm_periode order by p_id"</span>);
<a name="l00142"></a>00142 <a class="code" href="class__operation_8php.html#a8">print</a> <a class="code" href="balance_8php.html#a2">$w</a>-&gt;IOValue('to_periode',$periode_end);
<a name="l00143"></a>00143 <a class="code" href="class__operation_8php.html#a8">print</a> <span class="stringliteral">"&lt;/TR&gt;"</span>;
<a name="l00144"></a><a class="code" href="impress__rapport_8php.html#a11">00144</a> <a class="code" href="impress__rapport_8php.html#a11">$aStep</a>=array(
<a name="l00145"></a>00145 array('<a class="code" href="client_8inc_8php.html#a6">value</a>'=&gt;0,'<a class="code" href="balance_8php.html#a5">label</a>'=&gt;'Pas d\'<27>tape'),
<a name="l00146"></a>00146 array('<a class="code" href="client_8inc_8php.html#a6">value</a>'=&gt;1,'<a class="code" href="balance_8php.html#a5">label</a>'=&gt;'1 mois')
<a name="l00147"></a>00147 );
<a name="l00148"></a>00148 <a class="code" href="balance_8php.html#a2">$w</a>-&gt;label='Par <20>tape de';
<a name="l00149"></a>00149 echo '&lt;TR&gt; '.$w-&gt;IOValue('p_step',$aStep);
<a name="l00150"></a>00150 echo '&lt;/TR&gt;';
<a name="l00151"></a>00151
<a name="l00152"></a>00152 echo '&lt;/TABLE&gt;';
<a name="l00153"></a>00153 <a class="code" href="class__operation_8php.html#a8">print</a> <a class="code" href="balance_8php.html#a2">$w</a>-&gt;Submit('bt_html<span class="charliteral">','</span>Impression');
<a name="l00154"></a>00154
<a name="l00155"></a>00155 echo '&lt;/<a class="code" href="constant_8php.html#a7">FORM</a>&gt;';
<a name="l00156"></a>00156 echo '&lt;/div&gt;';
<a name="l00158"></a>00158 <span class="comment">// Function</span>
<a name="l00160"></a><a class="code" href="impress__rapport_8php.html#a12">00160</a> <span class="comment"></span> function <a class="code" href="impress__rapport_8php.html#a12">ShowReportResult</a>($p_array) {
<a name="l00161"></a>00161
<a name="l00162"></a>00162 echo '&lt;TABLE <span class="keyword">class</span>=<span class="stringliteral">"result"</span>&gt;';
<a name="l00163"></a>00163 echo <span class="stringliteral">"&lt;TR&gt;"</span>.
<a name="l00164"></a>00164 <span class="stringliteral">"&lt;TH&gt; Description &lt;/TH&gt;"</span>.
<a name="l00165"></a>00165 <span class="stringliteral">"&lt;TH&gt; montant &lt;/TH&gt;"</span>.
<a name="l00166"></a>00166 <span class="stringliteral">"&lt;/TR&gt;"</span>;
<a name="l00167"></a>00167 <a class="code" href="balance_8php.html#a11">$i</a>=0;
<a name="l00168"></a>00168 foreach ( $p_array as $op ) {
<a name="l00169"></a>00169 <a class="code" href="balance_8php.html#a11">$i</a>++;
<a name="l00170"></a>00170 $class= ( <a class="code" href="balance_8php.html#a11">$i</a> % 2 == 0 )?' <span class="keyword">class</span>=<span class="stringliteral">"odd"</span>':<span class="stringliteral">""</span>;
<a name="l00171"></a>00171
<a name="l00172"></a>00172 echo <span class="stringliteral">"&lt;TR $class&gt;"</span>.
<a name="l00173"></a>00173 <span class="stringliteral">"&lt;TD&gt;"</span>.$op['desc'].<span class="stringliteral">"&lt;/TD&gt;"</span>.
<a name="l00174"></a>00174 <span class="stringliteral">"&lt;TD align=\"right\"&gt;"</span>.sprintf(<span class="stringliteral">"% 8.2f"</span>,$op['montant']).<span class="stringliteral">"&lt;/TD&gt;"</span>.
<a name="l00175"></a>00175 <span class="stringliteral">"&lt;/TR&gt;"</span>;
<a name="l00176"></a>00176 }
<a name="l00177"></a>00177 echo <span class="stringliteral">"&lt;/table&gt;"</span>;
<a name="l00178"></a>00178
<a name="l00179"></a>00179 }
<a name="l00180"></a>00180
<a name="l00181"></a>00181 ?&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>