<?php
 
session_start();
if (isset($_POST['Submit22'])){
	$_SESSION['tip_nomina'] = $_REQUEST['tip_nom'];
}
include("DMMYSQLG.php");
//include("DSA1000.php");
include("DMMYSQLG.php");
?>
<html>
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>
<body>
<form name="frm1" method="post" action="">
  <table  align="center">
    <tr>
      <?php
 
	  $sql_tn = mysqli_query($con ,"select * from dntipnom where cve_nomi = $_SESSION['tip_nomina']");
	  $reg_tn = mysqli_fetch_array($sql_tn);
	  
	  $sq_pargen=mysqli_query($con ,"select * from dnpargen");
		$dt_pargen=mysqli_fetch_array($sq_pargen);

	$mesproc=$dt_pargen["mes_pro"];
	$fecproc=$dt_pargen["axo_pro"].'-'.$mesproc.'-01';

	$ssq_cageno="select * from dncageno where cve_nomi = '".$_SESSION['tip_nomina']."' and axo_mes ='$fecproc' and act_nom = 'NO' order by no_nomi";
	$sq_cageno=mysqli_query($con ,$ssq_cageno);
	$b=0;
	while($dt_cageno=mysqli_fetch_array($sq_cageno)){
		if($dt_cageno['act_nom']=="NO"){
			$b=1;
			break;
		}
	}

	  ?>
	  <th colspan="7" scope="col">CAPTURA EMPLEADOS : <?php
 echo $reg_tn['cve_nomi'].'-'.$reg_tn['des_nomi']?></th>
    </tr>
	<?php
 if($b==0){?>
				<tr>
				<td class="typeagre" colspan="7" nowrap="nowrap"><div align="center">PERIODOS ACTUALIZADOS O NO DISPONIBLES, VERIFIQUE CALENDARIO</div></td>
				</tr>
	<?php
 }?>
    <tr>
      <td colspan="7" class="inputcodigo">
	  <input type="button" name="Submit22" value="Procesar" <?php
 if($b==0) echo 'disabled="disabled"'?>onClick="openpage('DN31300_PR2.php','_self')"/>
      <input type="button" name="Submit2" value="Regresar" onClick="openpage('DN31300_PR.php','_self')"/>
      <input type="submit" name="incfij" <?php
 if($b==0) echo 'disabled="disabled"'?> value="Imp/Incide/Fijas" onClick="openpage('DN31300_PR3.php','_self')">	  </td>
    </tr>
    <tr>
	  <th><div align="center">Sel</div></th>
      <th><div align="center">Tipo Nomina</div></th>
      <th><div align="center">No. de 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>
    </tr>
   <?php
 
	$ssr=mysqli_query($con ,"select dndatnom.* from dndatnom INNER JOIN dntrab_a on dndatnom.no_nom = dntrab_a.no_trab where dndatnom.tip_nom='".$reg_tn['cve_nomi']."' and status='A' order by dntrab_a.no_nom");
	if($reg_tn['tipo_pago']=="F"){
		$ssr=mysqli_query($con ,"select dndatnom.* from dndatnom INNER JOIN dntrab_a on dndatnom.no_nom = dntrab_a.no_trab where status='I' order by dntrab_a.no_nom");
	}
	while($row = mysqli_fetch_array($ssr)){
	  $sql_tr = mysqli_query($con ,"select * from dntrab_a where no_trab = $row['no_nom']");
	  $reg_tr = mysqli_fetch_array($sql_tr);
   		echo "<tr>";
		echo '<td> <div align="center"><input name="bot" type="radio" value="'. $reg_tr['no_trab'].'"></div></td>';
		echo "<td> <div align='center'>" . $row['tip_nom'] . "&nbsp;</div></td>";
		//RFC
		echo "<td> <div align='center'>" . $reg_tr['no_nom'] . "&nbsp;</div></td>";
		echo "<td> <div align='center'>" . $reg_tr['ape_pat'] . "&nbsp;</div></td>";
		echo "<td> <div align='center'>" . $reg_tr['ape_mat'] . "&nbsp;</div></td>";
		echo "<td> <div align='center'>" . $reg_tr['nom'] . "&nbsp;</div></td>";
	echo "</tr>";
   }
   ?>
   <tr>
      <td colspan="7"><div align="center"></div></td>
    </tr>
  </table>
</form>
</body>
</html>