<?php

//Clase de Paises
class clase
{
  	var $nom_tabla = 'valeryus19';
        var  $n_reg = '0';
	var  $fcodtarifa = '0';
	var  $fnumres = '0';
	var  $fnumcto = '0';
	var  $fnumctos = '0';
	var  $fnumadu = '0';
	var  $fnummenor = '0';
	var  $ffecllegada = '0';
	var  $ffecsalida = '0';
	var  $ffecalt = '0';
	var  $status = '0';
	var  $tus = '0';
	var  $estact = '0';
	var  $ftipocto = '0';
	//datos
	var  $fcodgrupo = '0';
	var  $fcodagen = '0';
	var  $fcodmeca = '0';
	var  $fplan = '0';
	var  $smerf = '0';
	var  $fnorasvip = '0';
	var  $fhorallega = '0';
	var  $codseg = '0';
	var  $tex = '0';
	var  $tex2 = '0';
	var  $tex3 = '0';
	var  $tex4 = '0';
	var  $tex5 = '0';
	var  $tex6 = '0';
	var  $text1 = '0';
	var  $text2 = '0';
	var  $text3 = '0';
	var  $text4 = '0';
	var  $text5 = '0';
	var  $text6 = '0';
	var  $ftotal = '0';
	
	//forma de pago
	var  $fformpago = '0';
	var  $fnumtar = '0';
	var  $fsaldo = '0';
	var  $flimite = '0';
	var  $fcodseg = '0';
	var  $fdeposito = '0';
	//direccion
	var  $fnombre = '0';
	var  $fapellido = '0';
	var  $flengua = '0';
	var  $fempresa = '0';
	var  $ftelefono = '0';
	var  $fvip = '0';
	var  $femail = '0';
	var  $fmail = '0';
	var  $fdireccion = '0';
	var  $fgntd = '0';
	var  $fcp = '0';
	var  $fpais = '0';
	var  $festado = '0';
	var  $fciudad = '0';
	var  $fvehiculo = '0';
	var  $fplacas = '0';
	var  $ftelemp = '0';
	var  $ftiphuesped = '0';
	
