<?php

require("../conexion.php");

$numrec=$_GET["numrec"];
$fechahoy=date("d-m-y");

$consulta = "SELECT * FROM pagos_clientes WHERE numrec='$numrec' ";
$resultado = $mysqli->query($consulta);
$fila = $resultado->fetch_array();

		$cdgcli     = $fila["cdgcli"];
		$dsccli     = $fila["dsccli"];
		$totalpago  = $fila["montot"];
		$pagacon    = $fila["pagcon"];
		$vuelto     = $fila["vuelto"];
		$detrec     = $fila["detrec"];
        $fecrec     = $fila["fecrec"];
		$codmov     = $fila["codmov"];
		$fecrec     = implode("-", array_reverse(explode("-", $fecrec)));
		
				$efectivo = $fila["efectivo"];
		$tarjetas = $fila["tarjetas"];
		$depositos = $fila["depositos"];
		$simpes = $fila["simpes"];
?>	

<html>
	<head>
		<title>Facturas</title>
		<link href="../estilos/estilos.css" type="text/css" rel="stylesheet">
		<link href="../calendario/calendar-blue.css" rel="stylesheet" type="text/css">


  <script src="..//jquery-maskmoney/src/jquery.maskMoney.js" type="text/javascript"></script>

		<script type="text/javascript" src="../funciones/validar.js"></script>
		<script type="text/JavaScript" language="javascript" src="../calendario/calendar.js"></script>
		<script type="text/JavaScript" language="javascript" src="../calendario/lang/calendar-sp.js"></script>
		<script type="text/JavaScript" language="javascript" src="../calendario/calendar-setup.js"></script>
		<script language="javascript">
		

		
		
		var cursor;
		if (document.all) {
		// Está utilizando EXPLORER
		cursor='hand';
		} else {
		// Está utilizando MOZILLA/NETSCAPE
		cursor='pointer';
		}
		
		function inicio() {
			document.getElementById("form_busqueda").submit();
		}
		
		function nueva_Recibo() {
			location.href="Nuevo_Recibo.php";
		}
		




		function Anular(numrec,codmov,montot) {
				
			if (confirm(" Desea anular este recibo ? "))
				   
			location.href="Anular_Recibo.php?numrec=" + numrec + "&codmov="+ codmov + "&montot="+montot;
			    
			}
		

			function cancelar() {
			location.href="index.php";
		}
		
		
		
				function nobackbutton(){	
   window.location.hash="no-back-button";	
   window.location.hash="Again-No-back-button" //chrome	
   window.onhashchange=function(){window.location.hash="no-back-button";}	
}
		
		

		</script>
	</head>
			<body onLoad=" inicio();  nobackbutton();">
		<div id="">
			<div id="zonaVentanas">
				<div align="center">
				  <div id="" class="contenidoRecibo">
				<form id="form_busqueda" name="form_busqueda" method="post" action="frame_lineas_ver.php" target="frame_rejilla">
					<table class="fuente8" width="100%" cellspacing=0 cellpadding=0 border=0>					
						<input id="accion" name="accion" value="alta" type="hidden">
						<input name="numrec"  id="numrec" value="<?php echo $numrec?>" type="hidden">
						<input name="salfac"  id="salfac" value="<?php echo $salfac?>" type="hidden">
						<input name="salact"  id="salact" value="<?php echo $salact?>" type="hidden">
						<input name="codmov"  id="codmov" value="<?php echo $codmov?>" type="hidden">
						<input name="montot"  id="montot" value="<?php echo $totalpago?>" type="hidden">
						<input name="saldoporpagar"  id="saldoporpagar" value="<?php echo $saldoporpagar?>" type="hidden">
	<input type="hidden" id="currency" />
						<tr>
						  <td rowspan="2">&nbsp;</td>
						  <td rowspan="2">&nbsp;</td>
						  <td rowspan="2">&nbsp;</td>
						  <td rowspan="2" >&nbsp;</td>
						  <td colspan="2" >&nbsp;</td>
						  <td >&nbsp;</td>
						  <td >&nbsp;</td>
						  <td rowspan="2">&nbsp;</td>
					 <tr>
                        
                         <?php  if ($efectivo>0){?>
						  <td ><div align="right">Efectivo</div></td>
                          <td >
                          <input type="checkbox" id="pago_efectivo" name="pago_efectivo"  value="1" onClick=""  checked >

                          </td>
                            <?php }  
                            
                            else if ($tarjetas>0){?>
						  <td ><div align="right">Targeta</div></td>
                          <td >
                          <input type="checkbox" id="pago_tarjeta" name="pago_tarjeta"  value="1" onClick=""  checked >

                          </td>
						  
						    <?php }  
                            
                            else if ($depositos>0){?>
						  <td ><div align="right">Depósito</div></td>
                          <td >
                          <input type="checkbox" id="pago_deposito" name="pago_deposito"  value="1" onClick=""  checked >

                          </td>
						     <?php } 
							
							         else if ($simpes>0){?>
					   <td ><div align="right">Sinpe</div></td>
                          <td >
                          <input type="checkbox" id="pago_tarjeta" name="pago_tarjeta"  value="1" onClick=""  checked >

                          </td>
						  
                            <?php }  
                            
                            else if ($depositos>0){?>
						  <td ><div align="right">Depósito</div></td>
                          <td >
                          <input type="checkbox" id="pago_deposito" name="pago_deposito"  value="1" onClick=""  checked >

                          </td>
                            <?php } ?> 
                            
                            
						  
						  <td >&nbsp;</td>
						  <td >&nbsp;</td>
					  </tr>
						<tr>
						  <td width="1%" rowspan="2">&nbsp;</td>
						  <td width="1%">&nbsp;</td>
						  <td colspan="2">Numero de Recibo
					      <input id="numrec2" readonly type="text" class="cajaPequena" name="cdgcli2" maxlength="10"  value="<?php echo $numrec?>"  style='text-align:center;' onFocus="buscar(), siguienteCampo ='dsccli';"   onChange="validarcliente(); buscar()" ></td>
						  <td>Fecha 
					      <input id="fecrec"  readonly type="text" class="cajaPequena" name="fecrec" maxlength="10"  value="<?php echo $fecrec?>"  style='text-align:center;' onFocus="buscar(), siguienteCampo ='dsccli';"   onChange="validarcliente(); buscar()" ></td>
						  <td width="5%" ><div align="center"></div></td>
					      <td width="32%" rowspan="2" ><div align="center"><input  autocomplete="off" name="pagacon" type="text" class="fuente_totales" id="pagacon"  style='text-align:center;'  value="<?php echo number_format($pagacon,2,".",",")  ?>" readonly  ></div></td>
					      <td width="1%" rowspan="2">&nbsp;</td>
					  </tr>
						<tr>
						  <td width="1%" height="18">&nbsp;</td>
						  <td colspan="2">&nbsp;</td>
						  <td>&nbsp;</td>
						  <td width="5%" align="center" >Pago</td>
			          </tr>
						<tr>
						  <td rowspan="4">&nbsp;</td>
							<td rowspan="2">&nbsp;</td>
							<td colspan="2"><input id="cdgcli" type="text" readonly class="cajaPequena" name="cdgcli" maxlength="10"  value="<?php echo $cdgcli?>"  style='text-align:center;' onFocus="buscar(), siguienteCampo ='dsccli';"   onChange="validarcliente(); buscar()" >  </td>
						  <td width="32%" rowspan="2"  align="right" >Total
						    <input name="totalpago" type="text" class="fuente_totales" id="totalpago"  value="<?php echo number_format($totalpago,2,".",",")  ?>" style='text-align:center;'   readonly ></td>
							<td ><div align="center"></div></td>
							<td rowspan="2" ><div align="center">
							  <input name="vuelto" type="text" class="fuente_totales" id="vuelto"  style='text-align:center;' value="<?php echo number_format($vuelto,2,".",",")  ?>" readonly    >
						    </div></td>
							<td rowspan="2">&nbsp;</td>
						</tr>
						<tr>
						  <td colspan="2"><input id="dsccli" name="dsccli" type="text" class="cajaGrande" maxlength="45"   value="<?php echo $dsccli?>"   readonly ></td>
						  <td  align="center">Vuelto</td>
			          </tr>
						<tr>
						  <td>&nbsp;</td>
						  <td>Detalle</td>
						  <td colspan="2" rowspan="3"><input id="detrec" readonly  name="detrec" type="text" class="cajaGrande" maxlength="100"   value="<?php echo $detrec?>"  ></td>
						  <td rowspan="3">&nbsp;</td>
						  <td rowspan="3">&nbsp;</td>
						  <td>&nbsp;</td>
					  </tr>
						<tr>
						  <td>&nbsp;</td>
						  <td width="6%">&nbsp;</td>
						  <td>&nbsp;</td>
						</tr>
					</table>
					<div id="frmResultado">
				<table class="fuente8" width="100%" cellspacing=0 cellpadding=3 border=0 ID="Table1">
						<tr class="cabeceraTabla">
						  <td width="13%">N. FACTURA</td>
							
							<td width="14%">FECHA</td>
							<td width="11%">SALDO</td>
							<td width="11%">INTERESES</td>
							<td width="14%">ABONO CAPITAL </td>
							<td width="13%">ABONO INTERES </td>
							<td width="12%">TOTAL PAGO </td>
							<td width="12%">SALDO</td>							
						</tr>
				</table>
                  
	</div>
				    <iframe width="100%" height="350" id="frame_rejilla" name="frame_rejilla" frameborder="0">
                    <ilayer width="100%" height="70" id="frame_rejilla" name="frame_rejilla"></ilayer>
				    </iframe>
				    <input type="hidden" id="iniciopagina" name="iniciopagina">
				    <div id="">
                      <div align="center">
                        <input id="codfamilia" name="codfamilia" value="<?php echo $codfamilia?>" type="hidden">
                          <input id="codfacturatmp" name="codfacturatmp" value="<?php echo $codfacturatmp?>" type="hidden">
                          <input id="preciototal2" name="preciototal" value="<?php echo $preciototal?>" type="hidden">
                      </div>
			      </div>
				    <input type="hidden" id="cadena_busqueda" name="cadena_busqueda">
				    <img src="../img/Symbol-Check_48x48-32.png" alt="anular" width="48" height="48" title="Anular" onClick="Anular(<?php echo $numrec ?>,<?php echo $codmov ?>,<?php echo $totalpago ?>)" onMouseOver="style.cursor=cursor" border="0">			      <img src="../img/Symbol-Delete_48x48-32.png" alt="eliminar" width="48" height="48" title="Cancelar" onClick="cancelar()" onMouseOver="style.cursor=cursor" border="0">
				</form>
			  
				<iframe id="frame_datos" name="frame_datos" width="0" height="0" frameborder="0">
					<ilayer width="0" height="0" id="frame_datos" name="frame_datos"></ilayer>
					</iframe>
					
					
				<iframe id="frame_datos1" name="frame_datos1" width="0" height="0" frameborder="0">
					<ilayer width="0" height="0" id="frame_datos" name="frame_datos"></ilayer>
					</iframe>
					
			<iframe id="frame_datos3" name="frame_datos3" width="0" height="0" frameborder="0">
					<ilayer width="0" height="0" id="frame_datos3" name="frame_datos3"></ilayer>
					</iframe>


			  </form>
			 </div>
		  </div>
    </div>
		
	</body>
</html>
