<style>
    body {
        font-family: sans-serif;
        font-size: 14px;
    }

    table.items {
        border: 0.1mm solid #000000;
    }

    td {
        vertical-align: top;
    }

    table thead td {
        background-color: #e1e1e1;
        text-align: center;
        border: 0.1mm solid #000000;
        text-transform: uppercase;
    }

    .items tbody td {
        border: 0.1mm solid #000000;
    }
</style>

<!-- <htmlpageheader name="myheader"> -->
<table width="100%">
    <tr>
        <td width="50%">
            <div style="font-weight: bold; font-size: 22px;"><?= $entInfo['ent_name']; ?></div>
            <div><?= $posInfo['pos_address']; ?></div>
            <div><?= $posInfo['pos_city']; ?></div>
            <div><?= $entInfo['ent_document']; ?>: <?= $entInfo['ent_document_number']; ?></div>
            <div style="font-family:dejavusanscondensed;">&#9742; <?= $posInfo['pos_phone']; ?></div>
        </td>

        <td width="50%" style="text-align: right;">
            <div><?= $currentDateTimeByZone; ?></div>
            <div><?= $posTranslate['branch'] ?>: <?= $posInfo['pos_name']; ?></div>
            <div><?= $posTranslate['from_date'] ?>: <?= $start_date_format; ?></div>
            <div><?= $posTranslate['to_date'] ?>: <?= $end_date_format; ?></div>
        </td>
    </tr>
</table>
<!-- </htmlpageheader> -->

<!-- <sethtmlpageheader name="myheader" value="on" show-this-page="1" /> -->
<sethtmlpagefooter name="myfooter" value="on" />


<div style="text-align: right;">&nbsp;</div>

<table width="100%" style="font-size: 16px; border-collapse: collapse;">
    <tr>
        <td width="100%" style="text-align: center; font-weight: bold;">
            <div><?= strtoupper($posTranslate['sold_products_report']); ?></div>
        </td>
    </tr>
</table>

<br />

<?php

$grandTotal = 0;

if ($productsDetails['status'] == "success") {
?>

    <table class="items" width="100%" style="font-size: 12px; border-collapse: collapse;" cellpadding="8">
        <thead>
            <tr>
                <td width="25%" style="font-weight: bold; text-align: left;"><?= strtoupper($posTranslate['date']) ?></td>
                <td width="25%" style="font-weight: bold; text-align: left;"><?= strtoupper($posTranslate['product']) ?></td>
                <td width="25%" style="font-weight: bold; text-align: left;"><?= mb_strtoupper($posTranslate['sold']) ?></td>
                <td width="25%" style="font-weight: bold; text-align: left;"><?= mb_strtoupper($posTranslate['current_stock']) ?></td>
            </tr>
        </thead>
        <tbody>

            <!-- LOOP ITEMS HERE -->

            <?php

            foreach ($productsDetails['data'] as $key => $value) {

                $grandTotal += $value['product_quantity'];
            ?>

                <tr>
                    <td style="font-size: 13px;"><?= $value['sale_det_sale_date']; ?></td>
                    <td style="font-size: 13px;"><?= $value['pro_description']; ?></td>
                    <td style="font-size: 13px;"><?= number_format($value['product_quantity'], 2, '.', ','); ?></td>
                    <td style="font-size: 13px;"><?= $value['stock_actual']; ?></td>
                </tr>

            <?php } ?>

            <!-- END LOOP ITEMS HERE -->

        </tbody>
    </table>

    <div style="margin-bottom: 30px"></div>

    <table width="100%" style="text-align: right; border-collapse: collapse;" cellpadding="8">
        <tbody>
            <tr>
                <td style="font-weight: bold; font-size: 14px; text-transform: uppercase;" height="20%" width="76%"><?= mb_strtoupper($posTranslate['total_sold']) ?> &nbsp;</td>
                <td style="font-weight: bold; font-size: 14px; border: 1px solid #000000;" height="20%" width="24%"><?= number_format($grandTotal, 2); ?></td>
            </tr>
        </tbody>
    </table>

<?php } else if ($productsDetails['status'] == "warning") { ?>
    <div><?= strtoupper($posTranslate['we_are_sorry_there_is_no_data_to_display']); ?></div>
<?php } else { ?>
    <div><?= strtoupper($posTranslate['data_could_not_be_loaded_please_contact_the_system_vendor_for_technical_assistance']); ?></div>
<?php } ?>

<htmlpagefooter name="myfooter">
    <div style="border-top: 1px solid #000000; font-size: 9pt; text-align: center; padding-top: 3mm; ">
        Page {PAGENO} of {nb}
    </div>
</htmlpagefooter>