<?php $idn = $_GET['idn'];?>
<html>
  <head><title>Solicita descuento</title>
   <!-- Bootstrap Core CSS -->
    <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
	<link rel="stylesheet" type="text/css" href="bootstrap/css/stilosForm.css">
	<link rel="stylesheet" href="bootstrap/font-awesome/4.2.0/css/font-awesome.min.css" />
	<link href="bootstrap/css/sb-admin.css" rel="stylesheet">
	<script src="bootstrap/js/jquery.js"></script>
	<script src="bootstrap/js/bootstrap.min.js"></script>
	<script src="https://code.jquery.com/jquery-3.2.1.js" integrity="sha256-DZAnKJ/6XZ9si04Hgrsxu/8s717jcIzLy3oi35EouyE=" crossorigin="anonymous"></script>
    <!-- Custom CSS -->
	<!--script src="bootstrap/js/jquery320.min.js"></script-->
	<!--script src="bootstrap/js/bootstrap.min.js"></script-->
    <!-- Morris Charts CSS -->
    <!--<link href="bootstrap/css/plugins/morris.css" rel="stylesheet">-->
    <!-- Custom Fonts -->
   
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
	
			<!-- page specific plugin tables scripts -->
		<script src="bootstrap/js/jquery.dataTables.min.js"></script>
		<script src="bootstrap/js/jquery.dataTables.bootstrap.min.js"></script>
		<script src="bootstrap/js/dataTables.tableTools.min.js"></script>
		<script src="bootstrap/js/dataTables.colVis.min.js"></script> 
		<script type="text/javascript">
		// Solo permite ingresar numeros.
		function soloNumeros(e){
			var key = window.Event ? e.which : e.keyCode
			return (key >= 48 && key <= 57)
		}
		</script>
  </head>
  <body>
   
            <div class="container-fluid">
	            <h4 class="page-header">Solicitud de descuento</h4>
	        <div id="msg"></div>
		    <div class="recuadroFondo">
  
  
    <form name="desc" method="POST">
	  <div class="row">
	    <div class="form-group col-md-3">
			<label for="nombre">introduce el % de descuento (valores admitidos del 1 al 100)</label>
			<input type="text" name="porcentaje" class="form-control" onKeyPress="return soloNumeros(event)" maxlength="3" required>
	    </div>
	  </div>
	  <div class="row">
	    <div class="form-group col-md-3">
			<label for="nombre">Introduce el motivo por el cual solicitas el descuento</label>
			<textarea name="motivodesc"  rows="5" class="form-control" maxlength="300" required></textarea>
	    </div>
	  </div>
	  <div class="row">
		<div class="form-group col-md-6">
			<button type="submit" name="Guardar" class="btn btn-default">Solicitar</button>
		</div>
	  </div>
	</form>
	</div>
 </div>	
	
	<?php if(isset($_POST['Guardar'])){
		   extract($_POST);		   
		?>
           <script>
		    window.opener.document.forma.descsol<?php echo $idn;?>.value=<?php echo $porcentaje;?>;
		    window.opener.document.forma.motivodesc<?php echo $idn;?>.value="<?php echo $motivodesc;?>";
		    window.opener.document.forma.autorizadesc<?php echo $idn;?>.value=0;
		    window.opener.document.forma.solicitud<?php echo $idn;?>.value=1;
			alert("El descuento a sido solicitado cuando sea aprobado por direccion recibiras una notificacion");
			self.close(); 
		   </script>	
	<?php } ?>
  </body>
</html>