<?php
function lblenti1($ci,$ruta)
{
require($ruta);
// 	$enti_sql='select * from enti00 where enti_codigo like "'.trim($ci).'"';
$enti_sql='select * from enti00 where enti_codigo like "'.trim($ci).'"';
$enti_res=mysql_query($enti_sql,$link_vcrx);

$adrs_sql='select * from adrs00 where adrs_enti like "'.trim($ci).'%" order by adrs_defa desc, adrs_sucu, adrs_codigo';
$adrs_sql='select * from adrs00 where adrs_enti like "'.trim($ci).'%" order by adrs_defa desc, adrs_codigo';
$adrs_res=mysql_query($adrs_sql,$link_vcrx);
	
?>
<!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>Ficha de Entidad</title>
<style type="text/css">
body{margin:0px; padding:0px; font:"Courier New", Courier, monospace; text-transform:uppercase; }

@page {
/*    size: 7in 9.25in; */
/* 	 top left bott right */
    size: 215mm 292mm; 
}
	

	</style>

</head>

<body>
<div align="center" valign="top">
<div id="contenedor">

<table border="2" align ="center" width="100%" cellpadding="2" cellspacing="0" style="border-collapse:collapse;font-size:20px">
<tr align="center" style="background: #F7F7F7; border-top:solid 1px#000;border-bottom:solid 1px#000">
	
	
	
	<td valign="top">
		<b><?php echo mysql_result($enti_res,0,'enti_codigo').' - '.mysql_result($enti_res,0,'enti_descri');?>
	</td>	
</tr>
</table>
	<br>
	
<table border="0" align ="center" width="100%" cellpadding="2" cellspacing="0" style="border-collapse:collapse;font-size:12px">
<tr>
	<td valign="top" width="50%">
	<table border="1" align ="center" width="100%" cellpadding="4" cellspacing="0" style="border-collapse:collapse;font-size:12px">

	<?php if (mysql_result($enti_res,0,'enti_struc')=="A" || mysql_result($enti_res,0,'enti_tiporuc')!="N"):?>
  <tr>
		<td >RUC :</td>
    <td><?php echo substr(mysql_result($enti_res,0,'enti_codigo'),0,10).'001';?></td>
	</tr>
	<?php endif;?>
		
  <tr>
		<td >RAZON SOCIAL</td>
    <td><b><?php echo mysql_result($enti_res,0,'enti_razsoc');?></td>
	</tr>
  <tr>
		<td >NOMBRE COMERCIAL</td>
    <td><?php echo mysql_result($enti_res,0,'enti_nomcom');?></td>
	</tr>
  <tr>
		<td >OBLIG.CONTABILIDAD</td>
    <td><?php echo substr(mysql_result($enti_res,0,'enti_obcon').'N',0,1);?></td>
	</tr>
	<?php if (mysql_result($enti_res,0,'enti_zsub')>""):?>
   <tr>
		<td >ZONA</td>
    <td><?php echo mysql_result($enti_res,0,'zsub_descri');?></td>
	</tr>
	<?php endif; ?>

	<?php if (mysql_result($enti_res,0,'enti_rcdd')>""):?>
<!--    <tr>
		<td >RECAUDADOR</td>
    <td><?php echo mysql_result($enti_res,0,'rcdd_descri');?></td>
	</tr> -->
	<?php endif; ?>
		
	<?php if (mysql_result($enti_res,0,'enti_tpro')>""):?>
  <tr>
		<td >TIPO PROV.</td>
    <td><?php echo mysql_result($enti_res,0,'tpro_descri');?></td>
	</tr>
	<?php endif; ?>
		
		</table>
	</td>

	<td valign="top">
<table border="1" align ="center" width="100%" cellpadding="4" cellspacing="0" style="border-collapse:collapse;font-size:12px">
	<?php if (mysql_result($enti_res,0,'enti_tiporuc')=="N"):?>
  <tr>
		<td align="right" >CEDULA :</td>
    <td><?php echo substr(mysql_result($enti_res,0,'enti_codigo'),0,10);?></td>
	</tr>

	<?php if (mysql_result($enti_res,0,'enti_pasaporte')>""):?>
  <tr>
		<td align="right" >PASAPORTE :</td>
    <td><?php echo mysql_result($enti_res,0,'enti_pasaporte');?></td>
	</tr>
	<?php endif;?>
	<?php if (mysql_result($enti_res,0,'enti_conadis')>""):?>
  <tr>
		<td align="right" >CONADIS :</td>
    <td><?php echo mysql_result($enti_res,0,'enti_conadis');?></td>
	</tr>
	<?php endif;?>
		
		
	<tr>
		<td align="right" >APE.PATERNO :</td>
    <td><?php echo mysql_result($enti_res,0,'enti_ape1');?></td>
	</tr>
  <tr>
		<td align="right" >APE.MATERNO :</td>
    <td><?php echo mysql_result($enti_res,0,'enti_ape2');?></td>
	</tr>
  <tr>
		<td align="right" >NOMBRE 1 :</td>
    <td><?php echo mysql_result($enti_res,0,'enti_nom1');?></td>
	</tr>
  <tr>
		<td align="right" >NOMBRE 2 :</td>
    <td><?php echo mysql_result($enti_res,0,'enti_nom2');?></td>
	</tr>
	<?php endif;?>

	</table>
	</td>
	
</tr>
	
<!-- <tr style="height:80px;">
	<td></td>
    <td></td>
</tr>
 -->
</table>
<br>

<!-- <table border = 0 align="center" width="100%" cellspacing="0" cellpadding="2" style="font-size:12px"> -->

<table border="0" align ="center" width="100%" cellpadding="2" cellspacing="0" style="border-collapse:collapse;font-size:12px">
	
<tr align="center" style="background: #F7F7F7; border-top:solid 1px#000;border-bottom:solid 1px#000">
<th>E-MAIL</th>
<th>CALLE1</th>
<th>NUM</th>
<th>CALLE2</th>
<th>REFER</th>
<th>TELEFONO</th>
<th>PROV/CIUDAD</th>
<th>CONTACTO</th>
</tr>

	<?php 	
$filax=1;
$adrs_res=mysql_query($adrs_sql,$link_vcrx);
while($r_adrs=mysql_fetch_assoc($adrs_res))
{
?>
<tr style=" <?php if($filax==1){echo 'border-bottom:dotted 1px #000;';$filax=1;}else{$filax++;} ?>" >
	<td align="left"><?php echo $r_adrs['adrs_email'];?></td>
	<td align="left"><?php echo $r_adrs['adrs_calle1'];?></td>
	<td align="left"><?php echo $r_adrs['adrs_callen'];?></td>
	<td align="left"><?php echo $r_adrs['adrs_calle2'];?></td>
	<td align="left"><?php echo $r_adrs['adrs_calle3'];?></td>
	<td align="left"><?php echo $r_adrs['adrs_tlfn'];?></td>
	<td align="center"><?php echo $r_adrs['prvc_descri'].'/'.$r_adrs['cdad_descri'];?></td>
	<td align="left"><?php echo $r_adrs['adrs_contacto'];?></td>
</tr>

<?php	
}
?>
</table>
			 
	
	
</div>
</div>

</body>
</html>
<?php	
}
?>