<?php
session_start();
if (!isset($_SESSION['nick'])){
 header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/index.php" );
}
 $fechai=date("d/m/Y");
 $fechat=date("d/m/Y");
include("emenux.php");
 //------INI-Coneccion Local
require ("conecta.php");
 //-----INI-Coneccion Local
 //Recibe descripcion
 $nick=$_SESSION['nick'];
 $sqlc="select * from m06006 where nick='$nick'";
 $resc=mysql_query($sqlc,$con) or die(mysql_error());
 $cont=0;
 if (mysql_num_rows($resc)>0){
  while($fila=mysql_fetch_row($resc)){//while
   $cont++;
  }//while
 }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<HEAD>

<TITLE>Entrada de Usuarios</TITLE>

<link rel="stylesheet" href="styles.css">
<script language="javascript" src="fstandar.js"></script>
<SCRIPT language=JavaScript>
function envia(){
 if (document.form1.fechai.value.length==10 && document.form1.fechat.value.length==10){
  document.form1.action="infcaja.php";
  document.form1.method="post";
  document.form1.submit();
  }else{
   window.alert("una o ambas fechas tienen error de formato");
  }
}//fin envia 
function validar(form1){
 if (document.form1.fechai.value.length < 8){
  alert("Escriba una fecha valida el campo \"Fecha Inicio\".");
  document.form1.fechai.style.backgroundColor="#FFFFCC";
  document.form1.fechai.focus();
  return (false);
 }
 if (document.form1.fechat.value.length < 8){
  alert("Escriba una fecha valida el campo \"Fecha Termino\".");
  document.form1.fechat.style.backgroundColor="#FFFFCC";
  document.form1.fechat.focus();
  return (false);
 }
 return (true);
}
function vefecha(num){
 
 if (event.keyCode==13){
  var fec = new String;
  if (num==1){
   fec=document.form1.fechai.value;  
  }else{
   fec=document.form1.fechat.value;  
  }
  if(fec.length==10){//si len
   var dia=new String;
   dia=fec.substr(0,2);
   var mes=new String;
   mes=fec.substr(3,2);
   var ano=new String;
   ano=fec.substr(6,4);
   var frase=new String;
   var frase="fecha";
   if (valida_fecha(mes,dia,ano,frase)==true){
    //window.alert("hola");
	if (num==1){
    document.form1.fechat.focus();
     }else{
    document.form1.action="infcaja.php";
	document.form1.method="post";
	document.form1.submit();
    } 
   }//valida_fecha   
  }else{
   window.alert("Largo de fecha " + num  + " no corresponde"); 
  }//fin si len
 }
}
//--></SCRIPT>
</HEAD>
<BODY>
<TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%" align=center 
border=0>
  <TBODY>
  <TR>
    <TD vAlign=center align=middle height="100%">
      <TABLE height=400 cellSpacing=0 cellPadding=0 width=718 border=0>
        <TBODY>
        <TR>
          <TD width="718" height=22>
            <TABLE height=22 cellSpacing=0 cellPadding=0 width="100%" 
              border=0><TBODY>
              <TR>
                <TD vAlign=top align=left width=24><A 
                  href="index.php"><IMG 
                  height=22 src="images/xc_left.gif" width=24 
                  border=0></A></TD>
                <TD vAlign=top align=left width="100%"><IMG height=22 
                  src="images/xc_center.gif" width="100%" 
                border=0></TD>
              <TD vAlign=top align=right width=24><IMG height=22 
                  src="images/xc_right.gif" width=24 
              border=0></TD></TR></TBODY></TABLE></TD></TR>
        <TR>
          <TD class=BottomTable vAlign=top 
          background=images/xc_stripes.gif height="100%">
            <TABLE class=IconsTable height=33 cellSpacing=0 cellPadding=0 
            width="100%" border=0>
              <TBODY>
              <TR>
                <TD height="32"><div align="right" class="larger">
                  <div align="right">Vemol</div>
                </div></TD>
                </TR></TBODY></TABLE>
            <TABLE cellSpacing=0 cellPadding=0 width="715" 
              border=0>
              <TBODY>
              <TR>
                <TD width=23 height=18>&nbsp;</TD>
                <TD vAlign=top align=left width=180 height=18>&nbsp;</TD>
                <TD width=12 height=18>&nbsp;</TD>
                <TD width="461" height=18 class=LeftMenu>Filtro de ventas: <span class="Emphasize"></span> </TD>
                <TD width=20 height=18>&nbsp;</TD></TR>
              <TR>
                <TD width=23 height="100%">&nbsp;</TD>
                <TD vAlign=top align=left width=180 height="100%">
                  <TABLE cellSpacing=0 cellPadding=0 width="150" border=0>
                    <TBODY>
                    <TR>
                      <TD width=10 align="left" valign="top"><IMG 
                        src="images/xc_dotgrey.gif" width=10 height=12 align="top"></TD>
                      <TD width=4>&nbsp;</TD>
                      <TD class=LeftMenu noWrap><p>Acciones Ventas por rango:<br />
                          <span class="LeftMenu">-Acceder a los datos filtrados.<br />
                          -Consultar detalles.</span><span class="LeftMenuHeaders"><br />
                          </span><br />
                          </p>
                        </TD>
                    </TR>
                    <TR>
                      <TD width=10 align="left" valign="top"><IMG height=12 
                        src="images/xc_dotgrey.gif" width=10></TD>
                      <TD width=4>&nbsp;</TD>
                      <TD valign="top" noWrap class=LeftMenu>Acciones de Administrador:<br /></TD>
                    </TR>
                    <TR>
                      <TD width=10><IMG height=12 
                        src="images/xc_dotgrey.gif" width=10></TD>
                      <TD>&nbsp;</TD>
                      <TD class=LeftMenu noWrap>&nbsp;</TD>
                    </TR></TBODY></TABLE></TD>
                <TD width=12 height="100%">&nbsp;</TD>
                <TD class=contentcell vAlign=top align=middle width=461 
                height="100%"><form id="form1" name="form1" method="post" onSubmit="return validar(this)" action="">
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <th colspan="4" scope="col">Busqueda Documentos </th>
                      </tr>
                    <tr>
                      <td scope="row"><label>
                        <div align="right" class="LeftMenu">Fecha Inicio:</div>
                        </label>                        </td>
                      <td><div align="left">
                        <input name="fechai" type="text" class="LeftMenu" id="fechai" onkeypress="vefecha(1)" value="<?php echo $fechai ?>" size="11" maxlength="11"/>
                      </div></td>
                      <td><div align="right" class="LeftMenu">Fecha termino: </div></td>
                      <td><div align="left">
                        <input name="fechat" type="text" class="LeftMenu" id="fechat" onkeypress="vefecha(2)" value="<?php echo $fechat ?>" size="11" maxlength="11"/>
                      </div></td>
                    </tr>
                    <tr>
                      <th scope="row">&nbsp;</th>
                      <td colspan="3"><input name="hdsw" type="hidden" id="hdsw" /></td>
                    </tr>
                    <tr>
                      <td colspan="4" scope="row"><label>
                        <div align="center">
                          <input name="filtrar" type="button" id="filtrar" value="Filtrar" onclick="envia()" />
&nbsp;                        </div>
                        </label></td>
                      </tr>
                  </table>
                </form>
                <p>&nbsp;</p>
                  </TD>
                <TD width=20 height="100%">&nbsp;</TD></TR>
              <TR>
                <TD width=23 height=8>&nbsp;</TD>
                <TD width=180 height=8>&nbsp;</TD>
                <TD width=12 height=8>&nbsp;</TD>
                <TD width="461" height=8>&nbsp;</TD>
        <TD width=20 
      height=8>&nbsp;</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY>
<!-- /Footer -->
<script language="JavaScript" src="menu.js"></script>
<script language="JavaScript" src="menu_tpl.js"></script>
<script language="JavaScript">
	new menu (MENU_ITEMS, MENU_POS);
</script>
	  </TABLE>
</BODY>
<?php
	mysql_close($con);
?>
</HTML>