<?php
 
session_start();
include("DMMYSQLG.php");
include("DSA1000.php");
include("DMMYSQLG.php");
include('DF30000.inc');
include('DN54300_CL.php');
?>
<?php
 
//busquedas
	if(isset($_POST['setipnom'])){
		$m=substr($_SESSION['m_a'],0,2);
		$a=substr($_SESSION['m_a'],2,4);
		$fecproc=$a.'-'.$m.'-01';
		$busqcal="select * from dncageno where cve_nomi = '".$_POST['setipnom']."' and axo_mes='$fecproc'  order by no_nomi";
		$stnomina=mysqli_query($con ,"select * from dntipnom where cve_nomi = '".$_POST['setipnom']."'");
		//$arrstnomina=mysqli_fetch_array($stnomina);
		//$busq="select * from dndatnom where tip_nom ='".$arrstnomina['des_nomi']."'";
		//$busq="select dndatnom.* from dndatnom inner join dntrab_a on dntrab_a.no_trab = dndatnom.no_nom where dndatnom.tip_nom ='".$_POST['setipnom']."' and dndatnom.status = 'A' order by dntrab_a.no_nom";
	}
	else{
		$busq=" ";
	}
	//$sqbusq=mysqli_query($con ,$busq);
	$sqbusqcal=mysqli_query($con ,$busqcal);
	while(@$arbusqw=mysqli_fetch_array($sqbusqcal)){
		if($arbusqw['act_nom']=="NO") break;
		$ar_per[]=array($arbusqw['no_reg'],$arbusqw['fec_ini'],$arbusqw['fec_fin'],$arbusqw['axo_mes'],$arbusqw['des_nomi']);
	}
	if(isset($_POST['seper']) && $_POST['seper']!=-1){
		$arbusqw=mysqli_fetch_array(mysqli_query($con ,"select * from dncageno where no_reg='".$_POST['seper']."'"));
		$fec1 = $arbusqw['fec_ini'];
		include('DF20000.php');
		$fecha_inicial = $f_f;
		$fec1 = $arbusqw['fec_fin'];
		include('DF20000.php');
		$fecha_final = $f_f;
		$nomusu = new clase('dnnomina',$a,$m,$_POST['setipnom'],$arbusqw["no_nomi"],-1,$_SESSION['num_usu']);
		$sqbusq=$nomusu->listaElemEmp();
	}
?>
<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 = 'DN5430A_AG.php';
include("DYAYUDA.php");
?>
<div align="center">
<form name="form1" id="form1" method="post" action="">
  <table  align="center">
    <tr>
      <th>RECIBO DE NOMINA </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>
	    
	    <tr>
	      <th><div align="center">Periodo de  Nomina</div></th>
      </tr>
	    <tr>
	      <th><select name="seper" id="seper" onChange="javascript: document.getElementById('form1').submit()">
	      <option value="-1">--Sel. No. Nomina--</option>
	      <?php
  
		  $cont=count($ar_per);
		  for($c=0;$c<$cont;$c++){
		  	if($_POST['seper']==$ar_per[$c][0]) echo '<option value="'.$ar_per[$c][0].'" selected>'.$ar_per[$c][4].'</option>';
		  	else echo '<option value="'.$ar_per[$c][0].'">'.$ar_per[$c][4].'</option>';
		  }
		  ?>
		  </select>&nbsp;</th>
      </tr>
      <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'])) echo 'value="'.$fecha_inicial.'"'; 
			 ?>
			  >
			  <input name="tefecfin" type="hidden" class="thcons" id="tefecfin" size="30" readonly
				<?php
 
			  if(isset($_POST['tefecfin'])) echo 'value="'.$fecha_final.'"'; 
			  ?>
				>
		      </p>
      </div></td></tr>
      </table>
</form>
<form name="form2" method="post" action="">
</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'])) echo 'value="'.$fecha_final.'"'; 
	 ?>	>
	 <input name="tefecini" type="hidden" class="thcons" id="tefecini" size="30"
	<?php
 
			  if(isset($_POST['tefecini'])) echo 'value="'.$fecha_inicial.'"'; 
	 ?>>
   <table width="750" border='1'>
      <tr>
        <th colspan="7">
		  <div align="left">
            <input name="boimp" type="button" id="boimp" 
			<?php
 
				if(!isset($_POST['setipnom']) || $_POST['setipnom']==-1) echo 'disabled="disabled"';
			?>onClick="openpage('DN54300_IM.php','_self')" value="Imprimir"/>
		  </div>		</th>
      </tr>
      <tr>
        <th colspan="7">Concepto - Recibo de Nomina </th>
      </tr>
      <tr>
	  	<th><div align="center">Sel<br><input name="chtodos" type="checkbox" value="ALL"  onClick="todos(this)"></div></th>
		<th><div align="center">No. Nomina</div></th>
      	<th><div align="center">Ape. Paterno</div></th>
      	<th><div align="center">Ape. 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>
	  <tr>
      </tr>
<?php

if($arbusqw){
	while($abusqcal=mysqli_fetch_array($sqbusq)){
		$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="checkbox" value="'.$arbusq["no_trab"].'">&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>
