<?php
 
session_start();
include("DMMYSQLG.php");
include("DSA1000.php");
include("DMMYSQLG.php");
include('DF30000.inc');
?>
<?php

//busquedas
	if(isset($_POST['setipnom']) || isset($_POST['pp'])){
		$m=substr($_SESSION['m_a'],0,2);
		$a=substr($_SESSION['m_a'],2,4);
		//$busq=mysqli_query($con ,"select * from dnnomina where cve_nomi ='".$_POST['setipnom']."' and mes_pro = '$m' and axo_pro = '$a' ");
		$busq=mysqli_query($con ,"select dndatnom.* from dndatnom inner join dntrab_a on dntrab_a.no_trab = dndatnom.no_nom where dndatnom.tip_nom ='".$_POST['setipnom']."' and  dndatnom.no_nom in(select no_nomina from dnnommen where mes_pro = '$m' and axo_pro = '$a' GROUP BY no_nomina order by no_nomina) order by dntrab_a.ape_pat");
	}
	else{
		$busq=" ";
	}
?>
<html>
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>

<body>
<?php
 
$ayuda = 'DN5100A_AG.php';
include("DYAYUDA.php");
?>
<div align="center">
<form name="form1" id="form1" method="post" action="">
  <table  align="center">
    <tr>
      <th>CONSULTA NOMINAS ACUMULADAS </th>
    </tr>
    <tr>
      <th>        Tipo de Nomina</th>
      </tr>
	<tr>
	  <td class="inputcodigo"><div align="center">
	    <select name="setipnom" id="setipnom" onChange="javascript: document.getElementById('form1').submit()">
	      <option value="-1">--Seleccione Nomina--</option>
	      <?php
  
		  $stipnom="select * from dntipnom";
		  $sqtipnom=mysqli_query($con ,$stipnom);
		  while($artipnom=mysqli_fetch_array($sqtipnom)){
		  	if("$_POST['setipnom']"=="$artipnom['cve_nomi']") echo '<option value="'.$artipnom['cve_nomi'].'" selected>'.$artipnom['des_nomi'].'</option>';
		  	else echo '<option value="'.$artipnom['cve_nomi'].'">'.$artipnom['des_nomi'].'</option>';
		  }
		  ?>
		  </select>
	    </div>	    <div align="center"></div></td>
	  </tr>
	  <?php

	  if(isset($_POST['setipnom'])){
	  ?>		
	  <tr>
	      <th><div align="center">Periodo de  Nomina</div></th>
      </tr>
	  <tr>
	      <td class="typeagre"><div align="center">
		  <?php
 
		  	echo 'MES - A&Ntilde;O ('.$_SESSION['m_a'].')';
		  ?>
		  </div></td>
      </tr>
	  <?php

	  }
	  ?>
      <tr>
        <td class="inputcodigo">
		    <div align="center">
		      <p>
			  <input name="tenonom" type="hidden" id="tenonom"  readonly value="<?php
 echo $arbusqw['no_nomi'];?>">
			  <input name="tefecini" type="hidden" class="thcons" id="tefecini" size="30"  readonly
			  <?php
 
			  if(isset($_POST['tefecini']) || isset($_POST['pp'])) echo 'value="'.$fecha_inicial.'"'; 
			 ?>
			  >
			  <input name="tefecfin" type="hidden" class="thcons" id="tefecfin" size="30" readonly
				<?php
 
			  if(isset($_POST['tefecfin']) || isset($_POST['pp'])) echo 'value="'.$fecha_final.'"'; 
			  ?>
				>
		      </p>
      </div></td></tr>
      </table>
</form>
</div>
<div align="center">
  <form name="frm1" id="frm1" method="post" action="" >
   <input type="hidden" name="setipnom" id="setipnom" value="<?php
 echo $_POST['setipnom'];?>">
   <input name="tenonom2" type="hidden" id="tenonom2"   value="<?php
 echo $arbusqw['no_nomi'];?>">
    <input name="tefecfin" type="hidden" class="thcons" id="tefecfin" size="30"
	<?php
 
			  if(isset($_POST['tefecfin']) || isset($_POST['pp'])) echo 'value="'.$fecha_final.'"'; 
	 ?>	>
	 <input name="tefecini" type="hidden" class="thcons" id="tefecini" size="30"
	<?php
 
			  if(isset($_POST['tefecini']) || isset($_POST['pp'])) echo 'value="'.$fecha_inicial.'"'; 
	 ?>>
   <table border='1'>
      <tr>
        <th colspan="7">
		  <div align="left">
            <input name="procesar" type="button" id="procesar" onClick="openpage('DN51000_AG.php','_self')" value="Procesar"/>
			</div>		</th>
      </tr>
      <tr>
        <th colspan="7">Concepto - Consulta Nominas Acumuladas </th>
      </tr>
      <tr>
	  	<th><div align="center">Sel</div></th>
	    <th><div align="center">No. Nomina</div></th>
      	<th><div align="center">Apellido Paterno</div></th>
      	<th><div align="center">Apellido Materno</div></th>
	  	<th><div align="center">Nombre</div></th>
      	<th><div align="center">R.F.C.</div></th>
		<th><div align="center">No. IMSS</div></th>
      </tr>
	  
<?php

//if($arbusqw){
	while(@$abusqcal=mysqli_fetch_array($busq)){
		$sqbusqx=mysqli_query($con ,"select * from dntrab_a where no_trab = $abusqcal['no_nom']");
		$arbusq=mysqli_fetch_array($sqbusqx);
		$sqbusqx=mysqli_query($con ,"select * from dntrab_b where no_nom = $abusqcal['no_nom']");
		$arbusqx=mysqli_fetch_array($sqbusqx);
		echo '<tr>';
		echo '<td><div align="center"><input name="bot" type="radio" value="'.$abusqcal["no_nom"].'">&nbsp</div></td>';
		echo '<td><div align="center">'.$arbusq["no_nom"].'&nbsp</div></td>';
		echo '<td><div align="center">'.$arbusq["ape_pat"].'&nbsp</div></td>';
		echo '<td><div align="center">'.$arbusq["ape_mat"].'&nbsp</div></td>';
		echo '<td><div align="center">'.$arbusq["nom"].'&nbsp</div></td>';
		echo '<td><div align="center">'.$arbusqx["rfc"].'&nbsp</div></td>';
		echo '<td><div align="center">'.$arbusqx["seg_soc"].'&nbsp</div></td>';
		echo '</tr>';
	}
//}
mysqli_close($con);
?>
    </table>
  </form>
</div>
</body>
</html>
