<?php

//require_once("class.conectar.php");

//class SubhoraEjecutado extends Conectar
class SubhoraEjecutado
{
	
	private $ask_hrsprog=array();

	
	public function ask_hrseje_per($con,$ugid,$anno,$mm,$idtp,$idj,$ids,$idso,$thora)
	{
		$sql="select ug_id from tb_subhoraeje".$anno." where ug_id='$ugid' and uap_anno='$anno' and uap_mes='$mm' and  tp_id='$idtp'  and he_idserva='$idso' and he_idserva not in ('$ids')  and j_id='$idj' and she_tipohora='$thora'";
		//echo $sql."<br>";
		$res=mysqli_query($con, $sql);
		while ($reg=mysqli_fetch_assoc($res))
		{
			$this->ask_hrsprog[]=$reg;
		}
			return $this->ask_hrsprog;
	}
	
	public function ask_eje_mes($con,$anno,$mm,$idtp,$idj,$ids,$idga)
	{
		$sql="select ug_id from tb_subhoraeje".$anno." where ga_id='$idga' and uap_anno='$anno' and uap_mes='$mm' and  tp_id='$idtp'  and he_idserva='$ids' and j_id='$idj' and (she_numho + she_numhe) > 0 limit 1";
		//echo $sql."<br>";
		$res=mysqli_query($con, $sql);
		while ($reg=mysqli_fetch_assoc($res))
		{
			$this->ask_hrsprog[]=$reg;
		}
			return $this->ask_hrsprog;
	}
	
	
}
?>