<?php
require("php_con.php");

if(isset($_COOKIE['user_id'])){
}
else{
	echo "<script>window.location='logout';</script>";
}

if(isset($_GET['q_id'])){
	$q_id=mysqli_real_escape_string($connation,$_GET['q_id']);
}
else{
	echo "<script>window.location='poin-of-sale';</script>";
}

if(isset($_POST['print_btn'])){
	$quotation_cus_name=mysqli_real_escape_string($connation,$_POST['quotation_cus_name']);
	$quotation_mobile=mysqli_real_escape_string($connation,$_POST['quotation_mobile']);
	$quotation_remark=mysqli_real_escape_string($connation,$_POST['quotation_remark']);
	if(mysqli_query($connation,"INSERT INTO
	quotation_details (qd_id, qd_bill_id, quotation_cus_name, quotation_mobile, quotation_remark, qd_c_date, qd_c_time, qd_user)
	VALUES (NULL, '$q_id', '$quotation_cus_name', '$quotation_mobile', '$quotation_remark', '$current_date', '$current_time', '$_COOKIE[user_id]')")){
		echo "<script>window.location='poin-of-sale?q_id=$q_id&re-print';</script>";
	}
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php echo $system_name; ?></title>
<link rel="stylesheet" href="cus_css.css">
	
<script src="data_table/js/jquery-3.5.1.js"></script>
<script src="data_table/js/jquery.dataTables.min.js"></script>
<script src="data_table/js/dataTables.bootstrap4.min.js"></script>
<link rel="stylesheet" href="data_table/css/bootstrap.css">
<link rel="stylesheet" href="data_table/css/dataTables.bootstrap4.min.css">
	
<link rel="stylesheet" href="alert/sweetalert2.min.css">
<script src="alert/sweetalert2.min.js"></script>
	
<link rel="stylesheet" href="icon/css/font-awesome.css">
<link rel="stylesheet" href="icon/css/font-awesome.min.css">
</head>

<body class="bg-light">
<script>
window.addEventListener("load",function(){
	var load_screen=document.getElementById('load_screen');
	document.body.removeChild(load_screen);
});
</script>

<div id="load_screen"><div id="loading"><img src="image/loading.gif" width="80px;"></div></div>
	
	
<div class="container">
  <div class="row mt-4">
		<div class="col-lg-4 col-sm-12 m-auto card p-2">					
			<form method="post" autocomplete="off">
			<table class="table table-sm table-borderless">
				<tbody>
					<tr>
					  <td colspan="2" align="center" valign="middle" style="background-color: black;" class="pb-0"><h1 class="font-weight-bold text-warning">New Quotation</h1></td>
				  </tr>
				  <tr>
					  <td colspan="2">&nbsp;</td>
				  </tr>
					<tr>
						<td valign="middle">Customer/Company</td>
					  <td valign="middle"><input name="quotation_cus_name" type="text" required="required" class="form-control form-control-sm" id="quotation_cus_name"></td>
					</tr>
					<tr>
					  <td valign="middle">Contact Number</td>
					  <td valign="middle"><input name="quotation_mobile" type="text" required="required" class="form-control form-control-sm" id="quotation_mobile"></td>
				  </tr>
					<tr>
					  <td valign="middle">Remark</td>
					  <td valign="middle">
						<textarea name="quotation_remark" rows="4" class="form-control form-control-sm" id="quotation_remark"></textarea>
					  </td>
				  </tr>
					<tr>
					  <td colspan="2">&nbsp;</td>
				  </tr>
					<tr>
						<td colspan="2" align="right">
							<button type="submit" name="print_btn" class="btn btn-sm btn-success">Print Quotation</button>
							<button type="button" class="btn btn-sm btn-danger" onClick="if(confirm('Are your sure close bill?')){window.location='poin-of-sale';}">Close Quotation</button>
						</td>
					</tr>
				</tbody>
			</table>
</form>
	  </div>
  </div>
</div>
	

</body>
</html>
<?php @mysqli_close($connation); ?>