<?php
 
session_start();
include("DMMYSQLG.php");
?>
<html>
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>
<body>
<?php
 
$fec=$_POST['tfec'];
include("DF20000.php");
//buscar almacen
if (isset($_POST['Submit22']))
{
	@$result = mysqli_query($con ,"SELECT * FROM dgtipven WHERE tip_ven = '".$_POST['tip_ven']."'");
	while(@$dato = mysqli_fetch_array ($result))
	{ 
		$al=$dato["almacen"];
	}
//Guardar registro en 
$sql="INSERT INTO dgpemema (tip_ven, fec_ven,cod_cli, por_des, alm_gen, oper, cod_ven, con_cre, iva_des,acc_fec, acc_hor, usuario,nom_cli_alt) VALUES ('".$_POST['tip_ven']."','".$f_m."', '".$_POST['tncli']."', '".$_POST['tdes']."', '".$al."', '" . $u . "', '".$_POST['select']."', '".$_POST['select2']."', '".$_POST['select3']."', '".date('Y-m-d')."', '".date('H:i:s')."','".$_SESSION['num_usu']."','".strtoupper($_POST['trefe'])."')";
	if (!mysqli_query($con ,$sql))
	{
		die('Error: ' . mysqli_error($con));
		exit();
	}
}else{
	$al=$_SESSION['al'];
}
?>
<form name="frm1" id="frm1" method="post" action="">
  <input name="ver" type="hidden" value="1">
 <input name="tdis" type="hidden" 
	<?php
 
	if(isset($_POST['tncli'])){
		@$result = mysqli_query($con ,"SELECT * FROM dgcatcli WHERE cod_cli = '".$_POST['tncli']."'");
	}else{
		@$result = mysqli_query($con ,"SELECT * FROM dgcatcli WHERE cod_cli = '".$_POST['tdis']."'");
	}
	@$row = mysqli_fetch_array($result);
	echo 'value="'.$row['tip_cte'].'"';
	?>
 >
  <table   align="center">
<tr>
<td colspan="5" class="men">
    <?php
  
	if(isset($_POST['tnum']) || isset($_POST['boton_car']))
	{
		echo '<input name="tnum" type="hidden" value="'.$_POST['tnum'].'">';
		echo 'NUMERO DE VENTA:'.$_POST['tnum']; 
		@$result = mysqli_query($con ,"SELECT * FROM dgpemema WHERE fol_ven = '".$_POST['tnum']."'");
	}
	if(isset($_POST['Submit22']))
	{
		@$ultimo_id = mysqli_insert_id($con);
		echo '<input name="tnum" type="hidden" value="'.$ultimo_id.'">';
		echo 'NUMERO DE VENTA:'.$ultimo_id; 
		@$result = mysqli_query($con ,"SELECT * FROM dgpemema WHERE fol_ven = '$ultimo_id'");
	}	
