Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
<table class="table-print">
<thead>
<tr>
<th class="text-left" width="17%" colspan="2">Histórico</th>
<th class="text-right" width="7%">JAN</th>
<th class="text-right" width="7%">FEV</th>
<th class="text-right" width="7%">MAR</th>
<th class="text-right" width="7%">ABR</th>
<th class="text-right" width="7%">MAI</th>
<th class="text-right" width="7%">JUN</th>
<th class="text-right" width="7%">JUL</th>
<th class="text-right" width="7%">AGO</th>
<th class="text-right" width="6%">SET</th>
<th class="text-right" width="6%">OUT</th>
<th class="text-right" width="6%">NOV</th>
<th class="text-right" width="5%">DEZ</th>
<th class="text-right" class="text-right">Total</th>
</tr>
</thead>
<tbody>
<?php
$valorDebido = 0;
$valorJan = 0;
$valorFev = 0;
$valorMar = 0;
$valorAbr = 0;
$valorMai = 0;
$valorJun = 0;
$valorJul = 0;
$valorAgt = 0;
$valorSet = 0;
$valorOut = 0;
$valorNov = 0;
$valorDez = 0;
$ultima = '';
foreach ($resultadosDebitos as $res){
$var = 0;
$jan = (empty($res->debitos1)) ? null : $res->debitos1;
$fev = (empty($res->debitos2)) ? null : $res->debitos2;
$mar = (empty($res->debitos3)) ? null : $res->debitos3;
$abr = (empty($res->debitos4)) ? null : $res->debitos4;
$mai = (empty($res->debitos5)) ? null : $res->debitos5;
$jun = (empty($res->debitos6)) ? null : $res->debitos6;
$jul = (empty($res->debitos7)) ? null : $res->debitos7;
$ago = (empty($res->debitos8)) ? null : $res->debitos8;
$set = (empty($res->debitos9)) ? null : $res->debitos9;
$out = (empty($res->debitos10)) ? null : $res->debitos10;
$nov = (empty($res->debitos11)) ? null : $res->debitos11;
$dez = (empty($res->debitos12)) ? null : $res->debitos12;
$valorJan += $jan;
$valorFev += $fev;
$valorMar += $mar;
$valorAbr += $abr;
$valorMai += $mai;
$valorJun += $jun;
$valorJul += $jul;
$valorAgt += $ago;
$valorSet += $set;
$valorOut += $out;
$valorNov += $nov;
$valorDez += $dez;
$var = ($jan) + ($fev) + ($mar) + ($abr) +($mai) + ($jun) +($jul) + ($ago) + ($set) + ($out) + ($nov) + ($dez);
$valorDebido += $var;
?>
<?php
$vl = $res->grupoHistorico;
if($vl <> $ultima) { ?>
<tr>
<td colspan="2"><font size="1px"><strong><?php echo substr($res->grupoHistorico, 0, 25); ?></strong></td>
<td class="text-right"> <font size="1px"></td>
<td class="text-right"> <font size="1px"></td>
<td class="text-right"> <font size="1px"></td>
<td class="text-right"> <font size="1px"></td>
<td class="text-right"> <font size="1px"></td>
<td class="text-right"> <font size="1px"></td>
<td class="text-right"> <font size="1px"></td>
<td class="text-right"> <font size="1px"></td>
<td class="text-right"> <font size="1px"></td>
<td class="text-right"> <font size="1px"></td>
<td class="text-right"> <font size="1px"></td>
<td class="text-right"> <font size="1px"></td>
<td class="text-right" width="20%"><font size="1px"></td>
<?php
$ultima = $vl;
} else { ?>
<td></td>
<td><font size="1px"><?php echo $res->codigoHistorico; ?> <?php echo substr($res->descricaoHistorico, 0, 19); ?></td>
<td class="text-right"> <font size="1px"><?php $jan = ($jan == '0.00') ? '' : $jan; echo $jan;?></td>
<td class="text-right"> <font size="1px"><?php $fev = ($fev == '0.00') ? '' : $fev; echo $fev;?></td>
<td class="text-right"> <font size="1px"><?php $mar = ($mar == '0.00') ? '' : $mar; echo $mar;?></td>
<td class="text-right"> <font size="1px"><?php $abr = ($abr == '0.00') ? '' : $abr; echo $abr;?></td>
<td class="text-right"> <font size="1px"><?php $mai = ($mai == '0.00') ? '' : $mai; echo $mai;?></td>
<td class="text-right"> <font size="1px"><?php $jun = ($jun == '0.00') ? '' : $jun; echo $jun;?></td>
<td class="text-right"> <font size="1px"><?php $jul = ($jul == '0.00') ? '' : $jul; echo $jul;?></td>
<td class="text-right"> <font size="1px"><?php $ago = ($ago == '0.00') ? '' : $ago; echo $ago;?></td>
<td class="text-right"> <font size="1px"><?php $set = ($set == '0.00') ? '' : $set; echo $set;?></td>
<td class="text-right"> <font size="1px"><?php $out = ($out == '0.00') ? '' : $out; echo $out;?></td>
<td class="text-right"> <font size="1px"><?php $nov = ($nov == '0.00') ? '' : $nov; echo $nov;?></td>
<td class="text-right"> <font size="1px"><?php $dez = ($dez == '0.00') ? '' : $dez; echo $dez;?></td>
<td class="text-right" width="20%"><font size="1px"><?php echo number_format($var, 2, ",", ".") ; ?></td>
<?php } ?>
</tr>
<?php } ?>
Essa table forma isso :

Só que tem um porem nesse foreach a primeira linha que vem do banco não esta sendo exibida na tabela só a partir da segunda:
Carregando comentários...