<title>IDUMSM Tool - Incentive Voucher</title>
<?php
	ini_set('display_errors', 0);
?>
<script type="text/javascript" src="includes/js/jquery-1.7.1.min.js"></script>
<script language="javascript">
	function print_box()
	{
		$("#print_box").hide();
        $("#prnt_copy").html($(".table").html());
		if(window.print())
		{
			window.self.close();
		}
		else
		{
			$("#print_box").show();
		}
		$("#prnt_copy").html("");
	}
</script>
<style>
    table .question_title{
        float: none;
    }
    table .question{
        float: none;
        width: 0px;
    }
    .table {
        font-size: 11px;
        border-right: 1px solid #AAAAAA;
        border-bottom: 1px solid #AAAAAA;
		line-height: 20px;
    }
    .table th, .table td {
        border-left: 1px solid #AAAAAA;
        border-top: 1px solid #AAAAAA;
    }
</style>
<table border="0" cellpadding="0" cellspacing="0" width="90%" align="center" class="table">
    <tr>
        <th>
            <img src="includes/images/logo.jpg" style="height: 75px; padding-top: 5px;" />
        </th>
        <th>
            <span style="font-size: 15px;">Y.R.Gaitonde Centre for AIDS Research and Education </span><br/>
            <span style="font-weight: normal;">VHS Campus, Rajiv Gandhi Road, Taramani, Chennai 600113 India.</span>
        </th>
    </tr>
    <tr>
        <th colspan="2" style="font-size: 14px;"><strong><?php echo $rec[0]['sur_title']; ?></strong></th>
    </tr>
    <tr>
        <th colspan="2" style="font-size: 12px;"><strong>Incentive Voucher</strong></th>
    </tr>
    <tr>
        <td colspan="2">
            <table border="0" cellpadding="0" cellspacing="0" width="100%" align="center" style="margin-top: -1px; margin-left: -1px; border: 0px;">
                <tr>
                    <td width="15%" style="border: 0px; padding-left: 3px;"><strong>Particpant ID</strong></td>
                    <td width="15%" style="border: 0px;">
                        <?php echo $_REQUEST['id']; ?>
                        <input type="hidden" name="partcpnt_id" id="partcpnt_id" value="<?php echo $_REQUEST['id']; ?>" />
                    </td>
                    <td width="40%" style="border: 0px;">&nbsp;</td>
                    <td width="15%" style="border: 0px;"><strong>Voucher No</strong></td>
                    <td width="15%" style="border: 0px;"><?php echo $vchr_no; ?></td>
                </tr>
                <tr>
                    <td style="border: 0px;" colspan="3"></td>
                    <td style="border: 0px;"><strong>Voucher Date</strong></td>
                    <td style="border: 0px;">
                        <?php 
                            $vchr_dt = substr($vchr_dt, 0, 10);
                            echo $common->date_format($vchr_dt, DT_FMT, true);
                        ?>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td colspan="2" style="border: 0px;">
            <table border="0" cellpadding="0" cellspacing="0" width="100%" align="center" style="border: 0px;">
                <tr>
                    <th width="10%" style="font-size: 13px;">S. No</th>
                    <th width="45%" style="font-size: 13px;">Incentives</th>                   
                    <th width="30%" style="font-size: 13px;">Rate</th>
                    <th width="15%" style="font-size: 13px;">Amount</th>
                </tr>
                <?php
                    $ids = '';
					$incamt='';
					$tot=0;
					$j = 0;
                    for($i=0; $i<count($rec); $i++)
					{
						
						if($incentive_id == $rec[$i]['incentive_vchr_no'])
						{
							$ids .= $rec[$i]['coupn_participant_id'].', ';
							$incamt .= $rec[$i]['incentive_amt'].', ';	
                            $tot= $tot + $rec[$i]['incentive_amt'];						
							$j++;
						}						
					}
                    $ids = substr($ids, 0, -2);
                    $txt = 'Incentive for Coupon(s) ('.$ids.')';
                    // $inc_amt = number_format(incamt, 2, '.', ',');
					$inc_amt=substr($incamt, 0, -2);
                    $amt = $tot;
                ?>
                <tr>
                    <td style="text-align: center;"><?php echo "1"; ?></td>
                    <td style="padding-left: 3px;"><?php echo $txt; ?></td>              
                    <td style="text-align: center; padding-right: 3px;"><?php echo $inc_amt; ?></td>
                    <td style="text-align: center; padding-right: 3px;">
                        <?php echo number_format($amt, 2, '.', ','); ?>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td colspan="2" style="border: 0px;">
            <table border="0" cellpadding="0" cellspacing="0" width="100%" align="center" class="table" style="border: 0px;">
                <tr>
                    <td width="55%" style="padding-left: 3px; vertical-align: top; height: 50px;">
                        <strong>Amount in Words: </strong>
                        <?php echo number_to_words($amt).' Only'; ?>
                    </td>
                    <th width="30%" style="font-size: 13px;"><strong>Total</strong></th>
                    <td width="15%" style="font-size: 13px; text-align: center; padding-right: 3px;">
                        <strong><?php echo number_format($amt, 2, '.', ','); ?></strong>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <table border="0" cellpadding="0" cellspacing="0" width="100%" align="center" style="margin-top: -1px; margin-left: -1px; border: 0px;">
                <tr>
                    <td colspan="5" style="height: 50px;">&nbsp;</td>
                </tr>
                <tr>
                    <td width="15%" style="border: 0px; padding-left: 3px;"><strong>Received By</strong></td>
                    <td width="15%" style="border: 0px;">&nbsp;</td>
                    <td width="30%" style="border: 0px;">&nbsp;</td>
                    <td width="20%" style="border: 0px;"><strong>Authorised Signatory</strong></td>
                    <td width="15%" style="border: 0px;">&nbsp;</td>
                </tr>
                <tr>
                    <td style="border: 0px; padding-left: 3px;"><strong>Received Date</strong></td>
                    <td style="border: 0px;" colspan="2"></td>
                    <td style="border: 0px;"><strong>Issued Date</strong></td>
                    <td style="border: 0px;"><?php echo str_replace("%", "", date(DT_FRMT)); ?></td>
                </tr>
            </table>
        </td>
    </tr>
    <tr id="print_box">
        <th colspan="2" style="height: 50px;">
            <input type="button" name="print" value="Print" onclick="return print_box();" />
            &nbsp;&nbsp;&nbsp;
            <input type="button" name="close" value="Close" onclick="Javascript: window.self.close();" />
        </th>
    </tr>
