<?php
$nro_doc_actual = 0;
$inicio = 1;
$html_total = ''; ?>
<table>
<thead>
<tr>
<th>Nro Doc</th>
<th>Descripcion</th>
<th>Total</th>
</tr>
</thead>
<tbody>
<?php foreach($documentos as $doc){
if ($doc->nro_doc != $nro_doc_actual){
$nro_doc_actual = $doc->nro_doc;
if ($inicio == 1){
$inicio = 0;
} else {
$html_total = '<tr><td colspan="3">'.$suma_documentos.'</td></tr>';
}
} ?>
<tr>
<td><?php echo $doc->nro_doc; ?></td>
<td><?php echo $doc->descripcion; ?></td>
<td><?php echo $doc->total; ?></td>
</tr>
<?php $suma_documentos = $suma_documentos + $doc->total;
echo $html_total;
$html_total = '';
} ?>
</tbody>
</table>
Ejemplo para mostrar totales por php
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.