00001 <?
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00027 include_once("class_rapport.php");
00028 include_once("ac_common.php");
00029 include_once("postgres.php");
00030 include_once("class.ezpdf.php");
00031 include_once("impress_inc.php");
00032
00033 $cn=DbConnect($_SESSION['g_dossier']);
00034 foreach ($HTTP_POST_VARS as $key=>$element) {
00035 ${"$key"}=$element;
00036 }
00037
00038 $ret="";
00039 $pdf=& new Cezpdf();
00040 $pdf->selectFont('./addon/fonts/Helvetica.afm');
00041
00042 $Form=new rapport($cn,$form_id);
00043
00044
00045 if ( $_POST['p_step'] == 0 )
00046 {
00047
00048
00049 $array=$Form->GetRow($from_periode,$to_periode);
00050 }
00051 else
00052 {
00053
00054
00055 for ($e=$_POST['from_periode'];$e<=$_POST['to_periode'];$e+=$_POST['p_step'])
00056 {
00057 $periode=getPeriodeName($cn,$e);
00058 if ( $periode == null ) continue;
00059 $array[]=$Form->GetRow($e,$e);
00060 $periode_name[]=$periode;
00061 }
00062
00063 }
00064
00065 $Libelle=sprintf("(%s) %s ",$Form->id,$Form->GetName());
00066
00067 $pdf->ezText($Libelle,30);
00068
00069 if ( $_POST['p_step'] == 0 )
00070 {
00071 $q=getPeriodeName($cn,$from_periode);
00072 if ( $from_periode != $to_periode){
00073 $periode=sprintf("Période %s à %s",$q,getPeriodeName($cn,$to_periode));
00074 } else {
00075 $periode=sprintf("Période %s",$q);
00076 }
00077
00078 $pdf->ezText($periode,25);
00079 $pdf->ezTable($array,
00080 array ('desc'=>'Description',
00081 'montant' => 'Montant'
00082 ),$Libelle,
00083 array('shaded'=>0,'showHeadings'=>1,'width'=>500,
00084 'cols'=>array('montant'=> array('justification'=>'right'),
00085 )));
00086
00087
00088
00089 }
00090 else
00091 {
00092 $a=0;
00093 foreach ($array as $e)
00094 {
00095 $pdf->ezText($periode_name[$a],25);
00096 $a++;
00097 $pdf->ezTable($e,
00098 array ('desc'=>'Description',
00099 'montant' => 'Montant'
00100 ),$Libelle,
00101 array('shaded'=>0,'showHeadings'=>1,'width'=>500,
00102 'cols'=>array('montant'=> array('justification'=>'right'),
00103 )));
00104 }
00105 }
00106 $pdf->ezStream();
00107
00108 ?>