<?php

include 'load.php';

?>
<?php /*
    $getReturnetailsQuery=$conn->query("SELECT COUNT(*) FROM tbl_return WHERE stat='0' ORDER BY return_id DESC");
    if ($GgrnQ=$getReturnetailsQuery->fetch_array()) {
        $ReturnOngoingCount=$GgrnQ[0];
    }
	*/
?>
<!-- new added -->

<!--  -->
<?php /* if($ReturnOngoingCount=='0'){ */?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
	<meta name="description" content="POS - Eat More Resturant   | Pos & Invetory System | Dashboard
">
	<meta name="keywords" content="Eat More Resturant   | Pos & Invetory System | Dashboard
">
	<meta name="author" content="Eat More Resturant   | Pos & Invetory System | Dashboard
">
	<meta name="robots" content="noindex, nofollow">

	<title>Home | Eat More Resturant   | Pos & Invetory System | Dashboard
</title>


	<?php
	require_once 'headercss.php';
	?>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
				<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.1.0-rc.0/js/select2.min.js"></script>
</head>
<body>
	<div id="global-loader">
		<div class="whirly-loader"> </div>
	</div>

	<div class="main-wrapper">
		<?php
		require_once 'header.php';
		?>

		<?php
		require_once 'navbar.php';
		?>
		<div class="page-wrapper">
			<div class="content">
				<div class="page-header">
					<div class="page-title">
						<h4>Create Sales Return</h4>
						<h6>Add/Update Sales Return</h6>
					</div>
				</div>
				<div class="card">
					<div class="card-body">
						<form id="Create-Return" action="sale_return.php" method="post" class="row">
							<div class="col-md-12">
								<label>Bill No/Order No.</label>
								<select name="orderid" class="form-control select2">
									<option value="">Select Order No</option>
										<?php $qry_new = mysqli_query($conn, "SELECT * FROM mobileorders");  
										if ($qry_new->num_rows > 0) {
											while($row = $qry_new->fetch_assoc()) { 
												echo "<option value='".$row['orid']."'>".$row['orid']." / ".$row['pay_option']." / Rs.".$row['amount']."</option>";
											} 
											
										} ?>
								</select>
								
							</div>
							<div class="col-md-12"><br>
								<button type="submit" class="btn btn-primary">Create Return Invoice</button>
							</div>
						</form>

					</div>
				</div>
			</div>
		</div>
	</div>
	<script>
	
	// Initialize Select2 plugin with typing search functionality
$('.select2').select2();
	
</script>

	<script src="assets/js/jquery-3.6.0.min.js"></script>

	<script src="assets/js/feather.min.js"></script>

	<script src="assets/js/jquery.slimscroll.min.js"></script>

	<script src="assets/js/jquery.dataTables.min.js"></script>
	<script src="assets/js/dataTables.bootstrap4.min.js"></script>

	<script src="assets/js/bootstrap.bundle.min.js"></script>

	<script src="assets/plugins/select2/js/select2.min.js"></script>

	<script src="assets/js/moment.min.js"></script>
	<script src="assets/js/bootstrap-datetimepicker.min.js"></script>

	<script src="assets/plugins/sweetalert/sweetalert2.all.min.js"></script>
	<script src="assets/plugins/sweetalert/sweetalerts.min.js"></script>
	<script src="assets/alertify/alertify.js"></script>
		<script src="assets/alertify/alertify.min.js"></script>

	<script src="assets/js/script.js"></script>
	<!-- <script src="process.js"></script> -->
	<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>

	<!-- <script>
        
        $(document).on('submit', '#Create-Return', function(e){
        e.preventDefault(); //stop default form submission
        var formData = new FormData($(this)[0]);

        $.ajax({

                beforeSend : function() {

                    Swal.fire({
                      title:'Info !',
                      icon:'info',
                      text:'Details is being sending...Please wait.',
                      showConfirmButton:false,
                      showCancelButton:false,
                      allowOutsideClick: false,
                    });

                },

                url:"post/create_return.php",
                type: 'POST',
                data: formData,
                //async: false,
                cache: false,
                contentType: false,
                processData: false,

                success: function (data) {

                    var json=JSON.parse(data);
                    if(json.result){
                        var j_id = json.j_id;

                        setTimeout(function () {
                        
                        window.location.href = "create_return_invoice?g="+j_id;
                       //location.reload();
                    },1000);

                    }else{
                        Swal.fire({
                        title:'Warning !',
                        icon:'warning',
                        text:'Something went wrong, please try again.'
                        });
                    }

                    

                }

            });

        return false;
        });
    </script> -->


</body>
</html>

<?php /* }else{ */ ?>

<?php /*
    $getReturnDetailsOngoingIdQuery=$conn->query("SELECT return_id FROM tbl_return WHERE stat='0' ORDER BY return_id DESC");
    if ($GRETDOrs=$getReturnDetailsOngoingIdQuery->fetch_array()) {
        $ReturnId=$GRETDOrs[0];
    }
	*/
?>
    <script>
    /*    window.location.href = "create_return_invoice?g=<?php /*  echo($ReturnId);*/ ?>";
    </script>

<?php /* } */ ?>