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
00024
00025 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
00026 header('Pragma: public');
00027 header('Content-type: application/csv');
00028 header('Content-Disposition: attachment;filename="histo-export.csv"',FALSE);
00029
00030 $ledger=new Acc_Ledger($cn,0);
00031 list($sql,$where)=$ledger->build_search_sql($_GET);
00032
00033 $order=" order by jr_date_order asc,substring(jr_pj_number,'[0-9]+$')::numeric asc ";
00034
00035 $res=$cn->get_array($sql.$order);
00036
00037 printf('"%s";',"Internal");
00038 printf('"%s";',"Journal");
00039 printf('"%s";',"Date");
00040 printf('"%s";',"Echeance");
00041 printf('"%s";',"Paiement");
00042 printf('"%s";',"Piece");
00043 printf('"%s";"";',"Tiers");
00044 printf('"%s";',"Description");
00045 printf('"%s";',"Note");
00046 printf('"%s"',"Montant opération");
00047 printf("\r\n");
00048
00049 for ($i=0;$i<count($res);$i++)
00050 {
00051 printf('"%s";',$res[$i]['jr_internal']);
00052 printf('"%s";',$res[$i]['jrn_def_name']);
00053 printf('"%s";',$res[$i]['str_jr_date']);
00054 printf('"%s";',$res[$i]['str_jr_ech']);
00055 printf('"%s";',$res[$i]['str_jr_date_paid']);
00056 printf('"%s";',$res[$i]['jr_pj_number']);
00057 printf('"%s";',$res[$i]['quick_code']);
00058 printf('"%s %s";',$res[$i]['name'],$res[$i]['first_name']);
00059 printf('"%s";',$res[$i]['jr_comment']);
00060 printf('"%s";',$res[$i]['n_text']);
00061
00062 $amount=$res[$i]['jr_montant'];
00063
00064 if ( $res[$i]['total_invoice']!=null && $res[$i]['jr_montant']!=$res[$i]['total_invoice'])
00065 $amount=$res[$i]['total_invoice'];
00066 if ( $res[$i]['jrn_def_type'] == 'FIN')
00067 {
00068 $positive = $cn->get_value("select qf_amount from quant_fin where jr_id=$1",array($res[$i]['jr_id']));
00069 if ( $positive !='' ) $amount=$positive;
00070 }
00071 printf('%s',nb($amount));
00072
00073 printf("\r\n");
00074
00075 }