<?php
session_start();

$userName=$_SESSION["aname"];
?>

<?php
//$pasali=(($_SESSION["pasali"])-591);

$pasali=$_SESSION["pasali"];

      include "../include/mysql.php";

        include "../include/common.php";

		 extract($_REQUEST);

        $advid=$val;

		//echo $print;

		$icondn=" where tmrno='$advid'";


            $getticketinfo=$db->select(AB,"*",$icondn);

			$getticketinfo_fetch=$db->fetch($getticketinfo);

			$rate=$getticketinfo_fetch["rate"];

		$name=$getticketinfo_fetch["name"];

		$address=stripslashes($getticketinfo_fetch["address"]);

		$description=stripslashes($getticketinfo_fetch["description"]);

		$description=substr($description,0,50);

		$ticket_no=$getticketinfo_fetch["ticketno"];

		$booking_date=date("d/m/Y",strtotime($getticketinfo_fetch["created_date"]));

		$booking_time=$getticketinfo_fetch["created_time"];

		
		
		$bdate=date("d/m/Y",strtotime($getticketinfo_fetch["bdate"]));

		

		$tid=$getticketinfo_fetch["tid"];

		$tmid=$getticketinfo_fetch["tmid"];

		$gid=$getticketinfo_fetch["gid"];

		$tid_condn=" where tid='$tid'";

		$ticketname_select=$db->select(TM,"*",$tid_condn);

		$ticketname_select_fetch=$db->fetch($ticketname_select);

		$tname_eng=$ticketname_select_fetch["tname_eng"];

		$tname_tam=$ticketname_select_fetch["tname_tam"];

		$tmid_condn=" where tmid='$tmid'";

		$getTime=$db->select(TMM,"timeval",$tmid_condn);

		$getTime_fetch=$db->fetch($getTime);

		$btime=$getTime_fetch[0];

		if($getticketinfo_fetch["bdate"]=="")
		{
		
			$functionDate="";

		}
		else
		{

			$functionDate=$bdate.",".$btime;
		
		}

		

		$gid_condn=" where gid='$gid'";

		$getGod=$db->select(GM,"gname",$gid_condn);

		$getGod_fetch=$db->fetch($getGod);

		$God=$getGod_fetch[0];



		$table="<div style='height:200px;'><table  align='center' style='height:1mm;margin-right:-8px;margin-top:2px;' border='0'><tr><td><table  style='width:400px;font-size:14px;' border='0'><tr><td width='10%'>Date</td><td width='2%'>:</td><td align='left' width='18%'>$booking_date</td><td width='30%'>Duplicate Copy</td><td width='18%'>Tkt.No</td><td width='2%'>:</td><td align='left' width='20%'>$ticket_no</td></tr>	<tr><td width='10%'>Time</td><td width='2%'>:</td><td align='left' width='18%'>$booking_time</td><td width='30%' align='center'>$pasali / $advid</td><td width='18%'>User Name</td><td width='2%'>:</td><td align='left' width='20%'>$userName</td></tr></table><table style='width:100%;height:40px;position: relative;background-repeat:repeat;font-size:15px;'><tr><td align='center'><b>$tname_eng</b></td></tr><tr><td align='center'><b>$tname_tam</b></td></tr></table><table style='width:100%;'></table><table  style='width:100%;font-size:16px;font-weight:bold;' border='0'><tr><td align='left' width='20%'><b>Name</b></td><td width='2%'>:</td><td width='53%'>$name</td><td align='right' width='25%'  style='font-size:18px;'>Amount</td></tr><tr><td align='left' width='20%'><b>Contact</b></td><td width='2%'>:</td><td width='53%'>$address</td><td align='right' width='25%'  style='font-size:18px;'>$rate/-</td></tr></table><table  style='width:100%;font-size:14px;font-weight:bold;' border='0'><tr><td width='20%'>God Name</td><td width='2%'>:</td><td>$God</td></tr><tr><td width='20%'>Func.Time</td><td width='2%'>:</td><td>$functionDate</td></tr>";		
		if($description!="")
		{	
				$table=$table."<tr><td width='20%' valign='top'>Description</td><td width='2%' valign='top'>:</td><td valign='top'>$description</td></tr>";
		}
		$table=$table."</table><table style='width:100%;font-size:9px;font-weight:bold;' border='0'><tr><td align='left' width='10%'></td><td width='10%'></td><td align='right' width='80%'><img src='jc.jpg' height='65px;'></td></tr></table>		
					</td></tr></table></div>";
echo $table; 

if($print!="")
{
	
	echo "<script type='text/javascript'>window.onload=function(){window.print()};</script>";

}
?>
