<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
<section class="content-header">
    <h1><i class="fa fa-file-text-o"></i> Recibos Emitidos</h1>
    <ol class="breadcrumb">
        <li><a href="<?php echo site_url('admin/financeiro')?>"><i class="fa fa-money"></i> Financeiro</a></li>
        <li class="active">Recibos</li>
    </ol>
</section>
<section class="content">
<div class="box">
    <div class="box-header with-border">
        <h3 class="box-title"><i class="fa fa-list"></i> Recibos</h3>
        <div class="box-tools pull-right">
            <a href="<?php echo site_url('admin/financeiro/gerar_recibo')?>" class="btn btn-success btn-sm">
                <i class="fa fa-plus"></i> Novo Recibo
            </a>
        </div>
    </div>
    <div class="box-body">
        <table class="table table-bordered table-striped table-hover" id="tbl-recibos">
            <thead><tr><th>Número</th><th>Pagador</th><th>Referente</th><th>Processo</th><th>Data</th><th class="text-right">Valor</th><th>Ações</th></tr></thead>
            <tbody>
            <?php foreach($recibos as $r): ?>
            <tr>
                <td><strong><?php echo htmlspecialchars($r->numero)?></strong></td>
                <td><?php echo htmlspecialchars($r->pagador_nome)?></td>
                <td><?php echo htmlspecialchars(mb_substr($r->referente,0,55)).(mb_strlen($r->referente)>55?'...':'')?></td>
                <td><?php echo htmlspecialchars($r->case_no??'-')?></td>
                <td><?php echo date('d/m/Y',strtotime($r->data_emissao))?></td>
                <td class="text-right"><strong>R$ <?php echo number_format($r->valor,2,',','.')?></strong></td>
                <td>
                    <a href="<?php echo site_url('admin/financeiro/imprimir_recibo/'.$r->id)?>" class="btn btn-info btn-xs" title="Visualizar"><i class="fa fa-print"></i></a>
                    <a href="<?php echo site_url('admin/financeiro/pdf_recibo/'.$r->id)?>" class="btn btn-danger btn-xs" title="PDF"><i class="fa fa-file-pdf-o"></i></a>
                </td>
            </tr>
            <?php endforeach; ?>
            </tbody>
        </table>
    </div>
</div>
</section>
<link href="<?php echo base_url('assets/css/datatables/dataTables.bootstrap.css')?>" rel="stylesheet">
<script src="<?php echo base_url('assets/js/plugins/datatables/jquery.dataTables.js')?>"></script>
<script src="<?php echo base_url('assets/js/plugins/datatables/dataTables.bootstrap.js')?>"></script>
<script>$(function(){$('#tbl-recibos').dataTable({"order":[[0,'desc']]});});</script>
