<?  
ini_set('error_reporting', 1);                                                       
session_start();
if ($_SESSION['estado'] != "ON")
		{
		?>
		<script>
			parent.location.href = '../index.php';
		</script>
		<? 
		exit();
		}
$id_empresa = $_SESSION['ss_empresa'];          //      ******  MCC   09-03-15 ************
if ($id_empresa ==2) {$id_bodega=2; $id_vendedor=2; }
if ($id_empresa ==1) {$id_bodega=1; $id_vendedor=1;}
		
$ivausocomun=0;
 $factorivausocomun=0;   
$cod_iva_no_recuperable=0;
$id_user = $_SESSION['ss_user'];		
?>
<?
include("../conex.php");
include("../css/mascara_fecha.js");
$contprod=1;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script language="JavaScript" src="../css/cal.js" type="text/JavaScript"></script>
<title>Documento DTE de Compra</title>
</head>
<?
/****************** Busca numero correlativo ***********************************************/	
	$sql_par = "SELECT correlativo FROM tipo_dcto_num_bodega  WHERE id_empresa = $id_empresa AND id_dcto=13";
	$res_par = mysql_query($sql_par,$enlace);
	$row=0;
	$txtcorrelativo=0;
	while (mysql_fetch_object ($res_par))
		{
		$txtcorrelativo=mysql_result($res_par, $row, "correlativo");
		$row=$row+1;
		}
		$txtcorrelativo+=1;	
/************ Datos Empresa *************************************************************/
	$sql_empresa = "SELECT * FROM empresa, comunas WHERE comunas.cod_comuna = empresa.comuna AND id=$id_empresa";
	$res_empresa = mysql_query($sql_empresa,$enlace);
	$row=0;
	while (mysql_fetch_object ($res_empresa))
		{
		$empresa_rut=mysql_result($res_empresa, $row, "rut_empresa");
		$empresa_nombre=mysql_result($res_empresa, $row, "nombre");
		$empresa_direccion=mysql_result($res_empresa, $row, "direccion");
		$empresa_ciudad=mysql_result($res_empresa, $row, "ciudad");
		$empresa_comuna=mysql_result($res_empresa, $row, "comunas.comuna");
		$empresa_actividad=mysql_result($res_empresa, $row, "actividad");
		$empresa_rut_representante=mysql_result($res_empresa, $row, "rut_representante");
		$empresa_nombre_representante=mysql_result($res_empresa, $row, "nombre_representante");
		$row=$row+1;
		}
$id_ent = $_POST["txt_nv"];		//Indice de la factura

	
	$fechaven=	$fecha_emision[$id_ent];

	$ano = substr ($fechaven, 0, 4);
	$mes = substr ($fechaven, 5, 2);
	$dia = substr ($fechaven, 8, 2); 
	$fecha3 = "$dia/$mes/$ano";
	$ano = substr ($fechaven, 0, 4);
	$mes = substr ($fechaven, 5, 2);
	$dia = substr ($fechaven, 8, 2); 
	$fecha = "$dia/$mes/$ano";	
	$ano = substr ($fechaven, 0, 4);
	$mes = substr ($fechaven, 5, 2);
	$dia = substr ($fechaven, 8, 2); 
	$fecha2 = "$dia/$mes/$ano";	

  $lstpago=$FmaPago[$id_ent];
       if ($lstpago=='') {$lstpago=3;} else {if ($lstpago==2) {$lstpago=3;} else {$lstpago=1;}}
  $txtndcto= $nro[$id_ent];
  $txtrsoc = $RznSoc[$id_ent];
  $txtemail=".";
  $txtactividad=$GiroEmis[$id_ent];
  $txtfono=$Telefono[$id_ent];
  $txtfax=".";
  $txtcomuna=$CmnaOrigen[$id_ent];  //  buscar comuna
                               
  $txtciudad=$CiudadOrigen[$id_ent];
  $txtdireccion=$DirOrigen[$id_ent];
   $deta=$detalle[$id_ent];
    $deta_1=$detalle_1[$id_ent];
   
	if ($id_ent=='')
	{
	?>
	<script language="javascript">
		alert("No existe Factura relacionada al numero ingresado");
		window.top.open('','_parent','');
		window.top.close();
	</script>
	<?
	}
	$txtcargo0=$exento[$id_ent]+$neto[$id_ent];		
		$lstdcto=$TipoDTE_O[0];
       $cons_dcto = mysql_query("SELECT * FROM tipo_dcto WHERE id=$lstdcto;", $enlace);
 			$cont=0;
			while ( mysql_fetch_object ($cons_dcto) ) 
 			{
 
  				$nom_dcto=mysql_result($cons_dcto, $cont, "descripcion");		
		    }
	

	$txtrut= substr ($rut_emisor[$id_ent],0,2).".".substr ($rut_emisor[$id_ent],2,3).".".substr ($rut_emisor[$id_ent],5);
	
	
		

