<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript" src="jquery-barcode.js"></script>
<?php
//include('barcode/barcode.inc.php');
//include('barcode/BarcodeGenerator.php');
//include('barcode/BarcodeGeneratorHTML.php');
include('../db_con.php');
session_start(); 
include('methodlist.php');

$res = mysqli_query($con,"select app_id, salu, surname, givenname, created_date, passport_no, visa_type, total_fee, v_uid, refer_no from applicant_table where app_id='$_GET[appid]'");
$resrow=mysqli_fetch_array($res);

$salu=$resrow["salu"];
$gname=$resrow["givenname"];
$sname=$resrow["surname"];
$code=$resrow["refer_no"];
$passport=$resrow["passport_no"];
$mainvisatypename=get_parent_mainvisatype_name($resrow["visa_type"],$con);
$visatypename=get_visatype_name($resrow["visa_type"],$con);
$pvisafee=get_visa_fee($resrow["visa_type"],$con);
$totalservicefee=0;

echo "<div style='text-align:center; padding: 15px; line-height: 20px; width:250px; font-weight:bold;'>";

echo "<div style='margin-top:0px;'>";
echo "<img src='../assets/img/sglogo.jpg' style='width:90%'></div>";

echo "<div style='font-size:16px;'>Thai Visa Application Center</div>";

echo "<div style='font-size:14px;margin-top:30px;'>
Saimon Centre, House# 4A, <br/>
Road# 22, Gulshan-1,Dhaka-1212<br/> 
E-mail: support@thaivisabd.com<br/>
Tel: 88-02-9898080, 09606556655<br>
<p style='font-weight:normal;'>Counter User:".get_session_user_fullname($con)."</p></div>";

echo "<div style='font-size:14px;margin-top:40px;'><b>Service Fee Reciept</b>";
echo "<br/><span style='font-weight:normal;'>Date: ".date('d-m-Y', strtotime(substr($resrow['created_date'], 0, 10)));
echo "</span></div>";

echo "</div>";

echo "<div style='margin-top: -20px; font-size: 11px; line-height: 20px; width:250px; text-align:left; padding: 15px;'>";
echo "<br/><b> Applicant Name: ".$salu." ".$gname." ".$sname."</b>";
echo "<br/><b> Reference No: </b>".$code;
echo "<br/><b> Passport No: </b>".$passport;
echo "<br/><b> Visa Category: </b>".$mainvisatypename." ".$visatypename;
echo "</div>";

echo "<div id='demo' style='margin: 0px 10px 0px 20px; text-align:center;'> </div>";
?>
<script>
$("#demo").barcode(
//"DFF1234567890128", // Value barcode (dependent on the type of barcode)
"<?php echo $code; ?>",
"code128"

);     
</script>
<?php
$child=0;
$countres = mysqli_query($con,"select app_id from  applicant_table where parent='$resrow[app_id]'");
$child=mysqli_num_rows($countres);
$i=1;
if($child>0){

	while($countrow=mysqli_fetch_array($countres)){

		$childres = mysqli_query($con,"select salu, surname, givenname, passport_no, visa_type, refer_no from applicant_table where app_id='$countrow[app_id]'");
		$childrow=mysqli_fetch_array($childres);

		$salu=$childrow["salu"];
		$gname=$childrow["givenname"];
		$sname=$childrow["surname"];
		$code=$childrow["refer_no"];
		$passport=$childrow["passport_no"];
		$mainvisatypename=get_parent_mainvisatype_name($childrow["visa_type"],$con);
		$visatypename=get_visatype_name($childrow["visa_type"],$con);
		$visafee=get_visa_fee($childrow["visa_type"],$con);
		//echo $child;
		if($visafee==0) $child=$child-1;
		
	
	    echo "<div style='font-size: 11px; line-height: 20px; width:250px; text-align:left; padding: 15px;'>";
		echo "<br/><b> Applicant Name: ".$salu." ".$gname." ".$sname."</b>";
		echo "<br/><b> Reference No: </b>".$code;
		echo "<br/><b> Passport No: </b>".$passport;
		echo "<br/><b> Visa Category: </b>".$mainvisatypename." ".$visatypename;
		echo "</div>";
		
		
		echo "<div style='margin: 0px 10px 0px 20px; text-align:center;' id='demo".$i."'> </div>"; ?>
		
		<script>
			$("#demo<?php echo $i; ?>").barcode(
			//"DFF1234567890128", // Value barcode (dependent on the type of barcode)
			"<?php echo $code; ?>",
			"code128"

			);     
		</script>
		<?php $i++;
	}

}

echo "<div style='font-size: 11px; line-height: 20px; width:250px; text-align:left; padding: 15px;'>";    

if($pvisafee!=0) $child=$child+1;

$sql = "SELECT * FROM `setting_table` order by s_id";
$sresult = mysqli_query($con,$sql);
while($srow = mysqli_fetch_array($sresult)){

	echo "<br/>".$srow["setting_name"]." (x".$child.") :".$srow["value"]*$child."/- BDT ";
	$totalservicefee=$totalservicefee+$srow["value"]*$child;	
}

echo "<br/><br/><b> Total Payment Received: ".number_format($totalservicefee,2)."/- BDT </b><br/>";
//echo "<p>We acknowledge the receipt of <b>".number_format($totalvisafee,2)."/- BDT </b>As Visa Fees on behalf of Royal Thai Embassy, Bangladesh.</p>";
 echo "<p style='text-align:center;'>All the service charges are inclusive of VAT.</p></div>";
// echo "<br/><br/><b>ACKNOWLEDGEMENT: </b>";
// echo "<br/><br/>1. All payments are non-refundable.";
// echo "<br/>2. All Applicants or the applicants agents acknowledge that is thier responsibilities to ensure that the information on the ICR and visas attached is correct and matched with the passports and to notify Saimon officers about any mistakes or misprints in visas UPON COLLECTING THE PASSPORTS.";
// echo "<br/>3. The Royal Thai Embassy and Saimon Group will not bear any responsibilities for any damages or cost of additional expenses(ticket, accommodation, and etc.) caused by the above mentioned mistakes and misprints in visas issued.";

// echo "<br/><br/>Applicants Signature <br/> Date:<br/><br/>";

// echo "<br/>SO Officers signature: ";
// echo "<br/><b> For more information </b> and our disclaimer Please visit www.saimongroup.com 
// </br> or Email: info@saimongroup.com
// <br/> or Call on: 88-02-9882273-74";

// echo "<br/><br/>Proper authorization is mandatory as mentioned on notice board.<br/><br/><br/><br/><br/>";

//echo "<br/>Important Note: <br/> The Royal Thai Embassy reserves the rights to withhold any application for further consideration.<br/>";




/*
$child=$child+1;
$sql = "SELECT * FROM `setting_table` order by s_id";
$sresult = mysqli_query($con,$sql);
while($srow = mysqli_fetch_array($sresult)){

	echo "<br/>".$srow["setting_name"]." (x".$child.") :".$srow["value"]*$child."/- BDT ";	
}

echo "<br/><br/> Total Payment Received: ".number_format($totalfee,2)."/- BDT <br/> All the service charges are inclusive of VAT";
//echo "<b> Printed: </b>".$dt->format('Y-m-d H:i:s');*/
echo "</div>";

?>
<br><br><br><br><br><br><br><br><br>..