<?php session_start();?>
<?php include('php_gene1.php'); ?>
<?php include('../cfg/config.php');?>
<?php include('php_session.php');?>

<?php $anio=$_POST['anio']; ?>
<?php $mes=$_POST['mes']; ?>
<?php $docu=$_POST['docu']; ?>

<?php
$semaa=date('W',strtotime('now'));
$fecha1=strtotime ('last Monday');
$fecha1=date('Y-m-d',$fecha1);

$fecha2=strtotime ('last Monday -14 days');
$fecha2=date('Y-m-d',$fecha2);

$fecha=date('Y-m-01');
$printer=false;

//  echo $fecha;
//  echo $fecha1;
//  echo $fecha2;

$jwib_sql='update jwib1, cong0 set fechar=adddate(fecha,cong_reu1-1) where cong=cong_codigo and docu in("ELIB","") and fecha>="'.$fecha.'"';
$jwib_res=msql_query($jwib_sql,$link_vcrx);

$jwib_sql='update jwib1, cong0 set fechar=adddate(fecha,cong_reu2-1) where cong=cong_codigo and docu in("EATA","DPU1") and fecha>="'.$fecha.'"';
$jwib_res=msql_query($jwib_sql,$link_vcrx);

if($docu=='DPU2')
{
	$jwib_sql='update jwib1, cong0 set fechar=adddate(fecha,5) where cong=cong_codigo and docu="DPU2" and fecha>="'.$fecha.'"';
	$jwib_res=msql_query($jwib_sql,$link_vcrx);

	$jwib_sql='update jwib1, cong0 set fechar=adddate(fecha,6) where cong=cong_codigo and docu="DPU2" and fecha>="'.$fecha.'" and (left(cong2_dpud,1)="7" or left(cong2_dpud,1)="D")';
	$jwib_res=msql_query($jwib_sql,$link_vcrx);
}


$ipip=$_SERVER['REMOTE_ADDR'];
$ipip_sql='insert into ipip0(ipip_codigo)value("'.$ipip.'")';
$ipip_res=msql_query($ipip_sql,$link_vcrx);
$ipip_sql='update ipip0 set ';
$ipip_sql.='ipip_descri="'.$_SERVER['REMOTE_PORT'].'",';
$ipip_sql.='ipip_idate=now(),';
$ipip_sql.='ipip_status=ipip_status ';
$ipip_sql.='where ipip_codigo="'.$ipip.'"';
$ipip_res=msql_query($ipip_sql,$link_vcrx);

if(mb_stristr('DPU1.DPU2',$docu))
{
	$jwib_sql='select * from jwib11 where docu="'.$docu.'" and cong="'.$cong_codigo.'" ';
	if(!mb_stristr('sist.admi',$_SESSION['user_tipo'])){$jwib_sql.=' and bsqj!="" ';}	
	if($anio!='')
	{	
	$jwib_sql.=' and fanior="'.$anio.'"';
	$jwib_sql.=' and fmesr="'.$mes.'"';
	$printer=true;
	}
	else
	{$jwib_sql.=' and fecha>="'.$fecha2.'" ';}
	
	if($docu=='DPU1')
	{$jwib_sql.=' order by fecha ';}

	if($docu=='DPU2')
	{$jwib_sql.=' order by fanior,fmesr,cong2_descri,fecha ';}
}


if($docu=='LECT')
{
	$jwib_sql='select *, ';
	$jwib_sql.='max(case when docu="ELIB" then idnum1 end) as idn_lib,';
	$jwib_sql.='max(case when docu="ELIB" then nombre1 end) as nom1lib,';
	$jwib_sql.='max(case when docu="ELIB" then nombre2 end) as nom2lib,';
	$jwib_sql.='max(case when docu="ELIB" then concat(fdianr," /",fdiar) end) as fec_lib,';
	$jwib_sql.='max(case when docu="EATA" then idnum1 end) as idn_ata,';
	$jwib_sql.='max(case when docu="EATA" then nombre1 end) as nom1ata,';
	$jwib_sql.='max(case when docu="EATA" then nombre2 end) as nom2ata,';
	$jwib_sql.='max(case when docu="EATA" then concat(fdianr," /",fdiar) end) as fec_ata,';
	$jwib_sql.='status as st1 ';
	$jwib_sql.=' from jwib11 where docu in ("ELIB","EATA") and cong="'.$cong_codigo.'" ';
	if($anio!='')
	{	
	$jwib_sql.=' and fanior="'.$anio.'"';
	$jwib_sql.=' and fmesr="'.$mes.'"';
	$printer=true;
	}
	else
	{$jwib_sql.=' and fecha>="'.$fecha2.'" ';}
	
	if(!mb_stristr('sist.admi',$_SESSION['user_tipo'])){$jwib_sql.=' and nombre1>"" ';}	
	$jwib_sql.=' group by fanio,fsema ';
	$jwib_sql.=' order by fecha,fechar ';
// 	echo $jwib_sql;
}


