<?php

require_once("DF80000.php");

$fecha='2013-08-01';
if(!isset($_POST['fecinini']))$_POST['fecini']="";
$fecIni=chfecha($_POST['fecini'],'d/m/Y','Y-m-d');
if(!isset($_POST['fecfin']))$_POST['fecfin']="";
$fecFin=chfecha($_POST['fecfin'],'d/m/Y','Y-m-d');
	
	if ($fecIni<''.$fecha.''){
	$table='pvrescaj';
	$taDet='pvrescad';
	//$posicion='fposres';
	//$tip='pvrestip';
	$impresion='pvresimp';
	$memaDet='pvresmemd';
	$mema='pvresmema';
	
	}else{
	$table='dgger_cajerosj';
	$taDet='dgger_cajerosd';
	//$posicion='fpos';
	//$tip='fpropina';
	$impresion='fimpresion';
	$memaDet='dgpememd';
	$mema='dgpemema';
	}

class valeryus09{
	var  $tabla = '0';
	var  $n_reg = '0';
	var  $pclave = '0';
	var  $descripcion = '0';
	var  $pmontomax = '0';
	var  $ppago = '0';
	var  $plimite = '0';
	var  $pca = '0';
	var  $pvalfact = '0';
	var  $cod_var = '0';
	var  $acc_fec = '0';
	var  $acc_hor = '0';
	var  $modulo = '0';
	var  $usuario = '0';
	var  $gravable = '0';
	var  $impuesto = '0';
	var  $cero = '0';
	var  $otros = '0';
	var  $gra = '0';
	var  $sobre = '0';
	var  $zero = '0';
	var  $otro = '0';
	var  $no_gra = '0';
	var  $restringido = '0';
	var  $mini = '0';
	var  $boutique = '0';
	var  $spa = '0';
	var  $paid = '0';
	var  $lastInsId = '0';
	
	function valeryus09($data){
		$this->tabla='valeryus09';
		if($data!=0)
		$this->resetData($data);
	}
	
	function resetData($data){
		$this->n_reg=$this->checkData($data['nReg'],'');
		$this->pclave=$this->checkData($data['pClave'],'');
		$this->descripcion=$this->checkData($data['desCripcion'],'');
		$this->pmontomax=$this->checkData($data['pMontomax'],'');
		$this->ppago=$this->checkData($data['pPago'],'');
		$this->plimite=$this->checkData($data['pLimite'],'');
		$this->pca=$this->checkData($data['pCa'],'');
		$this->pvalfact=$this->checkData($data['pValfact'],'');
		$this->cod_var=$this->checkData($data['codVar'],'');
		$this->acc_fec=$this->checkData($data['accFec'],'');
		$this->acc_hor=$this->checkData($data['accHor'],'');
		$this->modulo=$this->checkData($data['moduLo'],'');
		$this->usuario=$this->checkData($data['usuArio'],'');
		$this->gravable=$this->checkData($data['graVable'],'');
		$this->impuesto=$this->checkData($data['imPuesto'],'');
		$this->cero=$this->checkData($data['ceRo'],'');
		$this->otros=$this->checkData($data['oTros'],'');		
		$this->gra=$this->checkData($data['grA'],'');		
		$this->sobre=$this->checkData($data['sobrE'],'');
		$this->zero=$this->checkData($data['zerO'],'');
		$this->otro=$this->checkData($data['otrO'],'');
		$this->no_gra=$this->checkData($data['noGra'],'');
		$this->restringido=$this->checkData($data['restrinGido'],'');
		$this->mini=$this->checkData($data['minI'],'');
		$this->boutique=$this->checkData($data['boutiquE'],'');
		$this->spa=$this->checkData($data['spA'],'');
		$this->paid=$this->checkData($data['paiD'],'');
			
	}

	function checkData($data,$default){
		if(isset($data)) 
			$auxData=$data;
		else 
			$auxData=$default;
		if(get_magic_quotes_gpc()) 
			$auxData = stripslashes($auxData);
		return mysqli_real_escape_string($con,$auxData);
	}

	function getLastInsId(){
		return $this->lastInsId;
	}

	function getMySQLError(){
		return 'Error N:' . mysqli_errno($GLOBALS['con']) . ": " . mysqli_error($GLOBALS['con']); 
	}
	
