<?php
/**
* Created by JetBrains PhpStorm.
* User: Victor Bachiller
* Date: 6/08/14
* Time: 18:24
* To change this template use File | Settings | File Templates.
*/
require_once("cuadricula.php");
require_once("includeBoxGestacion.php");
if($_GET["valor"]!=null)
{
$valorEntrada= $_GET["valor"];
}
$valores=poblarBoxGestacion($valorEntrada);
?>
<div id="resultado" hidden="hidden">
<?php
//Estado actual del embarazo.
//$estadoEmbarazo =$valores['boxes'][0]['estadoEmbarazo'];
$estadoEmbarazo =$_POST["estadoEnviado"];
//echo "".$estadoEmbarazo;
?>
</div>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="estilos.css"/>
<script type="text/javascript" src="js/cambiarPestanna.js"></script>
<script src="js/jquery-1.11.1.js"></script>
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<title></title>
<script type="text/javascript">
function vaciar()
{
if(confirm("Esta seguro de que desea vaciar los controles"))
{
var controles= document.getElementById("controlesGestacion").getElementsByTagName("input");
for(i=0;i<controles.length;i++)
{
controles[i].value="";
}
document.reload();
}
}
function guardar(id)
{
//alert("Dentro de guardar gestacion Box vale"+id);
document.frmBoxGestacion.action="interiorBoxGestacion.php?accion=guardar&id="+id+"&valor="+id;
document.frmBoxGestacion.submit();
//alert("Se ha guardardo");
document.reload();
}
var estadoActual=1234;
function marcarEstadoInicial(estado)
{
estadoActual=estado;
//alert("holaaaaaa");
//alert("Estado inicial vale"+estadoActual);
switch (estado)
{
case 1:
document.frmBoxGestacion.estado[0].checked=true;
document.frmBoxGestacion.estado[1].checked=false;
document.frmBoxGestacion.estado[2].checked=false;
break;
case 0:
document.frmBoxGestacion.estado[0].checked=false;
document.frmBoxGestacion.estado[1].checked=true;
document.frmBoxGestacion.estado[2].checked=false;
break;
case 2:
document.frmBoxGestacion.estado[0].checked=false;
document.frmBoxGestacion.estado[1].checked=false;
document.frmBoxGestacion.estado[2].checked=true;
break;
}
$.ajax({
data: {estadoEnviado: estadoActual},
url: 'interiorBoxGestacion.php',
type: 'post',
/*beforeSend: function () {
$("#resultado").html("Procesando, espere por favor...");
},*/
success: function (response) {
$("#resultado").html(response);
}
});
}
/*
* Funciona para marcar el estado en que se encuentra madre actualmente.
*/
function marcaEstado(estado)
{
estadoActual=estado;
alert("Por que lo dice Kami"+estadoActual);
$.ajax({
data: {estadoEnviado: estadoActual},
url: 'interiorBoxGestacion.php',
type: 'post',
beforeSend: function () {
$("#resultado").html("Procesando, espere por favor...");
},
success: function (response) {
$("#resultado").html(response);
}
});
}
</script>
</head>
<body onload="javascript:marcarEstadoInicial(<?php echo $valores['boxes'][0]['estadoEmbarazo']?>);" style="align:center;">
<div class="contenedor">
<div class="titulo">GestionaTuFinca.com</div>
<div id="pestanas">
<ul id=lista>
<li id="pestana1"><a href='index.php' >Salas</a></li>
<li id="pestana2"><a href='silosVistaSilos.php'>Silos</a></li>
<li id="pestana3"><a href='Animales.php'>Animales</a></li>
</ul>
</div>
<body>
<div id="contenidopestanas">
<div id="cpestana1">
<fieldset>
<legend>BoxGestacion</legend>
<label>
<?php
echo "Box:".$valorEntrada;
$valores=poblarBoxGestacion($valorEntrada);
?>
</label>
<div id="controlesGestacion">
<form name="frmBoxGestacion" enctype="multipart/form-data" action="" method="post">
<table style="margin-top: 20px;border:black,10px;border-width: 2px;">
<tr>
<td style="text-align: left;">
<label>
Crotal
</label>
<input name="crotal" value="<?php echo $valores['boxes'][0]['crotal']?>" style="width: 150px;text-align: left;margin-left: 80px;">
</td>
<td>
<label>
Crotal Madre
</label>
<input name="crotalMadre" value="<?php echo $valores['boxes'][0]['crotalMadre']?>" style="width: 150px;text-align: left;margin-left: 6px;">
<button title="Ir" style="text-align:left;height: 20px;">
<label>Ir</label>
</button>
</td>
</tr>
<tr style="margin-left: 0px;">
<td style="text-align: left;">
<label>
Fecha de Entrada
</label>
<input type="date" name="fchEntrada" value="<?php echo $valores['boxes'][0]['fechaEntrada']?>" id="fechaEntrada"
style="margin-left: 11px;width: 150px;">
</td>
</tr>
<tr>
<td>
<label>
Inseminacion
</label>
<input name="fchInse" value="<?php echo $valores['boxes'][0]['fechaInse1']?>" style="width: 150px; margin-left: 40px" type="date">
</td>
<td>
<label>
Inseminacion 2
</label>
<input name="fchInse2" value="<?php echo $valores['boxes'][0]['fechaInse2']?>" style="width: 150px;" type="date">
</td>
<td>
<label>
Inseminacion 3
</label>
<input name="fhcInse3" value="<?php echo $valores['boxes'][0]['fechaInse3']?>" style="width: 150px;" ty type="date">
</td>
</tr>
<tr>
<td>
<label>
Fecha Recelo
</label>
<input name="fchRecelo" value="<?php echo $valores['boxes'][0]['fechaEntrada']?>" type="date" style="margin-left: 35px;width: 150px;">
</td>
<td>
<label>
Recelo 2
</label>
<input name="fchRecelo2" value="<?php echo $valores['boxes'][0]['fechaEntrada']?>" type="date" style="margin-left: 36px;width: 150px;">
</td>
<td>
<label>
Recelo 3
</label>
<input name="fchRecelo3" value="<?php echo $valores['boxes'][0]['fechaEntrada']?>" type="date" style="margin-left: 36px;width: 150px;">
</td>
</tr>
<tr>
<td>
<label style="margin-right: 35px;">
Embarazada
</label>
<input name="estado" type="radio" checked="" value="1" title="Si">Si
<input name="estado" type="radio" checked="" value="0" >No
<input name="estado" type="radio" checked="" value="2" >No lo se
<input type="hidden" name="estEmbarazo" id="estEmbarazo" value="<?php echo $estadoEmbarazo; ?>">
</td>
</tr>
</table>
</form>
</div>
<table style="padding-left: 350px;text-align: center;">
<tr>
<td>
<a href="javascript:guardar(<?php echo $valorEntrada?>)">
<input type="button" title="Guardar" value="Guardar">
</a>
<a href="VistaGestacion.php">
<input type="button" enable title="Volver" value="Volver">
</a>
<a href="javascript:vaciar()">
<input type="button" title="Vaciar" value="Vaciar">
</a>
</td>
</tr>
</table>
</fieldset>
</div>
</div>
</body>
</html>