<?php

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

//class TipoPersonal extends Conectar
class TipoPersonal 
{
	
	private $lis_tp1=array();
	private $lis_tp2=array();
	private $lis_tp3=array();
	
	public function buscar_tipoper($con,$idtp)
	{
		$sql="select tp_id as id, tp_desc as nom from tb_tipoperson where tp_id='$idtp'";
		$res=mysqli_query($con, $sql);
		while ($reg=mysqli_fetch_array($res))
		{
			$this->lis_tp1[]=$reg;
		}
			return $this->lis_tp1;
	}
	
	public function buscar_tipoper_dep($con,$idj,$ids)
	{
		
		$sql="select b.tp_id as id, b.tp_desc as nom from tb_areatipopersona a inner join tb_tipoperson b on a.tp_id=b.tp_id where a.j_id='$idj' and a.s_id='$ids'";
		$res=mysqli_query($con,$sql);
		//echo $sql."<br>"; 
		while ($reg=mysqli_fetch_array($res))
		{
			$this->lis_tp2[]=$reg;
		}
			return $this->lis_tp2;
	}
	
	public function buscar_tipoper_detalle($con,$ugid)
	{
		$sql="SELECT a.tp_id as id, b.tp_desc as nom FROM tb_usudep a inner join tb_tipoperson b on a.tp_id=b.tp_id where a.ug_id='$ugid' order by a.ud_id desc limit 1";
		$res=mysqli_query($con, $sql);
		while ($reg=mysqli_fetch_array($res))
		{
			$this->lis_tp3[]=$reg;
		}
			return $this->lis_tp3;
	}
	
	
}
?>