<?php
session_start();
$com = "A";
include("DMMYSQLG.php");
include("DSA3000.php");
include("DF80000.php");
include ("varfun.php");
include("JQUERY.inc");
?>

<html>
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>
<script language="javascript">

  $(document).ready(function(){
	function formatItem(row) {
		return " (<strong>" + row[1] + "</strong>)"+row[0];
	}

	var pagRes='caj_checkout_DS.php';
	var idObjDes='des_ope';
	var idObjCve='clave';
        var nomObjRad='tip_bus_ope';
	$("#"+idObjDes).autocomplete({ //Des
	    source:pagRes,	
            minChars: 1,                 //Caracteres Minimos antes de autocompletar
		max:20,                      //maximo de resultados mostrados, se manda como limit en autosugestion
		cacheLength: 0,
		delay: 200,                  //Retardo de autocompletar 
		width: 500,                  //ancho del cuadro de despliegue
		highlight: false,            //Resalta letras coincidentes
		autoFill: true,             //autocompleta en texto la posible palabra
		scroll: true,				 //si cuadro tiene barra scroll
		scrollHeight: 100,           //alto del cuadro para el scroll
	
		 select: function( event, ui ) {

   $("#"+idObjCve).val(ui.item.pclave);
   $("#"+idObjDes).val(ui.item.descripcion);		
		$('#des_ope').focus();
		$('#carbono').val(ui.item.pmontomax);
		$('#id_ope').val(ui.item.id);
                javascript: document.getElementById('frm1').submit();
                }
 //Parametros Extra a Mandar en autosugestion

	});	

});

     $(document).ready(function(){
	function formatItem(row) {
		return " (<strong>" + row[1] + "</strong>)"+row[0];
	}
        var pagRes='caj_checkout_DS.php';
	var idObjDes='des_ope';
	var idObjCve='clave'; 
	var nomObjRad='tip_bus_ope';
	$("#"+idObjCve).autocomplete( {
            source:pagRes,
		minChars: 1,                 //Caracteres Minimos antes de autocompletar
		max:20,                      //maximo de resultados mostrados, se manda como limit en autosugestion

		                 //ancho del cuadro de despliegue
		 delay: 200,           //Resalta letras coincidentes
		autoFill: true,             //autocompleta en texto la posible palabra
		scroll: true,				 //si cuadro tiene barra scroll
		scrollHeight: 100,           //alto del cuadro para el scroll	
                           select: function( event, ui ) {
                      $("#"+idObjCve).val(ui.item.pclave);
   $("#"+idObjDes).val(ui.item.descripcion);		
		$('#des_ope').focus();
		$('#carbono').val(ui.item.pmontomax);
		$('#id_ope').val(ui.item.id);
		javascript: document.getElementById('frm1').submit();

            }

    });	
});
//$(document).ready(function(){
//	function formatItem(row) {
//		return " (<strong>" + row[3] + "</strong>)"+row[0];
//	}
//	$("#des_ope").autocomplete('caj_checkout_DS.php',{
//		minChars: 1,                 //Caracteres Minimos antes de autocompletar
//		//max:3                        //maximo de resultados mostrados, se manda como limit en autosugestion
//		delay: 200,                  //Retardo de autocompletar 
//		width: 500,                  //ancho del cuadro de despliegue
//		highlight: false,            //Resalta letras coincidentes
//		autoFill: false,             //autocompleta en texto la posible palabra
//		scroll: true,				 //si cuadro tiene barra scroll
//		scrollHeight: 300,           //alto del cuadro para el scroll
//		formatItem:formatItem,	     //formato de presentacion de las posibles busquedas
//		extraParams:{tipBus:'d'}     //Parametros Extra a Mandar en autosugestion
//	});
//	$("#clave").autocomplete('caj_checkout_DS.php',{
//		minChars: 1,                 //Caracteres Minimos antes de autocompletar
//		//max:3                        //maximo de resultados mostrados, se manda como limit en autosugestion
//		delay: 200,                  //Retardo de autocompletar 
//		width: 500,                  //ancho del cuadro de despliegue
//		highlight: false,            //Resalta letras coincidentes
//		autoFill: false,             //autocompleta en texto la posible palabra
//		scroll: true,				 //si cuadro tiene barra scroll
//		scrollHeight: 300,           //alto del cuadro para el scroll
//		formatItem:formatItem,       //formato de presentacion de las posibles busquedas
//		formatResult:function(row){  //formato de seleccion de busqueda
//			return row[3];
//		},	                        
//		extraParams:{tipBus:'c'}     //Parametros Extra a Mandar en autosugestion
//	});
//	$("#clave").result(function(event, data, formatted){
//		$('#des_ope').val(data[0]);
//		$('#des_ope').focus();
//		$('#carbono').val(data[2]);
//		$('#id_ope').val(data[1]);
//		javascript: document.getElementById('frm1').submit();
//	});	
//	$("#des_ope").result(function(event, data, formatted){
//		$('#id_ope').val(data[1]);
//		$('#carbono').val(data[2]);
//		$('#clave').val(data[3]);
//		javascript: document.getElementById('frm1').submit();
//	});	
//	$("input[@name=tip_bus]").click(function(){
//		$('#des_ope').setOptions({
//			extraParams:{
//				tipBus:getValRadChe('tip_bus')
//			}
//		});
//	});
//});

function openWindow(dataGen,valores){

	var objDate=new Date();

	var getVars,getVarsAux,distPage;

	var idVentana;

	for(getVarsAux in valores){

		getVars +='&'+getVarsAux+'='+valores['getVarsAux'];

	}

	if(typeof dataGen.width=='undefined') dataGen.width='800';

	if(typeof dataGen.height=='undefined') dataGen.height='600';

	distPage='?tmr='+objDate.getHours()+objDate.getMinutes()+objDate.getSeconds()+objDate.getDay()+objDate.getMonth()+objDate.getFullYear();

	idVentana=window.open(dataGen.action+distPage+getVars,dataGen.name,'width='+dataGen.width+',height='+dataGen.height+',top=100,left=50,scrollbars=yes,menubar=no,status=no');

	return idVentana;

}

function act_checkbox(va)

