<?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);
?>
<!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 type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<title>Box Gestacion</title>
<script type="text/javascript">
function irAFicha(id)
{
this.location.href="vistaInteriorAnimal.php?valor="+id;
}
function vaciarGestacion(id)
{
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.frmBoxGestacion.action="interiorBoxGestacion.php?accion=vaciarGestacion&id="+id+"&valor="+id;
document.frmBoxGestacion.submit();
document.reload();
}
}
/*
*
* */
function guardar(id)
{
alert("Dentro de guardar gestacion Box vale"+id);
document.frmBoxGestacion.action="interiorBoxGestacion.php?accion=guardarGestacion&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 if($valores['boxes'][0]['crotal']==0 || $valores['boxes'][0]['crotal']==null){echo "";}
else{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: 12px;">
<?php
$Disabled= "";
if(isset($valores['boxes'][0]['crotalMadre']) &&
($valores['boxes'][0]['crotalMadre']!=0)&&
(trim($valores['boxes'][0]['crotalMadre'])!=""))
{
$Disabled="Enabled";
}else
{
$Disabled= "Disabled";
}
?>
<button <?php echo ($Disabled) ?> style="width: 20px;height: 20px;"
onclick="javascript:irAFicha(<?php echo $valores['boxes'][0]['crotalMadre']?>)">
<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: 8px;width: 150px;">
</td>
</tr>
<tr>
<td>
<label>
Inseminacion
</label>
<input name="fchInse" value="<?php echo $valores['boxes'][0]['fechaInse1']?>"
style="width: 150px; margin-left: 33px" 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: 33px;width: 150px;">
</td>
<td>
<label>
Recelo 2
</label>
<input name="fchRecelo2" value="<?php echo $valores['boxes'][0]['fechaEntrada']?>" type="date"
style="margin-left: 42px;width: 150px;">
</td>
<td>
<label>
Recelo 3
</label>
<input name="fchRecelo3" value="<?php echo $valores['boxes'][0]['fechaEntrada']?>" type="date"
style="margin-left: 42px;width: 150px;">
</td>
</tr>
<tr>
<td>
<div id="resultado" HIDDEN="hidden">
<?php
//Estado actual del embarazo.
//$estadoEmbarazo =$valores['boxes'][0]['estadoEmbarazo'];
$estadoEmbarazo =$_POST["estadoEnviado"];
echo "ESTADO ACTUAL DEL EMBARAZO".$estadoEmbarazo;
?>
</div>
<label style="margin-right: 35px;">
Embarazada
</label>
<label>Si</label>
<input name="estado" type="radio" value="1" style="margin-right:15px;' title="Si" checked=''"" onclick="javascript:marcaEstado(1)">
<label>No</label>
<input name="estado" type="radio" value="0" style="margin-right:15px;' title="No" checked=''"" onclick="javascript:marcaEstado(0)">
<label>No lo se</label>
<input name="estado" type="radio" value="2" style="margin-right:15px;' title="No lo se" checked=''"" onclick="javascript:marcaEstado(2)">
<label>No</label>
<?php if($valores['boxes'][0]['estadoEmbarazo']==0)
{echo "<input name='estado'type='radio' value='0' style='margin-right:15px;' title='No' checked='checked='";}
else{echo "<input name='estado'type='radio' value='0' style='margin-right:15px;' title='No'";}?>
<label>No le se</label>
<?php if($valores['boxes'][0]['estadoEmbarazo']==2)
{echo "<input name='estado'type='radio' value='2' style='margin-right:15px;' title='No lo se' checked='checked='";}
else{echo "<input name='estado'type='radio' value='2' style='margin-right:15px;' title='No lo se'";}?>
</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:vaciarGestacion(<?php echo $valorEntrada?>)">
<input type="button" title="Vaciar" value="Vaciar">
</a>
</td>
</tr>
</table>
</fieldset>
</div>
</div>
</body>
</html>