File: /home/artinside/www/finance/themes/admin/views/fragments/table-itens.php
<table class="table table-striped table-advance table-hover">
<?php if ($orderItems): ?>
<thead>
<tr>
<th><i class="fa fa-dollar"></i> Valor CHQ</th>
<th><i class="fa fa-calendar"></i> Data</th>
<th><i class=""></i> Dias</th>
<th class="hidden-phone"><i class="">%</i> Percentual</th>
<th><i class=""></i> Valor Real</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
$total1 = 0;
$total2 = 0;
$dias = 0;
$i = 0;
foreach ($orderItems as $item):
$orderId = $item->order_id;
$total1 += $item->item_value;
$total2 += $item->real_value;
$i++;
$dias += $item->days;
?>
<tr>
<td><b>R$ <?= preco_real($item->item_value)?></b></td>
<td><?= date_fmt($item->date_chq, "d/m/Y")?></td>
<td class="text-center"><?=$item->days?> [<?=$item->extra_days?>]</td>
<td class="hidden-phone"><?=$item->percentual?></td>
<td><b>R$ <?= preco_real($item->real_value)?></b></td>
<td>
<a class="btn btn-danger btn-sm text-white j_action"
data-url="<?= url("/admin/order/order"); ?>"
data-action="delete"
data-confirm="Tem certeza que deseja deletar?"
data-id="<?= $item->id; ?>"><i class="fal fa-trash"></i> </a>
</td>
</tr>
<?php
endforeach;
else:?>
<tr>
<td colspan="6" class="text-center font-medium">Não existem cheques cadastrados</td>
</tr>
<?php endif; ?>
<tr class="bg-infinity text-white">
<td class="font-medium2"><b>R$ <?= preco_real($total1)?></b></td>
<td></td>
<?php if($dias > 0):?>
<td class="text-center"><b>Média</b> <br><?= number_format(($dias/$i), 2, ",", "")?></td>
<?php else: ?>
<td class="text-center"><b>Média</b> <br>0</td>
<?php endif; ?>
<td></td>
<td class="font-medium2"><b>R$ <?= preco_real($total2)?></b></td>
<td></td>
</tr>
<?php if(!empty($orderId)):?>
<tr>
<td colspan="6" class="text-center bg-white"><a class="btn btn-success" href="<?= url("/admin/order/invoice/{$orderId}"); ?>"><i
class="fal fa-print"></i> IMPRIMIR ARQUIVO</a></td>
</tr>
<?php endif; ?>
</tbody>
</table>