</table>
<br/><br/><br/><br/><br/><br/>
<table border="0" cellpadding="0" cellspacing="0" width="90%" align="center" class="table" id="prnt_copy"></table>
<?php
        exit;
	ini_set('display_errors', 0);
?>
<script type="text/javascript" src="includes/js/jquery-1.7.1.min.js"></script>
<script language="javascript">
	function print_box()
	{
		$("#print_box").hide();
		if(window.print())
		{
			window.self.close();
		}
		else
		{
			$("#print_box").show();
		}
	}
</script>
<div style="width: 95%; margin: 0 auto; padding: 10px;">
	<div id="frm_display">
        <div id="tabs">
            <form class="form" name="survey" id="survey" method="post" action="<?php echo $action; ?>" onsubmit="return frm_validation();">
            	<table border="0" cellpadding="0" cellspacing="0" width="100%">
					<tr>
						<th colspan="2">Reimbursement Details</th>
					</tr>
                	<tr>
                    	<td><strong>Particpant ID</strong></td>
                        <td>
                        	<?php echo $_REQUEST['id']; ?>
                            <input type="hidden" name="partcpnt_id" id="partcpnt_id" value="<?php echo $_REQUEST['id']; ?>" />
                        </td>
                    </tr>
                	<tr>
                    	<td><strong>Survey</strong></td>
                        <td>
                        	<?php echo $rec[0]['sur_title']; ?>
                            <input type="hidden" name="survey_id" id="survey_id" value="<?php echo $_REQUEST['sur_id']; ?>" />
                        </td>
                    </tr>
                    <tr>
                    	<td colspan="2">
                        	<table border="0" cellpadding="0" cellspacing="0" width="100%">
                            	<tr>
                                	<td><strong>Coupon Code</strong></td>
                                	<td><strong>Amount</strong></td>
                                	<td><strong>Date</strong></td>
                                	<!--<td><strong>Status</strong></td>-->
                                	<td><strong>Issue</strong></td>
                                	<td><strong>Paid</strong></td>
                                </tr>
                                <?php
                                        $amt = 0;
                                        for($i=0; $i<count($rec); $i++)
                                        {
                                                if($rec[$i]['incentive_sts'] == 1)
                                                        $sts = "Registration Pending";
                                                if($rec[$i]['incentive_sts'] == 2)
                                                        $sts = "Survey Pending";
                                                if($rec[$i]['incentive_sts'] == 3)
                                                        $sts = "Lab Samples Pending";
                                                if($rec[$i]['incentive_sts'] == 4)
                                                        $sts = "Qualified";

                                                if($rec[$i]['incentive_issue'] == 1)
                                                        $iss = "Issued";
                                                else
                                                        $iss = "NA";

                                                if($rec[$i]['incentive_paid'] == 1)
                                                        $pd = "Y";
                                                else
                                                        $pd = "NA";
                                                $amt += $rec[$i]['incentive_amt'];

                                                ?>
                                        <tr>
                                        	<td><?php echo $rec[$i]['coupn_participant_id']; ?></td>
                                        	<td><?php echo $rec[$i]['incentive_amt']; ?></td>
                                        	<!--<td><?php //echo $sts; ?></td>-->
                                        	<td><?php echo str_replace('%', '', date(DT_FRMT)); ?></td>
                                        	<td><?php echo $iss; ?></td>
                                        	<td><?php echo $pd; ?></td>
                                        </tr>
                                        <?php
                                                }
                                ?>
                                <tr>
                                        <td colspan="5">&nbsp;</td>
                                </tr>
                            	<tr>
                                	<td><strong>Total</strong></td>
                                	<td><strong><?php echo $amt; ?></strong></td>
                                	<td><strong>&nbsp;</strong></td>
                                        <td><strong>&nbsp;</strong></td>
                                        <td><strong>&nbsp;</strong></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                    	<th colspan="2">&nbsp;</th>
                    </tr>
                    <tr>
                    	<td colspan="2">
                        	<table border="0" cellpadding="0" cellspacing="0" width="100%">
                            	<tr>
                                	<td><strong>Received By</strong></td>
                                	<td><strong>Issuing Authority</strong></td>
                                </tr>
                            	<tr>
                                	<td><strong>Date</strong></td>
                                	<td><strong>Date</strong></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                    	<th colspan="2">&nbsp;</th>
                    </tr>
                    <tr id="print_box">
                    	<th colspan="2">
                        <input type="button" name="print" value="Print" onclick="return print_box();" />
                        &nbsp;&nbsp;&nbsp;
                        <input type="button" name="close" value="Close" onclick="Javascript: window.self.close();" />
                        </th>
                    </tr>
                </table>
            </form>
		</div>
	</div>
</div>