<?
include("../../conexion/class-sb-conexion.php");
		$db = new sb_mysql();
		
		$sql="select * from sb_conta_eit where numero='".$numero_comp."' 
		AND year(fecha) = '".$ano."' AND cod_empresa='".$Codigo_Empresa."' ";
		//echo $sql;   
		$consulta = $db->consulta_free($sql);
		$comp = $db->sb_array($consulta);	        
		


?>

<!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=utf-8" />
<title>Documento sin t&iacute;tulo</title>
</head>

<body>
<form  name="form2" action="graba_comprobante.php"  method="post" target="_blank" >
<table  border="0" align="center" cellspacing="0" id="table3" 
style="border-collapse: collapse">
    	<tr class="Estilo1">
        	<td align="left">
           	  <font color="#000080" class="Estilo1 Estilo2 Estilo3">COMPROBANTE DE CONTABILIDAD</font>
             </td>
      </tr>
  </table>
<table border="0" align="center">
<tr>
<td >
<strong>
        <font color="#000080" size="-2" face="Verdana,Arial, Helvetica, sans-serif">
        EMPRESA        </font></strong></td>
<td width="700px" >&nbsp;&nbsp;
        <?
		//$db = new sb_mysql();
		//$db->proceso($empresa_global);
		$sql="select 
		  		id, nombre
			FROM empresa
		  	where id='".$comp['cod_empresa']."'";   
		//echo $sql;	
		$consulta = $db->consulta_free($sql);
		$resultados = $db->sb_array($consulta);	        
		 echo $resultados['nombre'];
		?>
		
</td><td>N&deg;&nbsp;<?=$numero_comp?></td>
</tr>
<tr>
<td>
<strong>
        <font color="#000080" size="-2" face="Verdana,Arial, Helvetica, sans-serif">
        TIPO
        </font>
</strong> 
</td>
<td>&nbsp;&nbsp;
<?=$comp['cod_tipo']?>
</td>
</tr>
<tr>
<td>
<strong>
<font color="#000080" size="-2" face="Verdana,Arial, Helvetica, sans-serif">
Fecha Emisi&oacute;n
</font>
</strong>
</td>
<td>&nbsp;&nbsp;
<?=$comp['fecha']?>
</td>
</tr>
<tr><td colspan="2" height="50px">
<div align="center"><strong><font color="#000080" size="-2" face="Verdana,Arial, Helvetica, sans-serif">GLOSA</font></strong><br>
<?=$comp['glosa']?>
              
    </div>
</td></tr>
</table>
<table  width="100%" height="0%" border="0" align="center" cellspacing="1" id="table2" style="border:0px Double #000080;   " >
  <tr>
    <td colspan="2" class="Estilo1" align="center"></td>
	</tr>
  <tr>

    <td valign="top" align="center">
      <table width="80%"  border="1" cellpadding="0" cellspacing="1" id="mi_tabla" 
      name="mi_tabla" style="border:0px Double #000080;">
     
        <tr class="titulo_tablas" bgcolor="#358391" >
          <th height="32" colspan="4" scope="col" style="color:#FFFFFF" >Ingreso de Detalle </th>
          </tr>
        <tr class="titulo_tablas" bgcolor="#358391" style="color:#FFFFFF">
          <th width="151" height="24" scope="col">C&oacute;digo</th>
          <th width="584" scope="col">Cuenta</th>
          <th width="95" scope="col">Cargo</th>
          <th width="95" scope="col">Abono</th>
		 
  
        </tr>
        <?
        $sql="select * from sb_conta_cta where numero_eit='".$numero_comp."'
			AND year(fecha) = '".$ano."' AND cod_empresa='".$Codigo_Empresa."'	";   
		//echo $sql;	
		$consulta = $db->consulta_free($sql);
		while($comp_detalle = $db->sb_array($consulta)){	        
		?>
        <tr class='detalle_tablas_II'>
          <td><div align="center">
          <?=$comp_detalle['codigo_contable']?>
          </div></td>
          <td align="left">
		  <?=$comp_detalle['glosa']?>	         
          </td>
          <td><div align="right">
          <?=number_format($comp_detalle['cargo'],0,"",".")?> 
          </div></td>
          <td><div align="right">
          <?=number_format($comp_detalle['abono'],0,"",".")?> 
          </div></td>
          
        </tr>
        <?
		}
        ?>
        <tr class='detalle_tablas_II'>
          <td colspan="2">
          <div align="center">
          TOTAL
          </div>
          </td>
          <td><div align="right">
          <?=number_format($comp['valor'],0,"",".")?> 
          </div></td>
          <td><div align="right">
          <?=number_format($comp['valor'],0,"",".")?> 
          </div></td>
          
        </tr>
</table>
</td>
</tr>
</table>
<table width="80%"  border="1" align="center" cellpadding="6" cellspacing="0">
  <tr class="impresion">
    
    <td width="25%" valign="bottom"><div align="center" class="Estilo113"><br><br><br><br><hr width="100%" size="2">Firma, nombre y Rut Receptor</div></td>
  </tr>
</table>


</div>
<div id="botones" style="display:block" align="center" >

<input name="Imprimir" type="button"  value="Imprimir" onClick="imprimir_formulario();">
<input name="S A L I R" type="button" onClick="top.window.close();" value="S A L I R">
<br /><br />
<?
if($flag=="anular"){
?>
<input name="Imprimir" type="button"  value="Anular" 
onClick="javascript:if(confirm('¿Desea anular este comprobante?')) { formulario2() }"

>

<?
}
?>
</div>
</form>
<script>




function imprimir_formulario(){
document.getElementById('botones').style.display = "none";
window.print();
document.getElementById('botones').style.display = "block";
};

function formulario2(){

//alert("prueba");
document.anular.submit();
};

</script>
<form name="anular" action="anular.php" target="carga">
<input name="Codigo_Empresa"  type="hidden" value="<?=$Codigo_Empresa?>" />
<input name="numero_comp"  type="hidden" value="<?=$numero_comp?>" />
<input name="ano"  type="hidden" value="<?=$ano?>" />
</form>
<iframe name="carga" width="0" height="0"></iframe>
</body>
</html>
