<?php require_once('../Connections/TRABAJO.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$colname_montajes = "-1";
if (isset($_GET['datepicker'])) {
  $colname_montajes = $_GET['datepicker'];
}
mysql_select_db($database_TRABAJO, $TRABAJO);
$query_montajes = sprintf("SELECT * FROM montajes WHERE datepicker = %s ORDER BY hora ASC", GetSQLValueString($colname_montajes, "text"));
$montajes = mysql_query($query_montajes, $TRABAJO) or die(mysql_error());
$row_montajes = mysql_fetch_assoc($montajes);
$totalRows_montajes = mysql_num_rows($montajes);
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>

 <link rel="stylesheet" type="text/css" href="css/default.css" />
	<link rel="stylesheet" type="text/css" href="css/jquery-ui-1.7.2.custom.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
<script type="text/javascript">
jQuery(function($){
	$.datepicker.regional['es'] = {
		closeText: 'Cerrar',
		prevText: '&#x3c;Ant',
		nextText: 'Sig&#x3e;',
		currentText: 'Hoy',
		monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio',
		'Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],
		monthNamesShort: ['Ene','Feb','Mar','Abr','May','Jun',
		'Jul','Ago','Sep','Oct','Nov','Dic'],
		dayNames: ['Domingo','Lunes','Martes','Mi&eacute;rcoles','Jueves','Viernes','S&aacute;bado'],
		dayNamesShort: ['Dom','Lun','Mar','Mi&eacute;','Juv','Vie','S&aacute;b'],
		dayNamesMin: ['Do','Lu','Ma','Mi','Ju','Vi','S&aacute;'],
		weekHeader: 'Sm',
		dateFormat: 'dd/mm/yy',
		firstDay: 1,
		isRTL: false,
		showMonthAfterYear: false,
		yearSuffix: ''};
	$.datepicker.setDefaults($.datepicker.regional['es']);
});    

        $(document).ready(function() {
           $("#datepicker").datepicker();
        });
    </script>


</head>

<body>
<table width="985" height="189" border="2">
  <tr>
    <th width="91" height="112" scope="col">BUSCAR MONTAJES POR FECHA</th>
    <th colspan="9" scope="col"><form action="index.php" method="get" name="form1" target="_self" id="form1">
        <label for="datepicker"></label>
        <input type="text" name="datepicker" id="datepicker" readonly="readonly" size="12" />
        <input type="submit" name="button" id="button" value="Enviar" />
    </form></th>
  </tr>
  <tr>
    <th scope="col">ID</th>
    <th width="167" scope="col">FECHA</th>
    <th width="167" scope="col">HORA</th>
    <th width="167" scope="col">EQUIPO</th>
    <th width="167" scope="col">EXPEDIENTE</th>
    <th width="167" scope="col">NOMBRE</th>
    <th width="167" scope="col">DIRECCION</th>
    <th width="167" scope="col">POBLACIÓN</th>
    <th width="167" scope="col">TELÉFONO</th>
    <th width="167" scope="col">OBSERVA</th>
  </tr>
  <tr>
    <?php do { ?>
      <th scope="col"><?php echo $row_montajes['id_montaje']; ?></th>
      <th scope="col"><?php echo $row_montajes['datepicker']; ?></th>
      <th scope="col"><?php echo $row_montajes['hora']; ?></th>
      <th scope="col"><?php echo $row_montajes['equipo']; ?></th>
      <th scope="col"><?php echo $row_montajes['num_expediente']; ?></th>
      <th scope="col"><?php echo $row_montajes['nom_cliente']; ?></th>
      <th scope="col"><?php echo $row_montajes['direccion']; ?></th>
      <th scope="col"><?php echo $row_montajes['poblacion']; ?></th>
      <th scope="col"><?php echo $row_montajes['tlf']; ?></th>
      <th scope="col"><?php echo $row_montajes['describe']; ?></th>
      <?php } while ($row_montajes = mysql_fetch_assoc($montajes)); ?>
  </tr>
</table>
</body>
</html>
<?php
mysql_free_result($montajes);
?>
