<?php
if($requi=='1'){
$do=mysqli_query($cons, "SELECT *FROM `requis` WHERE `Voucher`='$vous' AND `Status`='0' AND `Date`='$dte' AND `Action`='INTERNAL' ORDER BY `Number` ASC LIMIT 100");
if($fo=mysqli_num_rows($do)){
print("<html><head>
<title>$cna</title>
</head>
<body>");

	$n=0;
	print("<style type=text/css>
@media screen {
  .DONTPrinti{ display:none;
  margin-top: 0mm; margin-bottom: 0mm; 
           margin-left: 0mm; margin-right: 0mm }
			}
@media print {
  .DONTPrint{ display:none }
  .DOCheck{ display:table}
			}
</style>
	<script type='text/javascript'>
	function printpage()
  {  
window.print();
  } 
</script>");
		$ro=mysqli_fetch_assoc($do);
			$nu=$ro['Number'];
			$vou=$ro['Voucher'];
			$empo=$ro['User'];
			$pla=$ro['Destin'];
			$cus=$ro['Invoice'];
			$dao=$ro['Date'];
			$clie=$ro['Destin'];
			$prs=$ro['Person'];
				$pti="";

				$da=$ro['Date'];
				$ti=$ro['Time'];
				
				$pieces = explode(" ", $empo);
                    $empo = $pieces[0];
            /*
		$doib=mysqli_query($cons, "SELECT `Name`, `Telephone` FROM `branches` WHERE `Number`='$brc' ORDER BY `Number` ASC");
			$roib=mysqli_fetch_assoc($doib);
			*/
				$bra=$rd['Cname'];
				$tel=$rd['Phone1'];
						

print("<div class='DONTPrinti' style='margin-top:0px; position:relative;'><CENTER>
<TABLE RULES='ROWS' FRAME='BOX' BORDER='1' STYLE='font-family: verdana,sans-serif;
	font-size: 14px;
	color: #333333z;
	border-width: 1px;
	border-color: #999999;
	border-collapse: collapse;
	width: 380px; margin-top:0px;'>
	<TR>
	<TD>
		<table width=100% border='0' style='font-size:14px;'>
		<tr><td width='30%'>
   <img src='imgs/logo.png' width='120px' height='80px'></td>
   <td colspan='2'><div align='left'><b> $cna </b><br>$country - $city<br>TIN/VAT: $tax<br>TEL: $tel</div></td></tr>
		</table>
		 
		 	
					   
	&nbsp;  <br></TD>
		</TR>
		<TR style='height:60px;'>
		<TD><br>&nbsp;<b>REQUISITION VOUCHER No: $vous &nbsp;&nbsp;&nbsp;&nbsp; $pti</b>
		<br>&nbsp;&nbsp;&nbsp;Date&Time&nbsp;:$da&nbsp;&nbsp;&nbsp;&nbsp;$ti&nbsp;<br>
		&nbsp;&nbsp;&nbsp;Destination&nbsp;:&nbsp;<b>$pla</b><br>
		&nbsp;&nbsp;&nbsp;Requested&nbsp;By&nbsp;:&nbsp;$prs<br>
		<div align='right'>&nbsp;&nbsp;&nbsp;<b>$cus</b>&nbsp;&nbsp;</div><br><br>
		<table width='100%' style='font-size:14px;'><tr>
		<th>&nbsp;&nbsp;&nbsp;Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </th>
		<th><div align='right'>&nbsp;&nbsp;Quantity&nbsp;&nbsp;</th>
		<th><div align='right'>&nbsp;&nbsp;Price&nbsp;&nbsp;</th><th><div align='right'>&nbsp;&nbsp;Amount&nbsp;&nbsp;</th></tr>");
		$tot=$tq=0;         $n=1;
	$do=mysqli_query($cons, "SELECT *FROM `requis` WHERE `Voucher`='$vous' AND `Status`='0' AND `Action`='INTERNAL' AND `Date`='$dte' ORDER BY `Number` ASC LIMIT 100");
		$fo=mysqli_num_rows($do);
			while($ro=mysqli_fetch_assoc($do)){
				$cla=$ro['Item'];
				$pre=$ro['Price'];
				$qty=$ro['Quantity'];
				$to=$pre*$qty;
				
	    $l1=$l2='';
	$doi=mysqli_query($cons, "SELECT `Iname`, `Type`, `Descri`, `Unit` FROM `items` WHERE `Number`='$cla' ORDER BY `Number` ASC LIMIT 1");
		$roi=mysqli_fetch_assoc($doi);
			$iname=$roi['Iname'];
			$type=$roi['Type'];
			$desc=$roi['Descri'];
			$uno=$roi['Unit'];
			
			
			$dox=mysqli_query($cons, "SELECT `Unit` FROM `unit` WHERE `Number`='$uno' ORDER BY `Number` ASC");
					$rox=mysqli_fetch_assoc($dox);
							$unit=$rox['Unit'];
							if($unit=='KG')
				                $tq+=$qty;
			
	$dops=mysqli_query($cons, "SELECT `Type` FROM `itype` WHERE `Number`='$type' ORDER BY `Number` DESC LIMIT 1");
				$rops=mysqli_fetch_assoc($dops);
					$typ=$rops['Type'];
		
				$tw = explode("*", $typ);
					$l1=$tw[0]; 
					$l2=$tw[1]; 
					if($l1>='1' AND $l2>='1'){
					$cat=$qty/($l1*$l2*$desc/10000);
					$box=floor($cat);
					$pc=number_format(($cat-$box)*$desc);
					
			if($n!=$fo)
			    $line="<hr style='border:1px dotted #000000; margin:5px;'>";
			else
			    $line="";
				$afs="<tr><td colspan='4' align='center'> $box BOX 
					&nbsp;&nbsp;&nbsp;&nbsp; $pc PCS <br> $line </td></tr>";
					}
					else
				$afs="";

$qto=number_format($qty, 2);				$preo=number_format($pre);					$too=number_format($to);
		echo("<tr style='height:30px;'><td>$iname </td><td width='15%'><div align='right'>&nbsp;$qto&nbsp;$unit&nbsp;</td>
		<td width='15%'><div align='right'>&nbsp;$preo&nbsp;</td><td width='15%'><div align='right'>&nbsp;$too&nbsp;</td></tr> $afs ");
			$tot+=$to;          $n++;
			}
				
			print("</table></TD></TR>");
	$toto=number_format($tot);
	$tq=number_format($tq);

	print("<TR style='height:30px;'>
	<TD style='padding-right:5px'>");
	//if($fo>1)
		echo"<DIV ALIGN='right' style='font-size:font-size:10px;'><b> TOTAL&nbsp;:&nbsp; $tq KG &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $toto</b></DIV>";
	print("<FONT SIZE='1'><label style='padding-top:10px;'>&nbsp;&nbsp;Done&nbsp;by:&nbsp;$empo <br> &nbsp;&nbsp; ............................... <br><br>
	<div>.</label></FONT></DIV></TD>
	</TR></TABLE> .
    </div></div><div class='DONTPrint'>");

$so=mysqli_query($cons, "UPDATE `stouse` SET `Printed`='1', `Client`='$clie' WHERE `Voucher`='$vou' AND `Action`='SALES' ORDER BY `Number` ASC LIMIT 100");
$so=mysqli_query($cons, "UPDATE `payment` SET `Client`='$clie' WHERE `Voucher`='$vou' AND `Action`='SALES' ORDER BY `Number` ASC LIMIT 100");
	?>
	 <script type="text/javascript">
    window.print();
</script>
<?php
	echo"</body></html>";
}
	$t=$p=999;
}
elseif($requi=='2'){
 // ********************* For Proforma **********************************
$do=mysqli_query($cons, "SELECT *FROM `stouse` WHERE `Voucher`='$vou' AND `Status`='10' AND `Printed`!='1' AND `Action`='$action' ORDER BY `Number` ASC LIMIT 100");
if($fo=mysqli_num_rows($do)){
print("<html><head>
<title>$cna</title>
</head>
<body></div>");

	$n=0;
	print("<style type=text/css>
@media screen {
  .DONTPrinti{ display:none;
  margin-top: 0mm; margin-bottom: 0mm; 
           margin-left: 0mm; margin-right: 0mm }
			}
@media print {
  .DONTPrint{ display:none }
  .DOCheck{ display:table}
			}
</style>
	<script type='text/javascript'>
	function printpage()
  {  
window.print();
  } 
</script>

<div class='DONTPrinti' style='position:relative; width:99%;'><CENTER>");
		$ro=mysqli_fetch_assoc($do);
			$nu=$ro['Number'];
			$vou=$ro['Voucher'];
			$empo=$ro['User'];
			$pla=$ro['Destin'];
			$tra=$ro['Store'];
			$cli=$ro['Client'];
			$pt=$ro['Printed'];
			$cus=$ro['Invoice'];
			$brc=$ro['Branche'];
			$pers=$ro['Person'];
			$plat=$ro['Plate'];
			$locat=$ro['Location'];
			$comme=$ro['Comment'];
			
			if(!$plat)
			    $plat="--------";
			    
			if($pt=='2')
				$pti="(Duplicate)";
			else
				$pti="(Original)";

				$da=$ro['Date'];
				$ti=$ro['Time'];
				
				$pieces = explode(" ", $empo);
                    $empo = $pieces[0];										$dat=date('d-M-Y', strtotime($da));


				$doibi=mysqli_query($cons, "SELECT `Number`, `Customer`, `Address`, `Telephone`, `Tin` FROM `account` WHERE `Customer`='$pla' ORDER BY `Number` ASC");
					$roibi=mysqli_fetch_assoc($doibi);
						$clie=$roibi['Customer'];
						$addie=$roibi['Address'];
						$tini=$roibi['Tin'];
						$year=date('Y', strtotime($da));
						$cli=$roibi['Number'];
						
		$so=mysqli_query($cons, "UPDATE `stouse` SET `Client`='$cli' WHERE `Voucher`='$vou' AND `Action`='PROFORMA' ORDER BY `Number` ASC LIMIT 100");

if($cprint=='YES'){
    
		$tot=$box=0;						$n=1;
	$do=mysqli_query($cons, "SELECT *FROM `stouse` WHERE `Voucher`='$vou' AND `Status`='10' AND `Action`='$action' ORDER BY `Number` ASC LIMIT 100");
		$fo=mysqli_num_rows($do);
		
		$pre=10-$fo;                    $fre=10-$fo;
print("<h4> PROFORMA </h4>
<label style='float:right; text-align:right; margin-top:-25px; margin-right:20px; font-size:10px;'> $pti </label>
<TABLE BORDER='1' STYLE='font-size: 11px;
	border-width: 1px;
	border-color: #999999;
	border-collapse: collapse;
	width: 100%; margin-top:0px;
	font-weight:bold; margin-top:-15px;
	padding-top:0px; color: #333333z;'>
	
	<TR><TD COLSPAN='2' WIDTH='100%' VALIGN='TOP'>
<table width='100%'><tr><td><img src='imgs/logo.png' width='120px' height='90px'></td><td><b> $cna </b><br>$city - $country<br>TIN/VAT: $tax<br>TEL: $pho1 / $pho2 <br> $mail </td></tr></table></TD></TR><TR><TD WIDTH='50%' VALIGN='TOP'><BR>
   
 
   
   &nbsp;Customer <br>
   &nbsp;$clie <br>
   &nbsp;$addie <br>
   &nbsp;TIN: $tini <br><br>
   
   </TD><TD><table width='100%' border='1'><tr>");
   
   print("<TD>&nbsp;PROFORMA No. <br> &nbsp;&nbsp; PR/$vou/$year </TD>
<TD>&nbsp;Dated <br> &nbsp;&nbsp; $dat </TD></TR>

<TR style='height:40px;'><TD>&nbsp;Delivery Note <br> &nbsp;&nbsp; ....... / ....... /$year </TD>
<TD>&nbsp;Made/Terms of Payment <br> &nbsp;&nbsp;1 Day </TD></TR>

<TR style='height:40px;'><TD VALIGN='TOP'>&nbsp;Despatched through <br>
&nbsp;&nbsp;&nbsp;&nbsp; $plat </TD>
<TD VALIGN='TOP'>&nbsp;Location <br>&nbsp;$locat </TD></TR>

<TR style='height:40px;'><TD colspan='2' valign='top'>&nbsp;Reference <br>
&nbsp;&nbsp; $comme </TD></TR>

<TR style='height:40px;'><TD colspan='2' valign='top'>&nbsp;Terms of Delivery");
while($pre>0){
echo"<br>";
$pre--;
}
print("</td></tr></table></TD></TR>









		<TR><TD COLSPAN='3'> 

		<table width='100%' border='1' style='font-size:11px; border-width: 1px;
	border-color: #999999; border-collapse: collapse;'><tr style='height:20px;'>
		<th width='5%' style='text-align:center;'> No </th>
		<th style='text-align:center;'> Description of Goods </th>
		<th width='15%' style='text-align:center;'> Quantity </th>
		<th width='15%' style='text-align:center;'> Rate </th>
		<th width='5%' style='text-align:center;'> Per </th>
		<th width='15%' style='text-align:center;'> Amount </th></tr>");
		
			while($ro=mysqli_fetch_assoc($do)){
				$cla=$ro['Item'];
				$pre=$ro['Price'];
				$qty=$ro['Quantity'];

				
				$to=$pre*$qty;
	
	$doi=mysqli_query($cons, "SELECT `items`.`Iname`, `unit`.`Unit` FROM `items` INNER JOIN `unit` ON `items`.`Unit` = `unit`.`Number` WHERE `items`.`Number`='$cla' ORDER BY `items`.`Number` ASC LIMIT 1");
		$roi=mysqli_fetch_assoc($doi);
			$iname=$roi['Iname'];
			$unit=$roi['Unit'];

    $qto=number_format($qty);				$preo=number_format($pre);					$too=number_format($to);
		echo("<tr><td align='right'> $n&nbsp;&nbsp;</td><td>$iname </td><td><div align='right'>&nbsp;$qto&nbsp;$unit</td>
		<td><div align='right'>&nbsp;$preo&nbsp;</td><td> $unit </td>
		<td><div align='right'>&nbsp;$too&nbsp;</td></tr>");
			$tot+=$to;				$n++;				$box+=$qty;
			}
		$toto=number_format($tot);				$boxo=number_format($box);
	print("<tr><th> </th><th style='text-align:right'> Total &nbsp;</th>
	<th style='text-align:right'>&nbsp;$boxo&nbsp;$unit</th><th> </th><th> </th>
	<th style='text-align:right'>&nbsp;$toto&nbsp;</th></tr></table><br>
	</TD></TR>");
	
			include'inword.php';
	print("<TR><TD COLSPAN='3' style='padding-left:5px;'> Amount Chargeable 
	(in words) 
	 <div style='width:320px;'>".convert_number_to_words($tot)." rwanda francs only </div><br><br>");
while($fre>0){
echo"<br>";
$fre--;
}
print("Remarks: <br> PROFORMA OF $box $unit OF GOODS <br> Party's VAT No. : $tax 
	 <br><br><br><u>Decralation</u><br>
	 Proforma must be confirmed before delivery; <br>
	 any on above items will be amended within sales. <br>
	 Goods Once Sold not Returnable. <br><br>
	 
	 <div style='width:240px; height:100px; margin-top:-98px; float:right; text-align:center; border: 1px solid #999999; border-collapse: collapse; padding:10px; font-size:10px;'> For $cna <br><br><br><br><br><br> Authorized Signature</div>
	 </TD></TR></TABLE>
	<font size='1'>This is a Computer Generated Invoice</font><br>");

}

    print("</div></div><div class='DONTPrint'>");

$so=mysqli_query($cons, "UPDATE `stouse` SET `Printed`='1', `Client`='$clie' WHERE `Voucher`='$vou' AND `Action`='SALES' ORDER BY `Number` ASC LIMIT 100");
	?>
	 <script type="text/javascript">
    window.print();
</script>
<?php
	echo"</body></html>";
}
	$t=$p=999;
}
else{
    
$do=mysqli_query($cons, "SELECT *FROM `stouse` WHERE `Voucher`='$vou' AND `Status`='0' AND `Printed`!='1' AND `Action`='SALES' ORDER BY `Number` ASC LIMIT 100");
if($fo=mysqli_num_rows($do)){
print("<html><head>
<title>$cna</title>
</head>
<body>");

	$n=0;
	print("<style type=text/css>
@media screen {
  .DONTPrinti{ display:none;
  margin-top: 0mm; margin-bottom: 0mm; 
           margin-left: 0mm; margin-right: 0mm }
			}
@media print {
  .DONTPrint{ display:none }
  .DOCheck{ display:table}
			}
</style>
	<script type='text/javascript'>
	function printpage()
  {  
window.print();
  } 
</script>");
		$ro=mysqli_fetch_assoc($do);
			$nu=$ro['Number'];
			$vou=$ro['Voucher'];
			$empo=$ro['User'];
			$pla=$ro['Destin'];
			$pt=$ro['Printed'];
			$cus=$ro['Invoice'];
			$brc=$ro['Branche'];
			$dao=$ro['Date'];
			if($pt=='2')
				$pti="REPRINTED";
			else
				$pti="";

				$da=$ro['Date'];
				$ti=$ro['Time'];
				
				$pieces = explode(" ", $empo);
                    $empo = $pieces[0];
            /*
		$doib=mysqli_query($cons, "SELECT `Name`, `Telephone` FROM `branches` WHERE `Number`='$brc' ORDER BY `Number` ASC");
			$roib=mysqli_fetch_assoc($doib);
			*/
				$bra=$rd['Cname'];
				$tel=$rd['Phone1'];


				$doibi=mysqli_query($cons, "SELECT `Number`, `Balance` FROM `account` WHERE `Customer`='$pla' ORDER BY `Number` ASC");
					$roibi=mysqli_fetch_assoc($doibi);
						$clie=$roibi['Number'];
			$bal=$roibi['Balance'];             $balo=number_format($bal);
			
			if($bal>10)
			$baso="Credit &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : $balo";
			else
			$baso="";
						
				$don=mysqli_query($cons, "SELECT `Number` FROM `stouse` WHERE `Voucher`!='0' AND `Voucher`<='$vou' AND `Status`='0' AND `Date`='$dao' AND `Action`='SALES' GROUP BY `Voucher` ORDER BY `Number` ASC LIMIT 1000");
				$fon=mysqli_num_rows($don);

print("<div class='DONTPrinti' style='margin-top:0px; position:relative;'><CENTER>
<TABLE RULES='ROWS' FRAME='BOX' BORDER='1' STYLE='font-family: verdana,sans-serif;
	font-size: 14px;
	color: #333333z;
	border-width: 1px;
	border-color: #999999;
	border-collapse: collapse;
	width: 380px; margin-top:0px;'>
	<TR>
	<TD>
		<table width=100% border='0' style='font-size:12px;'>
		<tr><td width='30%'>
   <img src='imgs/logo.png' width='120px' height='80px'></td>
   <td colspan='2'><div align='left'><b> $cna </b><br>$country - $city<br>TIN/VAT: $tax<br>TEL 1: $pho1 <br>");
   if($pho2)
   echo"TEL 2: $pho2";
   
   print("</div></td><td width='1%'><div style='border:1px solid #000000; border-radius:50px; font-size:28px; width:50px; height:40px; text-align:center; float:right; margin:5px; top:5px;'>$fon</div>   
					   </div></td></tr>
		</table>
		 
		 	
					   
	&nbsp;  <br></TD>
		</TR>
		<TR style='height:60px;'>
		<TD><br>&nbsp;<b>PACKING LIST No: $vou &nbsp;&nbsp;&nbsp;&nbsp; $pti</b>
		<br>&nbsp;&nbsp;&nbsp;Date&Time&nbsp;:$da&nbsp;&nbsp;&nbsp;&nbsp;$ti&nbsp;<br>
		&nbsp;&nbsp;&nbsp;Customer&nbsp;&nbsp;:&nbsp;<b>$pla</b><br>
		&nbsp;&nbsp;&nbsp;Payment &nbsp;&nbsp;:&nbsp;$plino<br>
		&nbsp;&nbsp;&nbsp;$baso<br>
		<div align='right'>&nbsp;&nbsp;&nbsp;<b>$cus</b>&nbsp;&nbsp;</div><br>
		<table width='100%' style='font-size:14px;'><tr>
		<th>&nbsp;&nbsp;&nbsp;Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </th>
		<th><div align='right'>&nbsp;&nbsp;Quantity&nbsp;&nbsp;</th>
		<th><div align='right'>&nbsp;&nbsp;Price&nbsp;&nbsp;</th><th><div align='right'>&nbsp;&nbsp;Amount&nbsp;&nbsp;</th></tr>");
		$tot=$tq=0;         $n=1;
	$do=mysqli_query($cons, "SELECT *FROM `stouse` WHERE `Voucher`='$vou' AND `Status`='0' AND `Action`='SALES' ORDER BY `Number` ASC LIMIT 100");
		$fo=mysqli_num_rows($do);
			while($ro=mysqli_fetch_assoc($do)){
				$cla=$ro['Item'];
				$pre=$ro['Price'];
				$qty=$ro['Quantity'];
				$to=$pre*$qty;
				
	    $l1=$l2='';
	$doi=mysqli_query($cons, "SELECT `Iname`, `Type`, `Descri`, `Unit` FROM `items` WHERE `Number`='$cla' ORDER BY `Number` ASC LIMIT 1");
		$roi=mysqli_fetch_assoc($doi);
			$iname=$roi['Iname'];
			$type=$roi['Type'];
			$desc=$roi['Descri'];
			$uno=$roi['Unit'];
			
			$dox=mysqli_query($cons, "SELECT `Unit` FROM `unit` WHERE `Number`='$uno' ORDER BY `Number` ASC");
					$rox=mysqli_fetch_assoc($dox);
							$unit=$rox['Unit'];
							if($unit=='KG')
				                $tq+=$qty;
			
	$dops=mysqli_query($cons, "SELECT `Type` FROM `itype` WHERE `Number`='$type' ORDER BY `Number` DESC LIMIT 1");
				$rops=mysqli_fetch_assoc($dops);
					$typ=$rops['Type'];
		
				$tw = explode("*", $typ);
					$l1=$tw[0]; 
					$l2=$tw[1]; 
					if($l1>='1' AND $l2>='1'){
					$cat=$qty/($l1*$l2*$desc/10000);
					$box=floor($cat);
					$pc=number_format(($cat-$box)*$desc);
					
			if($n!=$fo)
			    $line="<hr style='border:1px dotted #000000; margin:5px;'>";
			else
			    $line="";
				$afs="<tr><td colspan='4' align='center'> $box BOX 
					&nbsp;&nbsp;&nbsp;&nbsp; $pc PCS <br> $line </td></tr>";
					}
					else
				$afs="";

$qto=number_format($qty, 2);				$preo=number_format($pre);					$too=number_format($to);
		echo("<tr style='height:30px;'><td>$iname </td><td width='15%'><div align='right'>&nbsp;$qto&nbsp;$unit&nbsp;</td>
		<td width='15%'><div align='right'>&nbsp;$preo&nbsp;</td><td width='15%'><div align='right'>&nbsp;$too&nbsp;</td></tr> $afs ");
			$tot+=$to;          $n++;
			}
				
			print("</table></TD></TR>");
	$toto=number_format($tot);
	$tq=number_format($tq, 2);

	print("<TR style='height:30px;'>
	<TD style='padding-right:5px'>");
	//if($fo>1)
	echo"<DIV ALIGN='right' style='font-size:font-size:10px;'><b> TOTAL
		&nbsp;:&nbsp;&nbsp; $tq KG &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $toto </b></DIV>";
	print("<FONT SIZE='1'><label style='padding-top:10px;'>&nbsp;&nbsp;Done&nbsp;by:&nbsp;$empo <br> &nbsp;&nbsp; ............................... <br><br>
	<div>.</label></FONT></DIV></TD>
	</TR></TABLE> .
    </div></div><div class='DONTPrint'>");

$so=mysqli_query($cons, "UPDATE `stouse` SET `Printed`='1', `Client`='$clie' WHERE `Voucher`='$vou' AND `Action`='SALES' ORDER BY `Number` ASC LIMIT 100");
$so=mysqli_query($cons, "UPDATE `payment` SET `Client`='$clie' WHERE `Voucher`='$vou' AND `Action`='SALES' ORDER BY `Number` ASC LIMIT 100");
	?>
	 <script type="text/javascript">
    window.print();
</script>
<?php
	echo"</body></html>";
}
	$t=$p=999;
}
		?>
