selectFont('./addon/fonts/Helvetica.afm'); $offset=0;$limit=35;$step=35; $rap_deb=0;$rap_cred=0; while (1) { $a=0; list ($a_jrn,$tot_deb,$tot_cred)=GetDataJrnPdf($cn,$HTTP_POST_VARS,$limit,$offset); echo_debug("Total debit $tot_deb,credit $tot_cred"); if ( $a_jrn==null) break; $offset+=$step; foreach ($a_jrn as $key=>$element) { echo_debug("$key => $element"); foreach ($element as $c1=>$c2) echo_debug("Array is $c1 => $c2"); } $first_id=$a_jrn[0]['j_id']; $Exercice=GetExercice($cn,$a_jrn[0]['periode']); list($rap_deb,$rap_cred)=GetRappel($cn,$first_id,$_POST["p_id"],$Exercice,FIRST,$l_type); echo_debug("MONTANT $rap_deb,$rap_cred"); echo_debug(" list($rap_deb,$rap_cred)=GetRappel($cn,$first_id,".$_POST["p_id"].",$Exercice,FIRST)"); $pdf->ezText($name_jrn,30); $str_debit=sprintf( "report Débit % 10.2f",$rap_deb); $str_credit=sprintf("report Crédit % 10.2f",$rap_cred); $pdf->ezText($str_debit,12,array('justification'=>'right')); $pdf->ezText($str_credit,12,array('justification'=>'right')); $pdf->ezTable($a_jrn, array ('internal'=>'Opération', 'j_date' => 'Date', 'poste'=>'Poste', 'description' => 'Description', 'deb_montant'=> 'Débit', 'cred_montant'=>'Crédit')," ", array('shaded'=>0,'showHeadings'=>1,'width'=>500, 'cols'=>array('deb_montant'=> array('justification'=>'right'), 'cred_montant'=> array('justification'=>'right')))); $a=1; // Total Page $apage=array(array('deb'=>sprintf("%8.2f",$tot_deb),'cred'=>$tot_cred)); foreach ($apage as $key=>$element) echo_debug ("apage $key => $element"); $pdf->ezTable($apage, array ( 'deb'=> 'Total Débit', 'cred'=>'Total Crédit')," ", array('shaded'=>0,'showHeadings'=>1,'width'=>200, 'xPos'=>'right','xOrientation'=>'left', 'cols'=>array('deb'=> array('justification'=>'right'), 'cred'=> array('justification'=>'right')))); $count=count($a_jrn)-1; $last_id=$a_jrn[$count]['j_id']; $Exercice=GetExercice($cn,$a_jrn[$count]['periode']); list($rap_deb,$rap_cred)=GetRappel($cn,$last_id,$_POST["p_id"],$Exercice,LAST,$l_type); $str_debit=sprintf( "à reporter Débit % 10.2f",$rap_deb); $str_credit=sprintf("à reporter Crédit % 10.2f",$rap_cred); $pdf->ezText($str_debit,12,array('justification'=>'right')); $pdf->ezText($str_credit,12,array('justification'=>'right')); //New page $pdf->ezNewPage(); } if ( $a == 1 ) { $apage=array('deb'=>$tot_deb,'cred'=>$tot_cred); $pdf->ezTable($apage, array ( 'deb'=> 'Total Débit', 'cred'=>'Total Crédit')," ", array('shaded'=>0,'showHeadings'=>1,'width'=>500, 'cols'=>array('deb'=> array('justification'=>'right'), 'cred'=> array('justification'=>'right')))); $count=count($a_jrn)-1; $last_id=$a_jrn[$count]['j_id']; $Exercice=GetExercice($cn,$a_jrn[$count]['periode']); list($rap_deb,$rap_cred)=GetRappel($cn,$last_id,$_POST["p_id"],$Exercice,LAST,$l_type); $str_debit=sprintf( "à reporter Débit % 10.2f",$rap_deb); $str_credit=sprintf("à reporter Crédit % 10.2f",$rap_cred); $pdf->ezText($str_debit,12,array('justification'=>'right')); $pdf->ezText($str_credit,12,array('justification'=>'right')); } $pdf->ezStream(); ?>