<style type="text/css">
#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;}
    th,td{color: #000 !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;
$account_name = array_key_exists($invoice_data['account'], $accounts) ? $accounts[$invoice_data['account']]['name'] : NULL;

?>
<h3 class="text-center" style="text-decoration: underline; font-weight: 800; font-size: 20px; color: #000 !important; margin: 20px auto;"><?= print_lang($app_lang,'mod_db_cr_nt_inv_'.$invoice_data["type"]); ?>&nbsp;#&nbsp;<?= $invoice_data['invoice']; ?></h3>
<table style="width: 100%; margin: 10px 0px; background: #fff;">
    <tr style="margin: 10px 0px;">
        <td style="width: 50%;"><span style="color: #bb0d0d !important; padding: 4px;"><strong style="color: #bb0d0d !important;"><?= print_lang($app_lang,'mod_db_cr_nt_inv_date'); ?>:</strong></span> <strong> <?= date("d-m-Y h:i:s a");?>  <?= get_persian_date(date('Y-m-d')).' '.date('h:i:s a'); ?></strong></td>
        <td <?php if($app_direction == 'rtl'){echo 'style="text-align: right; width: 50%;"';}else{echo 'style="text-align: right; width: 50%;"';}?>><span style="color: #bb0d0d !important; padding: 4px;"><strong style="color: #bb0d0d !important;"><?= print_lang($app_lang,'mod_db_cr_nt_inv_user'); ?>:</strong></span> <strong><?= get_logged_user_data('name'); ?></strong></td>
        <?php if($invoice_data['type'] == 'debit'){$_type = '(Dr)';}else{$_type = '(Cr)';}?>
    </tr>
</table>

<table class="table table-striped" style="width: 100%; margin: 0; background: #fff;">
    <thead>
        <tr style="border-top: 2px solid black !important; border-bottom: 2px solid black !important;">
            <th style="background: #efefef !important;"><?= ucfirst(print_lang($app_lang,'mod_db_cr_nt_inv_thead_sr')); ?></th>
            <th style="background: #efefef !important;"><?= ucfirst(print_lang($app_lang,'mod_db_cr_nt_inv_thead_group')); ?></th>
            <th style="background: #efefef !important;"><?= ucfirst(print_lang($app_lang,'mod_db_cr_nt_inv_thead_narration')); ?></th>
            <th style="background: #efefef !important;"><?= ucfirst(print_lang($app_lang,'mod_db_cr_nt_inv_thead_amount')); ?></th>
        </tr>
    </thead>
    <tbody>
        <?php
        $total = array();
        $i = 1;
        $account = fetch_table_where('accounts','uid',$invoice_data['account'],true);
            
        ?>
            <tr>
                <td><?= $i++; ?></td>
                <td><?= ucfirst($account['name']); ?></td>
                <td><?= ucfirst($invoice_data['details']); ?></td>
                <td><strong><?= $currency_symbol.' '.amount_number_format($invoice_data['amount']).' '.$_type; $total[] = $invoice_data['amount']; ?></strong></td>
            </tr>
            <tr>
                <td></td>
                <td style="font-size: 16px;"><strong><?= ucfirst(print_lang($app_lang,'total')); ?></strong></td>
                <td></td>
                <td style="font-size: 16px;"><strong><?= $currency_symbol.' '.amount_number_format(array_sum($total)).' '.$_type; ?></strong></td>
            </tr>
    </tbody>
</table>
