<?php
if( empty( $file_name ) ) $file_name = date('YmdHis').'.xls';

/*
 * Set Header
 */
header("Content-type: application/ms-excel");
header("Content-Disposition: attachment; filename=".$file_name);
header("Pragma: no-cache");
header("Expires: 0");
?>
<table border='1' width="70%">
        <tr>
            <th>S.No</th>
            <th>Receipt No</th>
            <th>Type</th>
            <th>Booked Date</th>
            <th>Name</th>
            <th>Tamil Name</th>
            <th>Contact No</th>
            <th>Email</th>
            <th>Address</th>
            <th>Desc</th>
            <th>Amount</th>
        </tr>
    
        <?php if(count($results) > 0) {  $total_amt = 0;?>
            <?php foreach($results as $key=>$value) {
                    $total_amt += $value->amount;
                ?>
                <tr>
                    <td class="align-center"><?php echo ++$key;?></td>
                    <td><?php echo (($general->prefix == 1) ? $value->prefix : '') . $value->receipt_no;?></td>
                    <td><?php echo text($value->service_name);?></td>
                    <td><?php echo date('d-m-Y',strtotime($value->created_on));?></td>
                    <td><?php echo text($value->name);?></td>
                    <td><?php echo (!empty($value->tamil_name)) ? '<span class="lang-tamil">' . $value->tamil_name . '</span>' : 'N/A';?></td>
                    <td><?php echo text($value->contact_no);?></td>
                    <td><?php echo text($value->email);?></td>
                    <td width="15%"><?php echo text(nl2br($value->address));?></td>
                    <td width="15%"><?php echo text(nl2br($value->desc));?></td>
                    <td class="align-right"><?php echo $value->amount;?></td>
                </tr>
            <?php } ?>
        <?php } ?>
</table>
