<style type="text/css">
::-webkit-scrollbar {
    display: none;
}
#dynamic-content-container{background: #fff;}
    .navbar-default.navbar-static-side{display: none !important;}
    #page-wrapper{margin: 0px !important; padding: 0 !important;}
    .row.border-bottom{display: none !important;}
    .footer.fixed{display: none;}
    .ibox-content{padding: 0 !important;}
    body {
    -webkit-print-color-adjust:exact;
    background: #fff;
    }

</style>



<table style="width: 100%; background: #fff;">
    <tr>
        <td><img style="width: 100%; height: 200px;" src="<?= get_branch_image('banner'); ?>"></td>
    </tr>
</table>

<?php
$date = date_create($invoice_data['created_at']);
$date = date_format($date,"Y-m-d h:i:s");
$currency_symbol = array_key_exists($invoice_data['currency'], $currencies) ? $currencies[$invoice_data['currency']]['symbol'] : NULL;

$client_name = array_key_exists($invoice_data['client'], $clients) ? $clients[$invoice_data['client']]['name'] : NULL;
$client_mobile = array_key_exists($invoice_data['client'], $clients) ? $clients[$invoice_data['client']]['mobile'] : NULL;
?>

<table style="width: 100%; margin: 5px 0px; background: #fff;">
    <tr style="margin: 10px 0px;">
        <td style="width: 25%;"><span style="color: #bb0d0d !important; padding: 4px;"><strong style="color: #bb0d0d !important;"><?= strtoupper(print_lang($app_lang,'services_mod_invoice_date')); ?>:</strong></span> <?= display_true_date($date); ?></td>
        <td style="width: 15%;"><span style="color: #bb0d0d !important; padding: 4px;"><strong style="color: #bb0d0d !important;"><?= strtoupper(print_lang($app_lang,'services_mod_invoice_user')); ?>:</strong></span> <?= get_logged_user_data('name'); ?></td>
        <td style="width: 20%;"><span style="color: #bb0d0d !important; padding: 4px;"><strong style="color: #bb0d0d !important;"><?= strtoupper(print_lang($app_lang,'services_mod_invoice_client')); ?>:</strong></span> <?= $client_name; ?></td>
        <td style="width: 22%;"><span style="color: #bb0d0d !important; padding: 4px;"><strong style="color: #bb0d0d !important;"><?= strtoupper(print_lang($app_lang,'services_mod_invoice_mobile')); ?>:</strong></span> <?= $client_mobile; ?></td>
        <td style="width: 18%; background: #bb0d0d !important; color: #fff!important; <?php if($app_direction == 'rtl'){echo 'border-radius: 20px 0px 20px 0px;';}else{echo 'border-radius: 0px 20px 0px 20px !important;';} ?> padding: 8px 0px; text-align: center;"><strong style="font-size: 15px;"><span style="color: #fff !important;"><?= strtoupper(print_lang($app_lang,'services_mod_invoice_invoice')); ?>:</span> <span style="color: #fff !important;"><?= $invoice_data['invoice']; ?></span></strong></td>
    </tr>
</table>