if(mb_stristr('VARI',$docu))
{
	$jwib_sql='select * from jwiv11 where docu="'.$docu.'" and cong="'.$cong_codigo.'" ';
// 	$jwib_sql='select * from jwib11 where docu="DPU1" and cong="'.$cong_codigo.'" ';
// 	if(!mb_stristr('sist.admi',$_SESSION['user_tipo'])){$jwib_sql.=' and bsqj!="" ';}	
	if($anio!='')
	{	
// 	$jwib_sql.=' and fanior="'.$anio.'"';
// 	$jwib_sql.=' and fmesr="'.$mes.'"';
	$printer=true;
	}
	$jwib_sql.=' order by fanio desc,fmes desc, fecha ';
}





// echo $jwib_sql;
// echo "\n";

?>

<?php if(mb_stristr('DPU1.DPU2',$docu)) { ?>

		<?php if($mobile=='false' and !$printer) {?>
		<?php //if(!$mobile and !$printer) {?>
		<?php $jwib_res=msql_query($jwib_sql,$link_vcrx); ?>
		<table cellspacing="0" cellpadding="2" width="100%" style="border-collapse:collapse;border:#000000 solid 2px; ">
			<?php $lmes=''; ?>
			<?php  while($jwib_aso=msql_fetch_assoc($jwib_res)) { ?>  
					<?php if($jwib_aso['fmesr']!=$lmes){ ?>
								<tr style="height:30px;border-top:solid 2px;border-bottom:solid 1px;background: #A9F5F2;">
									<th align="center" style="">
										<?php echo $jwib_aso['fmesnr'].' /'.$jwib_aso['fanior']; ?>
										<?php $lmes= $jwib_aso['fmesr']; ?>
									</th>
									<th>No.</th>
									<th>BOSQUEJO</th>
									<th>TEMA</th>
									<th>
										DISCURSANTES
										<br>
										<?php echo ' CONG: '.$jwib_aso['cong2_descri']; ?>								
									</th>

									<?php if(mb_stristr('sist.admi',$_SESSION['user_tipo']) and $jwib_aso['fecha']>=date('Y-m-d')) {?>
											<?php $pcaption='Congregacion'; $pidtxt='cong2'.$jwib_aso['idnum1']; $pobj=2; $pdefa=$jwib_aso['cong2_descri']; $plong=20; $pdocu=$docu; $pcolu='cong2_descri'; include('vrgettxt.php'); ?>
											<?php if($docu=='DPU2'){?>
											<?php $pcaption='Dia'; $pidtxt='dpud'.$jwib_aso['idnum1']; $pobj=2; $pdefa=$jwib_aso['cong2_dpud']; $plong=3;  $pdocu=$docu; $pcolu='cong2_dpud'; include('vrgettxt.php'); ?>
											<?php $pcaption='Hora'; $pidtxt='dpuh'.$jwib_aso['idnum1']; $pobj=2; $pdefa=$jwib_aso['cong2_dpuh']; $plong=5; $pdocu=$docu; $pcolu='cong2_dpuh'; include('vrgettxt.php'); ?>
											<?php } ?>
											<th>
											<?php 
													$pcaption="Imprimir"; $pidtxt='imprimir'.$jwib_aso['idnum1']; 
													$ponclick="jwib_rpu1('".$docu."','".$jwib_aso['fanior']."','".''.$jwib_aso['fmesr']."')";
													include('vrbutton.php');
											?>
											<?php 
													$pcaption="Grabar"; $pidtxt='graba'.$jwib_aso['idnum1']; 
													$ponclick="jwib_graba1('".$pidtxt."','".$jwib_aso['idnum1']."','".$docu."','nom1".$jwib_aso['idnum1']."','','".'bsqj'.$jwib_aso['idnum1']."','cong2".$jwib_aso['idnum1']."','dpud".$jwib_aso['idnum1']."','dpuh".$jwib_aso['idnum1']."')";
													include('vrbutton.php');
											?>
											</th>
									<?php }else{ ?>
											<th>
											<?php 
													$pcaption="Imprimir"; $pidtxt='imprimir'.$jwib_aso['idnum1']; 
													$ponclick="jwib_rpu1('".$docu."','".$jwib_aso['fanior']."','".''.$jwib_aso['fmesr']."')";
													include('vrbutton.php');
											?>
											</th>
									<th></th>
									<?php } ?>
								</tr>
							<?php if($docu=='DPU2'){ ?>
									<tr>
										<td>
										<?php //echo $jwib_aso['cong2_descri']; ?>
										</td>
									</tr>
							<?php } ?>
					<?php } ?>
		<!--   <tr> -->
			<tr style="<?php if($jwib_aso['fsema']==$semaa){echo 'font-weight:bold;';}?>">

				<td align="center">
					<?php echo $jwib_aso['fdianr'].' /'.$jwib_aso['fdiar']; ?>
				</td>
				<td align="center">
					<?php echo ($jwib_aso['bsqj']); ?>
				</td>
				<td>
					<?php echo ($jwib_aso['bsqj_descri']); ?>
				</td>
				<td>
					<?php echo $jwib_aso['bsqj_tema']; ?>
				</td>
				<td>
					<?php if(mb_stristr('sist.admi',$_SESSION['user_tipo']) and $jwib_aso['fechar']>=date('Y-m-d')) {?>
					<?php $pcaption='Nombre'; $pidtxt='nom1'.$jwib_aso['idnum1']; $pobj=1; $pdefa=$jwib_aso['nombre1']; $plong=20; $pdocu=$docu; $pcolu='nombre1'; include('vrgettxt.php'); ?>
					<?php $ptabla='bsqj'; $pidtxt='bsqj'.$jwib_aso['idnum1']; $pobj=5; $pdefa=$jwib_aso['bsqj']; $pdisab='0'; include('vrgetcod.php'); ?>
					<?php }else{ ?>
					<?php echo ($jwib_aso['nombre1']); ?>
					<?php } ?>
				</td>
				<td>
					<?php if(mb_stristr('sist.admi',$_SESSION['user_tipo']) and $jwib_aso['fecha']>=date('Y-m-d')) {?>
					<?php $pcaption="Grabar"; $pidtxt='graba'.$jwib_aso['idnum1']; 
							$ponclick="jwib_graba1('".$pidtxt."','".$jwib_aso['idnum1']."','".$docu."','nom1".$jwib_aso['idnum1']."','','".'bsqj'.$jwib_aso['idnum1']."')";
						 include('vrbutton.php'); ?>
					<?php } ?>
				</td>
			</tr>

			<?php }  ?>
		</table>  
		<?php } ?>

		<?php if($mobile=='true' and !$printer) {?>
		<?php //if($mobile and !$printer) {?>
		<?php $jwib_res=msql_query($jwib_sql,$link_vcrx); ?>
		<table cellspacing="0" cellpadding="2" width="100%" style="border-collapse:collapse;border:#000000 solid 2px;  ">
			<?php $lmes=''; ?>
			<?php  while($jwib_aso=msql_fetch_assoc($jwib_res)) { ?>  
					<?php if($jwib_aso['fmesr']!=$lmes){ ?>
								<tr style="height:30px;border-top:solid 2px;border-bottom:solid 1px;background: #A9F5F2;font-size:30px;">
									<th align="center" style="">
										<?php echo $jwib_aso['fmesnr'].' /'.$jwib_aso['fanior']; ?>
										<?php $lmes= $jwib_aso['fmesr']; ?>
										<br>

									<?php if(mb_stristr('sist.admi',$_SESSION['user_tipo']) and $jwib_aso['fecha']>=date('Y-m-d')) {?>
									<?php $pcaption='Cong:'; $pidtxt='cong2'.$jwib_aso['idnum1']; $pobj=1; $pdefa=$jwib_aso['cong2_descri']; $plong=20; $psize=30; $pdocu=$docu; $pcolu='cong2_descri'; include('vrgettxt.php'); ?>
									<?php  $pcaption="Grabar"; $pidtxt='graba'.$jwib_aso['idnum1']; $psize=30;
											$ponclick="jwib_graba1('".$pidtxt."','".$jwib_aso['idnum1']."','".$docu."','nom1".$jwib_aso['idnum1']."','','".'bsqj'.$jwib_aso['idnum1']."','cong2".$jwib_aso['idnum1']."')";
											 include('vrbutton.php'); ?>
									<?php }else{?>
										<?php echo ' CONG: '.$jwib_aso['cong2_descri']; ?>								
									<?php }?>
									</th>
								</tr>
					<?php } ?>
			<tr>
				<td align="center" style="border-top:solid 1px;<?php if($jwib_aso['fsema']==$semaa){echo 'background-color: #E5E5E5;';}?>">
					<div style="font-size:30px;<?php if($jwib_aso['fsema']==$semaa){echo 'font-weight:bold;';}?>">
					<?php echo $jwib_aso['fdianr'].' /'.$jwib_aso['fdiar']; ?>
					</div>
					<div style=" font-size:30px;font-weight:bold;">
					<?php echo ($jwib_aso['bsqj']).' - '.($jwib_aso['bsqj_descri']); ?>
					</div>
					<div style="font-size:25px;">
					<?php echo $jwib_aso['bsqj_tema']; ?>
					</div>
				</td>
			</tr>

			<?php if(mb_stristr('sist.admi',$_SESSION['user_tipo']) and $jwib_aso['fecha']>=date('Y-m-d')) {?>
			<tr>
				<td align="center" >
					<?php $pidtxt='nom1'.$jwib_aso['idnum1']; $pobj=1; $pdefa=$jwib_aso['nombre1']; $plong=20; $psize=30; $pdocu=$docu; $pcolu='nombre1'; include('vrgettxt.php'); ?>
				</td>
			</tr>
			<tr align="center">
					<?php $ptabla='bsqj'; $pidtxt='bsqj'.$jwib_aso['idnum1']; $pobj=5; $pdefa=$jwib_aso['bsqj']; $pdisab='0'; $psize=30; include('vrgetcod.php'); ?>
			</tr>
					<?php }else{ ?>
			<tr align="center" style="font-size:30px; font-style:italic;<?php if($jwib_aso['fsema']==$semaa){echo 'background-color: #E5E5E5;';}?>">
				<td>
					<?php echo ($jwib_aso['nombre1']); ?>
				</td>
			</tr>
			<?php } ?>

			<tr>
				<td>
					<?php if(mb_stristr('sist.admi',$_SESSION['user_tipo']) and $jwib_aso['fecha']>=date('Y-m-d')) {?>
					<?php  $pcaption="Grabar"; $pidtxt='graba'.$jwib_aso['idnum1']; $psize=30;
							$ponclick="jwib_graba1('".$pidtxt."','".$jwib_aso['idnum1']."','".$docu."','nom1".$jwib_aso['idnum1']."','',".'bsqj'.$jwib_aso['idnum1']."','cong2".$jwib_aso['idnum1']."')";
							 include('vrbutton.php'); ?>
					<?php } ?>
					<br>
				</td>
			</tr>

			<?php }  ?>
		</table>  
		<?php } ?>

		<?php if ($printer) { ?>
		<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
		<html xmlns="http://www.w3.org/1999/xhtml">
		<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>
		<?php if($docu=='DPU1'){echo 'Conferencias';} ?>	
		<?php if($docu=='DPU2'){echo 'Discursantes';} ?>	
		</title>
		<style type="text/css">
		/* body{ font-family:"Courier New", Courier, monospace;} */
		@page {
		/*    size: 7in 9.25in; */
		/* 	 top left bott right */
		/*     size: 210mm 297mm;  */
		/*     margin: 0mm 10mm 10mm 0mm; /* 	top right bottom left */ */
				size: 105mm 148mm; 
				margin: 20mm 5mm 0mm 5mm; /* 	top right bottom left */
		}

		</style>

		</head>
		<body>


		<?php $jwib_res=msql_query($jwib_sql,$link_vcrx); ?>
		<table cellspacing="0" cellpadding="2" width="40%" style="border-collapse:collapse;border:#000000 solid 2px;" align="left">
			<?php $lmes=''; ?>
			<?php  while($jwib_aso=msql_fetch_assoc($jwib_res)) { ?>  
					<?php if($jwib_aso['fmesr']!=$lmes){ ?>
								<tr style="height:30px;border-top:solid 2px;border-bottom:solid 1px;background: #A9F5F2;font-size:12px;">
									<th align="center" style="">

										<?php if($docu=='DPU1'){ ?>
											<?php echo 'PROGRAMA DE CONFERENCIAS'; ?>
											<br>
											<?php echo $cong_descri; ?>
											<br>
										<?php } ?>	
										<?php if($docu=='DPU2'){ ?>
											<?php echo 'DISCURSANTES SALIENTES'; ?>
											<br>
										<?php } ?>	

										<?php echo $jwib_aso['fmesnr'].' /'.$jwib_aso['fanior']; ?>
										<?php $lmes= $jwib_aso['fmesr']; ?>
										<br>
										<?php echo ' CONG: '.$jwib_aso['cong2_descri']; ?>								
									</th>
								</tr>
					<?php } ?>
			<tr>
				<td align="center" style="border-top:solid 1px;">
					<div style="font-size:12px;">
					<?php echo $jwib_aso['fdianr'].' /'.$jwib_aso['fdiar']; ?>
					</div>
					<div style=" font-size:12px;font-weight:bold;">
					<?php echo ($jwib_aso['bsqj']).' - '.($jwib_aso['bsqj_descri']); ?>
					</div>
					<div style="font-size:10px;">
					<?php echo $jwib_aso['bsqj_tema']; ?>
					</div>
				</td>
			</tr>

			<tr align="center" style="font-size:12px; font-style:italic;<?php if($jwib_aso['fsema']==$semaa){echo 'background-color: #E5E5E5;';}?>">
				<td>
					<?php echo ($jwib_aso['nombre1']); ?>
				</td>
			</tr>

			<tr>
				<td>
				</td>
			</tr>

			<?php }  ?>
		</table>  

		</body>
		</html>

		<?php } ?>

<?php } ?>