	function car_getGeneralBus(){
				
		$tipBus=(isset($_POST['r1']))?$_POST['r1']:"";
		$idOpe=(isset($_POST['id_ope']))?$_POST['id_ope']:"";
		
		$fecIni=chfecha($_POST['fecini'],'d/m/Y','Y-m-d');
	    $fecFin=chfecha($_POST['fecfin'],'d/m/Y','Y-m-d');
	
		$setIpd=(isset($_POST['setipdie']))?$_POST['setipdie']:""; 
		//$textBus=mysqli_real_escape_string($con,$_POST['t1']);
		if(!isset($_POST['secodven']))$_POST['secodven']="";
		$secOdv=$_POST['secodven'];
		if(!isset($_POST['setipven']))$_POST['setipven']="";
		$setIpv=$_POST['setipven'];
		if(!isset($_POST['setipvent']))$_POST['setipvent']="";
		$setIpn=$_POST['setipvent'];
		
		if ($tipBus=='N')
		  $condicion[]="n_reg='".$idOpe."'";
		    else if ($tipBus=='T')
		      $condicion[]="n_reg > 0";
		        else
		          $condicion[]="n_reg = 0";
				  
					  $condicion[]="pmontomax='CARGO'";
		               
	   /*if($secOdv!='T') {
		 $arrBus[]="dgger_cajerosj.vendedor='".$_POST['secodven']."'";		
	      }
	       if($setIpv!='T') {
	 	    $arrBus[]="$this->tabla.tip_ven='".$_POST['setipven']."'";
	         }	
	          if($setIpn!='T') {
  		       $arrBus[]='ptventa.nparte1='.$_POST['setipvent'].'';
	            }else{
		         $arrBus[]=' ptventa.nparte1<>0 ';
                  }
		           $arrBus[]="($this->tabla.fec_ven between '$fecIni' and '$fecFin')";*/
		
		return $condicion;

	}
	
	function car_getGeneraltip(){
				
		$tipBus=$_POST['r1'];
		$idOpe=$_POST['id_ope'];
		
		$fecIni=chfecha($_POST['fecini'],'d/m/Y','Y-m-d');
	    $fecFin=chfecha($_POST['fecfin'],'d/m/Y','Y-m-d');
		
		$setIpd=$_POST['setipdie']; 
		//$textBus=mysqli_real_escape_string($con,$_POST['t1']);
		
		$secOdv=$_POST['secodven'];
		$setIpv=$_POST['setipven'];
		$setIpn=$_POST['setipvent'];
		
		if ($tipBus=='N')
		  $condicion[]="n_reg='".$idOpe."'";
		    else if ($tipBus=='T')
		      $condicion[]="n_reg > 0";
		        else
		          $condicion[]="n_reg = 0";
				  
					  $condicion[]="pmontomax='CARGO' and tip='1'";
		
		return $condicion;

	}
	
	function abo_getGeneralBus(){
				
		$tipBus=(isset($_POST['r1']))?$_POST['r1']:"";
		
		$idOpe=(isset($_POST['id_ope']))?$_POST['id_ope']:"";
		
		$fecIni=chfecha($_POST['fecini'],'d/m/Y','Y-m-d');
	    $fecFin=chfecha($_POST['fecfin'],'d/m/Y','Y-m-d');
		
		$setIpd=(isset($_POST['setipdie']))?$_POST['setipdie']:""; 
		//$textBus=mysqli_real_escape_string($con,$_POST['t1']);
		
		$secOdv=$_POST['secodven'];
		$setIpv=$_POST['setipven'];
		$setIpn=$_POST['setipvent'];
		
		if ($tipBus=='N')
		  $condicion[]="n_reg='".$idOpe."'";
		    else if ($tipBus=='T')
		      $condicion[]="n_reg > 0";
		        else
		          $condicion[]="n_reg = 0";
				  
						  $condicion[]="pmontomax='ABONO'";
					   
		return $condicion;

	}
	
	
	
