build_search_sql($_GET); $order=" order by jr_date_order asc,substring(jr_pj_number,'[0-9]+$')::numeric asc "; $res=$cn->get_array($sql.$order); $title=array(); $title[]=_("Internal"); $title[]=_("Journal"); $title[]=_("Date"); $title[]=_("Echeance"); $title[]=_("Paiement"); $title[]=_("Piece"); $title[]=_("qcode"); $title[]=_("Tiers"); $title[]=_("Description"); $title[]=_("Note"); $title[]=_("Montant opération"); $export=new Noalyss_Csv("histo"); $export->send_header(); $export->write_header($title); for ($i=0;$iadd($res[$i]['jr_internal']); $export->add($res[$i]['jrn_def_name']); $export->add($res[$i]['str_jr_date']); $export->add($res[$i]['str_jr_ech']); $export->add($res[$i]['str_jr_date_paid']); $export->add($res[$i]['jr_pj_number']); $export->add($res[$i]['quick_code']); $export->add($res[$i]['name']." ".$res[$i]['first_name']); $export->add($res[$i]['jr_comment']); $export->add($res[$i]['n_text']); $amount=$res[$i]['jr_montant']; if ( $res[$i]['total_invoice']!=null && $res[$i]['jr_montant']!=$res[$i]['total_invoice']) $amount=$res[$i]['total_invoice']; if ( $res[$i]['jrn_def_type'] == 'FIN') { $positive = $cn->get_value("select qf_amount from quant_fin where jr_id=$1",array($res[$i]['jr_id'])); if ( $positive !='' ) $amount=$positive; } $export->add($amount,"number"); $export->write(); }