00001 <?
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 include_once("class_widget.php");
00029
00030
00031
00032
00033
00034 if ( isset( $_POST['bt_html'] ) ) {
00035 include("class_rapport.php");
00036 $Form=new rapport($cn,$_POST['form_id']);
00037 $Form->GetName();
00038
00039
00040 if ($_POST['p_step'] == 0 ) {
00041 $array=$Form->GetRow( $_POST['from_periode'],
00042 $_POST['to_periode']
00043 );
00044 } else {
00045
00046
00047 for ($e=$_POST['from_periode'];$e<=$_POST['to_periode'];$e+=$_POST['p_step'])
00048 {
00049
00050 $periode=getPeriodeName($cn,$e);
00051 if ( $periode == null ) continue;
00052 $array[]=$Form->GetRow($e,$e);
00053 $periode_name[]=$periode;
00054 }
00055 }
00056
00057
00058 $rep="";
00059 $submit=new widget();
00060 $hid=new widget("hidden");
00061 echo '<div class="u_content">';
00062 $t=($_POST['from_periode']==$_POST['to_periode'])?"":" -> ".getPeriodeName($cn,$_POST['to_periode'],'p_end');
00063 echo '<h2 class="info">'.$Form->id." ".$Form->name.
00064 " - ".getPeriodeName($cn,$_POST['from_periode'],'p_start').
00065 " ".$t.
00066 '</h2>';
00067 echo '<table >';
00068 echo '<TR>';
00069 echo '<TD><form method="GET" ACTION="user_impress.php">'.
00070 $submit->Submit('bt_other',"Autre Rapport").
00071 $hid->IOValue("type","rapport")."</form></TD>";
00072
00073 echo '<TD><form method="POST" ACTION="form_pdf.php">'.
00074 $submit->Submit('bt_pdf',"Export PDF").
00075 $hid->IOValue("type","rapport").
00076 $hid->IOValue("form_id",$Form->id).
00077 $hid->IOValue("from_periode",$_POST['from_periode']).
00078 $hid->IOValue("to_periode",$_POST['to_periode']).
00079 $hid->IOValue("p_step",$_POST['p_step']);
00080
00081
00082 echo "</form></TD>";
00083 echo '<TD><form method="POST" ACTION="form_csv.php">'.
00084 $submit->Submit('bt_csv',"Export CSV").
00085 $hid->IOValue("type","form").
00086 $hid->IOValue("form_id",$Form->id).
00087 $hid->IOValue("from_periode",$_POST['from_periode']).
00088 $hid->IOValue("to_periode",$_POST['to_periode']).
00089 $hid->IOValue("p_step",$_POST['p_step']);
00090
00091 echo "</form></TD>";
00092
00093 echo "</TR>";
00094
00095 echo "</table>";
00096 if ( count($Form->row ) == 0 )
00097 exit;
00098
00099 if ( $_POST['p_step'] == 0)
00100 {
00101
00102 ShowReportResult($Form->row);
00103 }
00104 else
00105 {
00106 $a=0;
00107 foreach ( $array as $e) {
00108 echo '<h2 class="info">Periode : '.$periode_name[$a]."</h2>";
00109 $a++;
00110 ShowReportResult($e);
00111 }
00112 }
00113
00114 echo "</div>";
00115 exit;
00116 }
00117
00118
00119
00120
00121 include_once("postgres.php");
00122 $ret=make_array($cn,"select fr_id,fr_label
00123 from formdef
00124 order by fr_label");
00125 if ( sizeof($ret) == 0 ) {
00126 echo "Aucun Rapport";
00127 return;
00128 }
00129
00130
00131
00132 echo '<div class="u_content">';
00133 echo '<FORM ACTION="?type=rapport" METHOD="POST">';
00134 echo '<TABLE><TR>';
00135 $w=new widget("select");
00136 $w->table=1;
00137 $w->label="Choississez le rapport";
00138 print $w->IOValue("form_id",$ret);
00139 print '</TR>';
00140 print '<TR>';
00141
00142 $filter_year=" where p_exercice='".$User->getExercice()."'";
00143
00144 $periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_id");
00145 $w->label="Depuis";
00146 print $w->IOValue('from_periode',$periode_start);
00147 $w->label=" jusqu'ŕ ";
00148 $periode_end=make_array($cn,"select p_id,to_char(p_end,'DD-MM-YYYY') from parm_periode $filter_year order by p_id");
00149 print $w->IOValue('to_periode',$periode_end);
00150 print "</TR>";
00151 $aStep=array(
00152 array('value'=>0,'label'=>'Pas d\'étape'),
00153 array('value'=>1,'label'=>'1 mois')
00154 );
00155 $w->label='Par étape de';
00156 echo '<TR> '.$w->IOValue('p_step',$aStep);
00157 echo '</TR>';
00158
00159 echo '</TABLE>';
00160 print $w->Submit('bt_html','Impression');
00161
00162 echo '</FORM>';
00163 echo '</div>';
00164
00165
00166
00167 function ShowReportResult($p_array) {
00168
00169 echo '<TABLE class="result">';
00170 echo "<TR>".
00171 "<TH> Description </TH>".
00172 "<TH> montant </TH>".
00173 "</TR>";
00174 $i=0;
00175 foreach ( $p_array as $op ) {
00176 $i++;
00177 $class= ( $i % 2 == 0 )?' class="odd"':"";
00178
00179 echo "<TR $class>".
00180 "<TD>".$op['desc']."</TD>".
00181 "<TD align=\"right\">".sprintf("% 8.2f",$op['montant'])."</TD>".
00182 "</TR>";
00183 }
00184 echo "</table>";
00185
00186 }
00187
00188 ?>