Check(); $User->check_dossier($gDossier); $User->can_request(IMPPOSTE,0); extract($_POST); if ( isset ( $poste_fille) ){ //choisit de voir tous les postes $a_poste=$cn->get_array("select pcm_val from tmp_pcmn where pcm_val::text like '$poste_id%'"); } else $a_poste=$cn->get_array("select pcm_val from tmp_pcmn where pcm_val::text = '$poste_id'"); $ret=""; $pdf=new Cezpdf(); $pdf->selectFont('./addon/fonts/Helvetica.afm'); header_pdf($cn,$pdf); if ( count($a_poste) == 0 ) { $pdf->ezStream(); return; } foreach ($a_poste as $poste) { echo_debug("poste_pdf",__LINE__,$poste); $Poste=new Acc_Account_Ledger($cn,$poste['pcm_val']); list($array,$tot_deb,$tot_cred)=$Poste->get_row_date($from_periode,$to_periode); // don't print empty account if ( count($array) == 0 ) { continue; } $Libelle=sprintf("(%s) %s ",$Poste->id,$Poste->get_name()); // $pdf->ezText($Libelle,30); $pdf->ezTable($array, array ('jr_internal'=>'Operation', 'j_date_fmt' => 'Date', 'jrn_name'=>'Journal', 'description'=>'Description', 'deb_montant'=> 'Montant', 'cred_montant'=> 'Montant' ),utf8_decode($Libelle), array('shaded'=>1,'showHeadings'=>1,'width'=>500, 'cols'=>array('montant'=> array('justification'=>'right'), )),true); $str_debit=utf8_decode(sprintf("Débit % 12.2f",$tot_deb)); $str_cred=utf8_decode(sprintf("Crédit % 12.2f",$tot_cred)); $diff_solde=$tot_deb-$tot_cred; if ( $diff_solde < 0 ) { $solde=" C "; $diff_solde*=-1; } else { $solde=" D "; } $str_solde=sprintf(" Solde %s %12.2f",$solde,$diff_solde); $pdf->ezText($str_debit,10,array('justification'=>'right')); $pdf->ezText($str_cred,10,array('justification'=>'right')); $pdf->ezText($str_solde,14,array('justification'=>'right')); //New page $pdf->ezNewPage(); header_pdf($cn,$pdf); } $pdf->ezStream(); ?>