<?php
$ti=time();
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=other_service_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">Period</th>
            <th class="align-center">Time</th>
            <th class="align-center">Date</th>
            <th class="align-center">Booked Date</th>
            <th class="align-center">Name</th>
            <th class="align-center">Tamil Name</th>
            <th class="align-center">Star</th>
            <th class="align-center">Contact No</th>
            <th class="align-center">Email</th>
            <th width="15%" class="align-center">Desc</th>
            <th width="15%" class="align-center">Address</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;
                    $tooltip = ($value->status == 2) ? $value->del_reason : '';
                ?>
                <tr data-toggle="tooltip" title="<?php echo $tooltip;?>">
                    <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 ($value->period == 1) ? 'Morning' : 'Evening';?></td>
                    <td><?php echo text(date('H:i',strtotime($value->from_time)) . ' - ' . date('H:i',strtotime($value->to_time)));?></td>
                    <td><?php echo ($value->date != '') ? date('d-m-Y',strtotime($value->date)) : '-';?></td>
                    <td><?php echo date('d-m-Y',strtotime($value->created_on));?></td>
                    <td><?php echo text($value->devotee_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->star);?></td>
                    <td><?php echo text($value->contact_no);?></td>
                    <td><?php echo text($value->email);?></td>
                    <td width="15%"><?php echo text(nl2br($value->desc));?></td>
                    <td width="15%"><?php echo text(nl2br($value->address));?></td>
                    <td class="align-right"><?php echo $value->amount;?></td>
                </tr>
            <?php } ?>
        <?php } ?>

		<?php if(!empty($total_amt)) { ?>
            <tr>
                <td colspan="14" align="right"><b>Total</b></td>
                <td align="right"><b><?php echo number_format($total_amt,2,'.','');?></b></td>
            </tr>
        <?php } ?>
</table>