<?php if(mb_stristr('LECT',$docu)) { ?>

		<?php if($mobile=='false' and !$printer){ ?>
		<?php $jwib_res=msql_query($jwib_sql,$link_vcrx); ?>
		<table cellspacing="0" cellpadding="2" width="100%" style="border-collapse:collapse;border:#000000 solid 2px;" border=0>
			<?php $lmes=''; ?>
			<?php  while($jwib_aso=msql_fetch_assoc($jwib_res)) { ?>  
					<?php if($jwib_aso['fmesr']!=$lmes){ ?>
								<tr style="border-top:solid 2px;background: #A9F5F2;">
									<th align="center" style="" width="10%">
										<?php echo $jwib_aso['fmesnr'].' /'.$jwib_aso['fanior']; ?>
										<?php $lmes= $jwib_aso['fmesr']; ?>
									</th>
									<th colspan=3 width="45%">EST. L I B R O</th>
									<th></th>
									<th colspan=3 width="45%">EST. A T A L A Y A</th>
									<th>
									<?php 
											$pcaption="Imprimir"; $pidtxt='imprimir'.$jwib_aso['idnum1']; 
											$ponclick="jwib_rpu1('".$docu."','".$jwib_aso['fanior']."','".''.$jwib_aso['fmesr']."')";
											include('vrbutton.php');
									?>
									</th>
									<th></th>
									
								</tr>
								<tr style="border-bottom:solid 1px;background: #A9F5F2;font-size:12px;">
									<th>SEMANA</th>
									<th width="10%">FECHA</th>
									<th>CONDUCTOR</th>
									<th>LECTOR</th>
									<th></th>
									<th width="10%">FECHA</th>
									<th>CONDUCTOR</th>
									<th>LECTOR</th>
									<th></th>
									<th></th>
								</tr>
					<?php } ?>
			
				<tr style="<?php if($jwib_aso['fsema']==$semaa){echo 'font-weight:bold;';}?>" align="center">
					<td>
						<?php //echo $jwib_aso['fechadmy'] ?>
						<?php echo $jwib_aso['fsemar'] ?>
					</td>
					<td style="border-left:solid 1px;">
						<?php echo $jwib_aso['fec_lib']; ?>
					</td>
					
					<?php if(mb_stristr('sist.admi',$_SESSION['user_tipo']) and $jwib_aso['fechar']>=date('Y-m-d')) {?>
						<td>
								<?php $pcaption='Nombre'; $pidtxt='nom1'.$jwib_aso['idn_lib']; $pobj=1; $pdefa=$jwib_aso['nom1lib']; $plong=20; $pdocu='ELIB'; $pcolu='nombre1'; 
									$ponclick="{document.getElementById('graba".$jwib_aso['idn_lib']."').click()}";
									include('vrgettxt.php'); ?>
						</td>
						<td>
								<?php $pcaption='Nombre'; $pidtxt='nom2'.$jwib_aso['idn_lib']; $pobj=1; $pdefa=$jwib_aso['nom2lib']; $plong=20; $pdocu='ELIB'; $pcolu='nombre2';
									$ponclick="{document.getElementById('graba".$jwib_aso['idn_lib']."').click()}";
									include('vrgettxt.php'); ?>
						</td>
						<td>
							<?php $pcaption="Grabar"; $pidtxt='graba'.$jwib_aso['idn_lib']; 
									$ponclick="jwib_graba1('".$pidtxt."','".$jwib_aso['idn_lib']."','".$docu."','nom1".$jwib_aso['idn_lib']."','nom2".$jwib_aso['idn_lib']."')";
								 include('vrbutton.php'); ?>
						</td>
					<?php }else{ ?>
						<td><?php echo $jwib_aso['nom1lib']; ?></td>
						<td><?php echo $jwib_aso['nom2lib']; ?></td>
						<td></td>
					<?php } ?>
					
					<td style="border-left:solid 1px;">
						<?php echo $jwib_aso['fec_ata']; ?>
					</td>

					<?php if(mb_stristr('sist.admi',$_SESSION['user_tipo']) and $jwib_aso['fechar']>=date('Y-m-d')) {?>
						<td>
								<?php $pcaption='Nombre'; $pidtxt='nom1'.$jwib_aso['idn_ata']; $pobj=1; $pdefa=$jwib_aso['nom1ata']; $plong=20; $pdocu='EATA'; $pcolu='nombre1'; include('vrgettxt.php'); ?>
						</td>
						<td>
								<?php $pcaption='Nombre'; $pidtxt='nom2'.$jwib_aso['idn_ata']; $pobj=1; $pdefa=$jwib_aso['nom2ata']; $plong=20; $pdocu='EATA'; $pcolu='nombre1'; include('vrgettxt.php'); ?>
						</td>
						<td>
							<?php $pcaption="Grabar"; $pidtxt='graba'.$jwib_aso['idn_ata']; 
									$ponclick="jwib_graba1('".$pidtxt."','".$jwib_aso['idn_ata']."','".$docu."','nom1".$jwib_aso['idn_ata']."','nom2".$jwib_aso['idn_ata']."')";
								 include('vrbutton.php'); ?>
						</td>
					<td></td>
					<?php }else{ ?>
					<td><?php echo $jwib_aso['nom1ata']; ?></td>
					<td><?php echo $jwib_aso['nom2ata']; ?></td>
					<td></td>
					<td></td>
					<?php } ?>
				</tr>
				<?php } ?>
		</table>
		<?php } ?>

		<?php if($mobile=='true' and !$printer){ ?>
		<?php $jwib_res=msql_query($jwib_sql,$link_vcrx); ?>
		<table cellspacing="0" cellpadding="2" width="100%" style="border-collapse:collapse;border:#000000 solid 2px;"  border=0>
			<?php $lmes=''; ?>
			<?php  while($jwib_aso=msql_fetch_assoc($jwib_res)) { ?>  
					<?php if($jwib_aso['fmesr']!=$lmes){ ?>
								<tr style="border-top:solid 2px;background: #A9F5F2;font-size:30px;">
									<th align="center" style="" colspan=2>
										<?php echo $jwib_aso['fmesnr'].' /'.$jwib_aso['fanior']; ?>
										<?php $lmes= $jwib_aso['fmesr']; ?>
									</th>
								</tr>
								<tr style="border-bottom:solid 2px;background: #A9F5F2;font-size:30px;">
									<th colspan=1 width="45%">EST. LIBRO</th>
									<th colspan=1 width="45%">EST. ATALAYA</th>
								</tr>
					<?php } ?>
			
				<tr style="<?php if($jwib_aso['fsema']==$semaa){echo 'font-weight:bold;';}?>font-size:30px;border-top:solid 1px;" align="center">
					
					<?php if(mb_stristr('sist.admi',$_SESSION['user_tipo']) and $jwib_aso['fechar']>=date('Y-m-d')) {?>
						<td>
								<?php echo $jwib_aso['fec_lib']; ?>
								<br>
								<?php $pcaption='Nombre'; $pidtxt='nom1'.$jwib_aso['idn_lib']; $pobj=1; $pdefa=$jwib_aso['nom1lib']; $plong=20; $psize=25; $pdocu='ELIB'; $pcolu='nombre1'; include('vrgettxt.php'); ?>
								<?php $pcaption='Nombre'; $pidtxt='nom2'.$jwib_aso['idn_lib']; $pobj=1; $pdefa=$jwib_aso['nom2lib']; $plong=20; $psize=25; $pdocu='ELIB'; $pcolu='nombre2'; include('vrgettxt.php'); ?>
								<br>
							<?php $pcaption="Grabar"; $pidtxt='graba'.$jwib_aso['idn_lib']; $psize=25;
									$ponclick="jwib_graba1('".$pidtxt."','".$jwib_aso['idn_lib']."','".$docu."','nom1".$jwib_aso['idn_lib']."','nom2".$jwib_aso['idn_lib']."')";
								 include('vrbutton.php'); ?>
								<br>
						</td>
						<td>
								<?php echo $jwib_aso['fec_ata']; ?>
								<br>
								<?php $pcaption='Nombre'; $pidtxt='nom1'.$jwib_aso['idn_ata']; $pobj=1; $pdefa=$jwib_aso['nom1ata']; $plong=20; $psize=25; $pdocu='EATA'; $pcolu='nombre1'; include('vrgettxt.php'); ?>
								<?php $pcaption='Nombre'; $pidtxt='nom2'.$jwib_aso['idn_ata']; $pobj=1; $pdefa=$jwib_aso['nom2ata']; $plong=20; $psize=25; $pdocu='EATA'; $pcolu='nombre2'; include('vrgettxt.php'); ?>
								<br>
							<?php $pcaption="Grabar"; $pidtxt='graba'.$jwib_aso['idn_ata']; $psize=25;
									$ponclick="jwib_graba1('".$pidtxt."','".$jwib_aso['idn_ata']."','".$docu."','nom1".$jwib_aso['idn_ata']."','nom2".$jwib_aso['idn_ata']."')";
								 include('vrbutton.php'); ?>
								<br>
						</td>
					<?php }else{ ?>
						<td style="border-right:solid 1px;">
							<?php echo $jwib_aso['fec_lib']; ?>
							<br>
							<?php echo ''.$jwib_aso['nom1lib']; ?>
							<br>
							<?php echo ''.$jwib_aso['nom2lib']; ?>
							<br>
							<br>
						</td>
						<td>
							<?php echo $jwib_aso['fec_ata']; ?>
							<br>
							<?php echo ''.$jwib_aso['nom1ata']; ?>
							<br>
							<?php echo ''.$jwib_aso['nom2ata']; ?>
							<br>
							<br>
						</td>
					<?php } ?>
					

				</tr>
				<?php } ?>
		</table>

		<?php } ?>

		<?php if($printer){ ?>
		<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
		<html xmlns="http://www.w3.org/1999/xhtml">
		<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>
		<?php echo 'LECTORES'; ?>
		</title>
		<style type="text/css">
		/* body{ font-family:"Courier New", Courier, monospace;} */
		@page {
		/*    size: 7in 9.25in; */
		/* 	 top left bott right */
		/*     size: 210mm 297mm;  */
		/*     margin: 0mm 10mm 10mm 0mm; /* 	top right bottom left */ */
				size: 105mm 148mm; 
				margin: 20mm 5mm 0mm 5mm; /* 	top right bottom left */
		}

		</style>

		</head>
		<body>

	
		<?php $jwib_res=msql_query($jwib_sql,$link_vcrx); ?>
		<table cellspacing="0" cellpadding="2" width="40%" style="border-collapse:collapse;border:#000000 solid 2px;font-size:12px; " align="left" border=0>
			<?php $lmes=''; ?>
			<?php  while($jwib_aso=msql_fetch_assoc($jwib_res)) { ?>  
					<?php if($jwib_aso['fmesr']!=$lmes){ ?>
								<tr style="border-top:solid 2px;background: #A9F5F2;font-size:15px;">
									<th align="center" style="" colspan=2>
										<?php echo 'LECTORES PARA : '.$jwib_aso['fmesnr'].' /'.$jwib_aso['fanior']; ?>
										<?php $lmes= $jwib_aso['fmesr']; ?>
									</th>
								</tr>
								<tr style="border-bottom:solid 2px;background: #A9F5F2;font-size:15px;">
									<th colspan=1 width="45%">EST. LIBRO</th>
									<th colspan=1 width="45%">EST. ATALAYA</th>
								</tr>
					<?php } ?>
			
				<tr style="border-top:solid 1px;" align="center">
					
						<td style="border-right:solid 1px;">
							<?php echo $jwib_aso['fec_lib']; ?>
							<br>
							<?php echo ''.$jwib_aso['nom1lib']; ?>
							<br>
							<?php echo ''.$jwib_aso['nom2lib']; ?>
							<br>
							<br>
						</td>
						<td>
							<?php echo $jwib_aso['fec_ata']; ?>
							<br>
							<?php echo ''.$jwib_aso['nom1ata']; ?>
							<br>
							<?php echo ''.$jwib_aso['nom2ata']; ?>
							<br>
							<br>
						</td>
					

				</tr>
				<?php } ?>
		</table>


		<?php } ?>

<?php } ?>


