<?php
session_start();
require_once("clases/covensol_fop_c_formulacion.php");
$objfop=new covensol_fop_c_formulacion('');
$objfop->io_conexiones->decodificar_post();
$datos = $objfop->io_conexiones->asignar_post();

$resultado = $objfop->ConsultaEp2($datos);
?>
<link href="../shared/css/catalogos.css" rel="stylesheet" type="text/css">
<link href="../shared/css/ventanas.css" rel="stylesheet" type="text/css">
<link href="../shared/css/general.css" rel="stylesheet" type="text/css">
<link href="../shared/css/tablas.css" rel="stylesheet" type="text/css">
<?php 
$ancho[1] = 60;
$ancho[2] = 40;
$ancho[3] = 60;
$ancho[4] = 600;
$ancho[5] = 40;

$ancho_total = array_sum($ancho);
$nrofila=0;
?>

<table width="<?php echo $ancho_total; ?>" border="0" cellpadding="0" cellspacing="0"  class='fondo-tabla'>
  <tr class="titulo-celda">
     <td width="<?php echo $ancho[1]; ?>"><div align="center">COD. P/A</div></td>
     <td width="<?php echo $ancho[2]; ?>"><div align="center">TIPO</div></td>
    <td width="<?php echo $ancho[3]; ?>"><div align="center">COD. AE</div></td>
     <td width="<?php echo $ancho[4]; ?>"><div align="center">DENOMINACIÓN</div></td>
	 <td width="<?php echo $ancho[5]; ?>"><div align="center">FICHA</div></td> 
    
  </tr>
  <?php foreach($resultado['rs'] as $fila) { ?>
          <?php
				$objfop->codintper = $fila['anopresup'].' - '.$fila['estcla'].' - '.$fila['codestpro1'].' - '.$fila['codestpro2'];		
				if(!$objfop->obtSegEstructuras()){continue;}
			
				$dato = $objfop->FormatLonCodEstPro($fila);
				$aceptar="aceptar('".$fila['codestpro1']."','".$fila['estcla']."','".$fila['anopresup']."','".$fila['codplangob']."','".$nrofila."','".$fila['codestpro2']."','".$dato['codestpro1']."','".$dato['codestpro2']."')";			
				$imprimir="uf_mostrar_reporte('".$fila['codestpro1']."','".$fila['estcla']."','".$fila['anopresup']."','".$fila['codplangob']."','".$nrofila."','".$fila['codestpro2']."','".$dato['codestpro1']."','".$dato['codestpro2']."')";			

				//$montotpry = number_format($dato['montotpry'],2,',','.');
		   ?>    
                  <tr id="consulta">
                    <td width="<?php echo $ancho[1]; ?>"><div align="center"><a href="#" onClick="<?php echo $aceptar; ?>"><?php echo $dato['codestpro1'];?></a></div></td>
                    <td width="<?php echo $ancho[2]; ?>"><div align="center"><a href="#" onClick="<?php echo $aceptar; ?>"><?php echo $dato['estcla'];?></a></div></td>
                    <td width="<?php echo $ancho[3]; ?>"><div align="left"><a href="#" onClick="<?php echo $aceptar; ?>"><?php echo $dato['codestpro2'];?></a></div></td>
                    <td width="<?php echo $ancho[4]; ?>"><div align="left"><a href="#" onClick="<?php echo $aceptar; ?>"><?php echo $dato['denestpro2'];?></a></div></td>
                    <td width="<?php echo $ancho[5]; ?>"><div align="right"><a href="#" onClick="<?php echo $imprimir; ?>"><img src="../shared/imagebank/tools20/imprimir.gif" alt="Imprimir" width="20" height="20" border="0" title="Imprimir"></a></div></td>

				  </tr>
                  <tr>
                    <td height="1" bgcolor="#BBBBBB" colspan="4">
					  <input name="hdenestpro1<?php echo $nrofila;?>" type="hidden" id="hdenestpro1<?php echo $nrofila;?>"  value="<?php echo $fila['denestpro1']; ?>"/>
					  <input name="hdenestpro2<?php echo $nrofila;?>" type="hidden" id="hdenestpro2<?php echo $nrofila;?>"  value="<?php echo $fila['denestpro2']; ?>"/>
                   	</td>
                  </tr>
          <?php 
		 		$nrofila++; 
		  ?>
  <?php }  ?>
</table>
    