Perform printing : avoid empty account

This commit is contained in:
sparkyx 2003-08-15 21:21:30 +00:00
parent b43f146319
commit 8a19837838
2 changed files with 28 additions and 5 deletions

View file

@ -42,8 +42,12 @@ $cond=CreatePeriodeCond($periode);
//$rap_deb=0;$rap_cred=0;
for ( $i =0;$i<count($poste);$i++) {
$Libelle=sprintf("(%s) %s ",$poste[$i],GetPosteLibelle($cn,$poste[$i],1));
list($array,$tot_deb,$tot_cred)=GetDataPoste($cn,$poste[$i],$cond);
// don't impress empty account
if ( count($array) == 0 ) {
continue;
}
$Libelle=sprintf("(%s) %s ",$poste[$i],GetPosteLibelle($cn,$poste[$i],1));
// $pdf->ezText($Libelle,30);
$pdf->ezTable($array,
@ -58,8 +62,19 @@ for ( $i =0;$i<count($poste);$i++) {
)));
$str_debit=sprintf("Débit % 12.2f",$tot_deb);
$str_cred=sprintf("Crédit % 12.2f",$tot_cred);
$pdf->ezText($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();

View file

@ -140,11 +140,11 @@ function ImpHtml($p_array,$p_cn)
$cond=CreatePeriodeCond($periode);
$ret="" ;
for ( $i =0;$i<count($poste);$i++) {
list ($array,$tot_deb,$tot_cred)=GetDataPoste($p_cn,$poste[$i],$cond);
if ( count($array) == 0) continue;
$ret.=sprintf("<H2 class=\"info\">%d %s</H2>",
$poste[$i],GetPosteLibelle($p_cn,$poste[$i],1));
$ret.="<TABLE border=0 >";
list ($array,$tot_deb,$tot_cred)=GetDataPoste($p_cn,$poste[$i],$cond);
if ( $array == null) continue;
foreach ($array as $col=>$element) {
$ret.="<TR>";
$ret.=sprintf("<TD>%s</TD>",$element['jr_internal']);
@ -166,6 +166,14 @@ function ImpHtml($p_array,$p_cn)
$tot_cred);
$ret.="</TABLE>";
$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.=" <B> Solde $solde_t = ".$solde."</B>";
}// for i
return $ret;
}//poste