Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
00024 require_once ("ac_common.php");
00025 require_once('class_database.php');
00026 require_once ('class_user.php');
00027 require_once("class_acc_report.php");
00028 require_once("class_impress.php");
00029 header('Pragma: public');
00030 header('Content-type: application/csv');
00031 header('Content-Disposition: attachment;filename="rapport.csv"',FALSE);
00032
00033 require_once('class_dossier.php');
00034 $gDossier=dossier::id();
00035
00036
00037 $cn=new Database($gDossier);
00038
00039 $Form=new Acc_Report($cn,$_GET['form_id']);
00040 $Form->get_name();
00041
00042
00043 $step=HtmlInput::default_value_get("p_step", 0);
00044 if ( $step == 0 )
00045 {
00046 if ( $_GET ['type_periode'] == 0 )
00047 $array=$Form->get_row( $_GET['from_periode'],$_GET['to_periode'], $_GET['type_periode']);
00048 else
00049 $array=$Form->get_row( $_GET['from_date'],$_GET['to_date'], $_GET['type_periode']);
00050
00051
00052 if ( count($Form->row ) == 0 )
00053 exit;
00054
00055 echo "\"Description\";".
00056 "\"Montant\"\n";
00057
00058
00059
00060 foreach ( $Form->row as $op )
00061 {
00062 echo '"'.$op['desc'].'"'.";".
00063 nb($op['montant']).
00064 "\n";
00065
00066 }
00067 }
00068 elseif ($step == 1)
00069 {
00070
00071
00072 for ($e=$_GET['from_periode'];$e<=$_GET['to_periode'];$e+=$_GET['p_step'])
00073 {
00074 $periode=getPeriodeName($cn,$e);
00075 if ( $periode == null ) continue;
00076 $array[]=$Form->get_row($e,$e,$_GET['type_periode']);
00077 $periode_name[]=$periode;
00078 }
00079
00080
00081 $x="";
00082 printf ("Mois;");
00083 foreach ($array[0] as $e)
00084 {
00085 printf("%s%s",$x,$e['desc']);
00086 $x=";";
00087
00088 }
00089 printf("\n");
00090
00091
00092 $a=0;
00093 foreach ($array as $e )
00094 {
00095 print $periode_name[$a];
00096 $a++;
00097 foreach ($e as $elt)
00098 {
00099 printf(";%s",nb($elt['montant']));
00100 }
00101 printf("\n");
00102 }
00103 }
00104 exit;
00105 ?>