
<div class="col-lg-6">
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>DUE INVOICES</h5> 
        </div>
        <div class="ibox-content">
            <table class="table">
                <thead>
                    <tr>
                        <th>Invoice Date</th>
                        <th>Due Date</th>
                        <th>Invoice#</th>
                        <th>Amount</th>
                        <th>Pay</th>
                    </tr>
                </thead>
                <tbody>
                    <?php if (count($invoice_list) > count($paid_invoices)) {?>
                        <?php foreach ($invoice_list as $key => $value) {
                            if(!in_array($value->sale_invoice_id, $paid_invoices)){ ?>
                        <tr class="payInvoice inv_<?php echo $value->invoice_no;?>" data-invoice_no="<?php echo $value->invoice_no;?>" data-inv_id="<?php echo $value->sale_invoice_id;?>" data-amount="<?php echo $value->total;?>">
                            <td><?php echo date('d/m/Y',strtotime(str_replace('-', '/', $value->invoice_date)));?></td>
                            <td><?php echo date('d/m/Y',strtotime(str_replace('-', '/', $value->due_date)));?></td>
                            <td><?php echo $value->invoice_no;?></td>
                            <td><?php echo number_format((float)$value->total, 2, '.', '');?></td>
                            <td><input type="checkbox" name="bill-pay" class="pay-bill-select"></td>
                        </tr>
                        <?php }
                        }?>
                    <?php } else {?>
                        <tr>
                            <td colspan="4">No Due Bills</td>
                        </tr>
                    <?php }?>
                </tbody>
            </table>
        </div>
    </div>
</div>


<div class="col-lg-6">
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>PAID INVOICES</h5> 
        </div>
        <div class="ibox-content">
            <table class="table">
                <thead>
                    <tr>
                        <th>Invoice Date</th>
                        <th>Due Date</th>
                        <th>Invoice#</th>
                        <th>Amount</th>
                    </tr>
                </thead>
                <tbody>
                    <?php if (count($paid_invoices) > 0) {?>
                        <?php foreach ($invoice_list as $key => $value) {
                            if(in_array($value->sale_invoice_id, $paid_invoices)){ ?>
                            <tr>
                                <td><?php echo date('d/m/Y',strtotime(str_replace('-', '/', $value->invoice_date)));?></td>
                                <td><?php echo date('d/m/Y',strtotime(str_replace('-', '/', $value->due_date)));?></td>
                                <td><?php echo $value->invoice_no;?></td>
                                <td><?php echo number_format((float)$value->total, 2, '.', '');?></td>
                            </tr>
                        <?php }
                        }?>
                    <?php } else {?>
                        <tr>
                            <td colspan="4">No Due Bills</td>
                        </tr>
                    <?php }?>
                </tbody>
            </table>
        </div>
    </div>
</div> 
