<?php include "config.php"; ?>
<style>
table { border: thin black solid; }
.first-row {
	padding-left: 10px;
	padding-right: 10px;	
}
.middle-row {
	padding-left: 10px;
	padding-right: 10px;	
}
.last-row {
	padding-left: 10px;
	padding-right: 10px;	
}
.left_rotate {
    -webkit-transform: rotate(269deg);
    -moz-transform: rotate(269deg);
    -o-transform: rotate(269deg);
    writing-mode: tb-rl;
}
@font-face
{
  font-family: event-heading;
  src: url('receipt/abaddon.TTF');
}
.event_name_font {
	font-family: event-heading;
	font-size:17px;
}

@font-face
{
  font-family: event-address;
  src: url('receipt/tt0140m_.ttf');
}

.event-address {
    font-family: event-address;
    font-size:11px; 
}
.event_name{
    font-size:12px;   
}
.ticket{
     font-size:10px;   
}
@media print {
    footer {
    page-break-after: always;
    page-break-inside: avoid;
     }
}
</style>
<?php
//$getTicket = mysql_query("SELECT * from test_user_information WHERE unique_number='".base64_decode($_GET['uid'])."' AND parent_email='".base64_decode($_GET['email'])."' ");
$getTicket = mysql_query("SELECT * from user_information WHERE parent_id='".base64_decode($_GET['pid'])."'");
$i=0;
while($tickets = mysql_fetch_array($getTicket)){
    if($i%2==0){
    ?>
        <footer>
    <?php
    }
    if($tickets['event_selected'] == 26){
     $address =  '	
		<div class="event-address" style="margin-top:20px;width:100%;height:100%">
	
						    <b>
                                 Date: Saturday July 26th 2014<br/>
                    Time: 7:00 pm onwards<br/>
                    Venue : Sheraton Four Points<br/>
                    1201 K St NW, Washington,<br/>
                    DC 20005
					        </b>
						
  						</div>';
                    
                
    }else if ($tickets['event_selected'] == 27) {
        $address =  '	
		<div class="event-address" style="margin-top:20px;width:100%;height:100%">
	
						    <b>
                                 Date: Sunday July 27th 2014<br/>
		            Time: 6:30pm-9:30pm<br/>
		            Venue: Five Star Banquet<br/>
		            13-05,43rd Ave, <br/>
		            Long Island City, New York 11102 
					        </b>
						
  						</div>';
		            
    } else if($tickets['event_selected'] == 2){
    	
		$address =  '<div class="event-address" style="margin-top:20px;width:100%;height:100%">
	
						    <b>
                                 Date: Saturday August 2nd 2014<br/>
		            Time: 6:00 pm onwards<br/>
		            Venue:	Chabot College<br/>
							Performing Arts Center<br/>
							25555 Hesperian Blvd,<br/>
							Hayward, CA 94545
					        </b>
						
						</div>';
    }
//echo "<pre>";
//print_r($tickets);exit;
    $unique_number  = $tickets['unique_number'];
     
    $get_ticket_number = mysql_query("select * from ticket_master
                                        where event_number = '".$tickets['event_selected']."'
                                        AND tkt_type = '".$tickets['category_selected']."' ");
                                        
    $alltickets     = mysql_fetch_array($get_ticket_number);
    
      
    if($tickets['is_ticket_generated'] == '0'){
        $ticket_id      = $alltickets['tkt_current'];
        
        mysql_query("UPDATE ticket_master set tkt_current=(tkt_current+1)
                     WHERE event_number = '".$tickets['event_selected']."'
                     AND tkt_type = '".$tickets['category_selected']."'  ");
                     
        mysql_query("UPDATE user_information
                     SET ticket_number = '".$ticket_id ."'
                     WHERE id = '".$tickets['id']."' ");
    } else{
        $ticket_id      = $tickets['ticket_number'];
    }               
?>
<div frame="border" style="background-color:#fffcdd">
<table width="100%">
	<tr border="1px">
		
		<td class="last-row" width="40%" style="border-right: 2px dashed #000;vertical-align:top">
			<table  style="border:none;width:100%">
			<!--	<tr>
					<td>
					<img src="logo.jpg" width="150" height="50"><br/>
					<div style="margin-top:15px">26th July 2014: 7:30pm <br/> A Night With Rabbi Shergill - DC </div></td>
				</tr>
				<tr>
					<td><div style="margin-top:10px;">Ticket # 1101/asd123</div></td>
				</tr>				-->
				<tr>
					<tr>
						<td>
							<div style="background-color:#1e5ba8;width:33%;float:left;height:38px">&nbsp;</div>
							<div style="background-color:#ffc12b;width:33%;float:left;height:38px">&nbsp;</div>
							<div style="background-color:#00afef;width:34%;float:left;height:38px">&nbsp;</div>
						</td>
					</tr>
					<td>
						<div style="margin-top:10px;color:#ad2c43" class="event_name_font">AN EVENING <br/> WITH <br/> RABBI SHERGIL</div>
						<div style="margin-top:8px;color:#3e71be" class="event_name"><b>A FUNDRAISING EVENT</b><br/>Hosted by UNITED SIKHS</div>
						
                                 <?php echo $address; ?>
					        
  
						<div style="margin-top:10px;float:left" class="ticket"><b>Ticket # <?php echo $ticket_id; ?> </b> / <?php echo $unique_number; ?></div>
					</td>	
					<!--<td width="10%">
						<div class="left_rotate">
							Seating starts 15 minutes in advance
							Program schedule subject to last minutes change
						</div>
					</td>-->
				</tr>		
                <tr>
                    <td>
                        <div style="background-color:#1e5ba8;width:33%;float:left;height:38px">&nbsp;</div>
                        <div style="background-color:#ffc12b;width:33%;float:left;height:38px">&nbsp;</div>
                        <div style="background-color:#00afef;width:34%;float:left;height:38px">&nbsp;</div>
                    </td>
                </tr>	
			</table>				
		</td>	
		<td class="middle-row" style="vertical-align:top" width="100%">
			<table  style="border:none;width:100%">
			<!--	<tr>
					<td>
						<div><h2 style="margin-top:2px;">An Evening with Rabbi Shergill -26th July 2014 -7:30pm - DC </h2><br/>All proceeds will towards charity UNITED SIKHS</div>						
					</td>
				</tr>
				<tr>
					<td><div style="margin-top:10px;">Ticket # 1101/12asdas4d</div></td>
				</tr>				
			</table>				-->
					<tr>
						<td colspan="2">
							<div style="background-color:#1e5ba8;width:33%;float:left;height:38px">&nbsp;</div>
							<div style="background-color:#ffc12b;width:33%;float:left;height:38px">&nbsp;</div>
							<div style="background-color:#00afef;width:34%;float:left;height:38px">&nbsp;</div>
						</td>						 
					</tr>
					<tr>
					<td>
						<div style="margin-top:10px;color:#ad2c43" class="event_name_font">AN EVENING <br/> WITH <br/> RABBI SHERGIL</div>
						<div style="margin-top:8px;color:#3e71be" class="event_name" ><b>A FUNDRAISING EVENT</b><br/>Hosted by UNITED SIKHS</div>  

						    
                                 <?php echo $address; ?>
					        
	
						<div style="margin-top:10px;float:left" class="ticket"><b>Ticket # <?php echo $ticket_id; ?></b> / <?php echo $unique_number; ?> </div>
					</td>	
					<td rowspan="" style="width:30%"><img src="receipt/UnitedSikhsLogo-1.jpg" style="width:100%"></td>
					<!--<td width="10%">
						<div class="left_rotate">
							Seating starts 15 minutes in advance
							Program schedule subject to last minutes change
						</div>
					</td>-->
				</tr>	
				<tr>
                    <td colspan="2">
                        <div style="background-color:#1e5ba8;width:33%;float:left;height:38px">&nbsp;</div>
                        <div style="background-color:#ffc12b;width:33%;float:left;height:38px">&nbsp;</div>
                        <div style="background-color:#00afef;width:34%;float:left;height:38px">&nbsp;</div>
                    </td>
                </tr>	    
				</table>
		</td>
				
	</tr>
</table>

</div>
<hr/>
<?php
$i++;
}
 $udpateTicket = mysql_query("update user_information SET is_ticket_generated = '1' WHERE parent_id='".base64_decode($_GET['pid'])."'");

// $udpateTicket = mysql_query("update test_user_information SET is_ticket_generated = '1' WHERE unique_number='".base64_decode($_GET['uid'])."'");
?>

