<?php

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

//class Area extends Conectar
class TipoContrato
{

	private $b_tc1=array();
	private $b_tc2=array();
	private $b_tc3=array();


		public function buscar_tipocontrato($con)
		{
			$sql="select tc_idcont as id, tc_abrev as abrev, tc_desccont as nom, tc_hrsprog as tthoras,
			tc_diasvaca as ndvaca from tb_tipocont";
			$res=mysqli_query($con, $sql);
				while ($reg=mysqli_fetch_assoc($res))
				{
					$this->b_tc1[]=$reg;
				}
					return $this->b_tc1;
		}

		public function buscar_tipocontratoxid($con,$idtc)
		{
			$sql="select tc_idcont as id, tc_abrev as abrev, tc_desccont as nom, tc_hrsprog as tthoras,
			tc_diasvaca as ndvaca from tb_tipocont where tc_idcont='$idtc'";
			$res=mysqli_query($con, $sql);
				while ($reg=mysqli_fetch_assoc($res))
				{
					$this->b_tc2[]=$reg;
				}
					return $this->b_tc2;
		}

		public function buscar_ultimotipocontratoxid($con,$idtc)
		{
			$sql="select tc_idcont as id, tc_abrev as abrev, tc_desccont as nom, tc_hrsprog as tthoras,
			tc_diasvaca as ndvaca from tb_tipocont where tc_idcont='$idtc' order by tc_idcont desc limit 1";
			$res=mysqli_query($con, $sql);
				while ($reg=mysqli_fetch_assoc($res))
				{
					$this->b_tc3[]=$reg;
				}
					return $this->b_tc3;
		}

		public function registrar_tipocontrato($con,$idtc,$abrev,$nom,$tthoras,$ndvaca)
		{
			$sql ="insert into tb_tipocont value('$idtc','$abrev','$nom','$tthoras','$ndvaca')";
			$res=mysqli_query($con, $sql);
		}


    public function modificar_tipocontrato($con,$idtc,$abrev,$nom,$tthoras,$ndvaca)
		{
			$sql ="update tb_tipocont set tc_abrev= '$abrev', tc_desccont = '$nom',tc_hrsprog = '$tthoras',tc_diasvaca = '$ndvaca'
      where tc_idcont='$idtc'";
			$res=mysqli_query($con, $sql);
		}


		public function eliminar_idhxarea($con,$idtc)
		{
			$sql="delete from tb_modelo where tc_idcont='$idtc'";
			$res=mysqli_query($con, $sql);
		}


	}

?>
