<?php
 
session_start();
include("DMMYSQLG.php");
include("DSA1000.php");
include("DMMYSQLG.php");
include("DF30000.inc");
include("DF80000.php");
include("DFJQUERY.inc");
include("JQUERY.inc");
$data=0;
$totSinIva=0;
$totSnIva=0;
$propinas=0;
$totIva=0;
$totPvIva=0;
$totIsh=0;
$totAbo=0;
?>
<html>
<head> <meta name="tipo_contenido" content="text/html;" http-equiv="content-type" charset="utf-8">
<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='id_ope';
        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.id);
                      $("#"+idObjDes).val(ui.item.descripcion);	
//		$('#fcodgrupo').focus();
                javascript: document.getElementById('frm1').submit();
                }
	});	
	
});
     $(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='id_ope'; 
	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.id);
                      $("#"+idObjDes).val(ui.item.descripcion);		
                      $('#fcodgrupo').focus();
		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
//	});
//	$("#id_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
//		formatResult:function(row){  //formato de seleccion de busqueda
//			return row[1];
//		},	                        
//		extraParams:{tipBus:'c'}     //Parametros Extra a Mandar en autosugestion
//	});
//	$("#id_ope").result(function(event, data, formatted){
//		$('#des_ope').val(data[0]);
//		$('#des_ope').focus();
//		javascript: document.getElementById('frm1').submit();
//	});	
//	$("#des_ope").result(function(event, data, formatted){
//		$('#id_ope').val(data[1]);
//		javascript: document.getElementById('frm1').submit();
//	});	
//	$("input[@name=tip_bus]").click(function(){
//		$('#des_ope').setOptions({
//			extraParams:{
//				tipBus:getValRadChe('tip_bus')
//			}
//		});
//	});
//});
</script>


</head>
  		
<body>
<div align="left">

</div>
<div align="center">
  <form name="frm1" id="frm1" method="post" action="">
    <table width="634" border="0">
	<tr>
	  <th colspan="2"><span class="Estilo23">RESUMEN DPTAL </span> </th>
	  </tr>
          <?php
          $fec=(isset($_POST['fec']))?$_POST['fec']:date('d/m/Y');
          ?>
	<tr>
	  <td width="111"> <div align="right" class="Estilo24 Estilo5"><span class="Estilo25">FECHA </span></div></td>
	  <td width="485"><span class="Estilo5"><strong>DEL</strong>
	      <input name="fec" type="text" class="emplea datefrom" id="fec" size="9" maxlength="20" value="<?=$fec?>"
			<?php

				if(isset($_POST['fec'])){ //este es el truco
					echo 'value="' . $_POST['fec'] .  '"';
				}else{
					echo 'value="'.date("d/m/Y").'"';
				}
			?> onkeypress="return soloNumeros(event)"
		/>
            <!--<input name="bot" id="bot" type="image" value=" ... " src="logos/cal4.jpg"/>
            -->
            <strong> AL </strong>
            </span>
	    <input name="fec2" type="text" class="emplea dateto" id="fec2" size="9" maxlength="20" 
			<?php

				if(isset($_POST['fec2'])){ //este es el truco
					echo 'value="' . $_POST['fec2'] .  '"';
				}else{
					echo 'value="'.date("d/m/Y").'"';
				}
			?>onkeypress="return soloNumeros(event)"
		/>
            <!--<input name="bot12" id="bot1" type="image" value="Cal" src="logos/cal4.jpg" />
        -->  </td>
	</tr>
	<tr>
	<td><div align="right" class="Estilo24 Estilo5"><span class="Estilo25">CARGO/ABONO.</span></div></td>
	  <td><div class="Estilo24"><span class="Estilo25">&nbsp; &nbsp; <span class="Estilo5">TODOS
            <input name="r1" type="radio" value="T" <?php
  if(isset($_POST['r1']) && $_POST['r1']=='T') echo 'checked';?> onClick="javascript: document.frm1.des_ope.disabled=true; javascript: document.frm1.id_ope.disabled=true;">
            &nbsp; &nbsp; 
	 	INDIVIDUAL</span>
	    <input name="r1" type="radio" value="N" <?php
  if(isset($_POST['r1']) && $_POST['r1']=='N') echo 'checked';  if (isset($_POST['r1']) && $_POST['r1']=='') echo 'checked';?> onClick="javascript: document.frm1.des_ope.disabled=false;javascript: document.frm1.id_ope.disabled=false;">
		</span></div>	  </td>
	  </tr>
	<tr id="descripcion">
      <td align="right"><span class="Estilo25 Estilo5">DESCRIPCIÓN:</span></td>
      <td colspan="3" align="left">
        <input name="id_ope" type="text" id="id_ope" size="10" value="<?php

							if(isset($_POST['id_ope']))
						echo $_POST['id_ope']; 
		?>" />
        <input name="des_ope" type="text" id="des_ope" size="50" value="<?php
 echo trim((isset($_POST['des_ope']))?$_POST['des_ope']:"" );?>" />      </td>		  	  
    </tr>
