<?php
$ti=time();
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=member_subscription_report".$ti.".xls");
header("Pragma: no-cache");
header("Expires: 0");
?>
<table class="table table-bordered table-striped filterTable" id="filterTable">
        <tr>
            <th width="5%" class="align-center">S.No</th>
            <th class="align-center">Receipt No</th>
            <th class="align-center">Type</th>
            <th class="align-center">Date of Joined</th>
            <th class="align-center">Member No</th>
            <th class="align-center">Name</th>
            <th class="align-center">Tamil Name</th>
            <th class="align-center">DOB</th>
            <th class="align-center">Sex</th>
            <th class="align-center">Maritial Status</th>
            <th class="align-center">Contact No</th>
            <th class="align-center">Email</th>
            <th class="align-center">Address</th>
            <th class="align-center">Postal Code</th>
            <th width="15%" class="align-center">Desc</th>
            <th class="align-center">Entry Fee Amount</th>
            <th class="align-center">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->date_of_join));?></td>
                <td><?php echo text($value->member_no);?></td>
                <td><?php echo text($value->member_name);?></td>
                <td><?php echo (!empty($value->tamil_name)) ? '<span class="lang-tamil">' . $value->tamil_name . '</span>': 'N/A';?></td>
                <td><?php echo date('d-m-Y',strtotime($value->dob));?></td>
                <td><?php echo ($value->sex == 1) ? 'Male' : 'Female';?></td>
                <td><?php if($value->maritial_status == 1) { echo 'Single'; } elseif($value->maritial_status == 2) { echo 'Married';}?></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><?php echo text($value->postal_code);?></td>
                <td width="15%"><?php echo text(nl2br($value->desc));?></td>
                <td class="align-right"><?php echo $value->entry_fee_amount;?></td>
                <td class="align-right"><?php echo $value->amount;?></td>
            </tr>
        <?php } ?>
    <?php } ?>
    
    <?php if(!empty($total_amt)) {?>
    <tr>
        <td colspan="16" align="right"><b>Total</b></td>
        <td align="right"><b><?php echo number_format($total_amt,2,'.','');?></b></td>
    </tr>
    <?php } ?>
</table>