	//extras
	var  $fnumadulx = '0';
	var  $fnummenorx = '0';
	var  $ftarifaxa = '0';
	var  $ftarifaxm = '0';
	var  $fmonadu = '0';
	var  $fmonmen = '0';
	//DEPOSITOS
	
//Funcion de Revicion
	function revisar(){
		$sql = "SELECT * FROM $this->nom_tabla WHERE n_reg = '$this->n_reg' or n_reg = '$this->n_reg'";
	   	$result = mysqli_query($GLOBALS['con'] ,$sql);
	   	$num_salidas=mysqli_num_rows($result); 
		if($num_salidas>=1){
			return "ok";
		}else{
			$error = 'Error N:' . mysqli_errno($GLOBALS['con']) . ": " . mysqli_error($GLOBALS['con']);
			return "$error()";  
		}
	}
//Funcion de Agregar
	function agregar(){
		$sql = "insert into $this->nom_tabla (fnumres, fcodtarifa, fnumcto, fmuncto, ffecllegada, ffecsalida, fnumadu, fnummenor, fcodgrupo, fcodagen, fcodmeca, fplan, smerf, fnorasvip, fnombre, fapellido, flengua, fempresa, ftelefono, fvip, femail, fmail, fdireccion, fformpago, fnumtar, fsaldo, flimite, fcodseg, fgntd, fcp, fpais, festado, fciudad, fnumadulx, fnummenorx, ftarifaxa, ftarifaxm, fmonadu, fmonmen, fdeposito, fhorallega, fnumctos, ffecalt, status, estact, fvehiculo, fplacas, ftelemp, codseg, ftipocto, tex, tex2, tex3, tex4, tex5, tex6, text1, text2, text3, text4, text5, text6, ftotal, ftiphuesped, tus, fusualta, folio, alta_huesped)values('$this->fnumres','$this->fcodtarifa','$this->fnumcto','$this->fnumcto', '".date('Y-m-d')."', '$this->ffecsalida','$this->fnumadu','$this->fnummenor','$this->fcodgrupo','$this->fcodagen','$this->fcodmeca','$this->fplan','$this->smerf','$this->fnorasvip','$this->fnombre','$this->fapellido','$this->flengua','$this->fempresa','$this->ftelefono','$this->fvip','$this->femail','$this->fmail','$this->fdireccion','$this->fformpago','$this->fnumtar','$this->fsaldo','$this->flimite','$this->fcodseg','$this->fgntd','$this->fcp','$this->fpais','$this->festado','$this->fciudad','$this->fnumadulx','$this->fnummenorx','$this->ftarifaxa','$this->ftarifaxm','$this->fmonadu','$this->fmonmen','$this->fdeposito','$this->fhorallega','$this->fnumctos', '".date('Y-m-d')."', '$this->status','$this->estact','$this->fvehiculo','$this->fplacas','$this->ftelemp','$this->codseg','$this->ftipocto', '$this->tex', '$this->tex2', '$this->tex3', '$this->tex4', '$this->tex5', '$this->tex6', '$this->text1', '$this->text2', '$this->text3', '$this->text4', '$this->text5', '$this->text6', '$this->ftotal', '$this->ftiphuesped', '$this->tus', '".$_SESSION['usuario']."', '$this->folio', '".$_SESSION['usuario']."')";
	   	$result = mysqli_query($GLOBALS['con'] ,$sql);
		if ($result){
			return "ok";
		}else{
			$error = 'Error N:' . mysqli_errno($GLOBALS['con']) . ": " . mysqli_error($GLOBALS['con']);
			return "$error()";  
		}
	}
//Funcion de Lista Completa
	function lista_completa(){
		$sql= "SELECT * FROM $this->nom_tabla";
		$lista = mysqli_query($GLOBALS['con'] ,$sql);
		if ($lista){
			return $lista;
		}else{
			$error = 'Error N:' . mysqli_errno($GLOBALS['con']) . ": " . mysqli_error($GLOBALS['con']);
			return "$error()";  
		}
	}
//Funcion de Lista con Busqueda
	function lista_busqueda($n_reg){
		$sql= "SELECT * FROM $this->nom_tabla WHERE n_reg = '$n_reg'";
		$lista = mysqli_query($GLOBALS['con'] ,$sql);
		if ($lista){
			return $lista;
		}else{
			$error = 'Error N:' . mysqli_errno($GLOBALS['con']) . ": " . mysqli_error($GLOBALS['con']);
			return "$error()";   
		}
	}
//Funcion de Modificar
	function modificar($n_reg){
		$sql = "UPDATE $this->nom_tabla SET fnumres = '$this->fnumres',fcodtarifa = '$this->fcodtarifa',fnumcto= '$this->fnumcto', ffecllegada= '$this->ffecllegada', ffecsalida= '$this->ffecsalida', fnumadu= '$this->fnumadu', fnummenor= '$this->fnummenor', fcodgrupo= '$this->fcodgrupo', fcodagen= '$this->fcodagen', fcodmeca= '$this->fcodmeca', fplan= '$this->fplan', smerf= '$this->smerf', fnorasvip= '$this->fnorasvip', fnombre= '$this->fnombre', fapellido= '$this->fapellido', flengua= '$this->flengua', fempresa= '$this->fempresa', ftelefono= '$this->ftelefono', fvip= '$this->fvip', femail= '$this->femail', fmail= '$this->fmail', fdireccion= '$this->fdireccion', fformpago= '$this->fformpago', fnumtar= '$this->fnumtar', fsaldo= '$this->fsaldo', flimite= '$this->flimite', fcodseg= '$this->fcodseg', fgntd= '$this->fgntd', fcp= '$this->fcp', fpais= '$this->fpais', festado= '$this->festado', fciudad= '$this->fciudad', fnumctos= '$this->fnumctos', status= '$this->status', fplacas= '$this->fplacas', fvehiculo= '$this->fvehiculo', ftelemp= '$this->ftelemp', ftipocto= '$this->ftipocto', ftiphuesped= '$this->ftiphuesped' where n_reg = '$n_reg' ";
		$result= mysqli_query($GLOBALS['con'] ,$sql);
		if($result){
			return "ok";
		}else{
			$error = 'Error N:' . mysqli_errno($GLOBALS['con']) . ": " . mysqli_error($GLOBALS['con']);
			return "$error()"; 
		}
	}
	
	
//Funcion de eliminar
	function eliminar($n_reg){   
		$sql = "UPDATE valeryus19 set cancelado = 1  WHERE n_reg = '$n_reg'";
		$resultado = mysqli_query($GLOBALS['con'] ,$sql);
		if($resultado){
			return "ok";
		}else{
			$error = 'Error N:' . mysqli_errno($GLOBALS['con']) . ": " . mysqli_error($GLOBALS['con']);
			return "$error()"; 
		}           
	}   
}   
//162    
?>
