<?php
$ti=time();
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=prasadam_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">Function Date</th>
            <th class="align-center">Booked Date</th>
            <th class="align-center">Period</th>
            <th class="align-center">Name 1</th>
            <th class="align-center">Tamil Name 1</th>
            <th class="align-center">Star 1</th>
            <th class="align-center">Name 2</th>
            <th class="align-center">Tamil Name 2</th>
            <th class="align-center">Star 2</th>
            <th class="align-center">Contact No</th>
            <th class="align-center">Email</th>
            <th width="15%" class="align-center">Particulars</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->bp_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->bp_rec_no;?></td>
                    <td><?php echo text($value->service_name);?></td>
                    <td><?php echo text(date('d-m-Y',strtotime($value->bp_fn_date)));?></td>
                    <td><?php echo text(date('d-m-Y',strtotime($value->created_on)));?></td>
                    <td><?php echo text($value->period_str);?></td>
                    <td><?php echo text($value->bp_dev_name_1);?></td>
                    <td><?php echo (!empty($value->bp_tamil_name_1)) ? '<span class="lang-tamil">' . $value->bp_tamil_name_1 . '</span>' : 'N/A';?></td>
                    <td><?php echo text($value->star);?></td>
                    <td><?php echo text($value->bp_dev_name_2);?></td>
                    <td><?php echo (!empty($value->bp_tamil_name_2)) ? '<span class="lang-tamil">' . $value->bp_tamil_name_2 . '</span>' : 'N/A';?></td>
                    <td><?php echo text($value->star2);?></td>
                    <td><?php echo text($value->bp_contact_no);?></td>
                    <td><?php echo text($value->bp_email);?></td>
                    <td width="15%"><?php echo text(nl2br($value->bp_desc));?></td>
                    <td class="align-right"><?php echo $value->bp_amount;?></td>
                </tr>
            <?php } ?>
        <?php } ?>

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