<?php 	include_once('../../config.php');   	
	//	include_once(ABS_PATH.'/admin/login_check.php');    
		require(ABS_PATH.'/admin/App/fpdf/fpdf.php');
		
       
        {
            class PDF extends FPDF
            {
                // Page header
                function Header()
                {
                    $this->SetFont('Arial','B',13);
                    // Move to the right
                   // $this->Cell(50);
                    // Title
                    
                    
                    $this->Cell(130,10,'Payment Receipt',3,1,'C');
                    // Line break
                    $this->Ln(10);
                }
            }
        	$pdf = new PDF();
        	
        	//$pdf = new FPDF();	
        	$pdf->AddPage();
        	$pdf->SetFont('Arial','',10);
        
            
            
            
            $pdf->Cell(75,10,'Payment Type', 1,0);
            $pdf->Cell(75,10,'XXXX', 1,1);
        
            
            $pdf->Cell(75,10,'Bank', 1,0);
            $pdf->Cell(75,10,'XXXX', 1,1);
         
            $pdf->Cell(75,10,'Receiver', 1,0);
            $pdf->Cell(75,10,'XXXX', 1,1);
            
            
            $pdf->Cell(75,10,'By UserId', 1,0);
            $pdf->Cell(75,10,'XXXX', 1,1);
            
            $pdf->Cell(75,10,'By Name', 1,0);
            $pdf->Cell(75,10,'XXXX', 1,1);
            
            $pdf->Cell(75,10,'Deduction', 1,0);
            $pdf->Cell(75,10,'XXXX', 1,1);
            
            $pdf->Cell(75,10,'Amount Paid', 1,0);
            $pdf->Cell(75,10,'XXXX', 1,1);
            
            $pdf->Cell(75,10,'UTR', 1,0);
            $pdf->Cell(75,10,'XXXX', 1,1);
            
            $pdf->Cell(75,10,'Satus', 1,0);
            $pdf->Cell(75,10,'XXXX', 1,1);
            
             $pdf->Cell(75,10,'Date', 1,0);
            $pdf->Cell(75,10,'XXXX', 1,1);
            
            

        	$pdf->Ln();
            $pdf->Output();
            
        }   
        
        
        die;
?>  
<?php  include ABS_PATH.'/admin/header.php';	?>  

<script>
function del_record(val)
{

	var r = confirm("Do you really want to delete record !");
	if (r == true) {    
	$.ajax({
	type: 'POST',
	url: "../ajax/default.php",
	//async: false,			 
	data: {del_city_names:1,val:val},	  
	success: function(ajaxresult){	     
		location.reload();	 	
	},
	error: function(XMLHttpRequest, textStatus, errorThrown) { 
	alert('Error');
	}
	});
	
	}	
	
}

function myFunction() 
{
  window.print();
}
function goback()
{
    window.location.href = "<?php echo ROOTPATH?>/admin/Bidding/download_pdf.php?id="+<?php echo $_REQUEST['id']; ?>;   
}
</script>

<?php 
            $Rec = mysql_query("select name from   Bazzar where id=$_REQUEST[id] ");   
            $Rec_detail  = mysql_fetch_object($Rec);	
            $datepicker = date("d-M-Y");