?>


<body>
<form id="form1" name="form1" method="post" action="">
<table width="640" align="center" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="60px"><div align="center"><img src="../Images/logo.gif" width="60px" height="60px"></div></td>
	<td width="220px"><div align="left"><font size="1">
		<?=$empresa_nombre?><br>
		<?=$empresa_direccion?><br>
		<?=$empresa_ciudad;?>

		</font></div>
	</td>
    <td width="360px" align="left"><div align="left"><font size="+1"> <?=$nom_dcto?> Nº <?=$nro[$id_ent];?></font></div></td>
  </tr>
</table>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr> 
		<td width="10%"><div align="center"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif"></font></strong></div></td>
		<td width="20%"><div align="center"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif"></font></strong></div></td>
		<td width="40%"><div align="center"></div></td>
		<td width="20%"><div align="center"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif"></font></strong></div></td>
		<td width="10%"><div align="center"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif"></font></strong></div></td>
    </tr>
</table>
<br>
<table width="640" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="100">R.U.T.</td>
    <td width="157"><input name="txtrut" id="txtrut" value="<?=$txtrut;?>" type="text" size="23" maxlength="12"/></td>
    <td width="23" align="left">&nbsp;</td>
    <td width="100" align="right"><div align="left">Señor: &nbsp;</div></td>
    <td width="260"><input name="txtrsoc" id="txtrsoc" type="text" size="42" value="<?=$txtrsoc;?>" readonly="1"/>    </td>
  </tr>
  <tr>
    <td>E-Mail</td>
    <td><input name="txtemail" id="txtemail" type="text" size="23" value="<?=$txtemail;?>" readonly="1" />    </td>
    <td>&nbsp;</td>
    <td align="right"><div align="left">Actividad:&nbsp; </div></td>
    <td><input name="txtactividad" id="txtactividad" type="text" size="42" value="<?=$txtactividad;?>" readonly="1" />    </td>
  </tr>
  <tr>
    <td>Fono: </td>
    <td><input name="txtfono" id="txtfono" type="text" size="23" value="<?=$$txtfono;?>" readonly="1"/></td>
    <td>&nbsp;</td>
    <td align="right"><div align="left">Regi&oacute;n: &nbsp;</div></td>
  </tr>
  <tr>
    <td>Fax:</td>
    <td><input name="txtfax" id="txtfax" type="text"  size="23" value="<?=$txtfax;?>" readonly="1"/></td>
    <td>&nbsp;</td>
    <td align="right"><div align="left">Comuna:&nbsp; </div></td>
    <td><input name="txtcomuna" id="txtcomuna" type="text" size="23" value="<?=$txtcomuna?>" readonly="1" /></td>
  </tr>
  <tr>
    <td>Ciudad:&nbsp; </td>
    <td><input name="txtciudad" id="txtciudad" type="text" size="23" value="<?=$txtciudad;?>" readonly="1" /></td>
    <td>&nbsp;</td>
    <td align="right"><div align="left">Direcci&oacute;n:</div></td>
    <td><input name="txtdireccion" id="txtdireccion" type="text" size="42" value="<?=$txtdireccion;?>" readonly="1"/></td>
  </tr>
  <tr>
    <td>N&ordm; Dcto. </td>
    <td><input name="txtndcto" type="text" id="txtndcto" value="<?=$txtndcto;?>" size="23" readonly="1" /></td>
    <td>&nbsp;</td>
    <td align="right"><div align="left">Tipo Dcto.</div></td>
    <td><input name="lstdcto" type="text" id="lstdcto" value="<?=$lstdcto?>" size="23" readonly="1" /></td>
  </tr>
  <tr>
    <td>Emision:</td>
    <td><input name="fecha" type="text" id="fecha" style="border-width:0;" value="<?=$fecha?>" size="23" readonly="1" />    </td>
    <td width="26"><a  href="javascript:show_calendar('form1.fecha');"><img name="foto2" id="foto2" align="top" border="0" src="../Images/CALENDAR.gif" style="cursor:pointer" title="Presione aqui y seleccione la fecha" /></a></td>
    <td>Pago:</td>
     <td><input name="lstpago" type="text" id="lstpago" value="<?=$lstpago?>" size="23" readonly="1"></td>
  </tr>
  <tr>
    <td>Fecha Libro: </td>
    <td><input name="fecha2" type="text" id="fecha2" style="border-width:0;" value="<?=$fecha2?>" size="23" readonly="1" /></td>
    <td width="26"><a  href="javascript:show_calendar('form1.fecha2');"><img name="foto2" id="foto2" align="top" border="0" src="../Images/CALENDAR.gif" style="cursor:pointer" title="Presione aqui y seleccione la fecha" /></a></td>
    <td>Iva Retenido:</td>
    <td><input name="txtivar2" id="txtivar2" type="text" size="42" value="<?=$ivar[$i];?>" readonly="1"/></td>
  </tr>
  <tr>
    <td> Vencimiento:</td>
    <td><input name="fecha3" type="text" id="fecha3" style="border-width:0;" value="<?=$fecha3?>" size="23" readonly="1" /></td>
    <td width="26"><a  href="javascript:show_calendar('form1.fecha3');"><img name="foto2" id="foto2" align="top" border="0" src="../Images/CALENDAR.gif" style="cursor:pointer" title="Presione aqui y seleccione la fecha" /></a></td>
    <td>Bodega</td>
    <td><input name="id_bodega" type="text" id="id_bodega" value="<?=$id_bodega?>" size="20" readonly="1" /></td>
  </tr>
  <tr>
    <td></td>
    <td></td>
    <td></td>
    <td>Comprador</td>
     <td><input name="id_vendedor" type="text" id="id_vendedor" value="<?=$id_vendedor?>" size="20" readonly="1" /></td>
  </tr>
  <tr>
    <?
	$mercaderia=0;
	if ($mercaderia==1) 
	{ ?>
   
    <td width="10%"><div align="right">Mercaderia&nbsp;</div></td>
    <td width="5%"><input name="mercaderia" type="radio"   value="1" checked = "checked" /> </td>
     <? }
	else 
	{?>
    <td width="10"><div align="right">Gastos&nbsp;</div></td>
    <td width="138"><input name="mercaderia" type="radio"  value="0" checked = "checked" />    </td>
    </td>
   <? }?>
   <td>Correlativo:</td>
    <td><input name="txtcorrelativo" id="txtcorrelativo" type="text" size="20" value="<?=$txtcorrelativo;?>"  /></td>
  </tr>
