<?php
//include "clase.conexion.php";
class clsChecInProductos extends clsConexion{
	public $varTitulo 	= "VENTA DE PRODUCTOS Y SERVICIOS";
	public $varMyTabla  = "_sh_hospedaje";
	public $varMyID  	= "id_hospedaje";
	function FormuBusqueda() {
		$varUsr = (isset($_SESSION["_CUSE"]))?$_SESSION["_CUSE"]:1;
		$sql = "call spQuery_Hospedaje_Habitacion(1);";
		$varTabla=array("id"=>"theTable", "name"=>"theTable", "tamano"=>"1000", "sql_cab"=>utf8_decode($sql),	"pages"=>50, "titulo"=>$this->varTitulo,
						"conte"=>array(array("titulo"=>"IDE",   	"ancho"=>"30" , "alinear"=>"center"), 
									   array("titulo"=>"CEMP",   	"ancho"=>"20" , "alinear"=>"center", "oculto"=>"SI"),
									   array("titulo"=>"EMPRESA",	"ancho"=>"200", "fijo"=>"SI", "funcion"=>array("contar")),
									   array("titulo"=>"CHAB",     	"ancho"=>"20",  "oculto"=>"SI"), 
									   array("titulo"=>"NUM",     	"ancho"=>"20",  "alinear"=>"center"), 
									   array("titulo"=>"TIPO",		"ancho"=>"200", "fijo"=>"SI"),
									   array("titulo"=>"F.INGRESO", "ancho"=>"50",  "alinear"=>"center", "fijo"=>"SI"), 
									   array("titulo"=>"CCLI",     	"ancho"=>"20",  "alinear"=>"center"), 
									   array("titulo"=>"CLIENTE",	"ancho"=>"200", "fijo"=>"SI"),
									   array("titulo"=>"DNI",    	"ancho"=>"60",  "alinear"=>"center", "fijo"=>"SI"),
									   array("titulo"=>"CTRA",     	"ancho"=>"20",  "alinear"=>"center", "oculto"=>"SI"), 
									   array("titulo"=>"TRABAJADOR","ancho"=>"200", "fijo"  =>"SI"),
									   array("titulo"=>"DIAS",     	"ancho"=>"20",  "alinear"=>"center", "oculto"=>"SI"), 
									   array("titulo"=>"INGRESO",  	"ancho"=>"60",  "alinear"=>"center", "fijo"=>"SI"),
									   array("titulo"=>"SALIDA",  	"ancho"=>"60",  "alinear"=>"center", "fijo"=>"SI"),
									   array("titulo"=>"FINGT",  	"ancho"=>"60",  "alinear"=>"center", "oculto"=>"SI"),
									   array("titulo"=>"FSALT",  	"ancho"=>"60",  "alinear"=>"center", "oculto"=>"SI"),
									   array("titulo"=>"HING",  	"ancho"=>"60",  "alinear"=>"center", "oculto"=>"SI"),
									   array("titulo"=>"HSAL",  	"ancho"=>"60",  "alinear"=>"center", "oculto"=>"SI"),
									   array("titulo"=>"ESTADO",  	"ancho"=>"60",  "alinear"=>"center", "fijo"=>"SI"),
									   array("titulo"=>"ADULT",  	"ancho"=>"60",  "alinear"=>"right"),
									   array("titulo"=>"NINOS",  	"ancho"=>"60",  "alinear"=>"right"),
									   array("titulo"=>"NUMHAB",  	"ancho"=>"60",  "alinear"=>"right", "oculto"=>"SI"),
									   array("titulo"=>"TOTAL",  	"ancho"=>"60",  "alinear"=>"right"),
									   array("titulo"=>"ACUENTA",  	"ancho"=>"60",  "alinear"=>"right"),
									   array("titulo"=>"REGISTRO",  "ancho"=>"100", "fijo"=>"SI", "oculto"=>"SI")									   
									   ),
						"boton"=>array(array("tipo"=>"img", "id"=>"bbus", "name"=>"bbus", "img"=>"../images/b_pedidos_add.png", 
											 "toltip"=>array(array("valor"=>"HAGA CLICK PARA <b>VENDER PRODUCTOS Y/O SERVICIOS</b> AL HOSPEDAJE"),
															 array("valor"=>"<br><b>Nro. Check-IN : </b>"),
															 array("valor"=>0, "tipo"=>"INDEX"),
															 array("valor"=>"<br><b>Empresa : </b>"),
															 array("valor"=>1, "tipo"=>"INDEX"),
															 array("valor"=>" - "),
															 array("valor"=>2, "tipo"=>"INDEX"),
															 array("valor"=>"<br><b>Cliente : </b>"),
															 array("valor"=>7, "tipo"=>"INDEX"),
															 array("valor"=>" - "),
															 array("valor"=>8, "tipo"=>"INDEX"),
															 array("valor"=>"<br><b>Trabajador : </b>"),
															 array("valor"=>10, "tipo"=>"INDEX"),
															 array("valor"=>" - "),
															 array("valor"=>11, "tipo"=>"INDEX"),
															 array("valor"=>"<br><b>Fecha Ingreso : </b>"),
															 array("valor"=>6, "tipo"=>"INDEX")
															 ),
											 "click"=>array("funcion"=>"FormuRegistroJS",
															"param"=>array(array("valor"=>0, 	  "tipo"=>"INDEX"),
																		   array("valor"=>"EDIT", "tipo"=>"TEXTO")
																		  )
															)										 
											)
									)
						);
		return $this->SetGridTabla($varTabla);
		}
 	function GridDatos($varForm  = NULL, 
					   $varField = NULL, 
					   $varOrder = NULL
					   ) {
		$sql = "select HH.id_hospedaje as CHOS, 
				HH.id_habitacion AS CHAB, X.numero AS NUM,
				CAST(CONCAT(X.id_tipo_habitacion, ' - ', T.nombre) AS CHAR) AS TIPO,
				H.fecha_ingreso,
				H.id_cliente as CCLI, C.nombre as CLIENTE, C.DNI,
				H.id_trabajador as CTRA, CONCAT(P.apellido_paterno, ' ', P.apellido_materno, ' ', P.nombre) as TRABAJADOR
				from _sh_hospedaje_habitacion HH
				inner join _sh_hospedaje H ON HH.id_hospedaje = H.id_hospedaje
				inner join _sh_habitacion X ON HH.id_habitacion = X.id_habitacion
				inner join _sh_tipo_habitacion T ON X.id_tipo_habitacion = T.id_tipo_habitacion
				inner join _sv_cliente C ON H.id_cliente = C.id_cliente
				inner join _sv_trabajador P ON H.id_trabajador = P.id_trabajador
				where HH._estado = 'A' and H._estado = 'A'
				and H.estado = 'AC'";
		$varTabla=array("id"=>"theTable", "name"=>"theTable", "tamano"=>"1000", "sql_cab"=>utf8_decode($sql),	"pages"=>50, "titulo"=>"HABITACIONES",
						"conte"=>array(array("titulo"=>"NUM",   	"ancho"=>"30" , "alinear"=>"center"), 
									   array("titulo"=>"CEMP",   	"ancho"=>"20" , "alinear"=>"center", "oculto"=>"SI"),
									   array("titulo"=>"EMPRESA",	"ancho"=>"200", "fijo"=>"SI", "funcion"=>array("contar")),
									   array("titulo"=>"CCLI",     	"ancho"=>"20",  "alinear"=>"center"), 
									   array("titulo"=>"CLIENTE",	"ancho"=>"200", "fijo"=>"SI"),
									   array("titulo"=>"DNI",    	"ancho"=>"60",  "alinear"=>"center", "fijo"=>"SI"),
									   array("titulo"=>"CTRA",     	"ancho"=>"20",  "alinear"=>"center", "oculto"=>"SI"), 
									   array("titulo"=>"TRABAJADOR","ancho"=>"200", "fijo"  =>"SI"),
									   array("titulo"=>"DIAS",     	"ancho"=>"20",  "alinear"=>"center", "oculto"=>"SI"), 
									   array("titulo"=>"INGRESO",  	"ancho"=>"60",  "alinear"=>"center", "fijo"=>"SI"),
									   array("titulo"=>"SALIDA",  	"ancho"=>"60",  "alinear"=>"center", "fijo"=>"SI"),
									   array("titulo"=>"FINGT",  	"ancho"=>"60",  "alinear"=>"center", "oculto"=>"SI"),
									   array("titulo"=>"FSALT",  	"ancho"=>"60",  "alinear"=>"center", "oculto"=>"SI"),
									   array("titulo"=>"HING",  	"ancho"=>"60",  "alinear"=>"center", "oculto"=>"SI"),
									   array("titulo"=>"HSAL",  	"ancho"=>"60",  "alinear"=>"center", "oculto"=>"SI"),
									   array("titulo"=>"ESTADO",  	"ancho"=>"60",  "alinear"=>"center", "fijo"=>"SI"),
									   array("titulo"=>"ADULT",  	"ancho"=>"60",  "alinear"=>"right"),
									   array("titulo"=>"NINOS",  	"ancho"=>"60",  "alinear"=>"right"),
									   array("titulo"=>"NUMHAB",  	"ancho"=>"60",  "alinear"=>"right", "oculto"=>"SI"),
									   array("titulo"=>"TOTAL",  	"ancho"=>"60",  "alinear"=>"right"),
									   array("titulo"=>"ACUENTA",  	"ancho"=>"60",  "alinear"=>"right"),
									   array("titulo"=>"REGISTRO",  "ancho"=>"100", "fijo"=>"SI", "oculto"=>"SI")									   
									   ),
						"boton"=>array(array("tipo"=>"img", "id"=>"bbus", "name"=>"bbus", "img"=>"../images/b_pedidos_add.png", 
											 "toltip"=>array(array("valor"=>"HAGA CLICK PARA <b>FINALIZAR</b> EL HOSPEDAJE"),
															 array("valor"=>"<br><b>Nro. Check-IN : </b>"),
															 array("valor"=>0, "tipo"=>"INDEX"),
															 array("valor"=>"<br><b>Empresa : </b>"),
															 array("valor"=>1, "tipo"=>"INDEX"),
															 array("valor"=>" - "),
															 array("valor"=>2, "tipo"=>"INDEX"),
															 array("valor"=>"<br><b>Cliente : </b>"),
															 array("valor"=>3, "tipo"=>"INDEX"),
															 array("valor"=>" - "),
															 array("valor"=>4, "tipo"=>"INDEX"),
															 array("valor"=>"<br><b>Trabajador : </b>"),
															 array("valor"=>6, "tipo"=>"INDEX"),
															 array("valor"=>" - "),
															 array("valor"=>7, "tipo"=>"INDEX"),
															 array("valor"=>"<br><b>Fecha Ingreso : </b>"),
															 array("valor"=>9, "tipo"=>"INDEX"),
															 array("valor"=>"<br><b>Fecha Salida : </b>"),
															 array("valor"=>10, "tipo"=>"INDEX"),
															 ),
											 "click"=>array("funcion"=>"FormuRegistroJS",
															"param"=>array(array("valor"=>0, 	  "tipo"=>"INDEX"),
																		   array("valor"=>1, 	  "tipo"=>"INDEX")
																		  )
															)										 
											),
									   array("tipo"=>"img", "id"=>"badd", "name"=>"badd", "img"=>"../images/b_imprimir.png", 
											 "toltip"=>array(array("valor"=>"HAGA CLICK PARA <img src=\"../images/b_imprimir.png\"> <b>IMPRIMIR</b> EL HOSPEDAJE"),
															 array("valor"=>"<br><b>Nro. Check-IN : </b>"),
															 array("valor"=>0, "tipo"=>"INDEX"),
															 array("valor"=>"<br><b>Empresa : </b>"),
															 array("valor"=>1, "tipo"=>"INDEX"),
															 array("valor"=>" - "),
															 array("valor"=>2, "tipo"=>"INDEX"),
															 array("valor"=>"<br><b>Cliente : </b>"),
															 array("valor"=>3, "tipo"=>"INDEX"),
															 array("valor"=>" - "),
															 array("valor"=>4, "tipo"=>"INDEX"),
															 array("valor"=>"<br><b>Trabajador : </b>"),
															 array("valor"=>6, "tipo"=>"INDEX"),
															 array("valor"=>" - "),
															 array("valor"=>7, "tipo"=>"INDEX"),
															 array("valor"=>"<br><b>Fecha Ingreso : </b>"),
															 array("valor"=>9, "tipo"=>"INDEX"),
															 array("valor"=>"<br><b>Fecha Salida : </b>"),
															 array("valor"=>10, "tipo"=>"INDEX"),
															 ),
											 "click"=>array("funcion"=>"xImprimirJS",
															"param"=>array(array("valor"=>0, "tipo"=>"INDEX")
																		   )
															)
											 )
									)
						);
		return $this->SetGridTabla2($varTabla);
		}
	