<table style="width: 100%; background: #fff;">
    <!-- Table Heead with red backgorund -->
    <thead>
        <tr style="">
            <th style=" font-size: 20px !important; <?php if($app_direction == 'rtl'){echo 'border-radius: 0px 30px 0px 0px;';}else{echo 'border-radius: 30px 0px 0px 0px;';} ?> background: #bb0d0d !important; color: #fff !important; padding: 5px; text-align: center; width: 5%;"><?= strtoupper(print_lang($app_lang,'services_mod_thead_sr_num')); ?></th>
            
            <th style=" font-size: 20px !important; background: #bb0d0d !important; color: #fff !important; padding: 8px; width: 40%;"><?= strtoupper(print_lang($app_lang,'services_mod_thead_title')); ?></th>
            <th style=" font-size: 20px !important; background: #bb0d0d !important; color: #fff !important; padding: 8px; text-align: center; width: 10%;"><?= strtoupper(print_lang($app_lang,'services_mod_thead_unit')); ?></th>
            <th style=" font-size: 20px !important; background: #bb0d0d !important; color: #fff !important; padding: 8px; text-align: center; width: 10%;"><?= strtoupper(print_lang($app_lang,'services_mod_thead_qty')); ?></th>
            <th style=" font-size: 20px !important; background: #bb0d0d !important; color: #fff !important; padding: 8px; text-align: center; width: 10%;"><?= strtoupper(print_lang($app_lang,'services_mod_thead_rate')); ?></th>
            <th style=" font-size: 20px !important; background: #bb0d0d !important; color: #fff !important; padding: 8px; text-align: center; width: 10%;"><?= strtoupper(print_lang($app_lang,'services_mod_thead_discount')); ?></th>
            <th style=" font-size: 20px !important; <?php if($app_direction == 'rtl'){echo 'border-radius: 0px 0px 0px 30px;';}else{echo 'border-radius: 0px 0px 30px 0px;';} ?>; background: #bb0d0d !important; color: #fff !important; padding: 15px; text-align: center; width: 15%;"><?= strtoupper(print_lang($app_lang,'services_mod_thead_total')); ?></th>
        </tr>
    </thead>
    <tbody>
        <?php
        $item_details = json_decode($invoice_data['details'],true);
        $sic = 1;
        foreach($item_details as $row)
        {
            if ($sic % 2 == 0){ $background_color = '#e8e5e5'; }else{ $background_color = '#f3f3f3'; }
        ?>

            <tr style="border-bottom: 1px dotted black;">
                <td style="padding: 8px; background: <?= $background_color; ?> !important; text-align: center; width: 5%; font-size: 15px;"><strong><?= $sic++; ?></strong></td>
                <td style="padding: 8px; background: <?= $background_color; ?> !important; font-size: 15px;"><strong><?= $row['title']; ?></strong></td>
                <td style="padding: 8px; background: <?= $background_color; ?> !important; text-align: center; font-size: 15px;"><strong><?= $row['unit']; ?></strong></td>
                <td style="padding: 8px; background: <?= $background_color; ?> !important; text-align: center; font-size: 15px;"><strong><?= $row['qty']; ?></strong></td>
                <td style="padding: 8px; background: <?= $background_color; ?> !important; text-align: center; font-size: 15px;"><strong><?= $row['rate']; ?></strong></td>
                <td style="padding: 8px; background: <?= $background_color; ?> !important; text-align: center; font-size: 15px;"><strong><?= $row['discount']; ?></strong></td>
                <td style="padding: 8px; background: <?= $background_color; ?> !important; text-align: center; font-size: 15px;"><strong><?= $row['total']; ?></strong></td>
            </tr>

        <?php } ?>
            <tr>
                <td colspan="4" rowspan="3">
                    <span style="border: 1px dotted; width: 98%; height: 60px; display: block; margin-left: 4px; padding: 10px; background: #f3f3f3 !important; border-radius: 0px 25px 0px 25px;" ><?= $invoice_data['memo']; ?></span><br>
                </td>
                <td colspan="3">
                    <p style="background: #f3f3f3 !important; margin-bottom: 0px; border-bottom: 1px dotted; padding: 5px 10px;"><strong style="margin-left: 5px;"><?= strtoupper(print_lang($app_lang,'services_mod_thead_invoice_total')); ?>: <span <?php if($app_direction == 'rtl'){echo 'style="float: left; margin-right: 5px;"';}else{echo 'style="float: right; margin-right: 5px;"';}?>><?= $currency_symbol; ?> <?= amount_number_format($invoice_data['total']); ?></span></strong></p>
                </td>
            </tr>

            <tr>
                <td colspan="3">
                    <p style="background: #f3f3f3 !important; margin-bottom: 0px; border-bottom: 1px dotted; padding: 5px 10px;"><strong style="margin-left: 5px;"><?= strtoupper(print_lang($app_lang,'services_mod_thead_invoice_discount')); ?>: <span <?php if($app_direction == 'rtl'){echo 'style="float: left; margin-right: 5px;"';}else{echo 'style="float: right; margin-right: 5px;"';}?>><?= $currency_symbol; ?> <?= amount_number_format($invoice_data['discount']); ?></span></strong></p>
                </td>
            </tr>

            <tr>
                <td colspan="3">
                    <p style="background: #f3f3f3 !important; margin-bottom: 0px; border-bottom: 1px dotted; padding: 5px 10px;"><strong style="margin-left: 5px;"><?= strtoupper(print_lang($app_lang,'services_mod_thead_invoice_gross')); ?>: <span <?php if($app_direction == 'rtl'){echo 'style="float: left; margin-right: 5px;"';}else{echo 'style="float: right; margin-right: 5px;"';}?>><?= $currency_symbol; ?> <?= amount_number_format($invoice_data['gross_total']); ?></span></strong></p>
                </td>
            </tr>

            <tr>
                <td colspan="4" rowspan="3">
                    <span style="margin-left: 4px; margin-top: 50px;"><?= strtoupper(print_lang($app_lang,'services_mod_thead_invoice_signature')); ?>_______________________________</span>
                </td>
                <td colspan="3">
                </td>
            </tr>

            <tr>
                <td colspan="3">
                    <p style="background: #f3f3f3 !important; margin-bottom: 0px; border-bottom: 1px dotted; padding: 5px 10px;"><strong style="margin-left: 5px;"><?= strtoupper(print_lang($app_lang,'services_mod_thead_invoice_paid')); ?>: <span <?php if($app_direction == 'rtl'){echo 'style="float: left; margin-right: 5px;"';}else{echo 'style="float: right; margin-right: 5px;"';}?>><?= $currency_symbol; ?> <?= amount_number_format($invoice_data['cash_paid']); ?></span></strong></p>
                </td>
            </tr>
            <tr>
                <td colspan="3">
                    <p style="background: #f3f3f3 !important; margin-bottom: 0px; border-bottom: 1px dotted; padding: 5px 10px;"><strong style="margin-left: 5px;"><?= strtoupper(print_lang($app_lang,'services_mod_thead_invoice_pending')); ?>: <span <?php if($app_direction == 'rtl'){echo 'style="float: left; margin-right: 5px;"';}else{echo 'style="float: right; margin-right: 5px;"';}?>><?= $currency_symbol; ?> <?= amount_number_format($invoice_data['pending_amount']); ?></span></strong></p>
                </td>
            </tr>

            <tr>
                <td colspan="4">
                    <p style=" margin-left: 4px; margin-top: 30px; font-size: 12px;"><?= print_lang($app_lang,'services_mod_thead_invoice_thanks'); ?></p>
                </td>
                <td colspan="3" <?php if($app_direction == 'rtl'){echo 'style="text-align: left;  font-size: 9px; color: #928e8e;"';}else{echo 'style="text-align: right;  font-size: 9px; color: #928e8e;"';}?>>
                    ALPHA SOFTWARE | 0700573290 | Development By En Sudais Noori
                </td>
            </tr>
    </tbody>
</table>



