<?php

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

//class SubhoraProgramado extends Conectar
class SubhoraProgramado
{
	
	private $ask_hprog_per=array();
	private $ask_hprog_mes=array();

		
	public function ask_hrsprog_per($con,$ugid,$anno,$mm,$idtp,$idj,$ids,$idso,$thora)
	{
		$sql="select ug_id from tb_subhoraprog".$anno." where ug_id='$ugid' and uap_anno='$anno' and uap_mes='$mm' and  tp_id='$idtp'  and hp_idserva='$idso' and hp_idserva not in ('$ids')  and j_id='$idj' and shp_tipohora='$thora'";
		//echo $sql."<br>";
		$res=mysqli_query($con, $sql);
		while ($reg=mysqli_fetch_assoc($res))
		{
			$this->ask_hprog_per[]=$reg;
		}
			return $this->ask_hprog_per;
	}
	
	public function ask_prog_mes($con,$anno,$mm,$idtp,$idj,$ids,$idga)
	{
		$sql="select ug_id from tb_subhoraprog".$anno." where ga_id='$idga' and uap_anno='$anno' and uap_mes='$mm' and  tp_id='$idtp'  and hp_idserva='$ids' and j_id='$idj' and (shp_numho + shp_numhe) > 0 limit 1";
		//echo $sql."<br>";
		$res=mysqli_query($con, $sql);
		while ($reg=mysqli_fetch_assoc($res))
		{
			$this->ask_hprog_mes[]=$reg;
		}
			return $this->ask_hprog_mes;
	}
	
	
}
?>