From 8a19837838621c1f7735e488fbb3650fb6f074f0 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Fri, 15 Aug 2003 21:21:30 +0000 Subject: [PATCH] Perform printing : avoid empty account --- html/send_poste_pdf.php | 21 ++++++++++++++++++--- include/impress_inc.php | 12 ++++++++++-- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/html/send_poste_pdf.php b/html/send_poste_pdf.php index f08990ac1..536e4c0f7 100644 --- a/html/send_poste_pdf.php +++ b/html/send_poste_pdf.php @@ -42,8 +42,12 @@ $cond=CreatePeriodeCond($periode); //$rap_deb=0;$rap_cred=0; for ( $i =0;$iezText($Libelle,30); $pdf->ezTable($array, @@ -58,8 +62,19 @@ for ( $i =0;$iezText($str_debit,14,array('justification'=>'right')); - $pdf->ezText($str_cred,14,array('justification'=>'right')); +$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(); diff --git a/include/impress_inc.php b/include/impress_inc.php index a43fba670..b66479fd6 100644 --- a/include/impress_inc.php +++ b/include/impress_inc.php @@ -140,11 +140,11 @@ function ImpHtml($p_array,$p_cn) $cond=CreatePeriodeCond($periode); $ret="" ; for ( $i =0;$i%d %s", $poste[$i],GetPosteLibelle($p_cn,$poste[$i],1)); $ret.=""; - list ($array,$tot_deb,$tot_cred)=GetDataPoste($p_cn,$poste[$i],$cond); - if ( $array == null) continue; foreach ($array as $col=>$element) { $ret.=""; $ret.=sprintf("",$element['jr_internal']); @@ -166,6 +166,14 @@ function ImpHtml($p_array,$p_cn) $tot_cred); $ret.="
%s
"; $ret.="Total débit :".$tot_deb." Total Crédit:".$tot_cred; + if ( $tot_deb > $tot_cred ) { + $solde_t="D"; + $solde=$tot_deb-$tot_cred; + }else { + $solde_t="C"; + $solde=$tot_cred-$tot_deb; + } + $ret.=" Solde $solde_t = ".$solde.""; }// for i return $ret; }//poste