?>
		 
		<div class="col-md-10">  
  			<div class="content-box-large">
  				<div class="panel-heading">
					<div class="panel-title"><h3><?php echo $Rec_detail->name." (".$datepicker.")"; ?>  </h3></div>
					
					<div align="right">
					    <!--a class="btn btn-warning">Download PDF</a-->
					    <form method="post">
                            <input type="button" name="submit" value="Download PDF"  class="btn btn-warning" onclick="goback()"/><!-- onclick="myFunction()"   -->
                            <input type="hidden" name="req_id" value="<?php echo $_REQUEST['id'];?>" />
                    	   
                	    </form>
					</div>
					<!--div align="right">  <input type="button"    class="btn btn-warning" name="btnback" id="btnback" value=" Add New User " onClick="javascript:location.href='add_new.php';" />
					</div-->
					
				</div>
				
  				<div class="panel-body">
					<?php
					// Open Single start
					    $datepicker = date("d-M-Y");
					    
						$result = mysql_query("select * from  biddings where bazarId=$_REQUEST[id] and gametype=1 and optionType=1 and adminDate='$datepicker'");
						$sr=1; 
					    
					?>
					<h3>OPEN GAME </h3><BR>
					<h5><b>Single  Ank:</b></h5>
					<?php
					    $cnt=0;
					    while($row = mysql_fetch_object($result))
					    {
					        $opensingle_total+=$row->Points;
					  ?>
					    <span style="width:100px;display: inline-block;font-size: 16px;">
					    <?php 
    					    echo $row->BidNo; ?> = <b>Rs <?php echo $row->Points.'</b>'; 
    					    $cnt++;
    					    
    					    if($cnt%10 == 0) 
                            {
                            ?>
                            <br>
                            <?php
                            }
					    ?>
					    </span>
					<?php
					    }   
				       ?>
					<br>
					<br>
					<?php // Open Single end ?> 
					
					<?php
					// Open Patti start
					
					    $datepicker = date("d-M-Y");
					    
						$result = mysql_query("select * from  biddings where bazarId=$_REQUEST[id] and gametype=1 and optionType=3 and adminDate='$datepicker'");
						$sr=1; 
					    
					?>
					<h5><b>SP :</b></h5>
					<?php
					    $cnt=0;
					    while($row = mysql_fetch_object($result))
					    {
					        $openSp_total+=$row->Points;
					  ?>
					    <span style="width:100px;display: inline-block;font-size: 16px;">
					    <?php 
					        echo $row->BidNo; ?> = <b>Rs <?php echo $row->Points.'</b>';
    					    $cnt++;
    					    
    					    if($cnt%10 == 0) 
                            {
                            ?>
                            <br>
                            <?php
                            }
					    ?>
					    </span>
					<?php
					    }   
				       ?>
					<br>
					<br>
					<?php // Open Patti end ?>
					
					
					<?php
					// Open Patti start
					
					    $datepicker = date("d-M-Y");
					    
						$result = mysql_query("select * from  biddings where bazarId=$_REQUEST[id] and gametype=1 and optionType=4 and adminDate='$datepicker'");
						$sr=1; 
					    
					?>
					<h5><b>DP :</b></h5>
					<?php
					    $cnt=0;
					    while($row = mysql_fetch_object($result))
					    {
					        $openDp_total+=$row->Points;
					  ?>
					    <span style="width:100px;display: inline-block;font-size: 16px;">
					    <?php 
					        echo $row->BidNo; ?> = <b>Rs <?php echo $row->Points.'</b>';
    					    $cnt++;
    					    
    					    if($cnt%10 == 0) 
                            {
                            ?>
                            <br>
                            <?php
                            }
					    ?>
					    </span>
					<?php
					    }   
				       ?>
					<br>
					<br>
					<?php // Open Patti end ?>
					
					
					<?php
					// Open Patti start
					
					    $datepicker = date("d-M-Y");
					    
						$result = mysql_query("select * from  biddings where bazarId=$_REQUEST[id] and gametype=1 and optionType=5 and adminDate='$datepicker'");
						$sr=1; 
					    
					?>
					<h5><b>TP :</b></h5>
					<?php
					    $cnt=0;
					    while($row = mysql_fetch_object($result))
					    {
					        $openTp_total+=$row->Points;
					  ?>
					    <span style="width:100px;display: inline-block;font-size: 16px;">
					    <?php 
					        echo $row->BidNo; ?> = <b>Rs <?php echo $row->Points.'</b>';
    					    $cnt++;
    					    
    					    if($cnt%10 == 0) 
                            {
                            ?>
                            <br>
                            <?php
                            }
					    ?>
					    </span>
					<?php
					    }   
				       ?>
					<br>
					<br>
					<?php // Open Patti end ?>
					
					
					<?php
					// Close Single start
					    $datepicker = date("d-M-Y");
					    
						$result = mysql_query("select * from  biddings where bazarId=$_REQUEST[id] and gametype=2 and optionType=1 and adminDate='$datepicker'");
						$sr=1; 
					    
					?>
					<h3>CLOSE GAME </h3><BR>
					<h5><b>Single  Ank:</b></h5>
					<?php
					    $cnt=0;
					    while($row = mysql_fetch_object($result))
					    {
					        $closesingle_total+=$row->Points;
					  ?>
					    <span style="width:100px;display: inline-block;font-size: 16px;">
					    <?php 
    					    echo $row->BidNo; ?> = <?php echo $row->Points; 
    					    $cnt++;
    					    
    					    if($cnt%10 == 0) 
                            {
                            ?>
                            <br>
                            <?php
                            }
					    ?>
					    </span>
					<?php
					    }   
				       ?>
					<br>
					<br>
					<?php // Open Single end ?> 
					
					<?php
					// Open Patti start
					
					    $datepicker = date("d-M-Y");
					    
						$result = mysql_query("select * from  biddings where bazarId=$_REQUEST[id] and gametype=2 and optionType=3 and adminDate='$datepicker'");
						$sr=1; 
					    
					?>
					<h5><b>SP :</b></h5>
					<?php
					    $cnt=0;
					    while($row = mysql_fetch_object($result))
					    {
					        $closeSp_total+=$row->Points;
					  ?>
					    <span style="width:100px;display: inline-block;font-size: 16px;">
					    <?php 
					        echo $row->BidNo; ?> = <?php echo $row->Points;
    					    $cnt++;
    					    
    					    if($cnt%10 == 0) 
                            {
                            ?>
                            <br>
                            <?php
                            }
					    ?>
					    </span>
					<?php
					    }   
				       ?>
					<br>
					<br>
					<?php // Open Patti end ?>
					
					
					<?php
					// Open Patti start
					
					    $datepicker = date("d-M-Y");
					    
						$result = mysql_query("select * from  biddings where bazarId=$_REQUEST[id] and gametype=2 and optionType=4 and adminDate='$datepicker'");
						$sr=1; 
					    
					?>
					<h5><b>DP :</b></h5>
					<?php
					    $cnt=0;
					    while($row = mysql_fetch_object($result))
					    {
					        $closeDp_total+=$row->Points;
					  ?>
					    <span style="width:100px;display: inline-block;font-size: 16px;">
					    <?php 
					        echo $row->BidNo; ?> = <?php echo $row->Points;
    					    $cnt++;
    					    
    					    if($cnt%10 == 0) 
                            {
                            ?>
                            <br>
                            <?php
                            }
					    ?>
					    </span>
					<?php
					    }   
				       ?>
					<br>
					<br>
					<?php // Open Patti end ?>
					
					
					<?php
					// Open Patti start
					
					    $datepicker = date("d-M-Y");
					    
						$result = mysql_query("select * from  biddings where bazarId=$_REQUEST[id] and gametype=2 and optionType=5 and adminDate='$datepicker'");
						$sr=1; 
					    
					?>
					<h5><b>TP :</b></h5>
					<?php
					    $cnt=0;
					    while($row = mysql_fetch_object($result))
					    {
					        $closeTp_total+=$row->Points;
					  ?>
					    <span style="width:100px;display: inline-block;font-size: 16px;">
					    <?php 
					        echo $row->BidNo; ?> = <?php echo $row->Points;
    					    $cnt++;
    					    
    					    if($cnt%10 == 0) 
                            {
                            ?>
                            <br>
                            <?php
                            }
					    ?>
					    </span>
					<?php
					    }   
				       ?>
					<br>
					<br>
					<?php // Open Patti end ?>
					
					
					<?php
					// Close Single start
					    $datepicker = date("d-M-Y");
					    
						$result = mysql_query("select * from  biddings where bazarId=$_REQUEST[id] and gametype=1 and optionType=2 and adminDate='$datepicker'");
						$sr=1; 
					    
					?>
					
					<h5><b>Jodi :</b></h5>
					<?php
					    $cnt=0;
					    while($row = mysql_fetch_object($result))
					    {
					        $jodi_total+=$row->Points;
					  ?>
					    <span style="width:100px;display: inline-block;font-size: 16px;">
					    <?php 
    					    echo $row->BidNo; ?> = <?php echo $row->Points; 
    					    $cnt++;
    					    
    					    if($cnt%10 == 0) 
                            {
                            ?>
                            <br>
                            <?php
                            }
					    ?>
					    </span>
					<?php
					    }   
				       ?>
					<br>
					<br>
					<?php // Jodi end ?>
						
				
					<h3>OPEN GAME TOTAL: </h3><BR>
					<span style="width:1000px;display: inline-block;font-size: 15px;"><b>Single : </b> <?php echo $opensingle_total; ?></span><br>
					<span style="width:1000px;display: inline-block;font-size: 15px;"><b>SP : </b> <?php echo $openSp_total; ?></span><br>
					<span style="width:1000px;display: inline-block;font-size: 15px;"><b>DP : </b> <?php echo $openDp_total; ?></span><br>
					<span style="width:1000px;display: inline-block;font-size: 15px;"><b>TP : </b> <?php echo $openTp_total; ?></span><br>
					
					
					<h3>CLOSE GAME TOTAL: </h3><BR>
					<span style="width:1000px;display: inline-block;font-size: 15px;"><b>Single : </b> <?php echo $closesingle_total; ?></span><br>
					<span style="width:1000px;display: inline-block;font-size: 15px;"><b>SP : </b> <?php echo $closeSp_total; ?></span><br>
					<span style="width:1000px;display: inline-block;font-size: 15px;"><b>DP : </b> <?php echo $closeDp_total; ?></span><br>
					<span style="width:1000px;display: inline-block;font-size: 15px;"><b>TP : </b> <?php echo $closeTp_total; ?></span><br>
					
					
					<h3>JODI TOTAL: </h3><BR>
					<span style="width:1000px;display: inline-block;font-size: 15px;"><b>Jdoi : </b> <?php echo $jodi_total; ?></span><br>
				 
				 
				    
					<h3 style="color:RED">FINAL TOTAL: </h3><BR>
					<span style="width:1000px;display: inline-block;font-size: 18px;"><b>Single :  Rs <?php echo ($opensingle_total+$openSp_total+$openDp_total+$openTp_total+$closesingle_total+$closeSp_total+$closeDp_total+$closeTp_total+$jodi_total); ?> </b></span><br>
				
				
					</div>
  			</div>



		  </div>
		</div>
    </div>

<?php  include ABS_PATH.'/admin/footer.php';	?>    