<?php if(mb_stristr('VARI',$docu)) { ?>
		<?php if($mobile=='false'){ ?>
		<?php if(mb_stristr('sist.admi',$_SESSION['user_tipo']) ) {?>
			<?php// echo $jwib_sql; ?>
		<table cellspacing="0" cellpadding="2" width="100%" style="border-collapse:collapse;border:#000000 solid 2px; " border=0>
			<tr>
			<?php $pcaption='FECHA'; $pidtxt='fecha'; $pobj=2;   include('vrgetfec.php'); ?>
			<?php $pcaption='ASUNTO'; $pidtxt='asunto'; $pobj=2;  $plong=120;  $pdocu='VARI'; $pcolu='concepto'; include('vrgettxt.php'); ?>
<!-- 			<td align="center"> -->
			<?php //$pcaption='CARTA'; $pidtxt='carta'; $pobj=2; $pmulti=1; $psize=12; $paccept='.pdf'; include('vrgetfil.php'); ?>
<!-- 			</td>	 -->
			<td width = "1%">
			<?php $pcaption='GRABAR'; $pidtxt='grabar';  $ponclick=''; $ponclick="jwib_graba1('".$pidtxt."','','".$docu."','fecha','asunto')";	include('vrbutton.php'); ?>
			</td>
			<td></td>	
			</tr>
		</table>			
		<br>
		<?php } ?>
			
		<?php $jwib_res=msql_query($jwib_sql,$link_vcrx); ?>

		<table cellspacing="0" cellpadding="2" width="100%" style="border-collapse:collapse;border:#000000 solid 2px; "  border=0>
			<?php $lmes=''; ?>
			<?php $linea=1; ?>
			<?php  while($jwib_aso=msql_fetch_assoc($jwib_res)) { ?>  
					<?php if($jwib_aso['fmes']!=$lmes){ ?>
								<tr style="border-top:solid 2px;background: #A9F5F2;font-size:15px;">
									<th align="center" style="" colspan=1>
										<?php //echo ''.$jwib_aso['fmesn'].' /'.$jwib_aso['fanio']; ?>
										<?php //$lmes= $jwib_aso['fmes']; ?>
									</th>
									<th></th>
									<th></th>
									<th></th>
								</tr>
								<tr style="border-bottom:solid 2px;background: #A9F5F2;font-size:15px;">
									<th width="10%">
										<?php echo ''.$jwib_aso['fmesn'].' /'.$jwib_aso['fanio']; ?>
										<?php $lmes= $jwib_aso['fmes']; ?>
										<?php $linea= 1; ?>
									</th>
									<th width="50%">ASUNTO</th>
									<th width="40%"></th>
									<th></th>
								</tr>
					<?php } ?>
			
				<tr style="<?php if($linea==4){echo 'border-bottom:dotted 1px;';$linea=1;}else{$linea++;} ?>" align="center">
						<td style="">
							<?php echo $jwib_aso['fdian'].' /'.$jwib_aso['fdia']; ?>
						</td>
						<td style="" align="left">
							<?php echo $jwib_aso['concepto']; ?>
						</td>
						<td align="center">
						<?php if(mb_stristr('sist.admi',$_SESSION['user_tipo']) ) {?>
						<?php $pcaption='ADJUNTO'; $pidtxt='adjt'; $pobj=3; $pmulti=1; $psize=12; $paccept='.pdf'; $ponclick="_upladjt('".$pidtxt."','VARI')" ; include('vrgetfil.php'); ?>
						<?php } ?>	
						</td>	

						<td>
						</td>
					

				</tr>
			<?php } ?>

		</table>			
		<?php } ?>
			
<?php } ?>
			
		