	function report_getGeneraltips(){
		//$tipoDieta = new tipDie($data);
		//$tabTipDie = $tipoDieta->getTableName();
		
		$condicionData=$this->car_getGeneraltip();
		$WHERE="WHERE ".implode(" AND ",$condicionData);
		$sq_retrieve="
			SELECT 
			*,
			$this->tabla.n_reg        as  nReg,
			$this->tabla.restringido  as  restrinGido,
			ptventa.nparte1           as  nParte1,
			$this->tabla.descripcion  as  desCripcion		
			
			FROM 
			$this->tabla
			LEFT JOIN ptventa ON(ptventa.codigo=$this->tabla.n_reg)	
			
			$WHERE
			
			ORDER BY 
			$this->tabla.descripcion
			";
		
		$rs=mysqli_query($GLOBALS['con'] ,$sq_retrieve);
		echo mysqli_error($GLOBALS['con']);		
		if($rs)
			return $rs;
		else
			return 0;		
	}
	
	function report_getGeneralcar(){
		//$tipoDieta = new tipDie($data);
		//$tabTipDie = $tipoDieta->getTableName();
		
		$condicionData=$this->car_getGeneralBus();
		$WHERE="WHERE ".implode(" AND ",$condicionData);
		$sq_retrieve="
			SELECT 
			*,
			$this->tabla.n_reg        as  nReg,
			$this->tabla.restringido  as  restrinGido,
			ptventa.nparte1           as  nParte1,
			$this->tabla.descripcion  as  desCripcion,	
			$this->tabla.tip          as  Tip		
			
			FROM 
			$this->tabla
			LEFT JOIN ptventa ON(ptventa.codigo=$this->tabla.n_reg)	
			
			$WHERE
			
			ORDER BY 
			$this->tabla.descripcion
			";
		
		$rs=mysqli_query($GLOBALS['con'] ,$sq_retrieve);
		echo mysqli_error($GLOBALS['con']);		
		if($rs)
			return $rs;
		else
			return 0;		
	}
	
	function report_getGeneralabo(){
		//$tipoDieta = new tipDie($data);
		//$tabTipDie = $tipoDieta->getTableName();
		
		$condicionData=$this->abo_getGeneralBus();
		$WHERE="WHERE ".implode(" AND ",$condicionData);
		$sq_retrieve="
			SELECT 
			*,
			$this->tabla.n_reg         as  nReg,
			$this->tabla.restringido   as  restrinGido,
			dgtippag.tip_pag           as  tipPag,
			dgtippag.codigo            as  codIgo,
			$this->tabla.descripcion   as  desCripcion		
			
			FROM 
			$this->tabla
			LEFT JOIN dgtippag ON(dgtippag.codigo=$this->tabla.n_reg)	
			
			$WHERE
			
			ORDER BY 
			$this->tabla.descripcion
			";
 
		$rs=mysqli_query($GLOBALS['con'] ,$sq_retrieve);
		//echo mysqli_error($GLOBALS['con']);		
		if($rs)
			return $rs;
		else
			return 0;		
	}
//CONCAT(dgcatven.nom_ven,' ',dgcatven.ap_pat_ven,' ',dgcatven.ap_mat_ven) as nomVen,	
//$mema.iva_ven,
//$this->tabla.tot_ven                         as totVen,
//$this->tabla.sub_ven                         as subVen,
//ctarea.np_desc1                              as darea,
//dgtippag.ini_pag                             as descpag,
//dgger_cajerosd.tip_pag                             as tipag,
//$this->tabla.por_des                         as descuento,
//$memaDet.imp_des                             as desc_uento,
//$posicion.mesa                               as mesa,
//$this->tabla.cancelado                       as cancelado,
//$table.num_cli                               as cliente,
//LEFT JOIN $posicion ON $posicion.fol_ven=$this->tabla.fol_ven
//LEFT JOIN  $tip ON $tip.fol_ven=$mema.fol_ven
//LEFT JOIN $taDet ON $taDet.n_rec=$table.n_rec	
//LEFT JOIN dgtippag ON dgtippag.tip_pag=$taDet.tip_pag	
//LEFT JOIN $memaDet ON $memaDet.cons_ven=$this->tabla.fol_ven

/*
SELECT 
				$this->tabla.fol_ven                         as folVen,
				$this->tabla.con_ven                         as conVen,
				$this->tabla.tip_ven                         as tipVen,
				$this->tabla.imp_pag                         as impPag,
			    $this->tabla.cod_ven                         as codVen,
				$this->tabla.tip                             as propina, 
				$this->tabla.cancela                         as cancela,
			    $this->tabla.servicio                        as servicio,
			    $this->tabla.mt_cancela                      as comentario,
				DATE_FORMAT($this->tabla.fec_ven,'%d/%m/%Y') as fecVen,
				$table.acc_hor                               as hora,
				ctmeser.np_desc1                             as nomVen,
			    ctmesas.np_desc1                             as dmesa,    
			    ptventa.tip_ven                              as dptvta,
				
				$table.fol_unp                               as folp
			    
				
				
				
				
			FROM 
			$this->tabla
			
			LEFT JOIN ctmesas ON ctmesas.nparte1=$this->tabla.fpos_mesa
			LEFT JOIN ctarea ON ctarea.nparte1=ctmesas.area
			LEFT JOIN ctmeser  ON ctmeser.nparte1=$this->tabla.cod_ven
			LEFT JOIN ptventa ON ptventa.nparte1=ctmesas.descripcion
			LEFT JOIN $table ON $table.pedido=$this->tabla.fol_ven		
			LEFT JOIN dgcatven ON $this->tabla.cod_ven=dgcatven.cod_ven
			
			LEFT JOIN  dgtippag ON dgtippag.tip_pag=dgger_cajerosj.tip_mov
			
			$WHERE
			group by $this->tabla.fol_ven
		    
			ORDER BY 
			$this->tabla.con_ven
*/
	
	
	
	
	
	
}

































