<?php
 session_start(); 

	if(!isset($_SESSION['tulsilogin']))
	{
		header('Location: index.php');
		return;
	}
	date_default_timezone_set("Asia/Kolkata");
	$mdate= date('Y-m-d H:i:s');
	
	include("connect.php");
	
	
	
	$stiqmid=$_POST['stiqmid'];
	$eve2 = "select imid from res_studentinquiry_detail where stiqmid=$stiqmid";
	$re2 = mysqli_query($conn, $eve2);
	while($rt2 = mysqli_fetch_assoc($re2))

	{
		$imid = $rt2['imid'];
	}
	$ptype='Application';
	
		$clgappmid = $_POST['clgappmid'];
		$packagemid =0;
	
	$isremark=$_POST['isremark'];
	$packagefees=$_POST['packagefees'];
	$spaymenttype='Full Payment';
	$servicepayamount=$_POST['packagefees'];
	$paycurrency=$_POST['paycurrency'];
	$paycurrencyvalue=$_POST['paycurrencyvalue'];
	
									
									
	
	$codaddedby=$_SESSION['umid'];
	$codaddedtype=$_SESSION['utype'];
	
	  $eve2 = "insert into res_inquiryservice_detail (imid,isaddedby,isaddedon,isupdatedby,isupdatedon,stiqmid,ispendingamount,isremark,packagemid,packagefees,servicefinalrate,spaymenttype,servicepayamount,linkmid,ptype) values ($imid,$codaddedby,'$mdate',$codaddedby,'$mdate','$stiqmid','$packagefees','$isremark','$packagemid','$packagefees','$packagefees','$spaymenttype','$servicepayamount','$clgappmid','$ptype')";

	if ($conn->query($eve2) === TRUE)
	{
		$isdid = $conn->insert_id;
		$eve1 = "INSERT INTO res_payments_detail (imid,isdid, paidamount,pdaddedon,pdaddedby,pdupdatedon,pdupdatedby,paycurrency,paycurrencyvalue) VALUES('$imid','$isdid','$servicepayamount','$mdate','$codaddedby','$mdate','$codaddedby','$paycurrency','$paycurrencyvalue')";
		$re1 = mysqli_query($conn, $eve1);
		
		
		
	}
	
	
		
	
	$_SESSION['msg'] = "Inquiry Status Changed";
	header("Location: applicationinquirydetail.php?id=$stiqmid");

?>	