</table>
<table width="640" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
	  <td>Observacion</td>
        <td><input name="txtobs" id="txtobs" type="text" size="20" value="<?=$observacion;?>" readonly="1"/></td>
         
    <td>Nombre XML:</td>
    <td><input name="nombre_xml" id="nombre_xml" type="text" size="60" value="<?=substr($archivo,13);?>"  /></td>
    <td>R_A:</td>
    <td><input name="recepcion_archivo" id="recepcion_archivo" type="text" size="1" value="<?=$recepcion_archivo;?>"  /></td>
    </tr>
	</tr>
</table>
<table width="890" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000">
<tr bgcolor="#000000"> 
		<td width="12%"><div align="center"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">Cant.</font></strong></div></td>
		<td width="14%"><div align="center"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">C&oacute;digo</font></strong></div></td>
		<td width="46%"><div align="center"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">Detalle</font></strong></div></td>
        <td width="14%"><div align="center"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">Precio</font></strong></div></td>
		<td width="14%"><div align="center"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">Descuento</font></strong></div></td>
		<td width="14%"><div align="center"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">Total $</font></strong></div></td>
    </tr><? 

$cnt =0;
$txtst=0;
//if ($mercaderia==0)  $txtst=$neto[$id_ent];  

	while ($cnt<$cant)
		{
		$txtst+=$sub_total[$cnt];	
		
	?>
  
	<tr> 
	<td><div align="center"><strong><font color="#333333" face="Arial, Helvetica, sans-serif">
<input name="cantidad[<?=$cnt;?>]" id="cantidad[<?=$cnt;?>]" type="text" style="width:100%" value="<?=$cantidad[$cnt];?>">
		</font></strong></div></td>
			
		<td><div align="center"><strong><font color="#333333" face="Arial, Helvetica, sans-serif">
	<input name="codigo[<?=$cnt;?>]" id="codigo[<?=$cnt;?>]" type="text" style="width:100%" value="<?=$codigo[$cnt];?>">
		</font></strong></div></td>
		
			
		<td><div align="center"><strong><font color="#333333" face="Arial, Helvetica, sans-serif">
			<input name="detalle[<?=$cnt;?>]" id="detalle[<?=$cnt;?>]" type="text" value="<?=$detalle[$cnt];?>" readonly="1" border="0" style="border-width:0;font-size:14px;width:100%">
		</font></strong></div></td>
		
		  
		
        
        <td><div align="right"><strong><font color="#333333" face="Arial, Helvetica, sans-serif">
			<input name="precio[<?=$cnt;?>]" id="precio[<?=$cnt;?>]" type="text" value="<?=$precio[$cnt];?>" style="border-width:0;text-align:right;width:100%">
		</font></strong></div></td>
		<td><div align="right"><strong><font color="#333333" face="Arial, Helvetica, sans-serif">
			<input name="descuento[<?=$cnt;?>]" id="descuento[<?=$cnt;?>]" type="text" value="<?=$descuento[$cnt];?>" style="border-width:0;text-align:right;width:100%">
		</font></strong></div></td>
		<td ><div align="right"><strong><font color="#333333" face="Arial, Helvetica, sans-serif">
			<input name="sub_total[<?=$cnt;?>]" id="sub_total[<?=$cnt;?>]" type="text" value="<?=$sub_total[$cnt];?>" style="border-width:0;text-align:right;width:100%">
			</font></strong></div></td>
    </tr>
	<? 
	
	$cnt += 1;
	}
	
	?>