while(@$row = mysqli_fetch_array($result))
{
	$op1=$row["tip_ven"];
	$op2=$row["fec_ven"];
	$op3=$row["cod_cli"];
	$op4=$row["con_cre"];
	$op5=$row["alm_gen"];
	$op6=$row["sub_ven"];
	$op7=$row["iva_ven"];
	$op8=$row["tot_ven"];
	$op9=$row["iva_des"];
	$op10=$row["por_des"];
	$op11=$row["cod_ven"];
	$op12=$row["des_ven"];
	$op13=$row["nom_cli_alt"];
}
?>  </td>
  </tr>
  <tr>
    <th colspan="5" class=\"titulo\">Datos de la Venta </th>
  </tr>
  <tr>
    <td width="117">Tipo de Venta:</td>
    <td width="267">
	<?php
 
		@$resultado=mysqli_query($con ,"select * from dgtipven where tip_ven like '%$op1%'");
		if(isset($_POST['ver1']))
		{
			@$res=mysqli_query($con ,"select * from dgtipven where tip_ven like '%".$_POST['ver1']."%'");
			while(@$reg=mysqli_fetch_array($res))
			{
				echo '<input name="ver1" type="hidden" value="'.$reg['tip_ven'].'">';
				echo $reg['des_tipven'];
			}
		}else{
			while(@$registro=mysqli_fetch_array($resultado))
			{
				echo '<input name="ver1" type="hidden" value="'.$registro['tip_ven'].'">';
				echo $registro['des_tipven'];
			}		
		}	
	?>&nbsp;</td>
    <td>Fecha de Venta : 
	  <?php
 
		if(isset($_POST['ver2']))
		{
			echo '<input name="ver2" type="hidden" value="'.$_POST['ver2'].'">';
			echo $_POST['ver2'];
		}else{
			$fec1=$op2;
			include("DF20000.php");
			echo '<input name="ver2" type="hidden" value="'.$f_f.'">';
			echo $f_f;
		}
	?>	</td>
    <td colspan="2">Venta a:  	 
      <?php
 
	  	if(isset($_POST['ver3'])){
			echo '<input name="ver3" type="hidden" value="'.$_POST['ver3'].'">';
			echo $_POST['ver3'];
		}else{
			if($op4 == 1){
				echo '<input name="ver3" type="hidden" value="CONTADO">';
				echo "CONTADO";
			}else{
				echo '<input name="ver3" type="hidden" value="CREDITO">';
				echo "CREDITO";
			}
		}
	?></td>
    </tr>
  <tr>
    <td>Vendedor: </td>
    <td><?php
 
		@$resultado=mysqli_query($con ,"select * from dgcatven where cod_ven = '$op11'");
		if(isset($_POST['ver11']))
		{
			echo '<input name="ver11" type="hidden" value="'.$_POST['ver11'].'">';
			echo $_POST['ver11'];
		}else{
			while(@$registro=mysqli_fetch_array($resultado))
			{
				echo '<input name="ver11" type="hidden" value="'.$registro['nom_ven'] . ' ' . $registro['ap_pat_ven'].'">';
				echo $registro['nom_ven'] . ' ' . $registro['ap_pat_ven'];
			}		
		}	
	?></td>
    <td>Descuento de Venta :
      <?php
 
	  	if(isset($_POST['ver31'])){
			echo '<input name="ver31" type="hidden" value="'.$_POST['ver31'].'">';
			echo $_POST['ver31'];
		}else{
			echo '<input name="ver31" type="hidden" value="'.$op10.'">';
			echo $op10;
		}
		echo ' %';
	?></td>
    <td width="129">Iva Desglosado: </td>
    <td width="68"><?php
 
	
	  	if(isset($_POST['ver311'])){
			echo '<input name="ver311" type="hidden" value="'.$_POST['ver311'].'">';
			echo $_POST['ver311'];
		}else{
			if($op9 == 0){
				echo '<input name="ver311" type="hidden" value="NO">';
				echo "NO";
			}else{
				echo '<input name="ver311" type="hidden" value="SI">';
				echo "SI";
			}
		}
	?></td>
  </tr>
  <tr>
    <td>Cliente: </td>
    <td colspan="2"><?php
 
		if(isset($_POST['ver33']))
		{
			@$res=mysqli_query($con ,"select * from dgcatcli where cod_cli = '".$_POST['ver33']."'");
			while(@$reg=mysqli_fetch_array($res))
			{
				echo '<input name="ver33" type="hidden" value="'.$_POST['ver33'].'">';
				echo '<input name="verd" type="hidden" value="'.$reg['distribuidor'] .'">';
				echo $reg['nom_cli'] . ' ' . $reg['ap_pat_cli'];
			}	
		}else{
			@$resultado=mysqli_query($con ,"select * from dgcatcli where cod_cli = '$op3'");
			while(@$registro=mysqli_fetch_array($resultado))
			{
				echo '<input name="ver33" type="hidden" value="'.$op3.'">';
				echo '<input name="verd" type="hidden" value="'.$registro['distribuidor'] .'">';
				echo $registro['nom_cli'] . ' ' . $registro['ap_pat_cli'];
			}		
		}	
	?></td>
    <td>N&ordm; de Cliente </td>
    <td><?php
 
		if(isset($_POST['tnc']))
		{
			echo '<input name="tnc" type="hidden" value="'.$_POST['tnc'].'">';
			echo $_POST['tnc'];
		}else{
			echo '<input name="tnc" type="hidden" value="'.$op3.'">';
			echo $op3;
		}	
	?></td>
  </tr>
  <tr>
    <td>Nombre de Cliente Alterno: </td>
    <td colspan="2">
<?php
 
	if(isset($_POST['ver26']))
	{
		echo '<input name="ver26" type="hidden" value="'.$_POST['ver26'] .'">';
		echo $_POST['ver26'];
	}else{
		echo '<input name="ver26" type="hidden" value="'.$op13.'">';
		echo $op13;
	}	