</table>


<div align="center">

      <table width="634" border="0">
        <tr>
		 <td colspan="2">
          <div align="center">
		  	  <input name="Submit32" type="submit" class="original" value="Buscar" onClick="openpage('ger_general_PR.php','_self')" />
              <input name="bot4" type="button" class="bot_WsW" onClick="openpage('ger_general_IM.php','_self')" value="Imprimir "/>
              <input name="bot4" type="button" class="bot_WsW" onClick="openpage('ger_general_NEW.php','_self')" value="Imprimir Nuevo"/>
          </div></td>
      </tr>
    </table>
 <table width="70%" align="center" border="0" cellpadding="0" cellspacing="0"> 
        <tr>
		 <th width="10%"><div align="center">CODIGO</div></th>
		 <th width="40%"><div align="center">DESCRIPCION</div></th>
		 <td width="10%"><div align="center"></div></td>
		 <th width="20%"><div align="center">SUBTOTAL</div></th>
		 <th width="20%"><div align="center">IVA</div></th>
		 <th width="20%"><div align="center">ISH</div></th>
		 <th width="20%"><div align="center">CARGO</div></th>		 		 		 		 
		 <th width="20%"><div align="center">ABONO</div></th>		 
      </tr>
 
  <?php
 
  require_once("valeryus00000_CL.php");
  $update=mysqli_query($con ,"UPDATE dgpemema as a JOIN fpropina as b ON a.fol_ven = b.fol_ven SET a.tip =b.tip");
  $valeryus09=new valeryus09($data);
  
  if (isset($_POST['r1']) && $_POST['r1']=='N')
  $condicion='n_reg="'.$_POST['id_ope'].'"';
  else if (isset($_POST['r1']) && $_POST['r1']=='T')
  $condicion='n_reg > 0';
  else 
  $condicion='n_reg = 0';

 	$fecIni=chfecha(isset($_POST['fec'])?$_POST['fec']:"",'d/m/Y','Y-m-d');

	$fecFin=chfecha(isset($_POST['fec2'])?$_POST['fec2']:"",'d/m/Y','Y-m-d');
	
	if ($fecIni<'2013-04-01'){
	$table='pvrescaj';
	$taDet='pvrescad';
	$posicion='fposres';
	$nuestra='pvrestip';
	}else{
	$table='dgger_cajerosj';
	$taDet='dgger_cajerosd';
	$posicion='fpos';
	$nuestra='fpropina';
	}

  $sql_hotel09=$valeryus09->report_getGeneralcar();
  if(!$sql_hotel09)die(mysqli_error($con));
  while ($reg=mysqli_fetch_array($sql_hotel09)){
  echo'<tr>';
  
         if ($reg['restrinGido']=='SI'){
		    echo"<td class=\"estiloDet\"><div align=\"left\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$reg['nReg']."</div></td><td class=\"estiloDet\"><div align=\"left\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$reg['desCripcion']."</div></td>";
			
			@$rest = mysqli_query($con ,"
		SELECT 
			dgpemema.fol_ven
			
		FROM 
			dgpemema
			
			LEFT JOIN ctmesas ON ctmesas.nparte1=dgpemema.fpos_mesa
			LEFT JOIN ctarea ON ctarea.nparte1=ctmesas.area
			LEFT JOIN ctmeser  ON ctmeser.nparte1=dgpemema.cod_ven
			LEFT JOIN ptventa ON ptventa.nparte1=ctmesas.descripcion
			
			
		where dgpemema.fec_ven between '".$fecIni."' and '".$fecFin."' and ptventa.nparte1='".$reg['nParte1']."'
		group by dgpemema.fol_ven
		ORDER BY 
		
			dgpemema.con_ven");
			//LEFT JOIN $table ON $table.pedido=dgpemema.fol_ven		
			//LEFT JOIN dgtippag ON dgtippag.tip_pag=$table.tip_mov								
			//LEFT JOIN dgcatven ON dgpemema.cod_ven=dgcatven.cod_ven
			
		$comida=0;
		while($rest1 = mysqli_fetch_array($rest)){
		@$sqal = mysqli_query($con ,"SELECT sum((can_ref*pre_bas)-imp_des) as totAli from dgpememd inner join dginventp on dginventp.nparte1=dgpememd.nparte1 left join dgpemema on dgpememd.cons_ven=dgpemema.fol_ven where dgpememd.cons_ven='".$rest1['fol_ven']."' and dgpememd.cancela=0 and dgpemema.cancela='0' and dgpemema.cancelado='0' group by dgpememd.nparte1");
		while ($com=mysqli_fetch_array($sqal)){
		
		$comida += $com['totAli'];
		
		}
	}	
	$comSnIva=$comida/1.16;
	$comSlIva=$comSnIva*.16;
	$ventas=$comSnIva+$comSlIva;
	
	$propinas=mysqli_fetch_array(mysqli_query($con ,"select sum(servicio) as servicio, sum(tip) as propina from dgpemema where fec_ven between '".$fecIni."' and '".$fecFin."' and (cancelado='0' and cancela='0')"));
	
	if ($reg['nReg']=='109'){
	
	echo "<td class=\"estiloDet\" align=\"right\"></td>
	        <td class=\"estiloDet\" align=\"center\">$".number_format($propinas['servicio'],2,'.',',')."&nbsp;&nbsp;&nbsp;</td>
	          <td class=\"estiloDet\" align=\"center\">$".number_format(0,2,'.',',')."&nbsp;&nbsp;&nbsp;</td>
	            <td class=\"estiloDet\" align=\"center\">$".number_format(0,2,'.',',')."&nbsp;&nbsp;&nbsp;</td>
	              <td class=\"estiloDet\" align=\"center\">$".number_format($propinas['servicio'],2,'.',',')."&nbsp;&nbsp;&nbsp;</td>  	
	                <tr> <td></td> <td colspan=\"5\">&nbsp;&nbsp;</td> </tr>";
	
	}elseif ($reg['nReg']=='37'){
	
	echo "<td class='estiloDet' align='right' ></td>";
	echo "<td class='estiloDet' align='center'>$".number_format($propinas['propina'],2,'.',',')."&nbsp;&nbsp;&nbsp;</td>";
	echo "<td class='estiloDet' align='center'>$".number_format(0,2,'.',',')."&nbsp;&nbsp;&nbsp;</td>";
	echo "<td class='estiloDet' align='center'>$".number_format(0,2,'.',',')."&nbsp;&nbsp;&nbsp;</td>";
	echo "<td class='estiloDet' align='center'>$".number_format($propinas['propina'],2,'.',',')."&nbsp;&nbsp;&nbsp;</td>";  	
	echo "<tr> <td></td> <td colspan=\"5\">&nbsp;&nbsp;</td> </tr>";
	}else{
	
	echo "<td class='estiloDet' align='right'></td>";
	echo "<td class='estiloDet' align='center'>$".number_format($comSnIva,2,'.',',')."&nbsp;&nbsp;&nbsp;</td>";
	echo "<td class='estiloDet' align='center'> $".number_format($comSlIva,2,'.',',')."&nbsp;&nbsp;&nbsp;</td>";  
	echo "<td class='estiloDet' align='center'> $".number_format(0,2,'.',',')."&nbsp;&nbsp;&nbsp;</td>";
	echo "<td class='estiloDet' align='center'> $".number_format($ventas,2,'.',',')."&nbsp;&nbsp;&nbsp;</td>";  	
	echo "<tr> <td></td> <td colspan=\"5\">&nbsp;&nbsp;</td> </tr>";	
		 $totSinIva+= $comSnIva;
		 $totPvIva+= $comSlIva;
		 }
		 
		 }else{			
			echo"<td class=\"estiloDet\" ><div align=\"left\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$reg['nReg']."</div></td><td class=\"estiloDet\"><div align=\"left\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$reg['desCripcion']."</div></td>";
         
		    $sql="select * from valeryus030 where nparte1_det='".$reg['nReg']."' and (acc_fec between '".$fecIni."' and '".$fecFin."') ";					
	$sql_dt=mysqli_query($con ,$sql);
	$cta1=0;
	$cargo1=0;
	$abono1=0;
	$sin_iva=0;
	$desIva=0;
	$desIsh=0;
	$cta=0;	
	$numVen=0;	
	$TotCargo2=0;
	while($red=mysqli_fetch_array($sql_dt)){
	$cta ++; 
		
		if(($red['cancelado'] == 0) || ($red['cancelado']==2)){  
		
		$cargo1 +=$red['costo'];
		$abono1 +=$red['total'];
		
		if ($reg['gra']=='SI' and $reg['sobre']=='SI'){
		   $iva=($reg['gravable']/100);
		   $ish=($reg['impuesto']/100);
		   $impuesto=($iva+$ish)+1;   
			  $sin_iva=$cargo1/$impuesto;
				 $desIva=$sin_iva*$iva;
				 $desIsh=$sin_iva*$ish;
		
		  }elseif($reg['gra']=='SI' and $reg['sobre']!='SI'){
		     $iva=($reg['gravable']/100);
		     $impuesto=$iva+1;
		        $sin_iva=$cargo1/$impuesto;
		        $desIva=$cargo1-$sin_iva;
		
		    }elseif($reg['no_gra']=='SI'){
		       $sin_iva=$cargo1;
			  
			  }elseif($reg['otro']=='SI'){
		         $sin_iva=$cargo1;
			}
		}
		
	}
	echo "	<td class=\"estiloDet\" align=\"right\"></td>  	
			<td class=\"estiloDet\" align=\"center\"> $".number_format($sin_iva,2,'.',',')."&nbsp;&nbsp;&nbsp;</td>  
			<td class=\"estiloDet\" align=\"center\"> $".number_format($desIva,2,'.',',')."&nbsp;&nbsp;&nbsp;</td>  
			<td class=\"estiloDet\" align=\"center\"> $".number_format($desIsh,2,'.',',')."&nbsp;&nbsp;&nbsp;</td> 
			<td class=\"estiloDet\" align=\"center\"> $".number_format($cargo1,2,'.',',')."&nbsp;&nbsp;&nbsp;</td>  	
			<td class=\"estiloDet\" align=\"right\">&nbsp;&nbsp;&nbsp;</td>  	
		    </tr>";
		$numVen +=$cta;
		$totSnIva +=$sin_iva;
		$totIva +=$desIva;
		$totIsh +=$desIsh;
		$TotCargo2 +=$cargo1;
			echo "<tr> <td></td> <td colspan=\"5\">&nbsp;&nbsp;</td> </tr>";		
  }
	 
		 }
	    $ivaTotal=$totSinIva+$totSnIva+$propinas['propina']+$propinas['servicio'];
		$totSoloIva=$totIva+$totPvIva;
		$totCargos=$ivaTotal+$totSoloIva+$totIsh;
	
	  echo "<tr> 
			<td class=\"granTotL\" colspan=\"3\">TOTAL DE CARGO</td>   						
			<td align='center' class=\"granTotR\"> $".number_format($ivaTotal,2,'.',',')."</td>  
			<td align='center' class=\"granTotR\"> $".number_format($totSoloIva,2,'.',',')."</td>
			<td align='center' class=\"granTotR\"> $".number_format($totIsh,2,'.',',')."</td>  	
			<td align='center' class=\"granTotR\"> $".number_format($totCargos,2,'.',',')."</td>  	
            <td class='granTotR' align='right'>&nbsp;&nbsp;&nbsp;</td>
		</tr>";
		
		$l=mysqli_query($con ,"SELECT * FROM valeryus09 where pmontomax='CARGO' and tip='1'");
		while($g=mysqli_fetch_array($l)){
		
		echo"<td class=\"estiloDet\" ><div align=\"left\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$g['n_reg']."</div></td><td class=\"estiloDet\"><div align=\"left\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$g['descripcion']."</div></td>";
		$sqls="select * from valeryus030 where nparte1_det='".$g['n_reg']."' and (acc_fec between '".$fecIni."' and '".$fecFin."') ";					
	$sql_dt=mysqli_query($con ,$sqls);
	$cta=0;
	$cargo=0;
	$abono=0;
	$sin_iva=0;
	$desIva=0;
	$desIsh=0;
	$cargo1=0;
	$abono1=0;
		 
	while($red=mysqli_fetch_array($sql_dt)){
	$cta ++; 
		
		if(($red['cancelado'] == 0) || ($red['cancelado']==2)){  
		
		$cargo1 +=$red['costo'];
		$abono1 +=$red['total'];
		
		if ($reg['gra']=='SI' and $reg['sobre']=='SI'){
		   $iva=($reg['gravable']/100);
		   $ish=($reg['impuesto']/100);
		   $impuesto=($iva+$ish)+1;   
			  $sin_iva=$cargo1/$impuesto;
				 $desIva=$sin_iva*$iva;
				 $desIsh=$sin_iva*$ish;
		
		  }elseif($reg['gra']=='SI' and $reg['sobre']!='SI'){
		     $iva=($reg['gravable']/100);
		     $impuesto=$iva+1;
		        $sin_iva=$cargo1/$impuesto;
		        $desIva=$cargo1-$sin_iva;
		
		    }elseif($reg['no_gra']=='SI'){
		       $sin_iva=$cargo1;
			  
			  }elseif($reg['otro']=='SI'){
		         $sin_iva=$cargo1;
			}
		}
		
	}
		
		echo "	<td class=\"estiloDet\" align=\"right\"></td>  	
			<td class=\"estiloDet\" align=\"center\"> $".number_format($sin_iva,2,'.',',')."&nbsp;&nbsp;&nbsp;</td>  
			<td class=\"estiloDet\" align=\"center\"> $".number_format($desIva,2,'.',',')."&nbsp;&nbsp;&nbsp;</td>  
			<td class=\"estiloDet\" align=\"center\"> $".number_format($desIsh,2,'.',',')."&nbsp;&nbsp;&nbsp;</td> 
			<td class=\"estiloDet\" align=\"center\"> $".number_format($cargo1,2,'.',',')."&nbsp;&nbsp;&nbsp;</td>  	
			<td class=\"estiloDet\" align=\"right\">&nbsp;&nbsp;&nbsp;</td>  	
		    </tr>";
		}
		
echo "<tr>
			  <td></td>
			  <td colspan=\"5\">&nbsp;&nbsp;</td>
          </tr>";		
//ABONOS
 $totAbo=0;
  $sql_hotel09=$valeryus09->report_getGeneralabo();		
  if(!$sql_hotel09)die(mysqli_error($con));
  while ($rega=mysqli_fetch_array($sql_hotel09)){
  echo'<tr>';
			echo"<td class=\"estiloDet\"><div align=\"left\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$rega['nReg']."</div></td><td class=\"estiloDet\"><div align=\"left\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$rega['desCripcion']."</div></td>";

	$sql="select * from valeryus030 where nparte1_det='".$rega['nReg']."' and (acc_fec between '".$fecIni."' and '".$fecFin."') and depositos='0'";					
	$sql_dt=mysqli_query($con ,$sql);
	$cta=0;
	$cargo=0;
	$abono=0;
	$TotAbono=0;
	while($red=mysqli_fetch_array($sql_dt)){
	$cta ++; 
		if(($red['cancelado'] == 0) || ($red['cancelado']==2)){  
		$cargo +=$red['costo'];
		$abono +=$red['total'];
		}
		
	}
	
	if($rega['codIgo']!='0'){
	
	$sql_pago=mysqli_fetch_array(mysqli_query($con ,"select sum($taDet.importe) as paGos from dgpemema left join $table on dgpemema.fol_ven=$table.pedido left join $taDet on $table.n_rec=$taDet.n_rec where dgpemema.fec_ven between '$fecIni' and '$fecFin' and (dgpemema.cancelado='0' and dgpemema.cancela='0') and $taDet.tip_pag='".$rega['tipPag']."'"));
	echo "	<td class='estiloDet' align='right'></td>  	
			<td class='estiloDet' align='right' colspan='4'> &nbsp;&nbsp;&nbsp;</td>  	
			<td class='estiloDet' align='right'> $".number_format($pagos=$abono+$sql_pago['paGos'],2,'.',',')."&nbsp;&nbsp;&nbsp;</td>  	
		";
	$totAbo+=$pagos;
	
	}
	
		$numVen +=$cta;
		$TotAbono +=$abono;
		
			echo "<tr><td></td><td colspan=\"5\">&nbsp;&nbsp;</td></tr>";		
  }
  echo "<tr> 
			<td class=\"granTotL\" colspan=\"7\"> TOTAL DE ABONO</td>  						
			<td align='right' class=\"granTotR\"> $".number_format($totAbo,2,'.',',')."</td>  
		</tr>";
	echo "
	<tr>
	<td>&nbsp; </td>
	</tr>
	";
  echo "<tr> 
			<td class=\"granTotL\" colspan=\"6\"> SALDO EN HUESPEDES</td> "; 
			$saldo=$totCargos-$totAbo;		
						
	echo "  <td align='right' class=\"granTotR\" colspan='2'> $".number_format($saldo,2,'.',',')."</td> </tr> </table>";

  mysqli_close($con);

?>
  </table>
  </form>
</div>
</body>
</html>
<?php

//577 --> 
?>