require_once("DF80000.php");

$fecha='2013-08-01';

$fecIni=chfecha($_POST['fecini'],'d/m/Y','Y-m-d');
$fecFin=chfecha($_POST['fecfin'],'d/m/Y','Y-m-d');
	
	if ($fecIni<''.$fecha.''){
	$table='pvrescaj';
	$taDet='pvrescad';
	//$posicion='fposres';
	//$tip='pvrestip';
	$impresion='pvresimp';
	$memaDet='pvresmemd';
	$mema='pvresmema';
	
	}else{
	$table='dgger_cajerosj';
	$taDet='dgger_cajerosd';
	//$posicion='fpos';
	//$tip='fpropina';
	$impresion='fimpresion';
	$memaDet='dgpememd';
	$mema='dgpemema';
	}

class valeryus19{
	var  $tabla = '0';
	var  $n_reg = '0';
	var  $fnumres = '0';
	var  $fnumbers = '0';
	var  $fapellido = '0';
	var  $smerf = '0';
	var  $fnombre = '0';
	var  $ffolrec = '0';
	var  $fdireccion = '0';
	var  $fciudad = '0';
	var  $festado = '0';
	var  $fcp = '0';
	var  $fempresa = '0';
	var  $ftipofolio = '0';
	var  $fplan = '0';
	var  $fcodgrupo = '0';
	var  $ftipocto = '0';
	var  $ftipohuespe = '0';
	var  $fsrc = '0';
	var  $fcodmeca = '0';
	var  $fcodagen = '0';
	var  $fhorallega = '0';
	var  $fnorasvip = '0';
	var  $fstatus = '0';
	var  $fnumcto = '0';
	var  $fformpago = '0';
	var  $fhorasalid = '0';
	var  $fusualta = '0';
	var  $fususali = '0';
	var  $fusucamb = '0';
	var  $ftelefono = '0';
	var  $flengua = '0';
	var  $fpais = '0';
	var  $fcodtarifa = '0';
	var  $fvip = '0';
	var  $ftarifaxa = '0';
	var  $ftarifaxm = '0';
	var  $fmail = '0';
	var  $femail = '0';
	var  $codseg = '0';
	var  $codstat = '0';
	var  $colorp = '0';
	
	
	
	
	
	var  $fpagodepo7 = '0';
	
	var  $fgntd = '0';
	var  $fnumctos = '0';
	var  $ffecllegada = '0';
	var  $ffecsalida = '0';
	var  $fnumadu = '0';
	var  $fnummenor = '0';
	var  $fdeposito = '0';
	var  $fnumtar = '0';
	var  $fsaldo = '0';
	var  $flimite = '0';
	var  $fcodseg = '0';
	var  $fnumadulx = '0';
	var  $fnummenorx = '0';
	var  $fmonadu = '0';
	var  $fmonmen = '0';
	