{

	if(va == true){

		document.frm1.costo.disabled = 1;

		document.frm1.total.disabled = 0;

		//document.getElementById("ftipocto").style.visibility='visible';

	}else{

		

		//document.getElementById("ftipocto").style.visibility='hidden';

	    document.frm1.costo.disabled = 0;

		document.frm1.total.disabled = 1;

	}

}
</script>
<body>
<?php 
/*Verifica que exista Variable contenedora del Id del Encabezado*/	
if (!isset($_REQUEST['bot'])){
	echo '<h2>!!! SELECCIONA UN REGISTRO... ACTUALIZANDO !!!</h2>';
	echo '<meta content="1; url=caj_checkout_PR.php"  HTTP-EQUIV="REFRESH">';
	exit();
}	
$his=mysqli_query($con ,"select * from valeryus19 where n_reg='".$_REQUEST['bot']."'");
$h1=mysqli_fetch_array($his);
if ($h1['status'] == 'HISTORICO'){
	echo '<h2>!!! ESTE FOLIO YA ESTA SALDADO... ACTUALIZANDO !!!</h2>';
	echo '<meta content="1; url=caj_checkout_PR.php"  HTTP-EQUIV="REFRESH">';
	exit();
	}
/****************************************************************/
/*Llena Variable para verificar si esta en modo Update*/
if(!isset($_POST['block_mod'])){
	$bMod=false;			//Bandera de modificar, bloquea pagina en modo Modificar esperando el evento que la cambie de estado
	$bSel='';				//Id registro a modificar
}
else{
	$bMod=$_POST['block_mod'];
	$bSel=$_POST['reg_mod'];
}

/****************************************************/
$bModPri=false;				//Bandera de Modificar(True solo En el Primer Bloqueo o recarga de pagina en modo Modificar)
$id_enc=$_REQUEST["bot"]; 	//Id de Encabezado
$id_det=$_POST['bot_det'];	//Id de Detalle (si se selecciono alguno)
/*Crear Objetos Necesarios para Manipular Encabezado y Detalle*/
include('DI21100_CL.php');
$dataEnc['idInvent']=$id_enc;
$dataDet['idInvent']=$id_enc;
$dataDet['idInvend']=$id_det;
//echo "DETALLE: $dataDet['idInvend']";$reg_cuenta = $_GET['n_reg'];
//$encInv = new EncFac($dataEnc);
//$detInv = new DetFac($dataDet);
/************************************************************/
/*Recuperar Informacin de Encabezado y la coloca en los objetos HTML*/
//$res=$encInv->busReg();
$dt_encinv=mysqli_fetch_array(mysqli_query($con ,"SELECT * FROM valeryus19 WHERE n_reg='$id_enc'"));
$_REQUEST['id_prod']=$dt_encinv['fnombre'];
$_REQUEST['des_prod']=$dt_encinv['fnumcto'];
$_REQUEST['fec_prod']=chfecha($dt_encinv['ffecsalida'],'Y-m-d','d/m/Y');
$_REQUEST['fac_prod']=$dt_encinv['fapellido'];
$_REQUEST['tip_prod']=$dt_encinv['almacen'];
$_REQUEST['n_reg']=$dt_encinv['n_reg'];
$_REQUEST['invmin']=$dt_encinv['ftipocto'];
$_REQUEST['invmax']=$dt_encinv['fnumctos'];
$_REQUEST['codigo']=$dt_encinv['n_reg'];
$_REQUEST['fnorasvip']=$dt_encinv['fnorasvip'];
$_REQUEST['fcodgrupo']=$dt_encinv['fcodgrupo'];
$_REQUEST['fcodmeca']=$dt_encinv['fcodmeca'];
$_REQUEST['fcodagen']=$dt_encinv['fcodagen'];
$_REQUEST['codseg']=$dt_encinv['codseg'];
$_REQUEST['ffecllegada']=chfecha($dt_encinv['ffecllegada'],'Y-m-d','d/m/Y');
$_REQUEST['fformpago']=$dt_encinv['fformpago'];
$_REQUEST['tex']=$dt_encinv['tex'];
$_REQUEST['tex4']=$dt_encinv['tex4'];
$_REQUEST['text1']=$dt_encinv['text1'];
$_REQUEST['text4']=$dt_encinv['text4'];
$_REQUEST['fmonmen']=$dt_encinv['fmonmen'];
$_REQUEST['fmonadu']=$dt_encinv['fmonadu'];
 if ($_REQUEST['text4'] == 0 && $_REQUEST['tex4'] != 0){
 	$tarifa=$_REQUEST['tex4'];
	}	
 if ($_REQUEST['text4'] != 0 && $_REQUEST['tex4'] == 0){
 	$tarifa=$_REQUEST['text4'];
	}		
 if ($_REQUEST['text4'] != 0 && $_REQUEST['tex4'] != 0){
		  $fecha1 = date('Y-m-d') ;
		echo  $today = date('l', strtotime($fecha1));
		  if ($today == "Sunday"){	//domingo
		   	$tarifa=$_REQUEST['text4'];
		  }
		  if ($today == "Monday"){ //lunes
		   	$tarifa=$_REQUEST['text4'];
		  }
		  if ($today == "Tuesday"){ //martes 	
		   	$tarifa=$_REQUEST['text4'];
		  }
	      if ($today == "Wednesday"){ //miercoles
		   	$tarifa=$_REQUEST['text4'];
		  }
		  if ($today == "Thursday"){ //jueves 
		   	$tarifa=$_REQUEST['text4'];
		  }
		  if ($today == "Friday"){ //viernes
		   	$tarifa=$_REQUEST['tex4'];
		  }
	      if ($today == "Saturday"){ //sabado
		   	$tarifa=$_REQUEST['tex4'];
		  }
	}	  
