File: //home/artinside/public_html/finance/themes/admin/widgets/order/invoice.php
<?php $v->layout("_admin");
$v->start("css");
?>
<link href="<?= url("admin-assets/css/invoice-print.css")?>" rel="stylesheet" media="print">
<?php
$v->end();
?>
<section class="wrapper">
<!-- invoice start-->
<section>
<div class="card card-primary">
<!--<div class="card-heading navyblue"> INVOICE</div>-->
<div class="card-body">
<div class="row invoice-list">
<div class="col-md-12 text-center corporate-id">
<img src="<?= theme("assets/images/logo.svg")?>" alt="<?= CONF_SITE_NAME ?>" width="190px" class="margin-bottom-20">
</div>
<div class="col-lg-4 col-sm-4">
<h4>Dados da Orderm</h4>
<p>
<b><?= $order->title ?></b><br>
Obs: <?= $order->observations ?><br>
</p>
</div>
<div class="col-lg-4 col-sm-4">
</div>
<div class="col-lg-4 col-sm-4">
<h4>Dados Gerais</h4>
<ul class="unstyled">
<li>Número Pedido: <strong>[#<?= order_id($order->id) ?>]</strong></li>
<li>Taxa: <strong><?= $order->percentual ?></strong></li>
<li>Data Base: <strong><?= date_fmt($order->starting_date, "d/m/Y") ?></strong></li>
</ul>
</div>
</div>
<table class="table table-striped table-hover">
<thead>
<tr>
<th>#</th>
<th class="hidden-phone">Valor</th>
<th class="">Data</th>
<th class="text-center">Dias</th>
<th class="text-center">Percentual</th>
<th>Valor Real</th>
</tr>
</thead>
<tbody>
<?php
$total1 = 0;
$total2 = 0;
$dias = 0;
$i = 0;
if($orderItems):
foreach ($orderItems as $item):
$total1 += $item->item_value;
$total2 += $item->real_value;
$i++;
$dias += $item->days;
?>
<tr>
<td><?= $i?></td>
<td class="hidden-phone">
R$ <?= preco_real($item->item_value)?>
</td>
<td class=""><?= date_fmt($item->date_chq, "d/m/Y") ?></td>
<td class="text-center"><?= $item->days ?> [<?= $item->extra_days ?>]</td>
<td class="text-center"><?= $item->percentual ?></td>
<td>R$ <?= preco_real($item->real_value) ?></td>
</tr>
<?php endforeach;
else:
?>
<tr>
<td colspan="6" class="text-center font-medium">Não existem itens cadastrados ainda</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<div class="row justify-content-end">
<div class="col-lg-4 invoice-block ">
<ul class="unstyled amounts">
<li><strong>Valor Cheques :</strong> R$ <?= preco_real($total1)?></li>
<?php if($dias > 0):?>
<li><strong>Média Dias :</strong> <?= number_format(($dias/$i), 2, ",", "")?></li>
<?php else: ?>
<li><strong>Média Dias :</strong> 0</li>
<?php endif;?>
<li><strong>Valor Real :</strong> <b> R$ <?= preco_real($total2)?></b></li>
</ul>
</div>
</div>
<div class="text-center invoice-btn j_actions">
<?php if($order->status == "paid" AND $order->shipment_code == "Aguardando Entrega"): ?>
<button class="btn btn-success" data-toggle="modal" data-target="#exampleModalCenter" data-order="<?= order_id($order->id)?>" data-id="<?= $order->id ?>" id="j_shipment_code"><i class="fal fa-truck"></i> Informar Entrega</button>
<?php endif; ?>
<a class="btn btn-info text-light" onclick="javascript:window.print();"><i class="fal fa-print"></i> Print </a>
</div>
</div>
</div>
</section>
<!-- invoice end-->
</section>
<?php
$v->start("scripts");
?>
<script>
$(".j_actions").on("click","#j_shipment_code", function (e) {
e.preventDefault();
var id = $(this).data("id");
var formatedId = $(this).data("order");
$("#form_order_id").val(id);
$(".j_order_id_number").html("Pedido Número: <b>[#"+formatedId+"]</b>");
})
</script>
<?php
$v->end();
$v->insert("views/modals/shipment-code");
?>