?>&nbsp;</td>
    <td>Almacen</td>
    <td><?php
 
	if($al <> ""){
		$_SESSION['al']=$al;
	}
	@$re=mysqli_query($con ,"select * from dgalmacen where almacen = '".$_SESSION['al']."'");
	@$reg=mysqli_fetch_array($re);
	echo $reg['desc_almacen'];
	?>      &nbsp;&nbsp;</td>
  </tr>
</table>
 <?php

/////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////si eprecionan el boton de eliminar/
/////////////////////////////////////////////////////////////////////////////////////////////
if (isset($_POST['Submit2'])){
	include('DG23000_AC7');	
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////Si se agrega un producto para la venta
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (isset($_POST['boton_car'])){

	include('DG23000_AC6.php');

}

?>

    <table  align="center">
  <tr>
    <th colspan="5" class=\"titulo\">Productos de la Venta </th>
    </tr>
  <tr>
    <td width="224"> 
        <input name="tbus" type="text" id="tbus"
		<?php
 
		echo 'value ="'.$_POST['tbus'].'"';
		?>
		>
          <input type="submit" name="Submit" value="Buscar" onClick="openpage('DG23000_AC.php','_self')"></td>
    <td colspan="4"><input name="r1" type="radio" value="clave" checked 
	<?php
 
	if($_POST['r1'] == "clave" ){
		echo ' checked';
	}
	?>
	>
Clave del producto
  <input name="r1" type="radio" value="des"
  <?php
 
	if($_POST['r1'] == "des"){
		echo ' checked';
	}
	?>
  >
Descripcion</td>
    <?php
 
@$resultado2=mysqli_query($con ,"SELECT * FROM dginvent WHERE dginvent.modulo='".$_SESSION['mod_sis']."' AND   nparte1 = '".$_POST['producto']."'");
@$regist2=mysqli_fetch_array($resultado2);
/* 	$a1 = $registro2['nparte1']; 
	$a2 = $registro2['np_desc1']; 
	$a3 = $registro2['exi_min']; 
	$a4 = $registro2['exi_max']; 
	$a5 = $registro2['linea']; 
	$a6 = $registro2['gpo_basico']; 
	$a7 = $registro2['cve_marca']; */
	$pp8 = $regist2['lim_vta1']; 
	$pp9 = $regist2['lim_vta2']; 
	$pp10 = $regist2['lim_vta3'];  
	$pp1 = $regist2['lim_1']; 
	$pp2 = $regist2['lim_2']; 
	$pp3 = $regist2['lim_3']; 
	/* $a14 = $registro2['tip_mon']; 
	$a15 = $registro2['uc_fec_doc']; 
	$a16 = $registro2['uc_num_doc']; 
	$a17 = $registro2['uc_pre_com']; 
	$a18 = $registro2['cos_prom']; 
	$a19 = $registro2['cos_prom_ant']; 
	$a20 = $registro2['exi_fis']; 
	$a21 = $registro2['exi_dis']; 
	$a22 = $registro2['fec_bck_ord']; 
	$a23 = $registro2['bck_ord']; 
	$a24 = $registro2['cve_uni_com']; */
	$a25 = $regist2['ven_esp1']; 
/* 	$a26 = $registro2['cve_uni_vta']; 
	$a27 = $registro2['cod_pro'];  */ 
?>
    </tr>
  <tr>
    <td class="mentab">Venta de 1 a <?php
 echo $pp1 ?> = <?php
 echo '$' . number_format($pp8, 2, '.', ','); ?></td>
    <td width="102" class="mentab">Venta de <?php
 echo $pp1 + 1 ?> a <?php
 echo $pp2  ?> =<?php
 echo '$' . number_format($pp9, 2, '.', ','); ?></td>
    <td width="201" class="mentab">Venta de <?php
 echo $pp2 + 1 ?> en adelante = <?php
 echo '$' . number_format($pp10, 2, '.', ','); ?></td>
    <td colspan="2" class="mentab">Venta distribuidor =<?php
 echo '$' . number_format($a25, 2, '.', ','); ?></td>
    </tr>
  <tr>
    <td colspan="5">Producto:
      <select name="producto" onChange="javascript: document.getElementById('frm1').submit()">
	  <option></option>
<?php
 
	if ($_POST['r1']=="clave"){//si 
		@$resultado=mysqli_query($con ,"SELECT * FROM dginvent WHERE dginvent.modulo='".$_SESSION['mod_sis']."' AND   nparte1 = '".$_POST['tbus']."'");
		$nr = mysqli_num_rows($resultado);
		//$x = 1;
		if($nr == 0){
			@$resultado=mysqli_query($con ,"SELECT * FROM dginvent WHERE dginvent.modulo='".$_SESSION['mod_sis']."' AND   nparte1 like '%".$_POST['tbus']."%'");
			$nr1 = mysqli_num_rows($resultado);
			//$x = 2;
		}
	}elseif($_POST['r1']=="des"){
		@$resultado=mysqli_query($con ,"SELECT * FROM dginvent WHERE dginvent.modulo='".$_SESSION['mod_sis']."' AND   np_desc1 like '%".$_POST['tbus']."%'");
		//$x = 3;
	}
	 while(@$registro=mysqli_fetch_array($resultado))
	{
		if(($_POST['producto'] == $registro['nparte1']) or (isset($_POST['Submit']) and $nr == 1)){
			echo '<option value="' . $registro['nparte1'] . '" selected>' . $registro['nparte1'] . ' | ' .$registro['np_desc1'] . ' | Dis: ' .$registro['exi_dis'] .'</option>';
			$va =  $registro['nparte1'];
		}else{
			echo '<option value="' . $registro['nparte1'] . '">' . $registro['nparte1'] . ' | ' .$registro['np_desc1'] . ' | Dis: ' .$registro['exi_dis'] .'</option>';
		}
	}			
?>
      </select>	  </td>
    </tr>
  <tr>
  <?php
 
  //sacar el precio del dolar
  	@$ress=mysqli_query($con ,"select * from dgparame");
	@$num_ro = mysqli_fetch_array($ress);
  ?>
    <td width="224">Precio: $
      <input name="tpre" type="text" class="tdato" size="10" readonly 
	<?php
 
	if($_POST['tbus']<>"" and isset($_POST['tbus']) or (isset($_POST['producto']))){
		if(isset($_POST['Submit'])){
			@$result = mysqli_query($con ,"SELECT * FROM dginvent WHERE dginvent.modulo='".$_SESSION['mod_sis']."' AND   nparte1 ='".$_POST['tbus']."'");
		}elseif(isset($_POST['producto'])){
			@$result = mysqli_query($con ,"SELECT * FROM dginvent WHERE dginvent.modulo='".$_SESSION['mod_sis']."' AND   nparte1 ='".$_POST['producto']."'");
		}
		//consultar el registro  y sacar datos
		@$num_rows = mysqli_num_rows($result);
		if ($num_rows==0){
			echo 'value="0"';
		}else{
			while($row = mysqli_fetch_array($result))
			{
				$lim1=$row['lim_1'];
				$lim2=$row['lim_2'];
				$lim3=$row['lim_3'];
				$p1=$row['lim_vta1'];
				$p2=$row['lim_vta2'];	
				$p3=$row['lim_vta3'];
				$p4=$row['ven_esp1'];
				$ti_mo = $row['tip_mon'];
			}
			if($_POST['verd']==1){
				$pr = $p4;
			}elseif($_POST['tcan']<=$lim1){
				$pr = $p1;
			}elseif($_POST['tcan']<=$lim2){
				$pr = $p2;
			}elseif($_POST['tcan']>=$lim3){
				$pr = $p3;
			}
			if($_POST['tdis']==1){
				$pp = $pr4;
			}else{
				$pp = $pr;
			}
		}
	}elseif(isset($_POST['tpre']) and $_POST['tpre']<>""){
		$pp = $_POST['tpre'];
	}else{
		$pp = 0;
	} 
	if($ti_mo == "E"){
		$pp=$num_ro['tip_camb_ven'] * $pp;
	}
	echo 'value="'.number_format($pp, 2, '.', ',').'"';	
	//echo 'value="'.$num_ro['tip_camb_ven'].'"';	
	?>
	
	>
	
      <input name="tp11" type="hidden" id="tp11" size="5" 
	<?php
 
		echo 'value="'.$p1.'"';
	?> >
      <input name="tp22" type="hidden" id="tp22" size="5" 
	<?php
 
		echo 'value="'.$p2.'"';
	?> >
      <input name="tp33" type="hidden" id="tp33" size="5" 
	<?php
 
		echo 'value="'.$p3.'"';
	?> >
      <input name="tp44" type="hidden" id="tp44" size="5" 
	<?php
 
		echo 'value="'.$p4.'"';
	?> >
      <input name="tp1" type="hidden" id="tp1" size="5" 
	<?php
 
		echo 'value="'.$lim1.'"';
	?> >
      <input name="tp2" type="hidden" id="tp2" size="5" 
	<?php
 
		echo 'value="'.$lim2.'"';
	?> >
      <input name="tp3" type="hidden" id="tp3" size="5" 
	<?php
 
		echo 'value="'.$lim3.'"';
	?> >
      <input name="t_m" type="hidden" id="tp32" size="5" 
	<?php
 
		echo 'value="'.$ti_mo.'"';
	?> >
      <input name="dll" type="hidden" id="dll" size="5" 
	<?php
 
		echo 'value="'.$num_ro['tip_camb_ven'].'"';
		
	?> ></td>
    <td colspan="2">Cantidad de producto:
      <input name="tcan" type="text" size="10" maxlength="15" onKeyUp="seg_can(this.value)" onKeyPress="return soloNumeros(event)"
	 <?php
 
	 if(isset($_POST['producto']) or ($_POST['tbus']<>"" and isset($_POST['tbus']))){
		@$resultado2=mysqli_query($con ,"select * from dginvalm where nparte1='$va'");
		@$num_rows = mysqli_num_rows($resultado2);
		if ($num_rows==0){
			echo '0';
		}else{
			@$registro2=mysqli_fetch_array($resultado2);
			
			echo $registro2['lim_vta1'];
		}
	}else{
		echo '0';
	}
	 ?> 
	  >
      <input type="button" name="Submit3" value="Cam / Precio" onClick="openpage('DG23000_AC2.php','_black')"
	  <?php
 
	@$res1 = mysqli_query($con ,"SELECT * FROM dgparame");
	@$row1 = mysqli_fetch_array($res1);
	if($row1['per_mod']=="N"){
		echo ' disabled';
	}
	  ?> 
	>
      <input type="hidden" name="t333"
	<?php
 
		echo 'value="'.$row1['por_vad'].'"';
	?>
	></td>
    <td width="90"> Exis/Disp/Almacen:
      <?php
 
	if(isset($_POST['producto']) or ($_POST['tbus']<>"" and isset($_POST['tbus']))){
		@$resultado2=mysqli_query($con ,"select * from dginvalm where nparte1='$va' and almacen = '".$_SESSION['al']."'");
		@$num_rows = mysqli_num_rows($resultado2);
		if ($num_rows==0){
			echo '0';
		}else{
			@$registro2=mysqli_fetch_array($resultado2);
			echo $registro2['can_dis_alm'];
		}
	}else{
		echo '0';
	}
	?></td>
    <td width="99">Exi/ Fisica/Almacen:	  
      <?php
 
	if(isset($_POST['producto']) or ($_POST['tbus']<>"" and isset($_POST['tbus']))){
		@$resultado2=mysqli_query($con ,"select * from dginvalm where nparte1='$va' and almacen = '".$_SESSION['al']."'");
		@$num_rows = mysqli_num_rows($resultado2);
		if ($num_rows==0){
			echo '0';
		}else{
			while(@$registro2=mysqli_fetch_array($resultado2)){
				echo $registro2['exi_fis_alm'];
			}
		}
	}else{
		echo '0';
	}
	?></td>
  </tr>
</table>
    <div align="center"><br>
    <input type="submit" name="boton_car" value="Agregar Porducto" onClick="openpage('DG23000_AC.php','_self')">
    <br>
</div>
<table border='1' align="center">
    <tr>
      <th> 
        <input type="submit" name="Submit2" value="Eliminar">
      </th>
      <th colspan="10"></th>
    </tr>
    <tr>
	  <th><div align="center">Sel</div></th>
      <th><div align="center">Clave Producto</div></th>
      <th><div align="center">Descripcion</div></th>
	  <th><div align="center">Precio Base</div></th>
	  <th><div align="center">% Descuento</div></th>
	  <th><div align="center">Descuento</div></th>
      <th><div align="center">Precio Unitario</div></th>
	  <th><div align="center">Cantidad</div></th>
	  <th><div align="center">Sub - total</div></th>
	  <th><div align="center">Iva</div></th>
	  <th><div align="center">Total</div></th>
    </tr>

<?php

if (isset($_POST['boton_car']) || isset($_POST['producto']) || isset($_POST['Submit'])){
	//saca el numero de producto
	@$res=mysqli_query($con ,"select * from dgpememd where cons_ven = '".$_POST['tnum']."'");
	while($row = mysqli_fetch_array($res))
	{
		$npr[]=$row["nparte1"];	
		$nrx[]=$row["fol_ven1"];	
	}
	//contar cuantos registros
	$num_elementos=count($npr);
	//saca la descripcion del producto
	for($j=0;$j<=$num_elementos-1;$j++)
	{
		@$res=mysqli_query($con ,"SELECT * FROM dginvent WHERE dginvent.modulo='".$_SESSION['mod_sis']."' AND   nparte1 like '$npr[$j]'");
		while($row = mysqli_fetch_array($res))
		{
			$dpr[]=$row["np_desc1"];	
		}
	}
	$num_elementos1=count($npr);
	for($y=0;$y<=$num_elementos1-1;$y++)
	{	
		//mostrar datos encontrados en dgrefodd
		@$res=mysqli_query($con ,"select * from dgpememd where cons_ven LIKE '".$_POST['tnum']."' && nparte1 like '$npr[$y]'");
		while($row = mysqli_fetch_array($res))
		{
			echo '<tr><td>';
			echo '<div align="center"><input name="r5" type="radio" value="'.$y.'"/></div>';
			echo '<input name="nu_re1'.$y.'" type="hidden" value="'.$nrx[$y].'">';
			echo '<input name="nu_re2'.$y.'" type="hidden" value="'. $npr[$y].'">';
			echo '</td><td><div align="center">' . $npr[$y] . '</div></td>';
			echo '<td><div align="center">' . $dpr[$y] . '</div></td>';
			$pbas=$row['pre_uni'];
			echo '<td><div align="center">$ ' . number_format($row['pre_uni'], 4, '.', ',') . '</div></td>';
			$pbase =  $pbase + $pbas;
			$c = $c + $row['can_ref'];
			echo '<td><div align="center">' . number_format($row['por_des'], 4, '.', ',') . '  %</div></td>';
			echo '<td><div align="center">$ ' . number_format($row['des'], 4, '.', ',') . '</div></td>';
			$d = $d + $row['des'];
			$pre_u = $pbas - $row['des'];
			echo '<td><div align="center">$ ' . number_format($pre_u, 4, '.', ',') . '</div></td>';
			$p = $p + $pre_u;
			//sacra el iva
			$sbt = $pre_u * $row['can_ref'];
			echo '<td><div align="center">' . $row['can_ref'] . '</div></td>';
			echo '<td><div align="center">$ ' . number_format($sbt, 2, '.', ',') . '</div></td>';
			$s = $s + $sbt;
			//$ti = $sbt
			$ivpp = $row['iva_pre'] ;
			echo '<td><div align="center">$ ' . number_format($ivpp, 2, '.', ',') . '</div></td>';
			$iv = $iv + $ivpp;
			$t = $ivpp + $sbt;
			echo '<td><div align="center">$ ' . number_format($t, 2, '.', ',') . '</div></td>';
			$tot = $tot + $t;
			echo '</tr>'; 
		}
	}
 } 
 mysqli_close($con);
?>
<th colspan="2">Totales</th>
      <th>&nbsp;</th>
	<th>&nbsp;</th>
	<th>&nbsp;</th>
      <th>&nbsp;</th>
	<th>&nbsp;</th>
	    <th>&nbsp;</th>
	    <th>
	<?php
 
	echo '<input name="txt_s" type="hidden" value="'.$s.'">';
	echo '$' . number_format($s, 2, '.', ',');
	?>	</th>
	    <th>
	<?php
 
	echo '<input name="txt_iv" type="hidden" value="'.$iv.'">';
	echo '$' . number_format($iv, 2, '.', ',');
	?>	</th>
	    <th>
	<?php
 
	echo '<input name="txt_to" type="hidden" value="'.$tot.'">';
	echo '$' . number_format($tot, 2, '.', ',');
	?>	</th>
  </table>
  <div align="center">
    <input name="Submit5" type="Submit" value="Terminar Captura" onClick="openpage('DG23000_AG2.php','_self')">
  </div>
</form>
</body>
</html>
