<?php 

@session_start();


	if($_REQUEST['id'] !=''){

	}else{
		die;
	}
?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=11" >
<link rel="stylesheet" type="text/css" href="<?php echo SITEURL?>/css/style.css">
	
</head>

<body style="background-color:#9BDC74">
	<div class="container">
		<div class="row inline">
			<div class="navstyle">
				
 <input id="hideAdminID" name="hideAdminID" type="hidden" value="<?php echo $_REQUEST['id']?>">
                        <input id="hideDrawTime" name="hideDrawTime" type="hidden" value="<?php echo drawTime();?>">
				
			</div>
			<div class="menus">
			<ul>
				 <?php echo innerAdminMenu()?>
			</ul>
		</div>

		</div>


		<p><?php echo date('d-M-Y')?> To <?php echo date('d-M-Y')?></p>	
        
        <table border="1px" cellpadding="1px" cellspacing="1" width="98%" style="font-size:20px; background-color:#fff;">
        <tr>
        	<td>Sr. No.</td>
            <td>Name</td>
            <td>Time</td>
            <td>Print</td>
            <td>Barcode</td>
            <td>Win.No.</td>
            <td>Win</td>
            <td>Date</td>
            
        </tr>
        <?php
        
			$sql = 'SELECT * FROM '.$DB->pre.'users WHERE   userType="2" AND underHead="'.$_REQUEST['id'].'"';
			$D = $DB->dbRows($sql);

			$sr = 0;
			foreach($D as $D){
						 $sqlS = 'SELECT name,id,winrate FROM '.$DB->pre.'users WHERE underHead="'.$D['id'].'" AND userType="3"';
						$S = $DB->dbRows($sqlS);		
						foreach($S as $S){
							$sqlW = 'SELECT * FROM '.$DB->pre.'result_win WHERE lotdate="'.date('Y-m-d').'" AND lotTime="'.$_REQUEST['lotTime'].'" AND uID="'.$S['id'].'"';
							$W = $DB->dbRows($sqlW);
							foreach($W as $W){
							$sr++;
							$sqlB = 'SELECT printTime,lotdate FROM '.$DB->pre.'lottary WHERE barcode="'.$W['barcode'].'"';
							$B = $DB->dbRow($sqlB);
				?>
                <tr>
		        	<td><?php echo $sr; ?> </td>
            <td><?php echo $S['name']?></td>
            <td><?php echo $_REQUEST['lotTime']?></td>
            <td><?php echo $B['printTime']?></td>
            <td><?php echo $W['barcode']?></td>
            <td><?php echo $W['cellID'];?>[<?php echo $W['point'] ?>]</td>
            <td><?php echo ($W['point']*$S['winrate']) ?></td>
            <td><?php echo $B['lotdate'] ?></td>
        </tr>
                <?php
							}
						}
			}
			
		
		?>
        </table>
			

	</div>

</body>
</html>
