00001 <?
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00024 include_once("ac_common.php");
00025 include_once ("postgres.php");
00026 include ('class_user.php');
00027 include("class_poste.php");
00028 header('Content-type: application/csv');
00029 header('Content-Disposition: attachment;filename="poste.csv"',FALSE);
00030
00031
00032 $cn=DbConnect($_SESSION['g_dossier']);
00033
00034
00035 $User=new cl_user($cn);
00036 $User->Check();
00037
00038
00039 $Poste=new poste($cn,$_POST['poste_id']);
00040 $Poste->GetName();
00041 list($array,$tot_deb,$tot_cred)=$Poste->GetRow( $_POST['from_periode'],
00042 $_POST['to_periode']
00043 );
00044 if ( count($Poste->row ) == 0 )
00045 exit;
00046
00047 echo "\"Code interne\";".
00048 "\"Date\";".
00049 "\"Description\";".
00050 "\"Débit\";".
00051 "\"Crédit\"";
00052 printf("\n");
00053
00054
00055 foreach ( $Poste->row as $op ) {
00056 echo '"'.$op['jr_internal'].'"'.";".
00057 '"'.$op['j_date'].'"'.";".
00058 '"'.$op['description'].'"'.";".
00059 sprintf("%8.4f",$op['deb_montant']).";".
00060 sprintf("%8.4f",$op['cred_montant']);
00061 printf("\n");
00062
00063
00064 }
00065 $solde_type=($tot_deb>$tot_cred)?"solde débiteur":"solde créditeur";
00066 $diff=abs($tot_deb-$tot_cred);
00067 printf(
00068 '"'."$solde_type".'"'.";".
00069 sprintf("%8.4f",$diff).";".
00070 sprintf("%8.4f",$tot_deb).";".
00071 sprintf("%8.4f",$tot_cred)."\n");
00072
00073 exit;
00074 ?>