<style>
    .table,
    .td,
    .th {
        border: 1px solid black;
        text-align: left;
    }

    .table {
        border-collapse: collapse;
        width: 100%;
    }

    .th,
    .td {
        padding: 5px;
    }
</style>
<?php

use Core\Helpers\Moneda; ?>
<div style="display:block; width: 100%;">
    <table width="100%" border="0">
        <tr>
            <td><strong>Sucursal:</strong></td>
            <td><?= $sucursal ?></td>
        </tr>
        <tr>
            <td style="width: 15%; text-align: left"><strong>Nota de entrega:</strong></td>
            <td style="width: 60%; text-align: left"><?= $factura ?></td>
            <td style="text-align: right"><strong>Fecha:</strong></td>
            <td style="text-align: right"><?= date('d-m-Y', strtotime($fecha)) ?></td>
        </tr>
        <tr>
            <td style="text-align: left"><strong>Cliente:</strong></td>
            <td style="text-align: left"><?= $cliente ?></td>
            <td style="text-align: right"><strong>RIF/CI:</strong></td>
            <td style="text-align: right"><?= $cedularif ?></td>
        </tr>
        <tr>
            <td style="text-align: left"><strong>Dirección:</strong></td>
            <td style="text-align: left"><?= $direccion ?></td>
            <td style="text-align: right"><strong>Telefóno:</strong></td>
            <td style="text-align: right"><?= $telefono ?></td>
        </tr>
    </table>
</div>

<div style="display:block; width: 100%; padding:15px"></div>

<div style="display:block; width: 100%;">
    <table class="table">
        <thead>
            <tr>
                <th class="th" style="text-align: left">Ref. + Descripción</th>
                <th class="th" style="text-align: right">Cant.</th>
                <th class="th" style="text-align: right">Dto %.</th>
                <th class="th" style="text-align: right">Precio</th>
                <th class="th" style="text-align: right">Subtotal</th>
                <th class="th" style="text-align: right">Total</th>
            </tr>
        </thead>
        <tbody>
            <?php foreach ($articulos as $row) : ?>
                <tr>
                    <td class="td" style="text-align: left"><strong><?= $row['neart_procodigo'] ?></strong> <?= $row['neart_propnombre'] ?></td>
                    <td class="td" style="text-align: right"><?= $row['neart_procantidad'] ?></td>
                    <td class="td" style="text-align: right"><?= $row['neart_prodescuento'] ?></td>

                    <?php if ($iva_integrado) : ?>
                        <?php  $descuento = convertir_a_float((($row['neart_procantidad'] * ($row['neart_proprecio']+($row['neart_proprecio'] *($row['imp_valor']/100)))) * ($row['neart_prodescuento'] / 100))) ?? 0; ?>
                        <td class="td" style="text-align: right"><?= Moneda::moneda(($row['neart_proprecio']+($row['neart_proprecio'] *($row['imp_valor']/100))), $div_locale, $div_simbolo) ?></td>
                        <td class="td" style="text-align: right"><?= Moneda::moneda(($row['neart_procantidad'] * ($row['neart_proprecio']+($row['neart_proprecio'] *($row['imp_valor']/100))))-$descuento, $div_locale, $div_simbolo) ?></td>
                        <td class="td" style="text-align: right"><?= Moneda::moneda(($row['neart_procantidad'] * ($row['neart_proprecio']+($row['neart_proprecio'] *($row['imp_valor']/100))))-$descuento, $div_locale, $div_simbolo) ?></td>
                    <?php else : ?>
                        <td class="td" style="text-align: right"><?= Moneda::moneda($row['neart_proprecio'], $div_locale, $div_simbolo) ?></td>
                        <td class="td" style="text-align: right"><?= Moneda::moneda($row['neart_procantidad'] * $row['neart_proprecio'], $div_locale, $div_simbolo) ?></td>
                        <td class="td" style="text-align: right"><?= Moneda::moneda($row['neart_prototal'], $div_locale, $div_simbolo) ?></td>
                    <?php endif; ?>
                </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
</div>

<p><strong>Observaciones:</strong></p>
<p style="text-align: justify;"><?= strtoupper($observaciones) ?></p>