<div class="table-wrap">
    <div class="table-responsive">
        <table class="table table-sm mb-0">
            <thead>
                <tr>
                    <th><?php echo $this->lang->line('sl_no'); ?></th>
                    <th><?php echo $this->lang->line('invoice_no'); ?></th>
                    <th><?php echo $this->lang->line('date'); ?></th>
                    <th><?php echo $this->lang->line('medicine'); ?></th>
                    <th><?php echo $this->lang->line('manufacturer'); ?></th>
                    <th><?php echo $this->lang->line('batch_no'); ?></th>
                    <th><?php echo $this->lang->line('expire'); ?></th>
                    <th><?php echo $this->lang->line('quantity'); ?></th>
                    <th><?php echo $this->lang->line('purchase'); ?> <?php echo $this->lang->line('price'); ?></th>
                    <th><?php echo $this->lang->line('total'); ?></th>
                </tr>
            </thead>
            <tbody>
                <?php if (isset($purchases) && !empty($purchases)) { ?>
                    <?php foreach ($purchases as $obj) { ?>
                        <tr>
                            <td><?php echo $sl_count; ?></td>
                            <td><?php echo $obj->custom_invoice_id; ?></td>
                            <td><?php echo date('d M, Y h:ia', strtotime($obj->purchase_date)); ?></td>
                            <td>
                                <a target="_blank" href="<?php echo site_url('reagent/purchase/invoice/' . $obj->invoice_id); ?>"><?php echo $obj->medicine_name; ?></a>
                            </td>
                            <td><?php echo $obj->manufacturer; ?></td>
                            <td><?php echo $obj->batch_no; ?></td>
                            <td><?php echo date('d M, Y', strtotime($obj->expiry_date)); ?></td>
                            <td><?php echo $obj->quantity; ?></td>
                            <td><?php echo $obj->purchase; ?></td>
                            <td><?php echo $obj->total; ?></td>
                        </tr>
                        <?php $sl_count++; ?>
                    <?php } ?>
                <?php } else { ?>
                    <tr>
                        <td colspan="10"><?php echo $this->lang->line('no_data_found'); ?></td>
                    </tr>
                <?php } ?>
            </tbody>
        </table>
    </div>
</div>

<!-- Card Footer -->
<?php if ($this->pagination->create_links()) { ?>
    <div class="card-footer justify-content-end">
        <?php echo $this->pagination->create_links(); ?>
    </div>
<?php } ?>