<?php
 
session_start();
include("DMMYSQLG.php");
include("DSA1000.php");
include("DMMYSQLG.php");
include('DF30000.inc');
?>
<?php
 
//busquedas
	if(isset($_POST['setipnom'])){
		$busproc=mysqli_query($con ,"select * from dnpargen");
		$arbusproc=mysqli_fetch_array($busproc);
		//$mesproc=$arbusproc["mes_pro"];
		$fecproc=$arbusproc["axo_pro"].'-'.$arbusproc["mes_pro"].'-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";
		//echo $busq;
	}
	else{
		$busq=" ";
	}
	$sqbusq=mysqli_query($con ,$busq);
	$sqbusqcal=mysqli_query($con ,$busqcal);
	while(@$arbusqw=mysqli_fetch_array($sqbusqcal)){
		if($arbusqw['act_nom']=="NO"){
			$b=1;
			break;
		}
	}
	
	$fec1 = $arbusqw['fec_ini'];
	include('DF20000.php');
	$fecha_inicial = $f_f;
	$fec1 = $arbusqw['fec_fin'];
	include('DF20000.php');
	$fecha_final = $f_f;
?>
<html>
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>

<body>
<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>
	      <td class="typeagre"><div align="center">
		  <?php
 
		  	if($b==0 && isset($_POST['setipnom']) && $_POST['setipnom']!=-1)
				echo 'PERIODOS ACTUALIZADOS O  NO DISPONIBLES, VERIFIQUE CALENDARIO';
			elseif($_POST['setipnom']!=-1)
				echo 'No. '.$arbusqw['no_nomi'].' Del '.$fecha_inicial.' Al '.$fecha_final;
		  ?>
		  </div></td>
      </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 || $b==0) echo 'disabled="disabled"';
			?>onClick="openpage('DN34300_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){
	include("DN34300_CL.php");
	$arbusproc=mysqli_fetch_array(mysqli_query($con ,"select * from dnpargen"));
	$nomusu = new clase('dnnomina',$arbusproc["axo_pro"],$arbusproc["mes_pro"],$_POST['setipnom'],$arbusqw['no_nomi'],-1,$_SESSION['num_usu']);
	$norec=0; 
	$sqbusq=$nomusu->listaElemEmp();
	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="'.$abusqcal["no_trab"].'">&nbsp</div></td>';
		echo '<td><div align="center">'.$abusqcal["noNom"].'&nbsp</div></td>';
		echo '<td><div align="center">'.$abusqcal["ape_pat"].'&nbsp</div></td>';
		echo '<td><div align="center">'.$abusqcal["ape_mat"].'&nbsp</div></td>';
		echo '<td><div align="center">'.$abusqcal["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>
