include("../conexion.php");
$n_predio = $_GET['n_predio'];
$fec_past_d = $_GET['f_desde'];
$fec_past_h = $_GET['f_hasta'];
$fec_past_v = $_GET['f_veces'];
$f_past_d = $anio."-".$mes."-".$dia;
$f_past_h = $anio2."-".$mes2."-".$dia2;
if(($f_past_d == "--") || ($f_past_h == "--")){
echo "<center style='sans-serif; font-size:13px; color:#000; font-weight: bold;'><br>Debe indicar un rango de fechas.<br></center>";
}
//si no exiaten las fechas muestra la tabla en blanco
else {
$sql ="select predio_cort, potrero_cort, DATE_FORMAT(f_cort,'%d/%m/%Y'), periodo, vacas_cort, tipo_vacas, ua_cort from corte where predio_cort=$n_predio and f_cort between '$f_past_d' and '$f_past_h' order by f_cort asc";
//echo "$sql";
or
die ("Fallo en la consulta"); if ($nfilas =="")
{
//====== PARTE FIJA DE LA TABLA ========================
$salida = "<TABLE border='0' style='border:1px #999999 solid; font-size:13px;' cellpadding='0' cellspacing='0' width='700' align='center'>";
$salida.= " <TR>";
$salida.= " <TD style='background-color:#EF2B2D; color:#fff; height:30px;'> Fecha</TD>";
$salida.= " <TD style='background-color:#EF2B2D; color:#fff; height:30px;'> Nombre Potrero</TD>";
$salida.= " <TD style='background-color:#EF2B2D; color:#fff; height:30px;'> Periodo</TD>";
$salida.= " <TD style='background-color:#EF2B2D; color:#fff; height:30px;'> Vacas</TD>";
$salida.= " <TD style='background-color:#EF2B2D; color:#fff; height:30px;'> Tipo</TD>";
$salida.= " <TD style='background-color:#EF2B2D; color:#fff; height:30px;'>U. A.</TD>";
$salida.= " </TR>";
//=========== PARTE DINAMICA DE LA TABLA ===============
//Imprimir los registros
for ($i=0; $i<=$nfilas-1; $i++)
{
$nro = $i + 1;
$tab = $tab + 1;
$fecha = $res["2"];
$select_res ="<select name='select_0$nro' id='select_0$nro' class='nom' tabindex='".($tab+1)."' disabled>";
$sql2 ="select * from potreros where predio_potr=$n_predio and orden_potr<>0 order by orden_potr asc";
{
$select_res.="<option value='".$ress["nombre_potr"]."' ";
if($ress["nombre_potr"]==$res[1])
$select_res.= "selected='selected'";
$select_res.= ">".$ress["nombre_potr"]."</option>";
}
$select_res.= "</select>";
//-------------------------
$select_peri= "<select class='periodo' disabled>";
$sqlp ="select * from periodo";
{
$select_peri.="<option value='".$resp["id"]."'";
if($resp["id"]==$res["periodo"])
$select_peri.= "selected='selected'";
$select_peri.= ">".$resp["periodo"]."</option>";
}
$select_peri.= "</select>";
//-----------------------//
$select_tipo= "<select class='tipo' disabled>";
$sqlt ="select * from tipo_vacas";
{
$select_tipo.="<option value='".$rest["id"]."'";
if($rest["id"]==$res["tipo_vacas"])
$select_tipo.= "selected='selected'";
$select_tipo.= ">".$rest["tipo"]."</option>";
}
$select_tipo.= "</select>";
//-----------------------//
$salida.= " <TR>";
$salida.= "<TD><input type='text' class='fecha' value='".$fecha."' maxlength='10' disabled></TD>";
$salida.= "<TD>$select_res</TD>";
$salida.= "<TD>$select_peri</TD>";
$salida.= "<TD><input type='text' class='vacas' value='".$res["vacas_cort"]."' disabled></TD>";
$salida.= "<TD>$select_tipo</TD>";
$salida.= "<TD><input type='text' class='ua' value='".$res["ua_cort"]."' disabled></TD>";
$salida.= " </TR>";
}
$fecha_i="$f_past_d";
$fecha_f="$f_past_h";
$periodo = $res["3"];
$fecha_ini=strtotime("$fecha_i + 0 days");//fecha inicio for($if=$fecha_ini; $if<=$fecha_fin; $if+=86400){
for($j=1;$j<=$fec_past_v;$j++){
$i2++;
$j2++;
$nro2 = $i2 + 2;
$tab2 = $j2 + 1;
$out="<input type='text' value='".date("d/m/Y", $if)."' class='fecha' name='fecha_past_0$nro2' id='fecha_past_0$nro2' tabindex='".($tab2+1)."'>"; $sql ="select * from potreros where predio_potr=$n_predio and orden_potr<>0 order by orden_potr asc";
$out2 ="<select name='select_0$nro2' id='select_0$nro2' class='nom' tabindex='".($tab2+1)."'>";
$out2.="<option value='0'>Seleccione...</option>";
$out2.= "<option value='".$fila['2']."'>".$fila['2']."</option>";
}
$out2.= "</select>";
$out3="<select class='periodo' name='select_peri_0$nro2' id='select_peri_0$nro2' onBlur='peri(this.id)' tabindex='".($tab2+1)."'>
<option value=0>Seleccione...</option>
<option value=1>A.M.</option>
<option value=2>P.M.</option>
</select>";
$out4="<input type='text' name='vacas_past_0$nro2' id='vacas_past_0$nro2' class='vacas' tabindex='".($tab2+1)."'>";
$out5="<select class='tipo' name='select_tipo_0$nro2' id='select_tipo_0$nro2' class='tipo' onBlur='calc_past(this.id)' tabindex='".($tab2+1)."'>
<option value=0>Seleccione...</option>
<option value=1>Lote 1</option>
<option value=2>Lote 2</option>
<option value=3>Lote 3</option>
<option value=4>Secas</option>
<option value=5>Vaquillas</option>
<option value=6>Enfermas</option>
</select>";
$out6="<input type='text' name='ua_past_0$nro2' id='ua_past_0$nro2' class='ua' tabindex='".($tab2+1)."'>";
$salida.= " <TR>";
$salida.= " <TD>$out</TD>";
$salida.= " <TD>$out2</TD>";
$salida.= " <TD>$out3</TD>";
$salida.= " <TD>$out4</TD>";
$salida.= " <TD>$out5</TD>";
$salida.= " <TD>$out6</TD>";
$salida.= " </TR>";
}}
$salida.= " </TABLE>";
echo $salida."**".$res[6];