<?php
 
session_start();
$com = "C";
include("DMMYSQLG.php");
include("DSA3000.php");
include("DMMYSQLG.php");
@$resu1=mysqli_query($con ,"select * from dgger_cajerosj where n_rec = '".$_REQUEST['bot']."'");
@$rego1=mysqli_fetch_array($resu1);

?>
<html>
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>
<body>
<form name="frm1" id="frm1" method="post" action="">
<input name="bot" type="hidden" value="<?php
 echo $_REQUEST['bot'] ?>">
  <table width="855"  align="center">
      
      <tr>
        <th colspan="7" class="titulo">RECIBO DE CAJA   </th>
      </tr>
      <tr>
        <td width="101">Fecha</td>
        <td colspan="4"><span class="inputcodigo"><?php
 echo $rego1['fec_rec'] ?></span></td>
        <td width="135">Pedido:</td>
        <td width="204"><span class="inputcodigo">
		<?php
 echo $rego1['pedido'] ?>
		</span></td>
      </tr>
      <tr>
        <td>Vendedor</td>
        <td colspan="4"><span class="inputcodigo">
		<?php
 
		@$resultado=mysqli_query($con ,"select * from dgcatven where cod_ven = '".$rego1['vendedor']."'");
		@$registro=mysqli_fetch_array($resultado);
		echo $registro['nom_ven'].' '.$registro['ap_pat_ven'].' '.$registro['ap_mat_ven'];
		?>
		</span></td>
        <td>Tipo de Movimiento: </td>
        <td><span class="inputcodigo">
          <?php
 
		@$reso=mysqli_query($con ,"select * from dgtipven where tip_ven = '".$rego1['tip_caj']."'");
		@$reg=mysqli_fetch_array($reso);
		echo $reg['des_tipven'];
		?>
        </span></td>
      </tr>
      <tr>
        <td>Importe </td>
        <td width="157"><span class="inputcodigo">
          <?php
 
		echo '$  ' .number_format($rego1['importe'],2,'.',',');
		?>
        </span></td>
        <td width="69">Descuento:</td>
        <td width="143" colspan="2"><span class="inputcodigo">
          <?php
 
		echo '$  ' .number_format($va,2,'.',',');
		?>
        </span></td>
        <td>Total</td>
        <td><span class="inputcodigo">
    <?php
 
		echo '$  ' .number_format($rego1['importe'],2,'.',',');
	?>
        </span></td>
      </tr>
      
      <tr>
        <td>Cliente </td>
        <td colspan="6"><?php
 
		@$rrr=mysqli_query($con ,"select * from dgcatcli where cod_cli = '".$rego1['num_cli']."'");
		$r=mysqli_fetch_array($rrr);
		echo $r['nom_cli'] . ' ' . $r['ap_pat_cli'] . ' ' . $r['ap_mat_cli'];
	?></td>
      </tr>
    <tr>
      <td>Concepto:</td>
      <td colspan="6"><?php
 
			echo $rego1['concepto'];
	?></td>
    </tr>
  </table>
    <table width="824" border="0" align="center">
	<!--Encabezado-->
     
      <tr>
        <td colspan="5" class="inputcodigo"><div align="center" class="mentab">DETALLE DE PAGO </div></td>
      </tr> 
	  <tr>
        <td colspan="5" class="inputcodigo">&nbsp;</td>
	  </tr>
	   <tr>
	     <td class="inputcodigo"><div align="center">TIPO DE PAGO</div></td>
	     <td class="inputcodigo"><div align="center">IMPORTE</div></td>
	     <td class="inputcodigo"><div align="center">REFERENCIA DE PAGO</div></td>
	     <td class="inputcodigo"><div align="center">AUTORIZACION</div></td>
	     <td class="inputcodigo"><div align="center">RESTA</div></td>
      </tr> 
	  <!--Desarrollo de pago-->
<?php
 
@$sql = mysqli_query($con ,"select * from dgger_cajerosd where n_rec = '".$_REQUEST['bot']."'");
while(@$row = mysqli_fetch_array($sql)){
	echo "<tr>";
		 @$sqlx = mysqli_query($con ,"select * from dgtippag where tip_pag = '".$row['tip_pag']."'");
		 @$rowx = mysqli_fetch_array($sqlx);
		 echo '<td><div align="center">' . $rowx['desc_pag'] . '&nbsp;</div></td>';
		 echo '<td><div align="center">' . $row['importe'] . '&nbsp;</div></td>';
		 $imp += $row['importe'];
		 echo '<td><div align="center">' . $row['ref'] . '&nbsp;</div></td>';
		 echo '<td><div align="center">' . $row['aut'] . '&nbsp;</div></td>';
		 $res =  $_REQUEST['ttot'] - $imp;
		 if($res>=0){
		 	 echo '<td> $' .number_format($res,2,'.',',') . "&nbsp;</td>";
		 }else{
		 	echo '<td> $' .number_format('0',2,'.',',') . "&nbsp;</td>";
		 }
	echo "</tr>";
}
?>
	  <!--Totales-->
	   <tr>
	     <td colspan="2">&nbsp;</td>
	     <td>&nbsp;</td>
	     <td class="mentab">PAGADO</td>
	     <td class="mentab"><?php
 
	echo '<input name="txt_p" type="hidden" value="'.$imp.'">';
	echo '$  ' . number_format($imp, 2, '.', ',');
	?>		 </td>
      </tr>
	   <tr>
	     <td colspan="2">&nbsp;</td>
	     <td>&nbsp;</td>
	     <td class="mentab">RESTA</td>
	     <td class="mentab"><?php
 
	echo '<input name="txt_r" type="hidden" value="'.$res.'">';
	$res =  $_REQUEST['ttot'] - $imp;
	if($res >= 0){
		echo '$  ' . number_format($res, 2, '.', ',');
	}else{
	 	echo '$  ' .number_format('0',2,'.',',');
	}
	?>&nbsp;</td>
      </tr>
	   <tr>
        <td colspan="2">&nbsp;</td>
        <td>&nbsp;</td>
        <td class="mentab">CAMBIO</td>
        <td class="mentab"><?php
 
	echo '<input name="txt_s" type="hidden" value="'.$s.'">';
	$cam = $imp - $_REQUEST['ttot'];
	if($cam >= 0 ){
		echo '$  ' . number_format($cam, 2, '.', ',');
	
		@$sql=mysqli_query($con ,"select * from dgger_cajerosd where num_pag = '$ultimo_id'");
		@$res=mysqli_fetch_array($sql);
		$imp = $res['importe'] - $cam;
	}else{
	 	echo '$  ' .number_format('0',2,'.',',');
	}	
	?>
	
         &nbsp;</td>
      </tr>
  </table>
  <p>
    <input type="submit" name="Submit2" value="Cancelar" onClick="openpage('DG31000_EC.php','_self')">
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input type="submit" name="Submit" value="Regresar"  onClick="openpage('DG31000_PR.php','_self')">
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
</form>
</blockquote>
</body>
</html>