	var  $fformapago7 = '0';
	var  $ffecalt = '0';
	var  $status = '0';
	var  $estact = '0';
	var  $ffeccam = '0';
	var  $fvehiculo = '0';
	var  $fplacas = '0';
	var  $ftelemp = '0';
	var  $tex = '0';
	var  $tex2 = '0';
	var  $tex3 = '0';
	var  $tex4 = '0';
	var  $ftiphuesped = '0';
	var  $tus = '0';
	var  $fnum = '0';
	var  $cod_var = '0';
	var  $modulo = '0';
	
	
	
	
	
	
	
	
	
	
	var  $cancelado = '0';
	var  $tipo = '0';
	var  $con_1 = '0';
	var  $text1 = '0';
	var  $text2 = '0';
	var  $text3 = '0';
	var  $text4 = '0';
	var  $ftotal = '0';
	var  $tex5 = '0';
	var  $tex6 = '0';
	var  $text5 = '0';
	var  $text6 = '0';
	var  $suma = '0';
	var  $acc_fec = '0';
	var  $acc_hor = '0';
	var  $usuario = '0';
	var  $total = '0';
	var  $fmuncto = '0';
	var  $boton = '0';
	var  $folio = '0';
	var  $fecha_real = '0';
	var  $tiporh = '0';
	var  $fusucancela = '0';
	var  $hor_cancela = '0';
	var  $fec_cancela = '0';
	var  $alta_huesped = '0';
	var  $cuarto_seguro = '0';
	
	var  $extra1 = '0';
	var  $extra2 = '0';
	var  $extra3 = '0';
	var  $extra4 = '0';
	var  $camb_hab = '0';
	var  $bot_cam = '0';
	var  $fec_fac = '0';
	var  $fol_fac = '0';
	var  $edades = '0';
	var  $mes = '0';
	var  $ano = '0';
	var  $chart = '0';
	var  $online = '0';
	var  $lastInsId = '0';
	
	function valeryus19($data){
		$this->tabla='valeryus19';
		$this->resetData($data);
	}

