<?php
		
include('../conexion.php'); 

 $codigo=$_GET["codigo"];


$consulta = "SELECT * FROM movimientos_caja WHERE codmov='$codigo' ";
$resultado = $mysqli->query($consulta);
$row = $resultado->fetch_array();

$codigo = $row["codigo"];
$nombre = $row["nombre"];
$fecfac = $row["fecha"];
$fecfac = implode("-", array_reverse(explode("-", $fecfac)));  
$numdoc = $row["numdoc"];
$total  = $row["total"];
$detmov = $row["detmov"];
$tipmov = $row["tipmov"];
$cdgcaj = $row["cdgcaj"];

$consulta = "SELECT * FROM web_2201 WHERE numfac='$numdoc' AND cdgpro='$codigo'";
$resultado = $mysqli->query($consulta);
$row = $resultado->fetch_array();

$cdgpro   = $row["cdgpro"];
$dscpro   = $row["dscpro"];
$fecfac   = $row["fecfac"];
$fecfac   = implode("-", array_reverse(explode("-", $fecfac))); 
$fecpro   = $row["fecpro"];
$fecpro   = implode("-", array_reverse(explode("-", $fecpro))); 
$numfac   = $row["numfac"];
$fecven   = $row["fecven"];
$pladia   = $row["pladia"];
$subexe   = $row["subexe"];
$subgra   = $row["subgra"];
$desfactot= $row["desfactot"];
$impfac   = $row["impfac"];
$flefac   = $row["flefac"];
$otrfac   = $row["otrfac"];
$totfac   = $row["totfac"];
$cdgtipven= $row["cdgtipven"];
$cdgtipcxp= $row["cdgtipcxp"];
$estado   = $row["estado"];
$marcaborrado = $row["borrado"];
$marcaestado  = $row["estado"];

  if ($marcaborrado == 1) { $borrado="Factura Anulada"; } else { $borrado=""; } 

?>


<html>
	<head>
		<title>Principal</title>
		<link href="../estilos/estilos.css" type="text/css" rel="stylesheet">
		
		
		<script src="../jquery/jquery-1.3.2.js" type="text/javascript"></script>
		<script src="../jquery/jquery.maskedinput-1.2.2.js" type="text/javascript"></script>
		
		<script language="javascript">
	
		var cursor;
		if (document.all) {
		// Está utilizando EXPLORER
		cursor='hand';
		} else {
		// Está utilizando MOZILLA/NETSCAPE
		cursor='pointer';
		}
		