<? 
$sql_cargos = "SELECT Id, codigo_producto, id_entrada, valor FROM cuentas_de_cargo WHERE id_entrada=$id_ent";
$res_cargos = mysql_query($sql_cargos,$enlace);	
	
$lstcargo0=0;
$lstcargo1=0;
$lstcargo2=0;
$lstcargo3=0;

$cant=0;
$row=0;
	while (mysql_fetch_object($res_cargos))
		{
	
	if ($cant==0) {
		$lstcargo0=mysql_result($res_cargos, $row, "codigo_producto");
		$txtcargo0=mysql_result($res_cargos, $row, "valor");
		}
	
	if ($cant==1) {
		$lstcargo1=mysql_result($res_cargos, $row, "codigo_producto");
		$txtcargo1=mysql_result($res_cargos, $row, "valor");
		}
	if ($cant==2) {
		$lstcargo2=mysql_result($res_cargos, $row, "codigo_producto");
		$txtcargo2=mysql_result($res_cargos, $row, "valor");
		}
	if ($cant==3) {
		$lstcargo3=mysql_result($res_cargos, $row, "codigo_producto");
		$txtcargo3=mysql_result($res_cargos, $row, "valor");
		}
	$cant=$cant+1;
	$row += 1;
	}

	?>




	
</table>