/******************************************************************/
/*Verificamos Si es la Primer Carga de La Pagina por si es necesario realizar alguna accion*/
if(!isset($_POST['DI21100_AGDET'])){
	$_REQUEST['id_iva']  =$dt_encinv['idTasIva'];
}
/************************************************/
/*Bloque de condiciones para Realizar las distintas operaciones sobre el detalle*/
if(isset($_POST['agregar'])){
    if($_POST['des_ope'] == "" || $_POST['id_ope'] == "" || $_POST['cantidad'] == ""){
	echo alert_js("NO SE HA PODIDO AGREGAR EL CARGO/ABONO");
	}else{
	//codigo agregar  solo guarda el id del producto
	$dataDet['idInventDet']=$_POST['id_ope'];
	$dataDet['canProd']=$_POST['cantidad'];
	$dataDet['subtotal']=$_POST['costo'];
	$dataDet['tolProd']=$_POST['total'];
	$dataDet['desProd']=$_POST['toldes'];
	$dataDet['TotalProd']=$_POST['ivatotal'];
	$dataDet['proProd']=$_POST['proteina']; 
	$dataDet['lipProd']=$_POST['lipido'];
	$dataDet['carProd']=$_POST['carbo'];
	$dataDet['kcalProd']=$_POST['kcal'];
	$dataDet['calProd']=$_POST['calcio'];
	$dataDet['sodProd']=$_POST['rfc'];
	$dataDet['potProd']=$_POST['potasio'];
	$dataDet['merProd']=$dt_encinv['fcodmeca'];
	$dataDet['gruProd']=$dt_encinv['fcodgrupo'];
	$dataDet['agenProd']=$dt_encinv['fcodagen'];
	$dataDet['segProd']=$dt_encinv['codseg'];
	//$detInv->resetData($dataDet);
	//$rs=$detInv->agregar();
		$fecha = $dt_empres['fec_alta'];
	    $fechita = chfecha($fecha,'Y-m-d','d/m/Y');
         //   echo "INSERT INTO valeryus030 SET nparte1='".$dataDet['idInvent']."', nparte1_det='".$dataDet['idInventDet']."', can_Ref='".$dataDet['canProd']."', costo='".$dataDet['subtotal']."', toldes='".$dataDet['desProd']."', total='".$dataDet['tolProd']."', ivatotal='".$dataDet['TotalProd']."', proteina='".$dataDet['proProd']."', potasio='".$dataDet['potProd']."', usuario='".$_SESSION['usuario']."', acc_fec='$fecha', acc_hor=CURTIME(), mercado='".$dataDet['merProd']."', grupo='".$dt_encinv['fcodgrupo']."', agencia='".$dt_encinv['fcodagen']."', segmento='".$dt_encinv['codseg']."'";
		$rs=mysqli_query($con ,"INSERT INTO valeryus030 SET nparte1='".$dataDet['idInvent']."', nparte1_det='".$dataDet['idInventDet']."', can_Ref='".$dataDet['canProd']."', costo='".$dataDet['subtotal']."', toldes='".$dataDet['desProd']."', total='".$dataDet['tolProd']."', ivatotal='".$dataDet['TotalProd']."', proteina='".$dataDet['proProd']."', potasio='".$dataDet['potProd']."', usuario='".$_SESSION['usuario']."', acc_fec='$fecha', acc_hor=CURTIME(), mercado='".$dataDet['merProd']."', grupo='".$dt_encinv['fcodgrupo']."', agencia='".$dt_encinv['fcodagen']."', segmento='".$dt_encinv['codseg']."'");
	}if($rs){
		$_REQUEST['id_ope']  ='';
		$_REQUEST['des_ope'] ='';
		$_REQUEST['cantidad']='';
		$_REQUEST['costo']='';
		$_REQUEST['total']='';	
		$_REQUEST['toldes']='';	
		$_REQUEST['ivatotal']='';
		$_REQUEST['proteina']='';
		$_REQUEST['lipido']='';
		$_REQUEST['carbo']='';
		$_REQUEST['kcal']='';
		$_REQUEST['calcio']='';
		$_REQUEST['clave']='';
		$_REQUEST['rfc']='';
		$_REQUEST['potasio']='';         //  nombre del campo....		
	}
}
elseif(isset($_POST['modificar']) && isset($_POST['bot_det'])){
  echo '12e'.  $ako = $_POST['bot_det'];
	$sql = mysqli_fetch_array(mysqli_query($con ,"SELECT * FROM valeryus030 WHERE id_invend = '$ako'"));
		$fecha = $dt_empres['fec_alta'];
	$fechita = chfecha($fecha,'Y-m-d','d/m/Y');
	if ($sql['acc_fec'] != $fecha){
	echo alert_js("NO SE PUEDE MODIFICAR");
	}else{
	//Recupera Registro de Detalle y coloca los valores en los objetos HTML
	//Cambia la bandera de modificar a True y llena la variable que contiene el id del registro a modificar
	//echo 'qqqqqqqqqqq13e'.$dataDet['idInvend'];
	$dt_invendMod=mysqli_fetch_array(mysqli_query($con ,"SELECT * FROM valeryus030 WHERE id_invend='".$dataDet['idInvend']."'"));
	$auxInvent=mysqli_fetch_array(mysqli_query($con ,"SELECT * FROM valeryus09 WHERE n_reg='".$dt_invendMod['nparte1_det']."'"));
	$_REQUEST['id_ope']=$dt_invendMod['nparte1_det'];
	$_REQUEST['des_ope']=$auxInvent['descripcion'];	
	$_REQUEST['cantidad']=$dt_invendMod['can_ref'];
	$_REQUEST['costo']=$dt_invendMod['costo'];
	$_REQUEST['total']=$dt_invendMod['total'];
	$_REQUEST['toldes']=$dt_invendMod['toldes'];
	$_REQUEST['ivatotal']=$dt_invendMod['ivatotal'];
	$_REQUEST['proteina']=$dt_invendMod['proteina'];
	$_REQUEST['lipido']=$dt_invendMod['lipido'];
	$_REQUEST['carbo']=$dt_invendMod['carbo'];
	$_REQUEST['kcal']=$dt_invendMod['calorias'];
	$_REQUEST['calcio']=$dt_invendMod['calcio'];
	$_REQUEST['rfc']=$dt_invendMod['sodio'];
	$_REQUEST['potasio']=$dt_invendMod['potasio'];            //izquierda. nombre del campo---->derecha. nombre de la variable.
	$bSel=$_POST['bot_det'];
	$bModPri=true;
	$bMod=true;
	echo $_REQUEST['costo'];
	$_POST['carbono']='';
}
}
elseif(isset($_POST['eliminar']) && isset($_POST['bot_det'])){
	//codigo eliminar
	$ako = $_POST['bot_det'];
	$sql = mysqli_fetch_array(mysqli_query($con ,"SELECT * FROM valeryus030 WHERE id_invend = '$ako'"));
		$fecha = $dt_empres['fec_alta'];
	$fechita = chfecha($fecha,'Y-m-d','d/m/Y');
	if ($sql['acc_fec'] != $fecha){
	echo alert_js("NO SE PUEDE CANCELAR");
	}else{
	$rs=mysqli_query($con ,"UPDATE valeryus030 SET cancelado = 1, usu_can='".$_SESSION['usuario']."' WHERE id_invend='".$dataDet['idInvend']."'");
}
}
elseif(isset($_POST['modificarReg'])){
	$dataDet['idInventDet']=$_POST['id_ope'];
	$dataDet['canProd']=$_POST['cantidad'];
	$dataDet['subtotal']=$_POST['costo'];
	$dataDet['tolProd']=$_POST['total'];
	$dataDet['desProd']=$_POST['toldes'];
	$dataDet['TotalProd']=$_POST['ivatotal'];
	$dataDet['proProd']=$_POST['proteina'];
	$dataDet['lipProd']=$_POST['lipido'];
	$dataDet['carProd']=$_POST['carbo'];
	$dataDet['kcalProd']=$_POST['kcal'];
	$dataDet['calProd']=$_POST['calcio'];
	$dataDet['sodProd']=$_POST['rfc'];
	$dataDet['potProd']=$_POST['potasio'];
	//$detInv->resetData($dataDet);
	//$rs=$detInv->agregar();
		$fecha = $dt_empres['fec_alta'];
	$fechita = chfecha($fecha,'Y-m-d','d/m/Y');
	$rs=mysqli_query($con ,$sq="UPDATE  valeryus030 SET nparte1_det='".$dataDet['idInventDet']."', can_ref='".$dataDet['canProd']."', costo='".$dataDet['subtotal']."', total='".$dataDet['tolProd']."', ivatotal='".$dataDet['TotalProd']."', toldes='".$dataDet['desProd']."', proteina='".$dataDet['proProd']."', potasio='".$dataDet['potProd']."', usu_mod='".$_SESSION['usuario']."', acc_fec='$fecha', acc_hor=CURTIME() WHERE id_invend='$bSel'");
	//echo $sq;
	$bMod=false;
	$bSel='';
	if($rs){
		$_REQUEST['id_ope']  ='';
		$_REQUEST['des_ope'] ='';
		$_REQUEST['cantidad']='';
		$_REQUEST['costo']='';
		$_REQUEST['total']='';	
		$_REQUEST['toldes']='';		
		$_REQUEST['ivatotal']='';
		$_REQUEST['proteina']='';
		$_REQUEST['lipido']='';
		$_REQUEST['carbo']='';
		$_REQUEST['kcal']='';
		$_REQUEST['calcio']='';
		$_REQUEST['clave']='';
		$_REQUEST['rfc']='';
		$_REQUEST['potasio']='';			
	}
}elseif(isset($_POST['terminarCaptura'])){
$d=mysqli_query($con ,"select sum(costo) as costo from valeryus030 where cancelado=0 AND nparte1='".$id_enc."' ");
$suma=mysqli_fetch_array($d);
$j=mysqli_query($con ,"select sum(costo) as costa from valeryus030 where cancelado=2 AND nparte1='".$id_enc."' ");
$sum=mysqli_fetch_array($j);
$e=mysqli_query($con ,"select sum(total) as total from valeryus030 where cancelado=0 AND nparte1='".$id_enc."' ");
$zuma=mysqli_fetch_array($e);
$v=mysqli_query($con ,"select sum(total) as totad from valeryus030 where cancelado=2 AND nparte1='".$id_enc."' ");
$zum=mysqli_fetch_array($v);
$w = $suma["costo"] + $sum["costa"];
$p = $zuma["total"] + $zum["totad"];
$r = $w - $p;
        //echo "$r";
		$ssql = "UPDATE valeryus19 SET suma='$r' WHERE n_reg='".$id_enc."'";
		mysqli_query($con ,$ssql);
		mysqli_error($con);
		echo '<meta content="0; url=caj_checkout_PR.php"  HTTP-EQUIV="REFRESH">';		
		mysqli_close();
		exit();
}elseif(isset($_POST['checkOut'])){
$hab=mysqli_real_escape_string($con,$_REQUEST['des_prod']);
$hab_tranza=mysqli_fetch_array(mysqli_query($con ,"SELECT count(*) as numRows, ptventa.np_desc1 as ptVta from ctmesas 
		left join ptventa on (ptventa.nparte1=ctmesas.descripcion) 
		left join ctarea on (ctarea.nparte1=ctmesas.area)
		left join fpos on (fpos.mesa=ctmesas.nparte1)
		left join fcomhues on (fcomhues.fol_ven=fpos.fol_ven)
		where ctmesas.status=1 and fpos.status=1 and no_hab='$hab'"));
$fecha1 = date('Y-m-d') ; 
$datesys=$dt_empres['fec_alta'];
$suma=mysqli_fetch_array(mysqli_query($con ,"select sum(costo) as cargo from valeryus030 where (cancelado='0' or cancelado='2') AND nparte1='".$id_enc."'"));
$zuma=mysqli_fetch_array(mysqli_query($con ,"select sum(total) as abono from valeryus030 where (cancelado='0' or cancelado='2') AND nparte1='".$id_enc."'"));
$r=$suma['cargo'] - $zuma['abono'];
		//if($hab_tranza['numRows']>0){
		  //		echo alert_JS ("EL HUESPED TIENE UNA CUENTA ABIERTA EN :".$hab_tranza['ptVta']." !!!");
				//}	else

				if ($r==0){
		$lll = mysqli_query($con ,"select * from valeryus19 where n_reg = '".$id_enc."'");
        $info = mysqli_fetch_array($lll);	
		$cuarto = $info['fnumcto'];
		$sqa = mysqli_query($con ,"UPDATE valeryus19 SET fmuncto='$cuarto', status='HISTORICO', fususali='".$_SESSION['usuario']."', fhorasalid='".date('H:i:s')."', tus='OUT', fecha_real='$fecha1', ffecsalida='$datesys', fnumcto='', suma='0' WHERE n_reg='".$id_enc."'");
		$llaves = mysqli_query($con ,"update valeryus08  set nstaamalla = 'SUCIO', nstarecep = 'VACIO', status = 'DESOCUPADO' where ncto = '$cuarto'");
		$llaves = mysqli_query($con ,"update valeryus08 set ocupado = '#FF0000' where ncto = '$cuarto' and ocupado <>'#FF00CC'");
		
		include("caj_checkout_FAC.php");

		}else{
		echo alert_JS ("ES NECESARIO SALDAR $".number_format($r,2,'.',',')." DE LA CUENTA!!!");
		}
}
/*Si Se Realizaron Operaciones sobre detalle actualiza Totales Factura*/
if($rs){
	//$encInv->resetData($detInv->getTotFac());
	//$encInv->actTotFac();
}
/****************************************************************/
/*Busca los Registros pertenecientes al encabezado en cuestion*/
$sq_detfac=mysqli_query($con ,"SELECT * FROM valeryus030 WHERE nparte1='".$dataEnc['idInvent']."' order by acc_fec");

/*************************************************************/
?>
<!--form name="formulario" action="cualquiera.html" method="post">
Acepto las condiciones <input type="checkbox" value="acepto" onclick="document.formulario.enviar.disabled=!document.formulario.enviar.disabled"><br>
<input type="submit" name="enviar" value="Enviar" disabled>
</form-->
<form name="frm1" id="frm1" method="post" action="" enctype="multipart/form-data">
<input type="hidden" name="DI21100_AGDET" id="DI21100_AGDET" value="DI21100_AGDET.php">
<input type="hidden" name="bot" id="bot" value="<?php echo $_REQUEST['bot'];?>">
<input type="hidden" name="reg_mod" id="reg_mod" value="<?php echo $bSel;?>">
<input type="hidden" name="block_mod" id="block_mod" value="<?php echo $bMod;?>">
  <table   align="center">
    <tr>
      <th colspan="8" class=\"titulo\"><div align="center">AGREGAR CARGO/CLIENTE  </div></th>
    </tr>
    <tr>
      <td width="119"><strong>APELLIDO Y NOMBRE.</strong> </td>
      <td colspan="3"><input name="id_prod" type="text" tabindex="1" value="<?php echo "".$_REQUEST['fac_prod'].' '.$_REQUEST['id_prod'].""?>" size="50" readonly/></td>
      <td width="59"><strong>FOLIO</strong></td>
      <td width="147"><input name="codigo" type="text" id="codigo" size="6" value="<?php echo $_REQUEST['codigo']?>"></td>
      <td width="117" rowspan="6" nowrap bordercolor="#FFFFFF" style="#5F84B1"><div align="center" id="capa"><?php

			$sql = mysqli_query($con ,"SELECT * FROM valeryus19 where n_reg = '".$_REQUEST['n_reg']."'");
			while($reg=mysqli_fetch_array($sql)){ 
			$fotografia = 'foto/valeryus19/NO_'. $reg["n_reg"] .'.JPG';
			if (file_exists($fotografia)) {
				echo '<img src="foto/valeryus19/NO_'.$reg["n_reg"].'.JPG" width="150" height="175">';
			}else{
				echo '<img src="foto/sin_producto.jpg" width="150" height="175">';
			}
			}
		  ?>
      </div>      </td>
    </tr>
    <tr>
      <td><strong>TIPO DE HABITACION</strong></td>
      <td width="217"><input name="invmin" type="text" id="invmin" size="25" value="<?php echo $_REQUEST['invmin']?>"></td>
      <td width="114"><strong>No. DE HABITACION</strong></td>
      <td width="173"><input name="des_prod" type="text" id="des_prod" tabindex="2" value="<?php echo $_REQUEST['des_prod']?>" size="10" readonly></td>
      <td colspan="2"><strong>DIAS</strong>&nbsp;&nbsp; <input name="inmax" type="text" id="inmax" size="8" value="<?php echo $_REQUEST['invmax']?>"></td>
    </tr>
    <tr>
      <td><strong>FECHA DE LLEGADA</strong></td>
      <td><label>
        <input name="fec_llegada" type="text" tabindex="1" readonly value="<?php echo $_REQUEST['ffecllegada']?>"/>
      </label></td>
      <td><strong>FECHA DE SALIDA</strong></td>
      <td><label>
        <input name="fec_prod" type="text" tabindex="1" readonly value="<?php echo $_REQUEST['fec_prod']?>"/>
      </label></td>
      <td colspan="2" rowspan="3"><div align="center"><strong>NOTAS</strong></div>
        <textarea name="fnorasvip" cols="26" rows="4" id="fnorasvip" onBlur="may(this)" tabindex="4"><?php echo $_REQUEST['fnorasvip'];?></textarea>      </td>
    </tr>
    <tr>
      <td><strong>GRUPO</strong></td>
      <td colspan="3"><input name="fcodgrupo" type="text" id="fcodgrupo" size="50" value="<?php echo $_REQUEST['fcodgrupo']?>"></td>
    </tr>
    <tr>
      <td><strong>MERCADO</strong></td>
      <td><input name="fcodmeca" type="text" id="fcodmeca" size="20" value="<?php echo $_REQUEST['fcodmeca']?>"></td>
      <td><strong>AGENCIA</strong></td>
      <td><input name="fcodagen" type="text" id="fcodagen" size="20" value="<?php echo $_REQUEST['fcodagen']?>"></td>
    </tr>
    <tr>
      <td><strong>TARIFA</strong></td>
      <td colspan="2"><?php
	  if (($_REQUEST['tex4']!=0)&&($_REQUEST['text4']==0))
		  $tar="" .$_REQUEST['tex']."-".$_REQUEST['tex4']."";
		else if (($_REQUEST['tex4']==0)&&($_REQUEST['text4']!=0))
		  $tar="".$_REQUEST['text1']."-".$_REQUEST['text4']."";	
		else if (($_REQUEST['tex4']!=0)&&($_REQUEST['text4']!=0))  
          $tar="" .$_REQUEST['tex']."- $".$_REQUEST['tex4']."  |  ".$_REQUEST['text1']."- $".$_REQUEST['text4']."";
		else 
			$tar="";
	   ?><input name="tarifa" type="text" id="tarifa" size="20" value="<?php echo $tar; ?>"></td>
      <td><strong>SEGMENTO</strong></td>
      <td colspan="2"><input name="codseg" type="text" id="codseg" size="35" value="<?php echo $_REQUEST['codseg']?>"></td>
    </tr>
    <tr>
      <td><strong>TAR-XTR-MEN</strong></td>
      <td><input name="fmonmen" type="text" id="fmonmen" size="10" value="<?php echo $_REQUEST['fmonmen']; ?>"></td>
      <td><strong>TAR-XTR-ADU</strong><input name="fmonadu" type="text" id="fmonadu" size="10" value="<?php echo $_REQUEST['fmonadu']; ?>"></td>
      <td><strong>FORMA DE PAGO </strong></td>
      <td colspan="2"><input name="forpag" type="text" id="forpag" size="35" value="<?php echo $_REQUEST['fformpago'];?>"></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <th>CARGO/ABONO.</th>
      <th colspan="6"><div align="left">
		<input name="id_ope" type="hidden" id="id_ope" size="10" value="<?php echo trim($_REQUEST['id_ope']);?>"/>
        <input name="clave" type="text" id="clave" size="10" value="<?php echo trim($_REQUEST['clave']);?>"/>
		<input name="des_ope" type="text" id="des_ope" size="50" value="<?php echo trim($_REQUEST['des_ope']);?>"/>
      </div></th>
    </tr>
    <tr>
      <th># RECIBO. </th>
      <th colspan="3">CARGOS.</th>
      <th colspan="2">ABONO.</th>
      <th>NOTAS.</th>
    </tr>
    <tr>
      <td><div align="center">
        <input name="cantidad" type="text" id="cantidad" value="<?php echo $_REQUEST['cantidad'];?>" size="10" onKeyPress="return soloNumeros(event)"/>
      </div></td>
      <td colspan="3"><div align="center">
        <input name="carbono" type="hidden" id="carbono" size="10" value="<?php echo $_REQUEST['carbono'];?>" onKeyPress="return soloNumeros(event)"/>
		<?php
		@$sql = mysqli_query($con ,"select * from dxopemaex where nombre like '".$_SESSION['usuario']."'");
        @$reg = mysqli_fetch_array($sql);
		if (($_POST["carbono"] == CARGO)or($_REQUEST['costo']!=0.00)){
		   if ($reg['negativo']==0){
		?>
			<input name="costo" type="text" id="costo" size="10" value="<?php echo $_REQUEST['costo'];?>"/>
		<?php
		}else{
		?>      
		<input name="costo" type="text" id="costo" size="10" value="<?php echo $_REQUEST['costo'];?>" onKeyPress="return Negativo(event)"/>
		<?php
		}
		}else{
		?>
		<?php
		}
		?>		
      </div></td>
      <td colspan="2"><div align="center">
        <?php
		if (($_POST["carbono"] == 'ABONO') or ($_REQUEST['total']!=0.00)){
		   if ($reg['negativo']==0){
		?>
	  <input name="total" type="text" id="total" value="<?php echo $_REQUEST['total'];?>"  size="10"/>
	   <?php
	  }else{
	  ?>
	  <input name="total" type="text" id="total" value="<?php echo $_REQUEST['total'];?>"  size="10" onKeyPress="return Negativo(event)"/>
      <?php
	  }
	  }else{
	  ?>
	  <?php
	  }
	  ?>
	  </div></td>
	  <td><div align="center">
        <input name="proteina" type="text" id="proteina" value="<?php echo $_REQUEST['proteina'];?>" size="15" onBlur="may(this)">
      </div></td>
    </tr>
    <tr>
      <td colspan="7"><div align="center">
        <?php
		  	if($bMod){
				echo ' <input name="modificarReg" type="submit" id="modificarReg" value="Modificar" class="bot_WsW">';
			}else{
				echo ' <input name="agregar" type="submit" id="agregar" value="Agregar" class="original">';
			}
			//http://ad.adserverplus.com/st?ad_type=iframe&ad_size=800x440&section=2971503&pub_url=${PUB_URL}
		  ?>
      </div>        <div align="center"></div>        <div align="center"></div>        <div align="center"></div></td>
    </tr>
  </table>
  <p>&nbsp;</p>
  <table width="644" border="0" align="center" cellspacing="4" id="tableDetail">
    <tr>
      <th colspan="19"><div align="center">
          <?php
			if(!$bMod){
				echo '  <input name="eliminar" type="submit" id="eliminar" value="Cancelar" class="bot_RjR">
          				<input name="modificar" type="submit" id="modificar" value="Modificar" class="bot_WsW">';
			}else{
				echo ' <input name="eliminar" disabled type="submit" id="eliminar" value="Cancelar" class="bot_RjR">';
			}
		?>
      </div></th>
    </tr>
    <tr>
      <th width="23" nowrap>SEL</span></th>
      <th width="41" nowrap>FECHA</th>
      <th width="37" nowrap>HORA</th>
	  <th width="61" nowrap># RECIBO </th>
      <th width="135" nowrap>DESCRIPCON /CARGO</th>
	  <th width="54" nowrap>CARGOS</th>
      <th width="55" nowrap>ABONOS</th>
	  <th width="60" nowrap>NOTAS</th>
	  <th width="100" nowrap>GRUPO</th>
	  <th width="100" nowrap>AGENCIA</th>
	  <th width="100" nowrap>SEGMENTO</th>
	  <th width="100" nowrap>MERCADO</th>
	  <th width="70" nowrap>? AGREGO</th>

	  <th width="80" nowrap>? MODIFICO</th>

	  <th width="80" nowrap>? CANCELO</th>

	  <th width="85" nowrap>? TRASPASO</th>

	  <th width="90" nowrap>FEC. TRAS</th>

	  <th width="120" nowrap>HOR. TRAS</th>

	  <th width="160" nowrap>NOTAS DE TRASPASO.</th>
    </tr>
    <?php
		//Codigo Mostrar
                // Detalle
		$subTotDoc=0.00;
		$ivaTotDoc=0.00;
		$totDoc=0.00;
		$subTotPar=0.00;
		$ivaTotPar=0.00;
		$totPar=0.00;
		$tipCar='-1';
		$contador=0;
		while($dt_invend=mysqli_fetch_array($sq_detfac)){
			$contador++;
			$auxInvent=mysqli_fetch_array(mysqli_query($con ,"SELECT * FROM valeryus09 WHERE n_reg='".$dt_invend['nparte1_det']."'"));			
			if($dt_invend['id_invend']!=$bSel){// nparte1, np_desc son de la table farticulos
    				if($dt_invend['cancelado'] == 0){
					echo'<tr>
					<td><div align="center">
						<input type="radio" name="bot_det" id="bot_det" value="'.$dt_invend['id_invend'].'">
					</div></td>
					<td><div align="right">
							'.chfecha($dt_invend['acc_fec'],'Y-m-d','d/m/Y').'&nbsp;
					</div></td>
					<td><div align="right">
							'.$dt_invend['acc_hor'].'&nbsp;
					</div></td>
					<td><div align="center">
							'.$dt_invend['can_ref'].'&nbsp;
					</div></td>
					<td><div align="left">
							'.$auxInvent['pclave'].'-'.$auxInvent['descripcion'].'&nbsp;
					</div></td>
					<td><div align="right">
							'.number_format($dt_invend['costo'],2,'.',',').'&nbsp;
					</div></td>
					<td><div align="right">
							'.number_format($dt_invend['total'],2,'.',',').'&nbsp;
					</div></td>
					<td><div align="right">
							'.$dt_invend['proteina'].'&nbsp;
					</div></td>
					<td><div align="left">
							'.$dt_invend['grupo'].'&nbsp;
					</div></td>
					<td><div align="left">
							'.$dt_invend['agencia'].'&nbsp;
					</div></td>
					<td><div align="left">
							'.$dt_invend['segmento'].'&nbsp;
					</div></td>
					<td><div align="left">
							'.$dt_invend['mercado'].'&nbsp;
					</div></td>
					<td><div align="left">
							'.$dt_invend['usuario'].'&nbsp;
					</div></td>
					<td class="detailRowTable" ><div align="left">
							'.$dt_invend['usu_mod'].'&nbsp;
					</div></td>
					<td class="detailRowTable" ><div align="left">
							'.$dt_invend['usu_can'].'&nbsp;
					</div></td>
					<td class="detailRowTable" ><div align="left">
							'.$dt_invend['usu_tra'].'&nbsp;
					</div></td>
					<td class="detailRowTable" ><div align="right">
							'.chfecha($dt_invend['fec_tra'],'Y-m-d','d/m/Y').'&nbsp;
					</div></td>
					<td class="detailRowTable" ><div align="left">
							'.$dt_invend['hor_tra'].'&nbsp;
					</div></td>
					</tr>';
					}if ($dt_invend['cancelado'] == 1){
				    echo'<tr>
					<td style="background:#FF3300"><div align="center">
						<input type="radio" name="bot_det" disabled id="bot_det" value="'.$dt_invend['id_invend'].'">
					</div></td>
					<td style="background:#FF3300"><div align="right">
							'.chfecha($dt_invend['acc_fec'],'Y-m-d','d/m/Y').'&nbsp;
					</div></td>
					<td style="background:#FF3300" class="detailRowTable" ><div align="right">
							'.$dt_invend['acc_hor'].'&nbsp;
					</div></td>
					<td style="background:#FF3300" class="detailRowTable" ><div align="center">
							'.$dt_invend['can_ref'].'&nbsp;
					</div></td>
					<td style="background:#FF3300" class="detailRowTable" ><div align="left">
							'.$auxInvent['descripcion'].'&nbsp;
					</div></td>
					<td style="background:#FF3300" class="detailRowTable" ><div align="right">
							'.number_format($dt_invend['costo'],2,'.',',').'&nbsp;
					</div></td>
					<td style="background:#FF3300" class="detailRowTable" ><div align="right">
							'.number_format($dt_invend['total'],2,'.',',').'&nbsp;
					</div></td>
					<td style="background:#FF3300" class="detailRowTable" ><div align="right">
							'.$dt_invend['proteina'].'&nbsp;
					</div></td>
					<td style="background:#FF3300"><div align="left">
							'.$dt_invend['grupo'].'&nbsp;
					</div></td>
					<td style="background:#FF3300"><div align="left">
							'.$dt_invend['agencia'].'&nbsp;
					</div></td>
					<td style="background:#FF3300"><div align="left">
							'.$dt_invend['segmento'].'&nbsp;
					</div></td>
					<td style="background:#FF3300"><div align="left">
							'.$dt_invend['mercado'].'&nbsp;
					</div></td>
					<td style="background:#FF3300" class="detailRowTable" ><div align="left">
							'.$dt_invend['usuario'].'&nbsp;
					</div></td>
					<td style="background:#FF3300" class="detailRowTable" ><div align="left">
							'.$dt_invend['usu_mod'].'&nbsp;
					</div></td>
					<td style="background:#FF3300" class="detailRowTable" ><div align="left">
							'.$dt_invend['usu_can'].'&nbsp;
					</div></td>
					<td style="background:#FF3300" class="detailRowTable" ><div align="left">
							'.$dt_invend['usu_tra'].'&nbsp;
					</div></td>
					<td style="background:#FF3300" class="detailRowTable" ><div align="right">
							'.chfecha($dt_invend['fec_tra'],'Y-m-d','d/m/Y').'&nbsp;
					</div></td>
					<td style="background:#FF3300" class="detailRowTable" ><div align="left">
							'.$dt_invend['hor_tra'].'&nbsp;
					</div></td>
					</tr>';
					}if ($dt_invend['cancelado'] == 2){
				    echo'<tr>
					<td style="background:#7970F1"><div align="center">
						<input type="radio" name="bot_det" id="bot_det" value="'.$dt_invend['id_invend'].'">
					</div></td>
					<td style="background:#7970F1"><div align="right">
							'.chfecha($dt_invend['acc_fec'],'Y-m-d','d/m/Y').'&nbsp;
					</div></td>
					<td style="background:#7970F1"><div align="right">
							'.$dt_invend['acc_hor'].'&nbsp;
					</div></td>
					<td style="background:#7970F1" class="detailRowTable" ><div align="center">
							'.$dt_invend['can_ref'].'&nbsp;
					</div></td>
					<td style="background:#7970F1" class="detailRowTable" ><div align="left">
							'.$auxInvent['descripcion'].'&nbsp;
					</div></td>
					<td style="background:#7970F1" class="detailRowTable" ><div align="right">
							'.number_format($dt_invend['costo'],2,'.',',').'&nbsp;
					</div></td>
					<td style="background:#7970F1" class="detailRowTable" ><div align="right">
							'.number_format($dt_invend['total'],2,'.',',').'&nbsp;
					</div></td>
					<td style="background:#7970F1" class="detailRowTable" ><div align="right">
							'.$dt_invend['proteina'].'&nbsp;
					</div></td>
					<td style="background:#7970F1"><div align="left">
							'.$dt_invend['grupo'].'&nbsp;
					</div></td>
					<td style="background:#7970F1"><div align="left">
							'.$dt_invend['agencia'].'&nbsp;
					</div></td>
					<td style="background:#7970F1"><div align="left">
							'.$dt_invend['segmento'].'&nbsp;
					</div></td>
					<td style="background:#7970F1"><div align="left">
							'.$dt_invend['mercado'].'&nbsp;
					</div></td>
					<td style="background:#7970F1" class="detailRowTable" ><div align="left">
							'.$dt_invend['usuario'].'&nbsp;
					</div></td>
					<td style="background:#7970F1" class="detailRowTable" ><div align="left">
							'.$dt_invend['usu_mod'].'&nbsp;
					</div></td>
					<td style="background:#7970F1" class="detailRowTable" ><div align="left">
							'.$dt_invend['usu_can'].'&nbsp;
					</div></td>
					<td style="background:#7970F1" class="detailRowTable" ><div align="left">
							'.$dt_invend['usu_tra'].'&nbsp;
					</div></td>
					<td style="background:#7970F1" class="detailRowTable" ><div align="right">
							'.chfecha($dt_invend['fec_tra'],'Y-m-d','d/m/Y').'&nbsp;
					</div></td>
					<td style="background:#7970F1" class="detailRowTable" ><div align="left">
							'.$dt_invend['hor_tra'].'&nbsp;
					</div></td>
					<td style="background:#7970F1" class="detailRowTable" ><div align="left">VIENE DEL FOLIO
							'.$dt_invend['num'].'&nbsp;.
					</div></td>
					</tr>';
					}if ($dt_invend['cancelado'] == 3){
				    echo'<tr>
					<td style="background:#CC3399"><div align="center"
						<input type="radio" name="bot_det" disabled id="bot_det" value="'.$dt_invend['id_invend'].'">
					</div></td>
					<td style="background:#CC3399"><div align="right">
							'.chfecha($dt_invend['acc_fec'],'Y-m-d','d/m/Y').'&nbsp;
					</div></td>
					<td style="background:#CC3399"><div align="right">
							'.$dt_invend['acc_hor'].'&nbsp;
					</div></td>
					<td style="background:#CC3399" class="detailRowTable" ><div align="center">
							'.$dt_invend['can_ref'].'&nbsp;
					</div></td>
					<td style="background:#CC3399" class="detailRowTable" ><div align="left">
							'.$auxInvent['descripcion'].'&nbsp;
					</div></td>
					<td style="background:#CC3399" class="detailRowTable" ><div align="right">
							'.number_format($dt_invend['costo'],2,'.',',').'&nbsp;
					</div></td>
					<td style="background:#CC3399" class="detailRowTable" ><div align="right">
							'.number_format($dt_invend['total'],2,'.',',').'&nbsp;
					</div></td>
					<td style="background:#CC3399"><div align="left">
							'.$dt_invend['grupo'].'&nbsp;
					</div></td>
					<td style="background:#CC3399"><div align="left">
							'.$dt_invend['agencia'].'&nbsp;
					</div></td>
					<td style="background:#CC3399"><div align="left">
							'.$dt_invend['segmento'].'&nbsp;
					</div></td>
					<td style="background:#CC3399"><div align="left">
							'.$dt_invend['mercado'].'&nbsp;
					</div></td>
					<td style="background:#CC3399" class="detailRowTable" ><div align="right">
							'.$dt_invend['proteina'].'&nbsp;
					</div></td>
					<td style="background:#CC3399" class="detailRowTable" ><div align="left">

							'.$dt_invend['usuario'].'&nbsp;
					</div></td>
					<td style="background:#CC3399" class="detailRowTable" ><div align="left">
							'.$dt_invend['usu_mod'].'&nbsp;
					</div></td>
					<td style="background:#CC3399" class="detailRowTable" ><div align="left">
							'.$dt_invend['usu_can'].'&nbsp;
					</div></td>
                                        <td style="background:#CC3399" class="detailRowTable" ><div align="left">
							'.$dt_invend['usu_tra'].'&nbsp;
					</div></td>
					<td style="background:#CC3399" class="detailRowTable" ><div align="right">
							'.chfecha($dt_invend['fec_tra'],'Y-m-d','d/m/Y').'&nbsp;
					</div></td>
					<td style="background:#CC3399" class="detailRowTable" ><div align="left">
							'.$dt_invend['hor_tra'].'&nbsp;
					</div></td>
					<td style="background:#CC3399" class="detailRowTable" ><div align="left">TR- AL FOLIO
							'.$dt_invend['num'].' o HAB '.$dt_invend['habitacion'].'&nbsp;.
					</div></td>
					</tr>';
					}
					$numPun +=$auxInvent['num_pun'];
					$sbt = $sbt + $dt_invend['toldes'];
					$p = $p + $dt_invend['total'];
					$q = $q + $dt_invend['ivatotal'];
					$jiu = ($q +$p)-$sbt;
					$nk = $nk + $dt_invend['proteina'];
		$sqo = mysqli_fetch_array(mysqli_query($con ,"SELECT SUM(costo) AS tot FROM valeryus030 WHERE cancelado=0 AND nparte1 = '".$_REQUEST['bot']."'"));
		$sqk = mysqli_fetch_array(mysqli_query($con ,"SELECT SUM(costo) AS tat FROM valeryus030 WHERE cancelado=2 AND nparte1 = '".$_REQUEST['bot']."'"));
		$sqf = mysqli_fetch_array(mysqli_query($con ,"SELECT SUM(total) AS sos FROM valeryus030 WHERE cancelado=0 AND nparte1 = '".$_REQUEST['bot']."'"));
		$sqs = mysqli_fetch_array(mysqli_query($con ,"SELECT SUM(total) AS sas FROM valeryus030 WHERE cancelado=2 AND nparte1 = '".$_REQUEST['bot']."'"));
					$uij = $sqo['tot'] + $sqk['tat'];
				    $pol = $sqf['sos'] + $sqs['sas'];
					$asd = $uij - $pol;
				}
		}
		echo '
			<tr>
			<td colspan="5" class="inputcodigo"><div align="right">TOTAL: &nbsp;</div></td>
			<td colspan="1" class="inputcodigo"><div align="right">'.number_format($uij,2,'.',',').'</div></td>
			<td colspan="1" class="inputcodigo"><div align="right">'.number_format($pol,2,'.',',').'</div></td>
			<td colspan="2" class="inputcodigo"><div align="right">=======>>>>>> &nbsp;</div></td>
			<td colspan="1" class="inputcodigo"><div align="right">'.number_format($asd,2,'.',',').'</div></td>
			</tr>';	
	?>
    <tr>
      <td colspan="15"><div align="center">
        <input name="terminarCaptura" type="submit" class="bot_WsW" id="terminarCaptura" value="Guardar">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<input name="checkOut" type="submit" class="original" id="checkOut" value="Check Out">
      </div></td>
    </tr>
  </table>
  <p>&nbsp;</p>
</form>
</body>
</html>
<?php
 mysqli_close($con);
//932--->700 ultima actualizacion 29/abril/2011
?>