function aceptar() {
			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="  nobackbutton(); ">
		<div id="">
			<div id="zonaContenido">
				<div align="center">
				<div id="tituloForm" class="header">Ver Cuenta por Pagar</div>
			
				<p>&nbsp;</p>
				<form id="formulario" name="formulario" method="post" action="guardar_cxp.php" >
				<div id="formulario" class="contenidoCliente">
				<table class="fuente8" width="100%" cellspacing=2 cellpadding=0 border=0>
                    <tr>
                      <td width="6%">&nbsp;</td>
                      <td width="15%">&nbsp;</td>
                      <td>&nbsp;</td>
                      <td colspan="5"><div align="right"></div></td>
                      <td><div align="center"></div></td>
                    </tr>
                    <tr>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                    </tr>
                    <tr>
                      <td>&nbsp;</td>
         <td width="15%"> Factura </td>
 <td><input NAME="numfac" type="text" class="cajaGrande" id="numfac" style='text-align:center;'  value="<?php echo $numfac ?>" readonly></td>
<td>&nbsp;</td>
<td><div align="center">Fecha</div></td>
<td><input name="fecfac" type="text" class="cajaGrande" id="fecfac"  style='text-align:center;' value="<?php echo $fecfac?>"  readonly="" ></td>
<td><div align="center">Proceso</div></td>
<td><input name="fecpro" type="text" class="cajaGrande" id="fecpro"  maxlength="10" style='text-align:center;'  value="<?php echo $fecpro?>"  readonly="" ></td>
<td width="13%">&nbsp;</td>
                    </tr>
                    <tr>
                      <td>&nbsp;</td>
                      <td>Proveedor</td>
                      <td><input name="cdgpro" type="text" class="cajaGrande" id="cdgpro"   click="limpiarcaja()" style='text-align:center;'  value="<?php echo $cdgpro?>"  readonly="" ></td>
                      <td colspan="5"><input name="dscpro" type="text" class="cajaGrande" id="dscpro"   click="limpiarcaja()" style='text-align:center;'  value="<?php echo $dscpro?>"  readonly="" ></td>
                      <td>&nbsp;</td>
                    <tr>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                    <tr>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                    <tr>
                      <td>&nbsp;</td>
                      <td>Sub. Exento </td>
<td><input name="subexe" type="text" class="cajaGrande" id="subexe" style='text-align:right;' value="<?php echo number_format($subexe,2,".",",")?>"  readonly="" ></td>
                      <td>&nbsp;</td>
					          <?php

						

                        	$query_tipoventa="SELECT * FROM tipoventa WHERE cdgtipven ='$cdgtipven' ";
                            $result = $mysqli->query($query_tipoventa);
           					$fila = $result->fetch_assoc()
				
					  ?>
<td><div align="left">Credito</div><td colspan="2"><input name="tipoventa" type="text" class="cajaGrande" id="tipoventa" style='text-align:center;' value="<?php echo  $fila["dsctipven"]?>"  readonly="" ></td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                    <tr>
                      <td>&nbsp;</td>
                      <td>Sub. Gravado </td>
                      <td><input name="subgra" type="text" class="cajaGrande" id="subgra" style='text-align:right;' value="<?php echo number_format($subgra,2,".",",")?>"  readonly="" ></td>
                      <td>&nbsp;</td>
			
					                    
                        <?php
						
						  	$query_tipocxp="SELECT * FROM tipo_cxp  WHERE cdgcxp='$cdgtipcxp'";
                            $result = $mysqli->query($query_tipocxp);
							$fila = $result->fetch_assoc()
					  ?>
                      <td><div align="left">Tipo</div></td>
                        <td colspan="2"><input name="subgra" type="text" class="cajaGrande" id="subgra" style='text-align:center;' value="<?php echo $fila["dsccxp"]?>"  readonly="" ></td>
                        
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                    <tr>
                      <td>&nbsp;</td>
                      <td><div align="left">Descuento </div></td>
                      <td><input name="desfactot" type="text" class="cajaGrande" id="desfactot" style='text-align:right;' value="<?php echo number_format($desfactot,2,".",",")?>"  readonly="" ></td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                    <tr>
                      <td>&nbsp;</td>
                      <td><div align="left">Impuesto</div></td>
                      <td><input name="impfac" type="text" class="cajaGrande" id="impfac"  style='text-align:right;'value="<?php echo number_format($impfac,2,".",",")?>"  readonly=""  ></td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                    <tr>
                      <td>&nbsp;</td>
                      <td><div align="left">Flete</div></td>
                      <td><input name="flefac" type="text" class="cajaGrande" id="flefac"  style='text-align:right;' value="<?php echo number_format($flefac,2,".",",")?>"  readonly="" ></td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                    <tr>
                      <td>&nbsp;</td>
                      <td><div align="left">Otros</div></td>
                      <td><input name="otrfac" type="text" class="cajaGrande" id="otrfac"  style='text-align:right;'value="<?php echo number_format($otrfac,2,".",",")?>"  readonly="" ></td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                    <tr>
                      <td>&nbsp;</td>
                      <td><div align="left">Total</div></td>
                      <td><input name="totfac" type="text" class="cajaGrande" id="totfac"  style='text-align:right;' value="<?php echo number_format( $totfac,2,".",",")?>"  readonly="" ></td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                      <td>&nbsp;</td>
                    <tr>
                      <td width="6%" height="22">&nbsp;</td>
                      <td width="15%">&nbsp;</td>
                      <td width	="14%">&nbsp;</td>
                      <td width="5%">&nbsp;</td>
                      <td width="8%">&nbsp;</td>
                      <td width="14%">&nbsp;</td>
                      <td width="9%">&nbsp;</td>
                      <td width="16%">&nbsp;</td>
                      <td width="13%">&nbsp;</td>
                  </table>
				</div>
			      <span class="contenido"><img src="../img/Undo_48x48-32.png" alt="salir" width="48" height="48" border="0" class="aCentro" title="Salir" onClick="aceptar()" onMouseOver="style.cursor=cursor"></span>
				</form>
			  </div>
		  </div>
		</div>
	</body>
</html>
