<?php
session_start();
require_once("clases/covensol_snoh_c_historico.php");
$objsnoh = new covensol_snoh;
//$objsnoh->io_conexiones->codificacion_navegador();
$objsnoh->io_conexiones->decodificar_post();
$datos = $objsnoh->io_conexiones->asignar_post();
$objsnoh->conecajax=1;
function css_estilo(){
	?>					
	<link href="../shared/css/catalogos.css" rel="stylesheet" type="text/css">
	<?php 

}
			
$ancho[1] = 50;
$ancho[2] = 50;
$ancho[3] = 50;
$ancho[4] = 250;
$ancho[5] = 100;
$ancho[6] = 100;
$ancho[7] = 100;
$ancho[8] = 50;
$ancho[9] = 70;
$ancho_total = array_sum($ancho);
$total_neto = 0;
$total_asi = 0;
$total_ded = 0;

$resp = $objsnoh->consulta_resumen_neto($datos);
if($resp===false){exit();}
if(!$resp->RecordCount()){
		$objsnoh->io_mensajes->message('No se encontraron netos para esta persona!');
		exit();
}
			
						
?>
			
<table width="<?php echo $ancho_total; ?>" border="0" cellpadding="0" cellspacing="0"  class='fondo-tabla' align="center">
  <tr class="titulo-celda">
    <td width="<?php echo $ancho[1]; ?>">Nómina</td>
    <td width="<?php echo $ancho[2]; ?>">Año</td>
    <td width="<?php echo $ancho[3]; ?>">Período.</td>
    <td width="<?php echo $ancho[9]; ?>">Fecha</td>
    <td width="<?php echo $ancho[4]; ?>">Denom.</td>
    <td width="<?php echo $ancho[5]; ?>" align="center">Asig.</td>
    <td width="<?php echo $ancho[6]; ?>" align="center">Deduc.</td>
    <td width="<?php echo $ancho[7]; ?>" align="center">Neto</td>
    <td width="<?php echo $ancho[8]; ?>" align="center">Imp.</td>       
  </tr>
  <?php foreach($resp as $filas) { ?>  
  
  <?php 
		
		$divisor = 1;
		if($datos['bsf']){	
			$divisor = ($filas['anonom']<2008)?1000:1;
		}
		
		
		
		$total_neto = $total_neto + ($filas['monnetres']/$divisor);
		$total_asi = $total_asi + ($filas['asires']/$divisor);
		$total_ded = $total_ded + (($filas['dedres']/$divisor) + ($filas['apoempres']/$divisor));
		
		if($datos['bsf'] and $filas['anonom']<2008){
		
			$filas['asires'] = $filas['asires']/1000;
			$filas['dedres'] = $filas['dedres']/1000;
			$filas['apoempres'] = $filas['apoempres']/1000;
			$filas['monnetres'] = $filas['monnetres']/1000;
		
		}
		
			
  ?>
  <tr id="consulta">
            <td width="<?php echo $ancho[1]; ?>" bgcolor="#FFFFFF"><?php echo $filas['codnom'];?></td>
    <td width="<?php echo $ancho[2]; ?>" bgcolor="#FFFFFF"><?php echo $filas['anonom'];?></td>
    <td width="<?php echo $ancho[3]; ?>" bgcolor="#FFFFFF"><?php echo $filas['codperi'];?></td>
    <td width="<?php echo $ancho[9]; ?>" bgcolor="#FFFFFF"><?php echo $objsnoh->io_conexiones->formatea_fecha_normal($filas['fechasper']);?></td>
    <td width="<?php echo $ancho[4]; ?>" bgcolor="#FFFFFF"><?php echo $filas['desnom'];?></td>
    <td width="<?php echo $ancho[5]; ?>" align="right" bgcolor="#FFFFFF"><?php echo number_format($filas['asires'],2,",",".");?></td>
    <td width="<?php echo $ancho[6]; ?>" align="right" bgcolor="#FFFFFF"><?php echo number_format(($filas['dedres'] + $filas['apoempres']),2,",",".");?></td>
    <td width="<?php echo $ancho[7]; ?>" align="right" bgcolor="#FFFFFF"><?php echo number_format($filas['monnetres'],2,",",".");?></td> 
    <td width="<?php echo $ancho[8]; ?>" align="right" bgcolor="#FFFFFF">
      <a href="javascript: imprmir_neto('<?php echo $filas['codnom']; ?>','<?php echo $filas['codperi']; ?>','<?php echo $filas['codper']; ?>','<?php echo $filas['anonom']; ?>');" >
                          <img src="../shared/imagebank/tools20/imprimir.gif" width="20" height="20" border="0" />     </a>    </td>                 	
  </tr>
                  <tr>
                    <td height="1" bgcolor="#BBBBBB" colspan="9"></td>
                  </tr>
  <?php 
  
  			
  
  ?>
  <?php } ?>
      <tr class="celdas-amarillas">
        <td width="<?php echo $ancho[1]; ?>" align="right"></td>
        <td width="<?php echo $ancho[2]; ?>" align="right"></td>
        <td width="<?php echo $ancho[3]; ?>" align="right"></td>
        <td width="<?php echo $ancho[9]; ?>" align="right">&nbsp;</td>
        <td width="<?php echo $ancho[4]; ?>" align="right"><b>Totales:</b></td>
        <td width="<?php echo $ancho[5]; ?>" align="right"><?php echo number_format($total_asi,2,",",".");?></td>
        <td width="<?php echo $ancho[6]; ?>" align="right"><?php echo number_format($total_ded,2,",",".");?></td>
        <td width="<?php echo $ancho[7]; ?>" align="right"><?php echo number_format($total_neto,2,",",".");?></td>
        <td width="<?php echo $ancho[8]; ?>" align="center"></td>       
  </tr>
</table>
            