<table width="785" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>		
	  <td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td><div align="right">Sub Total</div></td>
		<td align="right"><strong><font color="#333333" face="Arial, Helvetica, sans-serif">
		  <input name="txtst" id="txtst" type="text" value="<?=$txtst;?>" style="text-align:right;width:100%" readonly="1">
		</font></strong></td>
	</tr>
	<tr bordercolor="#000000"> 
    <td><div align="center"><strong>Cuenta de Cargo</strong></div></td>
		<td><div align="center"><strong>Valor</strong></div></td>
		<td>&nbsp;</td>
		<td><div align="right">Descuento</div></td>
		<td align="right"><strong><font color="#333333" face="Arial, Helvetica, sans-serif">
		  <input name="txtdes" id="txtdes" type="text" value="<?=$txtdes;?>" style="text-align:right;width:100%" readonly="1">
		</font></strong></td>
    </tr>
    
		<tr bordercolor="#000000"> 

       
		     
       	<td><select name="lstcargo0" id="lstcargo0" style="width:240px">

          <?
			$cons_pago = mysql_query("SELECT * FROM plan_cuenta where cuenta_contable>99999 ORDER BY descripcion;" , $enlace);
 			$cont=0;
			while ( mysql_fetch_object ($cons_pago) ) 
 			{
 				$ides=mysql_result($cons_pago, $cont, "id");
  				$nombres=mysql_result($cons_pago, $cont, "descripcion");
  				if($lstcargo0==$ides){$sel="selected";}
				else {$sel="";}
				echo "              <option value=\"".$ides."\"$sel>".$nombres."\n";
				
  				$cont = $cont + 1;
 			}
			?>

          </option>
                </select></td>

      <td><input name="txtcargo0" id="txtcargo0" type="text" value="<?=$txtcargo0;?>" style="text-align:right;width:92%" ></td>

		
       
		<td>&nbsp;</td>
		<td><div align="right">Exento</div></td>
		<td align="right"><strong><font color="#333333" face="Arial, Helvetica, sans-serif">
	    <input name="txtexento" id="txtexento" type="text" value="<?=$exento[$id_ent];?>" style="text-align:right;width:100%" readonly="1" />
		</font></strong></td>
    </tr>

 <tr bordercolor="#000000"> 
       
<td>&nbsp;</td>
<td>&nbsp;</td>
    
        
            <? 
			$txtcomision=0;
			?>    
            
		<td>&nbsp;</td>
		<td><div align="right">Comision y Otros</div></td>
		<td align="right"><strong><font color="#333333" face="Arial, Helvetica, sans-serif">
		  <input name="txtcomision" id="txtcomision" type="text" value="<?=$txtcomision;?>" style="text-align:right;width:100%" readonly="1">
		</font></strong></td>
    </tr>
       
    <tr bordercolor="#000000"> 
 <td>&nbsp;</td>
      
 <td>&nbsp;</td>
		 <td>&nbsp;</td>
		
		<td><div align="right">Neto</div></td>
		<td align="right"><strong><font color="#333333" face="Arial, Helvetica, sans-serif">
	    <input name="txtneto" id="txtneto" type="text" value="<?=$neto[$id_ent];?>" style="text-align:right;width:100%" readonly="1">
		</font></strong></td>
    </tr>
    
		<tr bordercolor="#000000">
         <td>&nbsp;</td>
          <td>&nbsp;</td>
	
		 <td>FactorIvaUsoComun</td>
		<td><div align="right">IVA</div></td>
		<td align="right"><strong><font color="#333333" face="Arial, Helvetica, sans-serif">
	    <input name="txtiva" id="txtiva" type="text" value="<?=$iva[$id_ent];?>" style="text-align:right;width:100%" readonly="1">
		</font></strong></td>
    </tr>
    <tr bordercolor="#000000">
    
   <td>&nbsp;</td>
    <td>&nbsp;</td><td align="right"><strong><font color="#333333" face="Arial, Helvetica, sans-serif">
		  <input name="factorivausocomun" id="factorivausocomun" type="text" value="<?=$factorivausocomun;?>" style="text-align:right;width:92%" >
		</font></strong></td>
    	
		<td><div align="right">IvaUsoComun</div></td>
		<td align="right"><strong><font color="#333333" face="Arial, Helvetica, sans-serif">
		  <input name="ivausocomun" id="ivausocomun" type="text" value="<?=$ivausocomun;?>" style="text-align:right;width:100%" readonly="1" />
		</font></strong></td>
    </tr>
     
     <tr bordercolor="#000000">
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
	<td><div align="right">ILA</div></td>
	<td align="right"><strong><font color="#333333" face="Arial, Helvetica, sans-serif">