	function resetData($data){
		$this->n_reg=$this->checkData($data['nReg'],'');
		$this->fnumres=$this->checkData($data['fNumres'],'');
		$this->fnumbers=$this->checkData($data['fNumbers'],'');
		$this->fapellido=$this->checkData($data['fApellido'],'');
		$this->smerf=$this->checkData($data['sMerf'],'');
		$this->fnombre=$this->checkData($data['fNombre'],'');
		$this->ffolrec=$this->checkData($data['fFolRec'],'');
		$this->fdireccion=$this->checkData($data['fDireccion'],'');
		$this->fciudad=$this->checkData($data['fCiudad'],'');
		$this->festado=$this->checkData($data['fEstado'],'');
		$this->fcp=$this->checkData($data['fCp'],'');
		$this->fempresa=$this->checkData($data['fEmpresa'],'');
		$this->ftipofolio=$this->checkData($data['fTipofolio'],'');
		$this->fplan=$this->checkData($data['fPlan'],'');
		$this->fcodgrupo=$this->checkData($data['fCodgrupo'],'');
		$this->ftipocto=$this->checkData($data['fTipocto'],'');
		$this->ftipohuespe=$this->checkData($data['fTipohuespe'],'');		
		$this->fscr=$this->checkData($data['fScr'],'');		
		$this->fcodmeca=$this->checkData($data['fCodmeca'],'');
		$this->fcodagen=$this->checkData($data['fCodagen'],'');
		$this->fhorallega=$this->checkData($data['fHorallega'],'');
		$this->fnorasvip=$this->checkData($data['fNorasvip'],'');
		$this->fstatus=$this->checkData($data['fStatus'],'');
		$this->fnumcto=$this->checkData($data['fNumcto'],'');
		$this->fformpago=$this->checkData($data['fFormpago'],'');
		$this->fhorasalid=$this->checkData($data['fHorasalid'],'');
		$this->fusualta=$this->checkData($data['fUsualta'],'');
		$this->fususali=$this->checkData($data['fUsusali'],'');
		$this->fusucamb=$this->checkData($data['fUsucamb'],'');
		$this->ftelefono=$this->checkData($data['fTelefono'],'');
		$this->flengua=$this->checkData($data['fLengua'],'');
		$this->fpais=$this->checkData($data['fPais'],'');
		$this->fcodtarifa=$this->checkData($data['fCodtarifa'],'');
		$this->fvip=$this->checkData($data['fVip'],'');
		$this->ftarifaxa=$this->checkData($data['fTarifaxa'],'');
		$this->ftarifaxm=$this->checkData($data['fTarifaxm'],'');
		$this->fmail=$this->checkData($data['fMail'],'');
		$this->femail=$this->checkData($data['fEmail'],'');
		$this->codseg=$this->checkData($data['codSeg'],'');
		$this->codstat=$this->checkData($data['codStat'],'');
		$this->colorp=$this->checkData($data['coloRp'],'');
		
		
		
		
		
		$this->fpagodepo7=$this->checkData($data['fPagodepo7'],'');
		
		$this->fgntd=$this->checkData($data['fGntd'],'');
		$this->fnumctos=$this->checkData($data['fNumctos'],'');
		$this->ffecllegada=$this->checkData($data['fFecllegada'],'');
		$this->ffecsalida=$this->checkData($data['fFecsalida'],'');
		$this->fnumadu=$this->checkData($data['fNumadu'],'');
		$this->fnummenor=$this->checkData($data['fNummenor'],'');
		$this->fdeposito=$this->checkData($data['fDeposito'],'');
		$this->fnumtar=$this->checkData($data['fNumtar'],'');
		$this->fsaldo=$this->checkData($data['fSaldo'],'');
		$this->flimite=$this->checkData($data['fLimite'],'');
		$this->fcodseg=$this->checkData($data['fCodseg'],'');
		$this->fnumadulx=$this->checkData($data['fNumadulx'],'');
		$this->fnummenorx=$this->checkData($data['fNummenorx'],'');
		$this->fmonadu=$this->checkData($data['fMonadu'],'');
		$this->fmonmen=$this->checkData($data['fMonmen'],'');
		
		$this->fformapago7=$this->checkData($data['fFormapago7'],'');
		$this->ffecalt=$this->checkData($data['fFecalt'],'');
		$this->status=$this->checkData($data['staTus'],'');
		$this->estact=$this->checkData($data['estAct'],'');
		$this->ffeccam=$this->checkData($data['fFeccam'],'');
		$this->fvehiculo=$this->checkData($data['fVehiculo'],'');
		$this->fplacas=$this->checkData($data['fPlacas'],'');
		$this->ftelemp=$this->checkData($data['fTelemp'],'');
		$this->tex=$this->checkData($data['teX'],'');
		$this->tex2=$this->checkData($data['teX2'],'');
		$this->tex3=$this->checkData($data['teX3'],'');
		$this->tex4=$this->checkData($data['teX4'],'');
		$this->ftiphuesped=$this->checkData($data['fTiphuesped'],'');
		$this->tus=$this->checkData($data['tuS'],'');
		$this->fnum=$this->checkData($data['fNum'],'');
		$this->cod_var=$this->checkData($data['codVar'],'');
		$this->modulo=$this->checkData($data['modUlo'],'');
		
		
		
		$this->cancelado=$this->checkData($data['canceLado'],'');
		
		
		$this->habitac=$this->checkData($data['habiTac'],'');
		$this->habita=$this->checkData($data['habiTa'],'');
		
		
		
		$this->tipo=$this->checkData($data['tipO'],'');
		$this->con_1=$this->checkData($data['cOn'],'');
		$this->text1=$this->checkData($data['texT1'],'');
		$this->text2=$this->checkData($data['texT2'],'');
		$this->text3=$this->checkData($data['texT3'],'');
		$this->text4=$this->checkData($data['texT4'],'');
		$this->ftotal=$this->checkData($data['fTotal'],'');
		$this->tex5=$this->checkData($data['teX5'],'');
		$this->tex6=$this->checkData($data['teX6'],'');
		$this->text5=$this->checkData($data['texT5'],'');
		$this->text6=$this->checkData($data['texT6'],'');
		$this->suma=$this->checkData($data['sumA'],'');
		$this->acc_fec=$this->checkData($data['accFec'],'');
		$this->acc_hor=$this->checkData($data['accHor'],'');
		$this->usuario=$this->checkData($data['usuArio'],'');
		$this->total=$this->checkData($data['toTal'],'');
		$this->fmuncto=$this->checkData($data['fMuncto'],'');
		$this->boton=$this->checkData($data['boTon'],'');
		$this->folio=$this->checkData($data['foLio'],'');
		$this->fecha_real=$this->checkData($data['fechaReal'],'');
		$this->tiporh=$this->checkData($data['tipoRh'],'');
		$this->fusucancela=$this->checkData($data['fUsuCancela'],'');
		$this->hor_cancela=$this->checkData($data['horCancela'],'');
		$this->fec_cancela=$this->checkData($data['fecCancela'],'');
		$this->alta_huesped=$this->checkData($data['altaHuesped'],'');
		$this->cuarto_seguro=$this->checkData($data['cuartoSeguro'],'');
		
		$this->extra1=$this->checkData($data['xtrA1'],'');
		$this->extra2=$this->checkData($data['xtrA2'],'');
		$this->extra3=$this->checkData($data['xtrA3'],'');
		$this->extra4=$this->checkData($data['xtrA4'],'');
		$this->camb_hab=$this->checkData($data['cambHab'],'');
		$this->bot_cam=$this->checkData($data['botCam'],'');
		$this->fec_fac=$this->checkData($data['fecFac'],'');
		$this->fol_fac=$this->checkData($data['folFac'],'');
		$this->edades=$this->checkData($data['edaDes'],'');
		$this->mes=$this->checkData($data['meS'],'');
		$this->ano=$this->checkData($data['anO'],'');
		$this->chart=$this->checkData($data['charT'],'');
		$this->online=$this->checkData($data['onLine'],'');
			
	}

