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 include_once("ac_common.php");
00025 require_once('class_database.php');
00026 require_once("class_fiche.php");
00027 header('Content-type: application/csv');
00028
00029 header('Pragma: public');
00030 header('Content-Disposition: attachment;filename="poste.csv"',FALSE);
00031 require_once('class_dossier.php');
00032 $gDossier=dossier::id();
00033
00034
00035 $cn=new Database($gDossier);
00036
00037
00038 $Fiche=new Fiche($cn,$_REQUEST['f_id']);
00039 $Fiche->getName();
00040 list($array,$tot_deb,$tot_cred)=$Fiche->get_row_date(
00041 $_GET['from_periode'],
00042 $_GET['to_periode'],
00043 $_GET['ople']
00044 );
00045 if ( count($Fiche->row ) == 0 )
00046 {
00047 echo "Aucune donnée";
00048 return;
00049 }
00050
00051
00052 if ( ! isset ($_REQUEST['oper_detail']))
00053 {
00054 echo '"Qcode";'.
00055 "\"Date\";".
00056 "\"n° pièce\";".
00057 "\"Code interne\";".
00058 "\"Description\";".
00059 "\"Débit\";".
00060 "\"Crédit\";".
00061 "\"Prog.\";".
00062 "\"Let.\"" ;
00063 printf("\n");
00064 $progress=0;
00065 foreach ( $Fiche->row as $op )
00066 {
00067 $progress+=$op['deb_montant']-$op['cred_montant'];
00068
00069 echo '"'.$op['j_qcode'].'";'.
00070 '"'.$op['j_date_fmt'].'"'.";".
00071 '"'.$op['jr_pj_number'].'"'.";".
00072 '"'.$op['jr_internal'].'"'.";".
00073 '"'.$op['description'].'"'.";".
00074 nb($op['deb_montant']).";".
00075 nb($op['cred_montant']).";".
00076 nb(abs($progress)).';'.
00077 '"'.(($op['letter']==-1)?'':strtoupper(base_convert($op['letter'],10,36))).'"';
00078 printf("\n");
00079
00080 }
00081 }
00082 else
00083 {
00084 echo '"Poste";"Qcode";"date";"ref";"internal";';
00085 echo "\"Description\";".
00086 "\"Montant\";".
00087 "\"D/C\"";
00088
00089 printf("\r\n");
00090
00091 foreach ( $Fiche->row as $op )
00092 {
00093 $acc=new Acc_Operation($cn);
00094 $acc->jr_id=$op['jr_id'];
00095 $result= $acc->get_jrnx_detail();
00096
00097 foreach ( $result as $r)
00098 {
00099 printf('"%s";"%s";"%s";"%s";"%s";%s;%s;"%s"',
00100 $r['j_poste'],
00101 $r['j_qcode'],
00102 $r['jr_date'],
00103 $op['jr_pj_number'],
00104 $r['jr_internal'],
00105 $r['description'],
00106 nb($r['j_montant']),
00107 $r['debit']);
00108 printf("\r\n");
00109
00110 }
00111
00112
00113
00114 }
00115 }
00116 $solde_type=($tot_deb>$tot_cred)?"solde débiteur":"solde créditeur";
00117 $diff=abs($tot_deb-$tot_cred);
00118 printf(
00119 '"'."$solde_type".'"'.";".
00120 nb($diff).";".
00121 nb($tot_deb).";".
00122 nb($tot_cred)."\n");
00123
00124 exit;
00125 ?>