<input name="txtila" id="txtila" type="text" value="<?=$ila[$id_ent];?>" style="text-align:right;width:100%" readonly="1">
	</font></strong></td>
    </tr>
         <tr bordercolor="#000000">
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
	<td><div align="right">IABA</div></td>
	<td align="right"><strong><font color="#333333" face="Arial, Helvetica, sans-serif">
<input name="txtiaba" id="txtiaba" type="text" value="<?=$iaba[$id_ent];?>" style="text-align:right;width:100%" readonly="1">
	</font></strong></td>
    </tr>
     <tr bordercolor="#000000">
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
	<td><div align="right">IABA18</div></td>
	<td align="right"><strong><font color="#333333" face="Arial, Helvetica, sans-serif">
<input name="txtiaba18" id="txtiaba18" type="text" value="<?=$iaba18[$id_ent];?>" style="text-align:right;width:100%" readonly="1">
	</font></strong></td>
    </tr>
     <tr bordercolor="#000000">
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
	<td><div align="right">HARINA</div></td>
	<td align="right"><strong><font color="#333333" face="Arial, Helvetica, sans-serif">
<input name="txtharina" id="txtharina" type="text" value="<?=$harina[$id_ent];?>" style="text-align:right;width:100%" readonly="1">
	</font></strong></td>
    </tr>

    <tr bordercolor="#000000">
    <td>&nbsp;</td>
    <td>&nbsp;</td>
   
    	<td>&nbsp;</td>
		
		<td><div align="right">Total</div></td>
		<td align="right"><strong><font color="#333333" face="Arial, Helvetica, sans-serif">
	    <input name="txttotal" id="txttotal" type="text" value="<?=$total[$id_ent];?>" style="text-align:right;width:100%" readonly="1">
		</font></strong></td>
    </tr>

</table>
<table width="640" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
		<td width="35%">&nbsp;</td>
		<td width="30%" align="center"><input type="button" name="Submit" value="Agregar Nuevo Producto"  style="visibility:hidden"></td>
		<td width="35%">&nbsp;</td>
    </tr>
</table>
<table width="640" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
		<td width="35%">&nbsp;</td>
		<td width="10%" align="center">	<input type="button" name="Submit1" value="Imprimir" onClick="fun_imprimir();" style="visibility:hidden"></td>
		<td width="10%" align="center">	<input type="button" name="Submit3" value="Salir" onClick="fun_salir();"></td>
		<td width="10%" align="center">	<input type="button" name="Submit2" value="Guardar" onClick="fun_guardar();" ></td>
   
        
		<td width="35%">&nbsp;</td>
    </tr>
</table>
<input name="txtcom" type="text" id="txtcom" style="visibility:hidden" size="1" />
<input name="txtcnd" type="text" id="txtcnd" style="visibility:hidden" size="1" />
<input name="txtcs" type="text" id="txtcs" style="visibility:hidden" size="1" />
<input name="txtcs2" type="text" id="txtcs2" style="visibility:hidden" size="1" />
<input name="cnt" type="text" id="cnt" value="<?=$cnt?>" style="visibility:hidden" size="1" />

</form>
</body>
</html>
<script language="Javascript">

function fun_imprimir()
	{
	var answer = confirm ("¿Seguro que desea imprimir?");
	
	}
function fun_salir()
	{
	var answer = confirm ("¿Desea Salir?");
	if (answer)
		{
		window.top.open('','_parent','');window.top.close();
		}
	}
function fun_guardar()
	{
	var answer = confirm ("¿Desea Guardar?");
	if (answer)
		{
		document.form1.action="guarda_dte.php";
		document.form1.target = "_self";
	document.form1.submit();

		}
	}

</script>