	function report_getDetInv(){
//		$WHERE=" WHERE ".implode(" AND ",$this->getDetInv());
		$sq_retrieve="select 
						count(*) as suma_esp,
						$this->tabla.id_raza idraza,
						$this->tabla.id_especie idesp,								
						rgespecie.nom_esp as especie
			FROM 
				$this->tabla 
				LEFT JOIN rgespecie ON(rgespecie.id_especie=$this->tabla.id_especie)				
			WHERE id_raza=$this->id_raza and $this->tabla.es_emb!=1 and $this->tabla.id_estadofis=1 and $this->tabla.sta_ani=1
			group by $this->tabla.id_raza
				";
		$rs=mysqli_query($GLOBALS['con'] ,$sq_retrieve);
		if($rs)
			return $rs;
		else
			return 0;
	}

	function checkData($data,$default){
		if(isset($data)) 
			$auxData=$data;
		else 
			$auxData=$default;
		if(get_magic_quotes_gpc()) 
			$auxData = stripslashes($auxData);
		return mysqli_real_escape_string($con,$auxData);
	}

	function getLastInsId(){
		return $this->lastInsId;
	}

	function getMySQLError(){
		return 'Error N:' . mysqli_errno($GLOBALS['con']) . ": " . mysqli_error($GLOBALS['con']); 
	}
	
	
	
	function rcp_getGenerSSSalBus(){
				
		$tipBus=$_POST['r1'];
		$idOpe=$_POST['id_ope'];
		
		$fecIni=chfecha($_POST['fecini'],'d/m/Y','Y-m-d');
	    $fecFin=chfecha($_POST['fecfin'],'d/m/Y','Y-m-d');
		
		$setIpd=$_POST['setipdie']; 
		//$textBus=mysqli_real_escape_string($con,$_POST['t1']);
		
		$secOdv=$_POST['secodven'];
		$setIpv=$_POST['setipven'];
		$setIpn=$_POST['setipvent'];
		
		if ($tipBus=='N')
		  $condicion[]='n_reg="'.$idOpe.'"';
		    else if ($tipBus=='T')
		      $condicion[]='n_reg > 0';
		        else
		          $condicion[]='n_reg = 0';
		
		/*if($secOdv!='T') {
		 $arrBus[]="dgger_cajerosj.vendedor='".$_POST['secodven']."'";		
	      }
	       if($setIpv!='T') {
	 	    $arrBus[]="$this->tabla.tip_ven='".$_POST['setipven']."'";
	         }	
	          if($setIpn!='T') {
  		       $arrBus[]='ptventa.nparte1='.$_POST['setipvent'].'';
	            }else{
		         $arrBus[]=' ptventa.nparte1<>0 ';
                  }
		           $arrBus[]="($this->tabla.fec_ven between '$fecIni' and '$fecFin')";*/
		
		return $condicion;

	}
	