	function FormuRegistro($varHos=NULL,$varHab=NULL) {
			$SubTit = $this->varTitulo." - REGISTRAR VENTA";
			$varLock = "SI";
			$sql = "select R.id_hospedaje as IDE, 
					R.id_empresa as CEMP, 
					R.id_cliente as CCLI, C.nombre AS CLIENTE, 
					C.id_segmento as CSEG, S.nombre as SEGMENTO, 
					CL.id_lista as CLIS, L.nombre as LISTA,
					R.id_trabajador AS CTRA, CONCAT(T.apellido_paterno,' ',T.apellido_materno,' ',T.nombre) AS TRABAJADOR, 
					HH.id_habitacion as CHAB, CONCAT(H.numero,' - ', TH.nombre) as HABITACION,
					spFuncion_FechaTexto(R.fecha_ingreso) AS FING, 
					DATE_FORMAT(R.fecha_ingreso,'%h:%i %p') AS HING
					from _sh_hospedaje_habitacion HH
					inner join _sh_hospedaje R on HH.id_hospedaje = R.id_hospedaje
					inner join _sh_habitacion H ON HH.id_habitacion = H.id_habitacion
					inner join _sh_tipo_habitacion TH ON H.id_tipo_habitacion = TH.id_tipo_habitacion
					inner join _sv_cliente C    ON R.id_cliente = C.id_cliente 
					left join _sh_segmento S    ON C.id_segmento = S.id_segmento 
					left join _sv_cliente_lista CL ON CL.id_cliente = C.id_cliente and CL.id_empresa = R.id_empresa
					left join _sv_lista L       ON L.id_empresa = CL.id_empresa AND L.id_lista = CL.id_lista
					inner join _sv_trabajador T ON R.id_trabajador = T.id_trabajador
					where R._estado = 'A' 
					and R.id_hospedaje = $varHos;";	
			$this->AbrirConexion();
			$rs = $this->Query($sql);
			$this->CerrarConexion();
			$Fila = $this->FetchArray($rs);
		$sqlemp = "call spQuery_Lista_Empresa($_SESSION[_CUSE], '','%');";
		$sqlalm = "call spQuery_Lista_Almacen($Fila[CEMP],NULL,NULL, $_SESSION[_CUSE]);";
		$sqlcon = array("CO" => "CONTADO", "CR" => "CREDITO");
		$varFormu=array("id"=>"form", "name"=>"form", "metodo"=>"POST");
		$varTabla=array("id"=>"table", "name"=>"table", "tamano"=>"470", "clase"=>"FormTitulo", "titulo"=>$SubTit,						
						"ocult"=>array(array("tipo"=>"oculto", "id"=>"titu",  "name"=>"titu",  "valor"=>$SubTit),
									   array("tipo"=>"oculto", "id"=>"opt",   "name"=>"opt",   "valor"=>$varOpt),
									   array("tipo"=>"oculto", "id"=>"emp1",  "name"=>"emp1" , "valor"=>$Fila["CEMP"]),
									   array("tipo"=>"oculto", "id"=>"alm1",  "name"=>"alm1" , "valor"=>""),
									  ),
						"conte"=>array(array("titulo"=>"Check-IN :", "clase1"=>"FormCampo1", "clase2"=>"interior", "tamano"=>"80",
											 "campo"=>array("tipo"=>"varios",
															"contenido"=>array(array("tipo"=>"texto", "id"=>"cod", "name"=>"cod", "ancho"=>"65",
											 										 "valor"=>$Fila["IDE"], "alinear"=>"center", 
																					 "clase"=>"inputDisable", "locked"=>"SI", )))),
									   array("titulo"=>"EMPRESA :", "clase1"=>"FormCampo1", "clase2"=>"interior", "tamano"=>"80",
											 "campo"=>array("tipo"=>"varios",
															"contenido"=>array(array("tipo"=>"texto", "id"=>"ecod", "name"=>"ecod", "ancho"=>"65",
											 										 "valor"=>$Fila["CEMP"], "alinear"=>"center", 
																					 "clase"=>"inputDisable", "locked"=>"SI"),
																			   array("tipo"=>"text", "id"=>"enom", "name"=>"enom", "ancho"=>"290",
																			   		 "valor"=>$Fila["EMPRESA"], "clase"=>"inputDisable", "locked"=>"SI"))
															)
											 ),
									   array("titulo"=>"Habitacion :", "clase1"=>"FormCampo1", "clase2"=>"interior", "tamano"=>"80",
											 "campo"=>array("tipo"=>"varios",
															"contenido"=>array(array("tipo"=>"texto", "id"=>"hcod", "name"=>"hcod", "ancho"=>"65",
											 										 "valor"=>$Fila["CHAB"], "alinear"=>"center", 
																					 "clase"=>"inputDisable", "locked"=>"SI"),
																			   array("tipo"=>"text", "id"=>"hnom", "name"=>"hnom", "ancho"=>"290",
																			   		 "valor"=>$Fila["HABITACION"], "clase"=>"inputDisable", "locked"=>"SI"))
															)
											 ),
									   array("titulo"=>"Ingreso :", "clase1"=>"FormCampo1", "clase2"=>"interior",
											 "campo"=>array("tipo"=>"varios",
															"contenido"=>array(array("tipo"=>"texto", "id"=>"hini", "name"=>"hini", "alinear"=>"center",
																					 "ancho"=>"65", "locked"=>"SI", "clase"=>"inputDisable",
																					 "valor"=>$Fila["HING"]),
																			   array("tipo"=>"texto", "id"=>"fini", "name"=>"fini",
																					 "ancho"=>"290", "locked"=>"SI", "clase"=>"inputDisable",
																					 "valor"=>$Fila["FING"])
																			   )
														 	)
											 ),
									   array("titulo"=>"Trabajador :", "clase1"=>"FormCampo1", "clase2"=>"interior",
											 "campo"=>array("tipo"=>"varios",
															"contenido"=>array(array("tipo"=>"text", "id"=>"tcod", "name"=>"tcod", "ancho"=>"65", 
																					 "alinear"=>"center", "valor"=>$Fila["CTRA"],
																					 "clase"=>"inputDisable", "locked"=>"SI"),
																			   array("tipo"=>"text", "id"=>"tnom", "name"=>"tnom", "ancho"=>"290",
																			   		 "valor"=>$Fila["TRABAJADOR"], "clase"=>"inputDisable", "locked"=>"SI")
																			   )
														 	)
											 ),
									   array("titulo"=>"Cliente :", "clase1"=>"FormCampo1", "clase2"=>"interior",
											 "campo"=>array("tipo"=>"varios",
															"contenido"=>array(array("tipo"=>"text", "id"=>"ccod", "name"=>"ccod", "valor"=>$Fila["CCLI"],
																					 "ancho"=>"65", "alinear"=>"center", 
																					 "clase"=>"inputDisable", "locked"=>"SI"),
																			   array("tipo"=>"text", "id"=>"cnom", "name"=>"cnom", "valor"=>$Fila["CLIENTE"], 
																					 "ancho"=>"290", "clase"=>"inputDisable", "locked"=>"SI")
																			   )
														 	)
											 ),
									   array("titulo"=>"Segmento :", "clase1"=>"FormCampo1", "clase2"=>"interior",
											 "campo"=>array("tipo"=>"varios",
															"contenido"=>array(array("tipo"=>"text", "id"=>"scod", "name"=>"scod", "ancho"=>"65", 
																					 "alinear"=>"center", "clase"=>"inputDisable", "locked"=>"SI",
																					 "valor"=>$Fila["CSEG"]),
																			   array("tipo"=>"text", "id"=>"snom", "name"=>"snom", "ancho"=>"290",  
																					 "clase"=>"inputDisable", "locked"=>"SI", "valor"=>$Fila["SEGMENTO"])
																			   )
														 	)
											 ),
									   array("titulo"=>"Lista P. :", "clase1"=>"FormCampo1", "clase2"=>"interior",
											 "campo"=>array("tipo"=>"varios",
															"contenido"=>array(array("tipo"=>"text", "id"=>"lcod", "name"=>"lcod", "ancho"=>"65", 
																					 "alinear"=>"center", "clase"=>"inputDisable", "locked"=>"SI",
																					 "valor"=>$Fila["CLIS"]),
																			   array("tipo"=>"text", "id"=>"lnom", "name"=>"nom", "ancho"=>"290",  
																					 "clase"=>"inputDisable", "locked"=>"SI", "valor"=>$Fila["LISTA"])
																			   )
														 	)
											 ),
									   array("titulo"=>"Almacen :", "clase1"=>"FormCampo1", "clase2"=>"interior",
											 "campo"=>array("tipo"=>"varios",
															"contenido"=>array(array("tipo"=>"select", "id"=>"alm", "name"=>"alm", "sql"=>$sqlalm,
											 										 "ancho"=>"290", "titulo"=>" --[[SELECCIONAR]]-- ")
																			   )
														 	)
											 ),
									   array("titulo"=>"Condicion :", "clase1"=>"FormCampo1", "clase2"=>"interior",
											 "campo"=>array("tipo"=>"varios",
															"contenido"=>array(array("tipo"=>"select_simple", "id"=>"con", "name"=>"con",
															  						 "combo"=>array("sql"=>$sqlcon, "sincod"=>"SI", "ancho"=>"150", 
																					 				"titulo"=>"--[[SELECCIONAR]]--"))
																			   )
														 	)
											 ),
									   array("titulo"=>"Sub Total :", "clase1"=>"FormCampo1", "clase2"=>"interior",
											 "campo"=>array("tipo"=>"varios",
															"contenido"=>array(array("tipo"=>"text", "id"=>"sub", "name"=>"sub", "ancho"=>"65", 
																					 "alinear"=>"right", "clase"=>"inputDisable", "locked"=>"SI"),
																			   array("tipo"=>"simple", "valor"=>"Igv : ", "clase_in"=>"FormCampo1", 
																			   		 "ancho"=>"65"),
																			   array("tipo"=>"text", "id"=>"igv", "name"=>"igv", "ancho"=>"65",  
																					 "alinear"=>"right", "clase"=>"inputDisable", "locked"=>"SI"),
																			   array("tipo"=>"simple", "valor"=>"Total : ", "clase_in"=>"FormCampo1", 
																			   		 "ancho"=>"65"),
																			   array("tipo"=>"text", "id"=>"tot", "name"=>"tot", "ancho"=>"65",  
																					 "alinear"=>"right", "clase"=>"inputDisable", "locked"=>"SI")
																			   )
														 	)
											 ),
									   ),
						"boton"=>array(array("tipo"=>"button", "id"=>"bsav", "name"=>"bsav", "ancho"=>"100",
											 "clase"=>"boton_guardar", "texto"=>"Grabar", "click"=>"javascrip:xGrabarJS()"),
									   array("tipo"=>"button", "id"=>"breg", "name"=>"breg", "ancho"=>"100",
											 "clase"=>"boton_cancelar", "texto"=>"Cancelar", "click"=>"javascrip:xajax_xRegresar()")
									  )
						);
		$varTitu1 = "<input id=\"btadd1\" name=\"btadd1\" type=\"button\" class=\"boton_agregar_producto\" style=\"cursor:pointer; width:150px;\"  
				    value=\"Agregar Producto\" onClick=\"AddHabProducto()\">";
		$varTitu2 = "<input id=\"btadd2\" name=\"btadd2\" type=\"button\" class=\"boton_agregar_servicio\" style=\"cursor:pointer; width:150px;\"  
				    value=\"Agregar Servicio\" onClick=\"AddHabServicio()\">";
		$varTab_1=array("id"=>"tab1", "name"=>"tab1", "tamano"=>"700", "clase"=>"FormTitulo", "titulo"=>$varTitu1, "sql"=>NULL,
						"ocult"=>array(array("tipo"=>"oculto", "id"=>"num1", "name"=>"num1", "valor"=>0)),
						"conte"=>array(array("titulo"=>"CODIGO", "clase"=>"FormTitulo", "tamano"=>"60", "alinear"=>"center",
											 "campo"=>array("tipo"=>"texto", "id"=>"pro", "name"=>"pro", "alinear"=>"center", "ancho"=>"60")
											 ),
									   array("titulo"=>"DESCRIPCION", "clase"=>"FormTitulo", "tamano"=>"280",
											 "campo"=>array("tipo"=>"texto", "id"=>"ide", "name"=>"ide", "clase"=>"inputDisable", 
											 				"locked"=>"SI", "ancho"=>"280", "alinear"=>"center")
											),
									   array("titulo"=>"UM", "clase"=>"FormTitulo", "tamano"=>"60",
											 "campo"=>array("tipo"=>"texto", "id"=>"tip", "name"=>"tip", "clase"=>"inputDisable", 
											 				"locked"=>"SI", "ancho"=>"60")
											),
									   array("titulo"=>"STOCK", "clase"=>"FormTitulo", "tamano"=>"60",
											 "campo"=>array("tipo"=>"texto", "id"=>"pis", "name"=>"pis", "clase"=>"inputDisable", 
															"locked"=>"SI", "ancho"=>"60")
											),
									   array("titulo"=>"PRECIO", "clase"=>"FormTitulo", "tamano"=>"60",
											 "campo"=>array("tipo"=>"texto", "id"=>"car", "name"=>"car", "clase"=>"inputDisable", 
															"locked"=>"SI", "ancho"=>"60", "alinear"=>"center")
											),										   
									   array("titulo"=>"CANT.", "clase"=>"FormTitulo", "tamano"=>"60", "alinear"=>"center",
											 "campo"=>array("tipo"=>"texto", "id"=>"cos", "name"=>"cos", "alinear"=>"center", "ancho"=>"60", 
															"clase"=>"inputDisable","locked"=>"SI"
															)
											),
									   array("titulo"=>"TOTAL", "clase"=>"FormTitulo", "tamano"=>"60", "alinear"=>"center",
											 "campo"=>array("tipo"=>"texto", "id"=>"cos", "name"=>"cos", "alinear"=>"center", "ancho"=>"60", 
															"clase"=>"inputDisable","locked"=>"SI"
															)
											),
									   array("titulo"=>"DEL", "clase"=>"FormTitulo", "tamano"=>"25", "alinear"=>"center",
											 "campo"=>array("tipo"=>"texto", "id"=>"cos", "name"=>"cos", "alinear"=>"center", "ancho"=>"25", 
															"clase"=>"inputDisable","locked"=>"SI"
															)
											)
									   )
						);
		
		$varTab_2=array("id"=>"tab2", "name"=>"tab2", "tamano"=>"700", "clase"=>"FormTitulo", "titulo"=>$varTitu2, "sql"=>NULL,
						"oculto"=>array(array("tipo"=>"oculto", "id"=>"num2", "name"=>"num2", "valor"=>0)),
						"conte"=>array(array("titulo"=>"CODIGO", "clase"=>"FormTitulo", "tamano"=>"60", "alinear"=>"center",
											 "campo"=>array("tipo"=>"texto", "id"=>"pro", "name"=>"pro", "alinear"=>"center", "ancho"=>"60")
											 ),
									   array("titulo"=>"DESCRIPCION", "clase"=>"FormTitulo", "tamano"=>"340",
											 "campo"=>array("tipo"=>"texto", "id"=>"ide", "name"=>"ide", "clase"=>"inputDisable", 
											 				"locked"=>"SI", "ancho"=>"340", "alinear"=>"center")
											),
									   array("titulo"=>"UM", "clase"=>"FormTitulo", "tamano"=>"60",
											 "campo"=>array("tipo"=>"texto", "id"=>"tip", "name"=>"tip", "clase"=>"inputDisable", 
											 				"locked"=>"SI", "ancho"=>"60")
											),
									   array("titulo"=>"PRECIO", "clase"=>"FormTitulo", "tamano"=>"60",
											 "campo"=>array("tipo"=>"texto", "id"=>"car", "name"=>"car", "clase"=>"inputDisable", 
															"locked"=>"SI", "ancho"=>"60", "alinear"=>"center")
											),										   
									   array("titulo"=>"CANT.", "clase"=>"FormTitulo", "tamano"=>"60", "alinear"=>"center",
											 "campo"=>array("tipo"=>"texto", "id"=>"cos", "name"=>"cos", "alinear"=>"center", "ancho"=>"60", 
															"clase"=>"inputDisable","locked"=>"SI"
															)
											),
									   array("titulo"=>"TOTAL", "clase"=>"FormTitulo", "tamano"=>"60", "alinear"=>"center",
											 "campo"=>array("tipo"=>"texto", "id"=>"cos", "name"=>"cos", "alinear"=>"center", "ancho"=>"60", 
															"clase"=>"inputDisable","locked"=>"SI"
															)
											),
									   array("titulo"=>"DEL", "clase"=>"FormTitulo", "tamano"=>"25", "alinear"=>"center",
											 "campo"=>array("tipo"=>"texto", "id"=>"cos", "name"=>"cos", "alinear"=>"center", "ancho"=>"25", 
															"clase"=>"inputDisable","locked"=>"SI"
															)
											)
									   )
						);
																		
		$varTabs =array(array("name"=>"Venta de Productos",
							  "tipo"=>"det",  "alto"=>"300", "ancho"=>"700", "tabla"=>$varTab_1
							  ),
						array("name"=>"Venta de Servicios",
							  "tipo"=>"det",  "alto"=>"300", "ancho"=>"700", "tabla"=>$varTab_2
							  )
						);
																		
		return $this->setTablaFormTabs($varFormu, $varTabla, $varTabs);
		}
	
	function ProcesoGrabar($varForm = NULL) {		
		$varUsr = (isset($_SESSION["_CUSE"]))?$_SESSION["_CUSE"]:1;
		$varEmp = $varForm["emp1"];
		$varAlm = $varForm["alm1"];
		$varHos = ($varForm["cod"]=="")? "NULL" : $varForm[cod];
		$varHab = ($varForm["hcod"]=="")? "NULL" : $varForm[hcod];
		$varLis = ($varForm["lcod"]=="")? "NULL" : $varForm[lcod];
		$varCon = $varForm["con"];
		foreach ($varForm["pro"] as $varIde=>$varPro) {
			$varPro = $varForm["pro"][$varIde];
			$varPre = $varForm["prp"][$varIde];
			$varCan = $varForm["cap"][$varIde];
			$varUme = "'".$varForm["ump"][$varIde]."'";
			$sqldet.= "call spMante_Hospedaje_Venta_Producto($varHos, $varEmp, $varAlm, $varLis, '$varCon', $varHab, '$varPro', $varCan, $varPre, $varUme, NOW(),$varUsr);";
			}
		$this->AbrirConexion();
		$this->Query($sqldet);
		$this->CerrarConexion();
		return "OK";
		}
		
	}
	
?>