<?
ini_set('error_reporting',1);
session_start();
if ($_SESSION['estado'] != "ON")
		{
		?>
		<script>
			parent.location.href = 'index.php';
		</script>
		<? 
		exit();
		}
$id_empresa = $_SESSION['ss_empresa'];
$id_user = $_SESSION['ss_user'];
$id_autoriza=58;
?>
<?
/*Sesiones*/
include("../conex.php");
include("../autoriza.php");
if ($crear==0)  
{
?>
		<script>
		alert ("No Autorizado");
			parent.location.href = 'index.php';
		</script>
	<? 
	exit();
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Mantenimiento Descuentos</title>
<style type="text/css">
<!--
.Estilo11 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; }
body {
	background-color: #CCCCCC;
	margin-left: 0px;
	margin-top: 3px;
	margin-right: 0px;
	margin-bottom: 0px;
}
select {
	clear: right;
	float: left;
	height: auto;
	width: 267px;
}
-->
</style></head>

<body>
<script language="JavaScript" src="../css/cal.js" type="text/JavaScript"></script>

<form action="guarda.php" method="post" enctype="multipart/form-data" name="form1" target="_self">
  <div align="center">Crear nuevo Descuento</div>
  <table border="1" align="center" cellpadding="1" cellspacing="0">
  <tr>
    <td width="69">Nombre</td>
    <td width="290"><input name="nombre" type="text" class="textboxnormal" id="nombre" size="40" maxlength="40"></td>
  </tr>
    <tr>
    <td>Fecha Inicio</td>
             <td><input name="inicio" type="text" id="inicio" style="border-width:0;" /> <a  href="javascript:show_calendar('form1.inicio');"><img src="../Images/CALENDAR.gif" name="foto2" width="20" height="17" border="0" align="top" id="foto2" style="cursor:pointer" title="Presione aqui y seleccione la fecha" /></a></td>
     </tr>
    <tr>
    <td>Fecha Final</td>
    <td><input name="final" type="text" class="textboxnormal" id="final"><a  href="javascript:show_calendar('form1.final');"><img src="../Images/CALENDAR.gif" name="foto2" width="20" height="17" border="0" align="top" id="foto2" style="cursor:pointer" title="Presione aqui y seleccione la fecha" /></a></td>
  </tr>
   <tr>
    <td>Bodega</td>
    <td><?
			$sql_umed = "SELECT * FROM bodega ORDER BY descripcion";
			$res_umed = mysql_query($sql_umed,$enlace);
			$cont=0;
			?>
              <select name="lstbodega" id="lsbodega" style="width:267px">
              <option value="0" selected="selected">Bodega (Todas)</option>
			  <?
			  while (mysql_fetch_object ($res_umed))
				{
				$sql_umed_cod = mysql_result($res_umed, $cont, "id");
				$sql_umed_nom = mysql_result($res_umed, $cont, "descripcion");
			?>
                <option value="<?=$sql_umed_cod?>"><? echo $sql_umed_nom;?></option>
			<?
				$cont = $cont+1;
			}
			?>
              </select>
		</td>
  </tr>
    <tr>
    <td>Familia</td>
    <td><?
			$sql_umed = "SELECT * FROM familia ORDER BY descripcion";
			$res_umed = mysql_query($sql_umed,$enlace);
			$cont=0;
			?>
              <select name="lstfamilia" id="lsfamilia" style="width:267px">
              <option value="0" selected="selected">Familias(Todas)</option>
			  <?
			  while (mysql_fetch_object ($res_umed))
				{
				$sql_umed_cod = mysql_result($res_umed, $cont, "id");
				$sql_umed_nom = mysql_result($res_umed, $cont, "descripcion");
			?>
                <option value="<?=$sql_umed_cod?>"><? echo $sql_umed_nom;?></option>
			<?
				$cont = $cont+1;
			}
			?>
              </select>
		</td>
  </tr>
   <tr>
    <td>Segmento</td>
    <td><?
			$sql_umed = "SELECT * FROM segmentacion ORDER BY descripcion";
			$res_umed = mysql_query($sql_umed,$enlace);
			$cont=0;
			?>
              <select name="lstsegmento" id="lstsegmento" style="width:267px">
              <option value="0" selected="selected">Segmentos(Todos)</option>
			  <?
			  while (mysql_fetch_object ($res_umed))
				{
				$sql_umed_cod = mysql_result($res_umed, $cont, "id");
				$sql_umed_nom = mysql_result($res_umed, $cont, "descripcion");
			?>
                <option value="<?=$sql_umed_cod?>"><? echo $sql_umed_nom;?></option>
			<?
				$cont = $cont+1;
			}
			?>
              </select>
		</td>
  </tr>
   
</table>
  <div align="center">
    <input name="Submit" type="button" class="botones" value="GRABAR" onClick="enviar(form1)">
  </div>
</form>
</body>
</html>

<script type="text/javascript" src="../css/validarut.js"></script>
<script language="javascript">
var nav4 = window.Event ? true : false;
<!-- Ingreso solo letras -->
function valida(evt){
var key = nav4 ? evt.which : evt.keyCode;
	if (key==13) document.form1.txtrsoc.focus()
	return (key <= 13 || (key >= 48 && key <= 57));
	}

function enviar(form)
{
	if (form.nombre.value==0)
		{
		alert ("Ingrese descripcion")
		form.nombre.focus();
		return false;
		}
	if (form.inicio.value=='')
		{
		alert ("Ingrese fecha de inicio")
		form.inicio.focus();
		return false;
		}
		if (form.final.value=='')
		{
		alert ("Ingrese fecha de Termino")
		form.final.focus();
		return false;
		}
form.submit();	
}	  
</script>