	function report_getGSSeneral(){
		//$tipoDieta = new tipDie($data);
		//$tabTipDie = $tipoDieta->getTableName();
		
		$fecIni=chfecha($_POST['fecini'],'d/m/Y','Y-m-d');
	    $fecFin=chfecha($_POST['fecfin'],'d/m/Y','Y-m-d');
	
	     if ($fecIni<''.$fecha.''){
	      $table='pvrescaj';
	      $this->tabla='pvresmema';
	
	     }else{
	      $table='dgger_cajerosj';
	      $this->tabla=$this->tabla;
	     
		 }
		
		$condicionData=$this->rcp_getGeneralBus();
		$WHERE="WHERE ".implode(" AND ",$condicionData);
		$sq_retrieve="
			SELECT 
			*		
			
			FROM 
			$this->tabla
			
			$WHERE
		    
			ORDER BY 
			$this->tabla.con_ven
			";
		
		
		$rs=mysqli_query($GLOBALS['con'] ,$sq_retrieve);
		echo mysqli_error($GLOBALS['con']);		
		if($rs)
			return $rs;
		else
			return 0;		
	}
//CONCAT(dgcatven.nom_ven,' ',dgcatven.ap_pat_ven,' ',dgcatven.ap_mat_ven) as nomVen,	
//$mema.iva_ven,
//$this->tabla.tot_ven                         as totVen,
//$this->tabla.sub_ven                         as subVen,
//ctarea.np_desc1                              as darea,
//dgtippag.ini_pag                             as descpag,
//dgger_cajerosd.tip_pag                             as tipag,
//$this->tabla.por_des                         as descuento,
//$memaDet.imp_des                             as desc_uento,
//$posicion.mesa                               as mesa,
//$this->tabla.cancelado                       as cancelado,
//$table.num_cli                               as cliente,
//LEFT JOIN $posicion ON $posicion.fol_ven=$this->tabla.fol_ven
//LEFT JOIN  $tip ON $tip.fol_ven=$mema.fol_ven
//LEFT JOIN $taDet ON $taDet.n_rec=$table.n_rec	
//LEFT JOIN dgtippag ON dgtippag.tip_pag=$taDet.tip_pag	
//LEFT JOIN $memaDet ON $memaDet.cons_ven=$this->tabla.fol_ven

/*
SELECT 
				$this->tabla.fol_ven                         as folVen,
				$this->tabla.con_ven                         as conVen,
				$this->tabla.tip_ven                         as tipVen,
				$this->tabla.imp_pag                         as impPag,
			    $this->tabla.cod_ven                         as codVen,
				$this->tabla.tip                             as propina, 
				$this->tabla.cancela                         as cancela,
			    $this->tabla.servicio                        as servicio,
			    $this->tabla.mt_cancela                      as comentario,
				DATE_FORMAT($this->tabla.fec_ven,'%d/%m/%Y') as fecVen,
				$table.acc_hor                               as hora,
				ctmeser.np_desc1                             as nomVen,
			    ctmesas.np_desc1                             as dmesa,    
			    ptventa.tip_ven                              as dptvta,
				
				$table.fol_unp                               as folp
			    
				
				
				
				
			FROM 
			$this->tabla
			
			LEFT JOIN ctmesas ON ctmesas.nparte1=$this->tabla.fpos_mesa
			LEFT JOIN ctarea ON ctarea.nparte1=ctmesas.area
			LEFT JOIN ctmeser  ON ctmeser.nparte1=$this->tabla.cod_ven
			LEFT JOIN ptventa ON ptventa.nparte1=ctmesas.descripcion
			LEFT JOIN $table ON $table.pedido=$this->tabla.fol_ven		
			LEFT JOIN dgcatven ON $this->tabla.cod_ven=dgcatven.cod_ven
			
			LEFT JOIN  dgtippag ON dgtippag.tip_pag=dgger_cajerosj.tip_mov
			
			$WHERE
			group by $this->tabla.fol_ven
		    
			ORDER BY 
			$this->tabla.con_ven
*/
	
	function report_corral(){
		$arrDataBus=$this->cat_getCorralBus();
		$WHERE="WHERE ".implode(" AND ",$arrDataBus);
		$sq_retrieve="
		SELECT
			distinct($this->tabla.id_corral) as dis_corral
								
		FROM 
			$this->tabla
			
		$WHERE 
			
		GROUP BY
			$this->tabla.id_corral";
		
		$rs=mysqli_query($GLOBALS['con'] ,$sq_retrieve);
		if($rs)
			return $rs;
		else
			return 0;
	}	
	
	
	
	
	
	
}
?>