<?php session_start();?>
<?php include('php_gene1.php'); ?>
<?php include('../_cfg/config.php');?>
<?php include('php_session.php');?>
<?php //include('excel_reader2.php');?>
<?php //include('vrreadxls.php');?>
<?php include('simplexlsx.class.php');?>
<?php $orient=$_POST['orient']; ?>
<?php $pant=$_POST['pant']; ?>
<?php $docu=$_POST['docu']; ?>
<?php $idnum=$_POST['idnum']; ?>
<?php $enti=$_POST['enti']; ?>
<?php $stat=$_POST['stat']; ?>
<?php $fecha1=$_POST['fecha1']; ?>
<?php $fecha2=$_POST['fecha2']; ?>

<?php $orient=$_POST['orient']; ?>
<?php $tabla='comp'; ?>
<?php $docu='FP'; ?>

<?php
$xfontsize=12;
if($mobile=='true' and $orient=='V'){$xfontsize=40;}
if($mobile=='true' and $orient=='H'){$xfontsize=20;}


$hpant1 =ceil($screenh*0.28);
$hpant11=ceil($screenh*0.08);
$hpant2 =ceil($screenh*0.20);

$wpant1 =$screenw-20;
	
if ($orient=='V')
{
	$hpant1 =ceil($screenh*0.70);
	$hpant11=ceil($screenh*0.40);
	$hpant2 =ceil($screenh*0.70);
}

?>

<?php
function rpc_full($grupo,$enti)
{
	include('../_cfg/config.php');
 	include('php_session.php');
	
	$papersize=$ps_a4;
	$xfontsize=16;
	
	$screensize=12;
	$printsize=32;
	
	ob_start();

// $grupo=1;
// $enti='';
	
	$pant_sql='select *  ';
	$pant_sql.='from enti00 where 1=1';
// 	$jwib_sql.='and enti_cong="'.$_SESSION['user_codigo'].'"';
	if($grupo!=''){$pant_sql.=' and enti_zsub="'.$grupo.'"';}
	if($enti!=''){$pant_sql.=' and enti_codigo="'.$enti.'"';}
	$pant_sql.=' order by enti_zsub, enti_descri ';
// 	$pant_res=mysql_query($pant_sql,$link_vcrx);
// echo $pant_sql;
?>
	
<?php //////////////////////////////////////////////////////////	?>
<!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">
<?php //////////////////////////////////////////////////////////	?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $grupo.'-'.r_fiel('enti',$enti); ?></title>
	
<style type="text/css">
/* body{ font-family:"Courier New", Courier, monospace;} */
@media print {.noprint {display:none}}
@media screen{.noscreen {display:none}}
	
@page
{
/* size:<?php echo $papersize; ?>; */
size:A5 ;
margin: 10mm 10mm 10mm 10mm; /* 	top right bottom left */
/* font-size: 24px; */
/* 	@body{font-size: 16pt;}	 */
}

p.saltodepagina
{page-break-after: always;}

</style>
	
	
</head>
<?php //////////////////////////////////////////////////////////	?>

<?php //////////////////////////////////////////////////////////	?>
<body>
		
	<?php $xfontsize=$screensize; ?>
<?php	$pant_res=mysql_query($pant_sql,$link_vcrx); ?>

<?php $lenti= '';?>		
<?php while($pant_aso=mysql_fetch_assoc($pant_res)){?>
<?php //$lenti= $pant_aso['enti_codigo'];?>		
<div id="s21s" valign="top" style="width:140mm; border:solid 0px; " >
<br>
<div align="center" style="font-weight:bolder;">REGISTRO DE PUBLICADOR DE LA CONGREGACION</div>	
<table border="0" width="100%" cellpadding="2" cellspacing="0" style="border-collapse:collapse;font-size:<?php echo $xfontsize; ?>px;">
	<tr style="font-size:<?php echo $xfontsize; ?>px; border-top:solid 1px; border-bottom:solid 1px;">
		<td style="font-weight:bolder;">Nombre:</td>
		<td colspan="1"><?php echo $pant_aso['enti_descri'] ;?></td>
		<td style="font-weight:bolder;" align="right"><?php  if($pant_aso['enti_sexo']==2){echo 'MUJER';}else{echo 'HOMBRE';};?></td>
		<td align="right"><?php echo '/'.$pant_aso['enti_cargo'];?></td>
	</tr>	
	<tr style="font-size:<?php echo $xfontsize; ?>px; border-top:solid 1px; border-bottom:solid 1px;">
		<td style="font-weight:bolder;">Dirección:</td>
		<td colspan="1"><?php echo $pant_aso['enti_calle1'].' - '.$pant_aso['enti_calle2'] ;?></td>
		<td style="font-weight:bolder;" align="right"><?php echo 'Grupo : '.$pant_aso['enti_zsub'] ;?></td>
		<td align="right"><?php echo '/'.$pant_aso['enti_csub'];?></td>
	</tr>	
	<tr style="font-size:<?php echo $xfontsize; ?>px; border-top:solid 1px; border-bottom:solid 1px;">
		<td style="font-weight:bolder;">Teléfono:</td>
		<td><?php echo $pant_aso['enti_telefono'] ;?></td>
		<td style="font-weight:bolder;" align="right">Fec.Nacimiento:</td>
		<td><?php echo $pant_aso['enti_fechanacdmy'].' ('.$pant_aso['enti_edad'].')' ;?></td>
	</tr>	
	<tr style="font-size:<?php echo $xfontsize; ?>px; border-top:solid 1px; border-bottom:solid 1px;">
		<td style="font-weight:bolder;">Móvil:</td>
		<td><?php echo $pant_aso['enti_celular'] ;?></td>
		<td style="font-weight:bolder;"align="right">Fec.Bautismo:</td>
		<td><?php echo $pant_aso['enti_fechainidmy'].' ('.$pant_aso['enti_anti'].')' ?></td>
	</tr>	
	<tr style="font-size:<?php echo $xfontsize; ?>px; border-top:solid 1px; border-bottom:solid 1px;">
		<td style="font-weight:bolder;">E-mail:</td>
		<td><?php echo $pant_aso['enti_email'];?></td>
		<td></td>
		<td align="right">O.O.</td>
	</tr>	
</table>

	<?php{
	$rpc1_sql='select jwrt11.*,';
				$rpc1_sql.=' case when fmes>=9 then fanio+1 else fanio end as faniot';
				$rpc1_sql.=' from jwrt11';
				$rpc1_sql.=' where enti="'.$pant_aso['enti_codigo'].'"';
// 				$rpc1_sql.=' order by fecha';
				$rpc1_sql.=' order by faniot desc, fecha ';
				$rpc1_sql.=' limit 36 ';
	
	$crow=0;
	$spublic=0;
	$svideos=0;
	$shoras=0;
	$srevisi=0;
	$scursos=0;
	}?>
<div style="font-size:4px;"><br></div>
<table border="0" width="100%" cellpadding="2" cellspacing="0" style="border-collapse:collapse;font-size:<?php echo $xfontsize; ?>px;">
<?php	$rpc1_res=mysql_query($rpc1_sql,$link_vcrx);?>
<?php while($rpc1_aso=mysql_fetch_assoc($rpc1_res)){?>
	<?php $crow++; ?>

	<?php if($rpc1_aso['fmes']==9 or $crow==1) {?>
		<tr style="border-top:solid 1px; border-bottom:solid 1px;">
		<th><?php echo $rpc1_aso['faniot']?> </th>
		<th>PUBLIC</th>
		<th>VIDEOS</th>
		<th>HORAS</th>
		<th>REVISITAS</th>
		<th>CURSOS</th>
		<th>NOTAS</th>
		</tr>
	<?php } ?>

	
	<tr style="font-size:<?php echo $xfontsize; ?>px; <?php if($rpc1_aso['fmes']%4==0){echo 'border-bottom:dashed 1px;';}?> ">
		<td><?php echo $rpc1_aso['fmesn'] ;?></td>
		<td align="center"><?php echo number_format($rpc1_aso['public'],0);?></td>
		<td align="center"><?php echo number_format($rpc1_aso['presen'],0);?></td>
		<td align="center"><?php echo number_format($rpc1_aso['horas'],0);?></td>
		<td align="center"><?php echo number_format($rpc1_aso['revisi'],0);?></td>
		<td align="center"><?php echo number_format($rpc1_aso['cursos'],0);?></td>
		<td><?php echo $rpc1_aso['concepto'];?></td>
	</tr>
<?php
	$spublic+=$rpc1_aso['public'];
	$svideos+=$rpc1_aso['presen'];
	$shoras+=$rpc1_aso['horas'];
	$srevisi+=$rpc1_aso['revisi'];
	$scursos+=$rpc1_aso['cursos'];
?>
	<?php if($rpc1_aso['fmes']==8 and $crow>1) {?>
		<tr style="border-top:solid 1px; border-bottom:solid 1px;">
		<th>TOTALES</th>
		<th><?php echo number_format($spublic,0);?></th>
		<th><?php echo number_format($svideos,0);?></th>
		<th><?php echo number_format($shoras,0);?></th>
		<th><?php echo number_format($srevisi,0);?></th>
		<th><?php echo number_format($scursos,0);?></th>
		<th></th>
		</tr>
		<tr><td  style="font-size:4px;"><br></td></tr>
		<?php
		$spublic=0;
		$svideos=0;
		$shoras=0;
		$srevisi=0;
		$scursos=0;
		$crow=0;
		?>
	<?php } ?>
<?php } ?>	
</table>	
</div>
<p class="saltodepagina" />	
<?php } ?>
</body>
<?php //////////////////////////////////////////////////////////	?>

</html>
	
	
<?php	
	
	
	$panthtml = ob_get_clean(); 
// 	file_put_contents($rutadoc.$pant.'_'.str_pad($idnum,9,"0",STR_PAD_LEFT).'.html',$panthtml);
// 	if(substr($xclaveacc,10,13)==$cfg_ruc)
// 	{file_put_contents($rutace.$xclaveacc.'.html',$panthtml);}
return $panthtml;	
}
// 	echo '***'.$_SESSION['osver'];
// 	echo '***'.$osver;
?>



	
<?php
// $fecha1=date('Y-m-d',strtotime ('today -12 months'));
// $fecha2=$fechaa;
$printer=false;
?>


	
<?php if(mb_stristr('XLSX',$pant)) { ?>
<?php
$origen = $_FILES['archivo']['tmp_name'];
$destino="../informes.xlsx";
echo move_uploaded_file($origen,$destino);
	
$xlsfile="../informes.xlsx";
$xlsx = new SimpleXLSX($xlsfile);
$hojas=	$xlsx->sheetNames();

for( $choja = 0; $choja <= count($hojas); $choja++)
{
// 	echo $hojas[$choja];
// 	echo "\n";
	if($hojas[$choja]=='Publicadores')
	{
			$xfila=$xlsx->rows($choja);

			$xcabe= $xfila[0];
			for( $ccolu = 0; $ccolu <= count($xcabe); $ccolu++)
			{
				if($xcabe[$ccolu]=='codigo'){$col_codigo=$ccolu;}
				if($xcabe[$ccolu]=='nombre'){$col_nombre=$ccolu;}
				if($xcabe[$ccolu]=='grupo'){$col_zsub=$ccolu;}
				if($xcabe[$ccolu]=='email'){$col_email=$ccolu;}
				if($xcabe[$ccolu]=='nacimiento'){$col_nacimiento=$ccolu;}
				if($xcabe[$ccolu]=='bautismo'){$col_bautismo=$ccolu;}
				if($xcabe[$ccolu]=='cdla'){$col_calle1=$ccolu;}
				if($xcabe[$ccolu]=='sexo'){$col_sexo=$ccolu;}
				if($xcabe[$ccolu]=='direccion'){$col_calle2=$ccolu;}
				if($xcabe[$ccolu]=='telefono'){$col_telefono=$ccolu;}
				if($xcabe[$ccolu]=='movil'){$col_movil=$ccolu;}
				if($xcabe[$ccolu]=='publicador'){$col_csub=$ccolu;}
				if($xcabe[$ccolu]=='privilegio'){$col_privilegio=$ccolu;}
			}
		
			for( $cfila = 1; $cfila <= count($xfila); $cfila++)
			{
				$xregi= $xfila[$cfila];

				$regi_sql='insert into enti0(enti_codigo)value('.$xregi[$col_codigo].')';
				$regi_res=mysql_query($regi_sql,$link_vcrx);
				
				$regi_sql='update enti0 set ';
				$regi_sql.='enti_descri="'.$xregi[$col_nombre].'", ';
				$regi_sql.='enti_zsub="'.$xregi[$col_zsub].'", ';
				$regi_sql.='enti_csub="'.$xregi[$col_csub].'", ';
				$regi_sql.='enti_cargo="'.$xregi[$col_privilegio].'", ';
				$regi_sql.='enti_calle1="'.$xregi[$col_calle1].'", ';
				$regi_sql.='enti_calle2="'.$xregi[$col_calle2].'", '; 
				$regi_sql.='enti_telefono="'.$xregi[$col_telefono].'", '; 
				$regi_sql.='enti_celular="'.$xregi[$col_movil].'", '; 
				$regi_sql.='enti_email="'.$xregi[$col_email].'", '; 
				$regi_sql.='enti_sexo="'.$xregi[$col_sexo].'", '; 
				$regi_sql.='enti_fechanac="'.$xregi[$col_nacimiento].'", '; 
				$regi_sql.='enti_fechaini="'.$xregi[$col_bautismo].'", '; 
				$regi_sql.='enti_status="-" ';
				$regi_sql.='where enti_codigo='.$xregi[$col_codigo];
				$regi_res=mysql_query($regi_sql,$link_vcrx);
// 				echo $regi_sql;

				
			}
// 			echo $xcolu[2];

	}

				$regi_sql='update enti0 set enti_sexo="1" where enti_sexo="H"';
				$regi_res=mysql_query($regi_sql,$link_vcrx);
				
				$regi_sql='update enti0 set enti_sexo="2" where enti_sexo="M"';
				$regi_res=mysql_query($regi_sql,$link_vcrx);
	
	
	if($hojas[$choja]=='Informes')
	{
			$xfila=$xlsx->rows($choja);

			$xcabe= $xfila[0];
			for( $ccolu = 0; $ccolu <= count($xcabe); $ccolu++)
			{
				if($xcabe[$ccolu]=='idPub'){$col_enti=$ccolu;}
				if($xcabe[$ccolu]=='mes'){$col_fecha=$ccolu;}
				if($xcabe[$ccolu]=='codTp'){$col_tipo=$ccolu;}
				if($xcabe[$ccolu]=='publicaciones'){$col_public=$ccolu;}
				if($xcabe[$ccolu]=='presentaciones'){$col_presen=$ccolu;}
				if($xcabe[$ccolu]=='horas'){$col_horas=$ccolu;}
				if($xcabe[$ccolu]=='revisitas'){$col_revisi=$ccolu;}
				if($xcabe[$ccolu]=='estudios'){$col_cursos=$ccolu;}
				if($xcabe[$ccolu]=='nota'){$col_concepto=$ccolu;}
			}

				$regi_sql='delete from jwrt1';
				$regi_res=mysql_query($regi_sql,$link_vcrx);
				
				$regi_sql='alter table jwrt1 AUTO_INCREMENT=1';
				$regi_res=mysql_query($regi_sql,$link_vcrx);
		
			for( $cfila = 1; $cfila <= count($xfila); $cfila++)
			{
				$xregi= $xfila[$cfila];

				$regi_sql='insert into jwrt1(docu,status,idate)value("RPC1","-",now())';
				$regi_res=mysql_query($regi_sql,$link_vcrx);
				
				$regi_sql='select max(idnum1) as idnum1 from jwrt1';
				$regi_res=mysql_query($regi_sql,$link_vcrx);
				$idnum1 = mysql_result($regi_res,0,'idnum1');
				
				$regi_sql='update jwrt1 set ';
				$regi_sql.='enti="'.$xregi[$col_enti].'", ';
				$regi_sql.='fecha="'.$xregi[$col_fecha].'01'.'", ';
				$regi_sql.='public="'.$xregi[$col_public].'", ';
				$regi_sql.='presen="'.$xregi[$col_presen].'", ';
				$regi_sql.='horas="'.$xregi[$col_horas].'", ';
				$regi_sql.='revisi="'.$xregi[$col_revisi].'", ';
				$regi_sql.='cursos="'.$xregi[$col_cursos].'", ';
				$regi_sql.='concepto="'.$xregi[$col_concepto].'", ';
				$regi_sql.='status="-" ';
				$regi_sql.='where idnum1='.$idnum1;
				$regi_res=mysql_query($regi_sql,$link_vcrx);
				
			}

	}

	
}


?> 
			
<?php } ?>
	
<resultado>
<?php if(mb_stristr('PANT0',$pant)) { ?>
<?php $fecha1=date('Y-m-d',strtotime ('today -12 months')); ?>
<?php $fecha2=$fechaa; ?>
			<div id="pant0" style="border:solid 2px; overflow:auto;">
				<?php if($mobile=='true' and $orient=="V") { ?>
			<table id="tpant0" cellpadding="2" width="100%" border="0"
						 style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:white;">
					<tr>
						<?php 	$pidtxt='fecha1'; $pcaption='Desde'; $pdefa=$fecha1; $psize=$xfontsize; include('vrgetfec.php'); ?>
					</tr>
					<tr>
						<?php 	$pidtxt='fecha2'; $pcaption='Hasta'; $psize=$xfontsize; include('vrgetfec.php'); ?>
					</tr>
					<tr>
						<?php 	$pidtxt='enti'; $pcaption='Cliente'; $ptabla='enti'; $pnotob="1"; $psize=$xfontsize; include('vrgetcod.php'); ?>
					</tr>
					<tr>
						<?php 	$pidtxt='stat'; $pcaption='Status'; $ptabla='stat'; $pnotob="1"; $psize=$xfontsize; include('vrgetcod.php'); ?>
					</tr>
					</table>	
				<br>
					<table id="tpant00" cellpadding="2" width="100%" border="0"
						 style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:white;">
					<tr>
						<td align="center" width="50%">
						<?php 	$pidtxt='consul'; $pcaption='Consultar '.$docu; $ponclick='info_cele("PANT1","'.$docu.'")'; $psize=$xfontsize; include('vrbutton.php'); ?>
						</td>
						<td align="center">
						<?php 	$pidtxt='nueva'; $pcaption='Nueva'; $ponclick='info_cele("PANT1")'; $psize=$xfontsize; include('vrbutton.php'); ?>
						</td>
					</tr>
			</table>			
				<br>
				<?php }else{ ?>
			<table id="tpant0" cellpadding="2" width="100%" border="0"
						 style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:white;">
				
				<tr>
				<td>
						<table width="100%" cellpadding="2" width="100%" border="0"
						 style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:white;">
						<tr>
							<td>
								<table width="100%" cellpadding="2" width="100%" border="0"
						 style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:white;">
									<tr>
										<td>
								<?php 	$pidtxt='fecha1'; $pcaption='Desde'; $pdefa=$fecha1; $psize=$xfontsize; include('vrgetfec.php'); ?>
										</td>
									</tr>
									<tr>
										<td>
								<?php 	$pidtxt='fecha2'; $pcaption='Hasta'; $psize=$xfontsize; include('vrgetfec.php'); ?>
										</td>
									</tr>
								</table>
							</td>
							<td>
								<table width="100%" cellpadding="2" width="100%" border="0"
						 style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:white;">
									<tr>
										<td>
										<?php 	$pidtxt='enti'; $pcaption='Cliente'; $ptabla='enti'; $pnotob="1"; $psize=$xfontsize; include('vrgetcod.php'); ?>
										</td>
									</tr>
									<tr>
										<td>
										<?php 	$pidtxt='stat'; $pcaption='Status'; $ptabla='stat'; $pnotob="1"; $psize=$xfontsize; include('vrgetcod.php'); ?>
										</td>
									</tr>
								</table>
							</td>
							<td>
								<?php 	$pidtxt='consul'; $pcaption='Consultar '.$docu; $ponclick='info_cele("PANT1","'.$docu.'")'; $psize=$xfontsize; include('vrbutton.php'); ?>
							</td>
							<td>
								<?php 	$pidtxt='nueva'; $pcaption='Nueva'; $ponclick='info_cele("PANT1")'; $psize=$xfontsize; include('vrbutton.php'); ?>
							</td>
						</tr>
						</table>
				</td>	
				</tr>	
			</table>
				<?php } ?>
			</div>	
<!-- <br> -->
					<div id="pant1" style="border:solid 1px; overflow:auto;max-height:<?php echo $hpant1; ?>px; font-family:arial;"></div>
<!-- <br> -->
					<div id="pant11" style="border:solid 1px; overflow:auto;max-height:<?php echo $hpant11; ?>px; font-family:arial;	"></div>
					<div id="pant2" style="border:solid 1px; overflow:auto;max-height:<?php echo $hpant2; ?>px; font-family:arial;"></div>
					<div id="pant9"></div>
<?php } ?>			

	
	
	
<?php
				$total_sql='select ';
				$total_sql.='sum(tsubt) as tsubt,';
				$total_sql.='sum(tsubtiva0) as tsubtiva0,';
				$total_sql.='sum(tsubtiva) as tsubtiva,';
				$total_sql.='sum(tdcto) as tdcto,';
				$total_sql.='sum(tice) as tice,';
				$total_sql.='sum(tiva) as tiva,';
				$total_sql.='sum(tirbp) as tirbp,';
				$total_sql.='sum(total) as total ';
	
				$dispcolu=1;
				if($mobile=='true'){$dispcolu=0;}
	
	
	
?>
	
	
<?php if(mb_stristr('PANT1',$pant)) { ?>
			<pant1>
	
			<?php
				$pant_sql='select * from '.$tabla.'12 ';
				$pant_sql.=' where (fecha between "'.$fecha1.'" and "'.$fecha2.'")';
				$pant_sql.=' and docu like "'.$docu.'%"';
// 				$pant_sql.=' and vndd like ""';
				if($enti!=""){$pant_sql.=' and (enti like "'.$enti.'%" or enti_descri like "%'.$enti.'%")';}
				if($stat!=""){$pant_sql.=' and (status="'.$stat.'")';}
// 				$pant_sql.=' order by numero desc';
// 				echo $pant_sql;
// 				$pant_res=mysql_query($pant_sql,$link_vcrx);
// 	 explain_sql($pant_sql);	

				$tpant_sql=str_replace('select *',$total_sql,$pant_sql);
// 				$tpant_sql=str_replace($tabla.'11',$tabla.'12',$pant_sql);

				$pant_sql.=' group by idnum2';
				$pant_sql.=' order by fecha desc,ptoe, numero desc';

				$pant_res=mysql_query($pant_sql,$link_vcrx);
				$tpant_res=mysql_query($tpant_sql,$link_vcrx);

	
	// 	 explain_sql($tpant_sql);	
	
// 				$dispcolu=1;

				$tsubt=mysql_result($tpant_res,0,'tsubt');
				$tsubtiva0=mysql_result($tpant_res,0,'tsubtiva0');
				$tsubtiva=mysql_result($tpant_res,0,'tsubtiva');
				$tdcto=mysql_result($tpant_res,0,'tdcto');
				$tice=mysql_result($tpant_res,0,'tice');
				$tiva=mysql_result($tpant_res,0,'tiva');
				$tirbp=mysql_result($tpant_res,0,'tirbp');
				$total=mysql_result($tpant_res,0,'total');
	
			

				if($dispcolu=='true')
				{
				$tsubt=0;
				$tsubtiva=0;
				$tsubtiva0=0;
				$tdcto=0;
				$tiva=0;
				$tice=0;
				$tirbp=0;
				}
	
	
			?>
	
				<?php $crow=0; ?>
				<?php $tnumero=0; ?>
			<table id="tpant1" class="pant1"
						 align="center" border="0" cellpadding="3" width="100%"
						 Xonclick="resizeTab(this.id);" 
						 Xonmouseover="this.onclick();"
						 style="font-size:<?php if($mobile=='true'){echo $xfontsize-8;}else{echo $xfontsize;} ?>px;border-collapse:collapse;background-color:white;"
						 >

				<?php if ($crow%1000==0) { ?>
				<thead style="display:block; <?php if($mobile!='true'){echo 'max-width:'.($screenw-20).'px;';} ?>">
				<tr style="border-bottom:solid 1px;">
				<th onclick="sortTable(this,0);" title="Imprimir">I</th>
				<th onclick="sortTable(this,0);" title="Detalle" style="<?php if($dispcolu==0){echo'display:none;';}?>">D</th>
				<th onclick="sortTable(this,2);"><?php if($mobile=='true'){echo 'NUM.';}else{echo 'NUMERO';} ?></th>
				<th onclick="sortTable(this,3);">FECHA</th>
				<th onclick="sortTable(this,4);" style="letter-spacing: 1px;<?php if($dispcolu==0){echo'display:none;';}?>">CED/RUC</th>
				<th onclick="sortTable(this,5);" style="letter-spacing: 10px; ">CLIENTE</th>
				<th onclick="sortTable(this,6);" style="<?php if($tsubt==0){echo'display:none;';}?> <?php echo 'font-size:'.($xfontsize*0.8).';' ?> ">SUB-TOT</th>			
				<th onclick="sortTable(this,7);" style="<?php if($tsubtiva0==0){echo'display:none;';}?> <?php echo 'font-size:'.($xfontsize*0.8).';' ?>">SUBT-IVA0</th>
				<th onclick="sortTable(this,8);" style="<?php if($tsubtiva==0){echo'display:none;';}?> <?php echo 'font-size:'.($xfontsize*0.8).';' ?>">SUBT-IVA</th>	
				<th onclick="sortTable(this,9);" style="<?php if($tdcto==0){echo'display:none;';}?> <?php echo 'font-size:'.($xfontsize*0.8).';' ?>">DCTO</th>	
				<th onclick="sortTable(this,10);" style="<?php if($tice==0){echo'display:none;';}?> <?php echo 'font-size:'.($xfontsize*0.8).';' ?>">ICE</th>	
				<th onclick="sortTable(this,11);" style="<?php if($tiva==0){echo'display:none;';}?> <?php echo 'font-size:'.($xfontsize*0.8).';' ?>">IVA</th>	
				<th onclick="sortTable(this,12);" style="<?php if($tirbp==0){echo'display:none;';}?> <?php echo 'font-size:'.($xfontsize*0.8).';' ?>">IRBP</th>
				<th onclick="sortTable(this,13);" >TOTAL</th>
				<th onclick="sortTable(this,14);" style="letter-spacing: 10px;<?php if($dispcolu==0){echo'display:none;';}?>">CONCEPTO</th>
				<th onclick="sortTable(this,15);">ST</th>
				<th>OX</th>
				</tr>
				</thead>
				<?php } ?>

				
				
			<?php while($pant_aso=mysql_fetch_assoc($pant_res)){ ?>
				<?php $crow++; ?> 
				<?php if($crow==1){ ?>
				<tbody style="overflow-y:auto; display:block; 
								<?php if($orient=='V'){echo'height:'.($hpant1-150).'px;';}else{echo'height:'.($hpant1-75).'px;';}  ?> ">
				<?php } ?>
					
				<tr id="tr_fila<?php echo $crow;?>" 
						class="tr_fila" 
						valign="top"
						style="<?php if ($crow%4==0){echo 'border-bottom:dotted 1px;'; } ?> "
						onclick="
										 _filabg(event,'tr_fila','<?php echo $crow; ?>','');
										<?php if($touchs=='true'){?>
										info_cele('PANT2','<?php echo $pant_aso['docu']; ?>','<?php echo $pant_aso['idnum1']; ?>');
										<?php } ?>
										 ";
						onkeypress=""
						onkeyup=""
						ondblclick=""
						height="<?php if($mobile=='true'){echo '55px';};?>"
						>
					<td align="center">
					<div style="display:none;"><?php echo fillzero($crow); ?></div>
					<?php
							$pidtxt='info'.'tr_fila'.$crow; $pname='itr_fila'; 
							$pcaption='Imprimir: '.$pant_aso['docu'].'-'.$pant_aso['numero']; $pabrev='I';
							$pidnum=$pant_aso['idnum1'];$pdocu=$pant_aso['docu'];
							$psize=$xfontsize;
// 							$ponclick='info_cele("PANTX","'.$pant_aso['enti'].'")';
							include('vrbutton.php');
					?>
					</td>
					<td align="center"
						style="<?php if($dispcolu==0){echo'display:none;';}?>"
						onclick="info_cele('PANT2','<?php echo $pant_aso['docu']; ?>','<?php echo $pant_aso['idnum1']; ?>');"; 							
							><?php $pidtxt='radio'.'tr_fila'.$crow; $pname='rtr_fila'; $pcaption=''; $psize=$xfontsize; include('vrradio.php'); ?></td>
					<td align="center">
						<span title="<?php echo $pant_aso['docu_descri'].'-'.$pant_aso['ptonumero']; ?>">
						<?php if($mobile=='true'){echo intval($pant_aso['numero'])	;}else{echo $pant_aso['numero'];} ?>
						</span>
					</td>
					<td align="center">
						<div style="display:none;"><?php echo $pant_aso['fecha']; ?></div>
						<?php echo $pant_aso['fechadmy']; ?>
					</td>
					<td align="center" style="<?php if($dispcolu==0){echo'display:none;';}?>">
						<?php $tipoid=$pant_aso['enti_tipoid']; ?>
						<?php $tiporuc=$pant_aso['enti_tiporuc']; ?>
						<?php $struc=$pant_aso['enti_struc']; ?>
						<span title="<?php if($tipoid=='R'){ echo 'RUC:'.$tiporuc.'-'.$struc;}
														else{	echo ' ID: '.$tipoid;};
												 ?>">
						<?php echo substr($pant_aso['enti'],0,10); ?>
						</span>
					</td>
					<td align="left" style="<?php if($mobile!='true' && strlen(trim($pant_aso['enti_descri']))>20){echo 'font-size:'.($xfontsize-2).'px';} ?>">
						<span title="<?php echo ' /RZ: '.$pant_aso['enti_razsoc']; ?>">
						<?php if($mobile=='true'){echo substr($pant_aso['enti_descri'],0,20);}else{echo $pant_aso['enti_descri'];} ?>
						</span>
					</td>
					<td align="right" style="<?php if($tsubt==0){echo'display:none;';}?>">
						<?php echo number_format(abs($pant_aso['tsubt']),2); ?>
					</td>	
					<td align="right" style="<?php if($tsubtiva0==0){echo'display:none;';}?>">
						<?php echo number_format(abs($pant_aso['tsubtiva0']),2); ?>
					</td>	
					<td align="right" style="<?php if($tsubtiva==0){echo'display:none;';}?>">
						<?php echo number_format(abs($pant_aso['tsubtiva']),2); ?>
					</td>	
					<td align="right" style="<?php if($tdcto==0){echo'display:none;';}?> font-style: italic;">
						<?php echo number_format(abs($pant_aso['tdcto']),2); ?>
					</td>	
					<td align="right" style="<?php if($tice==0){echo'display:none;';}?> font-style: italic;">
						<?php echo number_format(abs($pant_aso['tice']),2); ?>
					</td>	
					<td align="right" style="<?php if($tiva==0){echo'display:none;';}?> font-style: italic;">
						<?php echo number_format(abs($pant_aso['tiva']),2); ?>
					</td>	
					<td align="right" style="<?php if($tirbp==0){echo'display:none;';}?> font-style: italic;">
						<?php echo number_format(abs($pant_aso['tirbp']),2); ?>
					</td>	
					<td align="right" > 
						<div style="display:none;"><?php echo fillzero($pant_aso['total'],15); ?></div>
						<?php echo number_format(abs($pant_aso['total']),2); ?>
					</td>
					<td style="<?php if($dispcolu==0){echo'display:none;';}?>
										 <?php if(strlen(trim($pant_aso['concepto']))>50){echo 'font-size:'.($xfontsize-2).'px';} ?>">
						<?php echo $pant_aso['concepto']; ?>
					</td>
					<td align="center">
						<?php echo $pant_aso['status']; ?>
					</td>
					<td align="center">
					<?php
							if($pant_aso['status']!='O' and $pant_aso['status']!='X'){$tnumero++;}
							if($pant_aso['status']=='O')
							{$pcaption='Eliminar: '.$pant_aso['docu'].'-'.$pant_aso['numero']; $pabrev='X';}
							if(!mb_stristr('ROX',$pant_aso['status']))
							{$pcaption='Anular: '.$pant_aso['docu'].'-'.$pant_aso['numero']; $pabrev='O';}
							if(!mb_stristr('RX',$pant_aso['status']))
							{
								$pidtxt='anul'.'tr_fila'.$crow; $pname='itr_fila';
								$pidnum=$pant_aso['idnum1'];$pdocu=$pant_aso['docu'];
								$ponclick='info_cele("PANTX","'.$pant_aso['idnum1'].'")';
								include('vrbutton.php');
							}
					?>
					</td>
				</tr>
		
			<?php } ?>
			</tbody>
				
			<tfoot style="display:block; <?php if($mobile!='true'){echo 'max-width:'.($screenw-20).'px;';} ?> ">
				<tr style="border-top:solid 1px;">
					<th></th>
					<th style="<?php if($dispcolu==0){echo'display:none;';}?>"></th>
					<th><?php echo number_format($tnumero,0); ?></th>
					<th></th>
					<th style="letter-spacing: 1px; <?php if($dispcolu==0){echo'display:none;';}?>"><?php if($dispcolu==0){echo 'TOTAL';} ?></th>
					<th style="letter-spacing: 10px; "><?php if(1==1){echo 'TOTALES';} ?></th>
					<th align="right" style="<?php if($tsubt==0){echo'display:none;';}?>">
						<?php echo number_format(abs($tsubt),2); ?>
					</th>	
					<th align="right" style="<?php if($tsubtiva0==0){echo'display:none;';}?>">
						<?php echo number_format(abs($tsubtiva0),2); ?>
					</th>
					<th align="right" style="<?php if($tsubtiva==0){echo'display:none;';}?>">
						<?php echo number_format(abs($tsubtiva),2); ?>
					</th>	
					<th align="right" style="<?php if($tdcto==0){echo'display:none;';}?> font-style: italic;">
						<?php echo number_format(abs($tdcto),2); ?>
					</th>	
					<th align="right" style="<?php if($tice==0){echo'display:none;';}?> font-style: italic;">
						<?php echo number_format(abs($tice),2); ?>
					</th>	
					<th align="right" style="<?php if($tiva==0){echo'display:none;';}?> font-style: italic;">
						<?php echo number_format(abs($tiva),2); ?>
					</th>	
					<th align="right" style="<?php if($tirbp==0){echo'display:none;';}?> font-style: italic;">
						<?php echo number_format(abs($tirbp),2); ?>
					</th>	
					<th align="right">
						<?php echo number_format(abs($total),2); ?>
					</th>
					<th style="<?php if($dispcolu==0){echo'display:none;';}?>"></th>
					<th></th>

					<th></th>
				</tr>

				<tr style="border-top:solid 1px;">
					<th></th>
					<th style="<?php if($dispcolu==0){echo'display:none;';}?>"></th>
					<th></th>
					<th></th>
					<th style="letter-spacing: 1px; <?php if($dispcolu==0){echo'display:none;';}?>" ><?php if($dispcolu==0){echo'PROM.';}?></th>
					<th style="letter-spacing: 1px;" ><?php if(1==1){echo'PROMEDIOS';}?></th>
					<th align="right" style="<?php if($tsubt==0){echo'display:none;';}?>">
						<?php echo number_format(abs($tsubt/$tnumero),2); ?>
					</th>
					<th align="right" style="<?php if($tsubtiva0==0){echo'display:none;';}?>">
						<?php echo number_format(abs($tsubtiva0/$tnumero),2); ?>
					</th>
					<th align="right" style="<?php if($tsubtiva==0){echo'display:none;';}?>">
						<?php echo number_format(abs($tsubtiva/$tnumero),2); ?>
					</th>
					<th align="right" style="<?php if($tdcto==0){echo'display:none;';}?> font-style: italic;">
						<?php echo number_format(abs($tdcto/$tnumero),2); ?>
					</th>
					<th align="right" style="<?php if($tice==0){echo'display:none;';}?> font-style: italic;">
						<?php echo number_format(abs($tice/$tnumero),2); ?>
					</th>
					<th align="right" style="<?php if($tiva==0){echo'display:none;';}?> font-style: italic;">
						<?php echo number_format(abs($tiva/$tnumero),2); ?>
					</th>
					<th align="right" style="<?php if($tirbp==0){echo'display:none;';}?> font-style: italic;">
						<?php echo number_format(abs($tirbp/$tnumero),2); ?>
					</th>
					<th align="right" style="<?php if($total==0){echo'display:none;';}?> ">
						<?php echo number_format(abs($total/$tnumero),2); ?>
					</th>
					<th <?php if($dispcolu==0){echo'display:none;';}?>></th>
					<th></th>

					<th></th>
				</tr>
				
				
			</tfoot>
				
			</table>

			<pant1>
				
<?php } ?>			
			
<?php if(mb_stristr('PANT2',$pant)) { ?>
			<pant11>
<!-- 				<br> -->
			<?php //$pant_sql='select * from '.$tabla.'11 where docu ="'.$docu.'" and idnum1="'.$idnum.'"';	?>
			<?php
				$pant_sql ='select * from '.$tabla.'12 where idnum1="'.$idnum.'"';	

				$tpant_sql =str_replace('select *',$total_sql,$pant_sql);
				$tpant_sql.=' group by idnum1';
					
				$pant_res=mysql_query($pant_sql,$link_vcrx); 
// 				explain_sql($pant_sql);
			?>
	
				
			<?php
// 				if($mobile=='true')
				{
				$tpant_res=mysql_query($tpant_sql,$link_vcrx); 
				$tsubt=mysql_result($tpant_res,0,'tsubt');
				$tsubtiva0=mysql_result($tpant_res,0,'tsubtiva0');
				$tsubtiva=mysql_result($tpant_res,0,'tsubtiva');
				$tdcto=mysql_result($tpant_res,0,'tdcto');
				$tice=mysql_result($tpant_res,0,'tice');
				$tiva=mysql_result($tpant_res,0,'tiva');
				$tirbp=mysql_result($tpant_res,0,'tirbp');
				$total=mysql_result($tpant_res,0,'total');
				}
// explain_sql($pant_sql);
			?>

			<?php //echo $pant_sql; ?>
			<div style="font-size:<?php echo $xfontsize; ?>px;">
				<table width="<?php if($orient=='V'){echo '200%';}else{echo '100%';} ?>" cellpadding="2" width="100%"
							 border="0"
						 style="font-size:<?php if($mobile=='true'){echo $xfontsize-12;}else{echo $xfontsize;} ?>px;
										max-height:<?php echo $hpant11-15; ?>px;
										border-collapse:collapse; background-color:#eee;">
					<tr valign="top" >
						<td style="font-weight:bold;" width="10%">
							<?php echo mysql_result($pant_res,0,'docu').': '.mysql_result($pant_res,0,'ptonumero'); ?>
						</td>
						<td>
							<div style="font-weight:bold;">
							<?php echo substr(mysql_result($pant_res,0,'enti_descri'),0,200); ?>
							</div>
							<div style="font-size:<?php if($mobile=='true' and strlen(mysql_result($pant_res,0,'concepto')>100)){echo $xfontsize-16;}?>px" ;>
							<?php echo substr(mysql_result($pant_res,0,'concepto'),0,200); ?></td>
							</div>
						</td>
					</tr>
				</table>
				</div>
				<?php if($mobile=='true'){?>
				<table width="100%" cellpadding="2" width="100%" border="0"
						 style="font-size:<?php if($mobile=='true'){echo $xfontsize-8;}else{echo $xfontsize;} ?>px;border-collapse:collapse; background-color:white;">
					<tr>
						<?php if($tsubt!=0){ ?>
						<th align="center">SUBT:</th>
<!-- 						<td align="left"><?php echo number_format($tsubt,2); ?></td> -->
						<?php }?>
						<?php if($tsubtiva0!=0){ ?>
						<th align="center">SUBT-IVA0:</th>
<!-- 						<td align="left"><?php echo number_format($tsubtiva0,2); ?></td> -->
						<?php }?>
						<?php if($tsubtiva!=0){ ?>
						<th align="center">SUBT-IVA:</th>
<!-- 						<td align="left"><?php echo number_format($tsubtiva,2); ?></td> -->
						<?php }?>
						<?php if($tdcto!=0){ ?>
						<th align="center">DCTO:</th>
<!-- 						<td align="left"><?php echo number_format($tdcto,2); ?></td> -->
						<?php }?>
						<?php if($tice!=0){ ?>
						<th align="center">ICE:</th>
<!-- 						<td align="left"><?php echo number_format($tice,2); ?></td> -->
						<?php }?>
						<?php if($tiva!=0){ ?>
						<th align="center">IVA:</th>
<!-- 						<td align="left"><?php echo number_format($tiva,2); ?></td> -->
						<?php }?>
						<?php if($tirbp!=0){ ?>
						<th align="center">IRBP:</th>
<!-- 						<td align="left"><?php echo number_format($tirbp,2); ?></td> -->
						<?php }?>
						<?php if($total!=0){ ?>
						<th align="center">TOTAL:</th>
<!-- 						<td align="left"><?php echo number_format($total,2); ?></td> -->
						<?php }?>
					</tr>
					<tr>
						<?php if($tsubt!=0){ ?>
<!-- 						<th align="right">SUBT:</th> -->
						<td align="center"><?php echo number_format($tsubt,2); ?></td>
						<?php }?>
						<?php if($tsubtiva0!=0){ ?>
<!-- 						<th align="right">SUBT-IVA0:</th> -->
						<td align="center"><?php echo number_format($tsubtiva0,2); ?></td>
						<?php }?>
						<?php if($tsubtiva!=0){ ?>
<!-- 						<th align="right">SUBT-IVA:</th> -->
						<td align="center"><?php echo number_format($tsubtiva,2); ?></td>
						<?php }?>
						<?php if($tdcto!=0){ ?>
<!-- 						<th align="right">DCTO:</th> -->
						<td align="center"><?php echo number_format($tdcto,2); ?></td>
						<?php }?>
						<?php if($tice!=0){ ?>
<!-- 						<th align="right">ICE:</th> -->
						<td align="center"><?php echo number_format($tice,2); ?></td>
						<?php }?>
						<?php if($tiva!=0){ ?>
<!-- 						<th align="right">IVA:</th> -->
						<td align="center"><?php echo number_format($tiva,2); ?></td>
						<?php }?>
						<?php if($tirbp!=0){ ?>
<!-- 						<th align="right">IRBP:</th> -->
						<td align="center"><?php echo number_format($tirbp,2); ?></td>
						<?php }?>
						<?php if($total!=0){ ?>
<!-- 						<th align="right">TOTAL:</th> -->
						<td align="center"><?php echo number_format($total,2); ?></td>
						<?php }?>
					</tr>
				</table>
				<?php } ?>
			</div>
			</pant11>
	
			<pant2>
			<?php $crow=0; ?>
			<?php $pant_sql='select * from '.$tabla.'12 where idnum2="'.$idnum.'" order by iddet';	?>
			<?php $pant_res=mysql_query($pant_sql,$link_vcrx);	?>
			<table id="tpant2" class="pant2"
						 align="left" border="0" cellpadding="3" width="100%"
						 style="font-size:<?php if($mobile=='true'){echo $xfontsize-8;}else{echo $xfontsize;} ?>px;border-collapse:collapse;background-color:white;"
						 >

				<thead style="display:block;">
				<tr style="border-bottom:solid 1px;">
				<th onclick="sortTable(this,0);" title="Linea">L</th>
				<th style="<?php if($dispcolu==0){echo 'display:none;';} ?>">D</th>	
				<th onclick="sortTable(this,1);" title="Cantidad">Cant</th>
				<th onclick="sortTable(this,2);" title="Código" style="<?php if($dispcolu==09){echo'display:none;';}?>">Código</th>
				<th onclick="sortTable(this,3);" title="Descripción">Descripción</th>
				<th onclick="sortTable(this,4);" title="Prec.Unitario">P.Uni</th>
				<th onclick="sortTable(this,5);" style="<?php if($tsubt==0){echo'display:none;';}?>">SUB-TOT</th>			
				<th onclick="sortTable(this,6);" style="<?php if($tdcto==0){echo'display:none;';}?>">DCTO</th>	
				<th onclick="sortTable(this,7);" style="<?php if($tice==0){echo'display:none;';}?>">ICE</th>	
				<th onclick="sortTable(this,8);" style="<?php if($tiva==0){echo'display:none;';}?>">IVA</th>	
				<th onclick="sortTable(this,9);" style="<?php if($tirbp==0){echo'display:none;';}?>">IRBP</th>
<!-- 				<th onclick="sortTable(this,3);" title="Precio Unitario">PVP</th> -->
				<th onclick="sortTable(this,10);">TOTAL</th>
				<th onclick="sortTable(this,11);" style="letter-spacing: 10px;<?php if($dispcolu==0){echo'display:none;';}?>">DETALLE</th>
				<?php if($empr_cont=='1' and $tabla=='comp') {?>
				<th onclick="sortTable(this,12);" style="<?php if($dispcolu==0){echo'display:;';} ?>">CAIR</th>
				<th onclick="sortTable(this,13);" style="<?php if($dispcolu==0){echo'display:;';} ?>">Cuenta</th>
				<th onclick="sortTable(this,14);" style="<?php if($dispcolu==0){echo'display:;';} ?>">Contable</th>
				<?php } ?>
				</tr>
				</thead>

			<?php $numrows=mysql_num_rows($pant_res); ?>
			<tbody style="overflow-y:auto; display:block; border-bottom:solid 1px;
							<?php if($mobile=='true'){echo'height:'.($hpant2).'px;';}else{echo'height:'.($hpant2).'px;';}  ?> ">
			<?php while($pant_aso=mysql_fetch_assoc($pant_res)){ ?>
				<?php $crow++; ?>
				<?php $duni=$pant_aso['item_duni']; ?>
				<?php $dval=$pant_aso['item_dval']; ?>
				<?php $dval=2; ?>
				<tr id="tr_filad<?php echo $crow;?>" 
						class="tr_filad" 
						valign="top"
						style="<?php if ($crow%4==0){echo 'border-bottom:dotted 1px;'; } ?><?php if ($crow==$numrows){echo 'border-bottom:solid 2px;'; } ?> "
						onclick="
										 _filabg(event,'tr_filad','<?php echo $crow; ?>','');
										<?php if($touchs=='true'){?>
										<?php } ?>
										 ";
						onkeypress=""
						onkeyup=""
						ondblclick=""
						Xheight="<?php if($mobile=='true'){echo '55px';};?>"
						>
						<td align="center"><?php echo $pant_aso['iddet']; ?></td>
						<td align="center"
							style="<?php if($dispcolu==0){echo'display:none;';}?>"
							Xonclick="info_cele('PANT2','<?php echo $pant_aso['docu']; ?>','<?php echo $pant_aso['idnum1']; ?>');"; 							
								><?php $pidtxt='radio'.'tr_filad'.$crow; $pname='rtr_filad'; $pcaption=''; $psize=$xfontsize; include('vrradio.php'); ?></td>
					
						<td align="center"><?php echo number_format(abs($pant_aso['cant']),$duni); ?></td>
						<td align="left" style="<?php if($dispcolu==09){echo'display:none;';}?>">
							<span title="<?php echo $pant_aso['itemce']; ?>"><?php echo $pant_aso['item']; ?></span>
						</td>
						<td align="left"><span title="<?php echo $pant_aso['itemce']; ?>"><?php echo $pant_aso['item_descri']; ?></span></td>
						<td align="right"><?php echo number_format(abs($pant_aso['puni']),$dval); ?></td>
						<td align="right"><?php echo number_format(abs($pant_aso['tsubt']),$dval); ?></td>
						<td align="right" style="<?php if($tdcto==0){echo'display:none;';} ?>font-style: italic;">
							<span title="<?php echo number_format(abs($pant_aso['dcto']),$dval); ?>%">
								<?php echo number_format(abs($pant_aso['tdcto']),$dval); ?>
							</span>
						</td>
						<td align="right" style="<?php if($tice==0){echo'display:none;';} ?>font-style: italic;">
							<span title="<?php echo number_format(abs($pant_aso['ice']),$dval); ?>%">
								<?php echo number_format(abs($pant_aso['tice']),$dval); ?>
							</span>
						</td>
						<td align="right" style="<?php if($tiva==0){echo'display:none;';} ?>font-style: italic;">
							<span title="<?php echo number_format(abs($pant_aso['iva']),$dval); ?>%">
								<?php echo number_format(abs($pant_aso['tiva']),$dval); ?>
							</span>
						</td>
						<td align="right" style="<?php if($tirbp==0){echo'display:none;';} ?>font-style: italic;">
							<span title="<?php echo number_format(abs($pant_aso['irbp']),$dval); ?>">
								<?php echo number_format(abs($pant_aso['tirbp']),$dval); ?>
							</span>
						</td>
						<td align="right" style="<?php if($total==0){echo'display:none;';} ?>">
								<?php echo number_format(abs($pant_aso['total']),$dval); ?>
						</td>
						<td align="left" style="<?php if($dispcolu==0){echo'display:none;';} ?>
																		<?php if(strlen(trim($pant_aso['detalle']))>50){echo 'font-size:'.($xfontsize-2).'px';} ?>">
							<?php echo $pant_aso['detalle']; ?></td>

					 <?php if($empr_tipo=='cont' and $tabla=='comp') {?>
						<td align="center" style="<?php if($dispcolu==0){echo'display:;';} ?>">
							<?php echo $pant_aso['cair']; ?>
						</td>
						<td align="left" style="<?php if($dispcolu==0){echo'display:;';} ?>">
							<?php echo $pant_aso['ctas']; ?>
						</td>
						<td align="left" style="<?php if($dispcolu==0){echo'display:;';} ?>">
							<?php echo $pant_aso['ctas_descri']; ?>
						</td>
						<?php } ?>

				</tr>

			<?php } ?>
			</tbody>	
					
			<tfoot style="display:block;">
				<tr style="border-top:solid 1px;">
<!-- 				<th colspan="11"></th> -->
				</tr>
			</tfoot>
			</table>

<!-- 			<div id="scrollhere" ></div> -->
			</pant2>
	
<?php } ?>			

<?php if(mb_stristr('RPCI',$pant)) { ?>
<?php echo rpc_full('',$enti); ?>
<?php } ?>

				
			
<?php if(mb_stristr('RPCR',$pant)) { ?>
			<?php
				$pant_sql='select * from enti00 where enti_codigo ="'.$enti.'"';
				$pant_res=mysql_query($pant_sql,$link_vcrx);
	$aniot=$anio;
	if($mes>=9){$aniot++;}
	
	$rpc1_sql='select jwrt11.*,';
				$rpc1_sql.=' case when fmes>=9 then fanio+1 else fanio end as faniot';
				$rpc1_sql.=' from jwrt11';
				$rpc1_sql.=' where enti="'.$enti.'"';
				$rpc1_sql.=' and fanioserv="'.$aniot.'"';
				$rpc1_sql.=' order by fecha';
// 				$rpc1_res=mysql_query($rpc1_sql,$link_vcrx);
// 	echo $rpc1_sql;
	
	
			$head1=0;
			$foot1=0;
	
			if($mes==9){$head1=1;}
			else
			{
				$rpc1_res=mysql_query($rpc1_sql,$link_vcrx);
				if(mysql_result($rpc1_res,0,'fmes')==$mes){$head1=1;} 
			}

	
			$blanco='white;opacity:0.0;';
// 			$blanco='yellow';
// 			$blanco='black';
	
			?>

	
<!-- 	<div id="registro" style="position:fixed;width:140mm;height:100mm; margin-left:0mm;margin-top:0mm;border:solid 0px;font-size:12px;"> -->
	<div id="registro" style="position:fixed;width:155mm;height:100mm; margin-left:0mm;margin-top:0mm;border:solid 0px;font-size:12px;">
<!-- 		<div style="position:relative;width:3mm; left:10mm; top:5mm; z-index:9; font-size:14px;"> -->
			<?php  //echo substr(mysql_result($pant_res,0,'enti_descri'),0,1); ?>
<!-- 		</div> -->
		<div style="position:relative;width:3mm; left:131mm; top:0mm; z-index:9;<?php if ($head1==0) {echo 'color:'.$blanco.';';} ?>">
			<?php  if(mysql_result($pant_res,0,'enti_sexo')=="1") {echo 'H';}?>
		</div>
		<div style="position:relative;width:3mm; left:131mm; top:5mm; z-index:9;<?php if ($head1==0) {echo 'color:'.$blanco.';';} ?>">
			<?php  if(mysql_result($pant_res,0,'enti_sexo')=="2") {echo 'M';}?>
		</div>
<!-- 		<div id="cabecera1" style="position:relative;margin-top:0mm;height:22mm;"> -->
		<div id="cabecera1" style="position:relative;left:20mm;top:-8mm;height:22mm;">
			<table cellspacing="0" cellpadding="0"  
						 style="border-collapse:collapse;background-color:white;width:125mm; font-size:12px; table-layout:fixed;
										<?php if ($head1==0) {echo 'color:'.$blanco.';';} ?>" border=0>
				<tr style="height:8mm;"></tr>
				<tr style="height:5mm;">
<!-- 					<td style="width:1mm;"></td> -->
					<td colspan="4">
						<?php echo mysql_result($pant_res,0,'enti_descri') ?>
					</td>
				</tr>
				<tr style="height:4mm;">
<!-- 					<td></td> -->
					<td colspan="5">
						<?php echo mysql_result($pant_res,0,'enti_calle1').' '.mysql_result($pant_res,0,'enti_calle2') ?>
					</td>
				</tr>
				<tr style="height:5mm;">
					<td style="width:25mm;">
						<?php echo mysql_result($pant_res,0,'enti_telefono') ?>
					</td>
					<td style="width:20mm;"></td>
					<td style="width:25mm;">
						<?php echo mysql_result($pant_res,0,'enti_telefono') ?>
					</td>
					<td style="width:25mm;"></td>
					<td style="width:25mm;">
						<?php echo mysql_result($pant_res,0,'enti_fechanacdmy') ?>
					</td>
				</tr>
			</table>
		</div>		

		<div id="cabecera2" style="margin-top:-8mm;height:8mm;width:140mm;font-size:12px;<?php if ($head1==0) {echo 'color:'.$blanco.';';} ?>">
			<div style="position:relative;margin-left:25mm;margin-top:0mm;height:8mm;width:22mm;">
				<?php echo mysql_result($pant_res,0,'enti_fechainidmy') ?>
			</div>
		</div>		
	
<?php		//		$rpc1_res=mysql_query($rpc1_sql,$link_vcrx); ?>
				<?php $crow=0; ?>

				<?php $tpublic=0; ?>
				<?php $tpresen=0; ?>
				<?php $thoras=0; ?>
				<?php $trevisi=0; ?>
				<?php $tcursos=0; ?>
		
				<?php $cfecha=$anio.'-09-01' ; ?>
				<?php if ($mes<9) { ?>
				<?php $cfecha=($anio-1).'-09-01' ; ?>
				<?php } ?>
		<div id="detalle" style="top:-13mm;margin-left:0mm;">
			
			<table cellspacing="0" cellpadding="0" width="140mm" style="border-collapse:collapse;background-color:white; font-size:10px; table-layout:fixed;" border=0>
				<tr style="height:3.84mm;<?php if ($head1==0) {echo 'color:'.$blanco.';';} ?>">
					<td style="width:20mm;" align="center"><?php echo $aniot; ?></td>	
					<td style="width:19mm;"></td>
					<td style="width:22mm;"></td>
					<td style="width:11mm;"></td>
					<td style="width:15mm;"></td>
					<td style="width:15mm;"></td>
					<td style="width:38mm;"></td>
			</tr>				
			<?php for ($cmes=1; $cmes<=12; $cmes++) { ?>
				<tr style="height:3.84mm;<?php if (date('Ym',strtotime($cfecha))<($anio.$mes)) {echo 'color:'.$blanco.';';} ?>">
					<?php
							$rpcm_sql='select jwrt11.*,case when fmes>=9 then fanio+1 else fanio end as faniot from jwrt11 where enti="'.$enti.'" and fecha="'.$cfecha.'" and status!="X"';
							$rpcm_res=mysql_query($rpcm_sql,$link_vcrx);
							$cfecha=date('Y-m-01',strtotime($cfecha.' +1 month'));
					?>
					<?php if (mysql_num_rows($rpcm_res)!=0) {?>
					<?php if($cmes==12){$foot1=1;} ?>
					<td>
					</td>	
					<td align="center" >
						<?php echo number_format(mysql_result($rpcm_res,0,'public'),0);  ?>
					</td>
					<td align="center" >
						<?php echo number_format(mysql_result($rpcm_res,0,'presen'),0); ?>
					</td>
					<td align="center" >
						<?php echo number_format(mysql_result($rpcm_res,0,'horas'),0); ?>
					</td>
					<td align="center" >
						<?php echo number_format(mysql_result($rpcm_res,0,'revisi'),0); ?>
					</td>
					<td align="center" >
						<?php echo number_format(mysql_result($rpcm_res,0,'cursos'),0); ?>
					</td>
					<td align="left" style="font-size:8px;" >
						<?php echo mysql_result($rpcm_res,0,'concepto') ?>
					</td>
					<?php $tpublic+=mysql_result($rpcm_res,0,'public'); ?>
					<?php $tpresen+=mysql_result($rpcm_res,0,'presen'); ?>
					<?php $thoras+=mysql_result($rpcm_res,0,'horas'); ?>
					<?php $trevisi+=mysql_result($rpcm_res,0,'revisi'); ?>
					<?php $tcursos+=mysql_result($rpcm_res,0,'cursos'); ?>
					<?php } ?>
				</tr>
			<?php } ?>
				
				<tr style="height:3.84mm;<?php if ($foot1==0) {echo 'color:'.$blanco.';';} ?> font-weight:bold;">
					<td>
					</td>	
					<td align="center" >
						<?php echo number_format($tpublic,0) ?>
					</td>
					<td align="center" >
						<?php echo number_format($tpresen,0) ?>
					</td>
					<td align="center" >
						<?php echo number_format($thoras,0) ?>
					</td>
					<td align="center" >
						<?php echo number_format($trevisi,0) ?>
					</td>
					<td align="center" >
						<?php echo number_format($tcursos,0) ?>
					</td>
					<td align="left" >
					</td>
				</tr>

			</table>
		</div>

		</div>	
<?php } ?>			
	
				
				
<?php if(mb_stristr('RPCR',$pant) and 'LASER'=='1') { ?>
			<?php
				$pant_sql='select * from enti00 where enti_codigo ="'.$enti.'"';
				$pant_res=mysql_query($pant_sql,$link_vcrx);
	$aniot=$anio;
	if($mes>=9){$aniot++;}
	
	$rpc1_sql='select jwrt11.*,';
				$rpc1_sql.=' case when fmes>=9 then fanio+1 else fanio end as faniot';
				$rpc1_sql.=' from jwrt11';
				$rpc1_sql.=' where enti="'.$enti.'"';
				$rpc1_sql.=' and fanioserv="'.$aniot.'"';
				$rpc1_sql.=' order by fecha';
// 				$rpc1_res=mysql_query($rpc1_sql,$link_vcrx);
// 	echo $rpc1_sql;
	
	
			$head1=0;
			$foot1=0;
	
			if($mes==9){$head1=1;}
			else
			{
				$rpc1_res=mysql_query($rpc1_sql,$link_vcrx);
				if(mysql_result($rpc1_res,0,'fmes')==$mes){$head1=1;} 
			}

	
			$blanco='white;opacity:0.0;';
// 			$blanco='yellow';
// 			$blanco='black';
	
			?>

	
	<div id="registro" style="position:fixed;width:140mm;height:100mm; margin-left:0mm;margin-top:0mm;border:solid 0px;font-size:12px;">
<!-- 	<div id="registro" style="position:fixed;width:155mm;height:100mm; margin-left:0mm;margin-top:0mm;border:solid 0px;font-size:12px;"> -->
<!-- 		<div style="position:relative;width:3mm; left:10mm; top:5mm; z-index:9; font-size:14px;"> -->
			<?php  //echo substr(mysql_result($pant_res,0,'enti_descri'),0,1); ?>
<!-- 		</div> -->
		<div style="position:relative;width:3mm; left:134mm; top:5mm; z-index:9;<?php if ($head1==0) {echo 'color:'.$blanco.';';} ?>">
			<?php  if(mysql_result($pant_res,0,'enti_sexo')=="1") {echo 'H';}?>
		</div>
		<div style="position:relative;width:3mm; left:134mm; top:10mm; z-index:9;<?php if ($head1==0) {echo 'color:'.$blanco.';';} ?>">
			<?php  if(mysql_result($pant_res,0,'enti_sexo')=="2") {echo 'M';}?>
		</div>
<!-- 		<div id="cabecera1" style="position:relative;margin-top:0mm;height:22mm;"> -->
		<div id="cabecera1" style="position:relative;left:15mm;top:-3mm;height:22mm;">
			<table cellspacing="0" cellpadding="0"  
						 style="border-collapse:collapse;background-color:white;width:125mm; font-size:12px; table-layout:fixed;
										<?php if ($head1==0) {echo 'color:'.$blanco.';';} ?>" border=0>
				<tr style="height:8mm;"></tr>
				<tr style="height:5mm;">
<!-- 					<td style="width:1mm;"></td> -->
					<td colspan="4">
						<?php echo mysql_result($pant_res,0,'enti_descri') ?>
					</td>
				</tr>
				<tr style="height:4mm;">
<!-- 					<td></td> -->
					<td colspan="5">
						<?php echo mysql_result($pant_res,0,'enti_calle1').' '.mysql_result($pant_res,0,'enti_calle2') ?>
					</td>
				</tr>
				<tr style="height:5mm;">
<!-- 					<td></td> -->
					<td style="width:30mm;">
						<?php echo mysql_result($pant_res,0,'enti_telefono') ?>
					</td>
					<td style="width:25mm;"></td>
					<td style="width:25mm;">
						<?php echo mysql_result($pant_res,0,'enti_telefono') ?>
					</td>
					<td style="width:25mm;"></td>
					<td style="width:25mm;">
						<?php echo mysql_result($pant_res,0,'enti_fechanacdmy') ?>
					</td>
				</tr>
			</table>
		</div>		

		<div id="cabecera2" style="margin-top:0mm;height:8mm;width:140mm;font-size:12px;<?php if ($head1==0) {echo 'color:'.$blanco.';';} ?>">
			<div style="position:relative;margin-left:25mm;margin-top:0mm;height:8mm;width:22mm;">
				<?php echo mysql_result($pant_res,0,'enti_fechainidmy') ?>
			</div>
		</div>		
	
<?php		//		$rpc1_res=mysql_query($rpc1_sql,$link_vcrx); ?>
				<?php $crow=0; ?>

				<?php $tpublic=0; ?>
				<?php $tpresen=0; ?>
				<?php $thoras=0; ?>
				<?php $trevisi=0; ?>
				<?php $tcursos=0; ?>
		
				<?php $cfecha=$anio.'-09-01' ; ?>
				<?php if ($mes<9) { ?>
				<?php $cfecha=($anio-1).'-09-01' ; ?>
				<?php } ?>
		<div id="detalle" style="top:-2mm;margin-left:0mm;">
			
			<table cellspacing="0" cellpadding="0" width="140mm" style="border-collapse:collapse;background-color:white; font-size:12px; table-layout:fixed;" border=0>
				<tr style="height:4.16mm;<?php if ($head1==0) {echo 'color:'.$blanco.';';} ?>">
					<td style="width:20mm;" align="center"><?php echo $aniot; ?></td>	
					<td style="width:19mm;"></td>
					<td style="width:22mm;"></td>
					<td style="width:11mm;"></td>
					<td style="width:15mm;"></td>
					<td style="width:15mm;"></td>
					<td style="width:38mm;"></td>
			</tr>				
			<?php for ($cmes=1; $cmes<=12; $cmes++) { ?>
				<tr style="height:4.16mm;<?php if (date('Ym',strtotime($cfecha))<($anio.$mes)) {echo 'color:'.$blanco.';';} ?>">
					<?php
							$rpcm_sql='select jwrt11.*,case when fmes>=9 then fanio+1 else fanio end as faniot from jwrt11 where enti="'.$enti.'" and fecha="'.$cfecha.'" and status!="X"';
							$rpcm_res=mysql_query($rpcm_sql,$link_vcrx);
							$cfecha=date('Y-m-01',strtotime($cfecha.' +1 month'));
// 																echo $rpcm_sql;
					?>
					<?php if (mysql_num_rows($rpcm_res)!=0) {?>
					<?php if($cmes==12){$foot1=1;} ?>
					<td>
					</td>	
					<td align="center" >
						<?php echo number_format(mysql_result($rpcm_res,0,'public'),0);  ?>
					</td>
					<td align="center" >
						<?php echo number_format(mysql_result($rpcm_res,0,'presen'),0); ?>
					</td>
					<td align="center" >
						<?php echo number_format(mysql_result($rpcm_res,0,'horas'),0); ?>
					</td>
					<td align="center" >
						<?php echo number_format(mysql_result($rpcm_res,0,'revisi'),0); ?>
					</td>
					<td align="center" >
						<?php echo number_format(mysql_result($rpcm_res,0,'cursos'),0); ?>
					</td>
					<td align="left" >
						<?php echo mysql_result($rpcm_res,0,'concepto') ?>
					</td>
					<?php $tpublic+=mysql_result($rpcm_res,0,'public'); ?>
					<?php $tpresen+=mysql_result($rpcm_res,0,'presen'); ?>
					<?php $thoras+=mysql_result($rpcm_res,0,'horas'); ?>
					<?php $trevisi+=mysql_result($rpcm_res,0,'revisi'); ?>
					<?php $tcursos+=mysql_result($rpcm_res,0,'cursos'); ?>
					<?php } ?>
				</tr>
			<?php } ?>
				
				<tr style="height:4.16mm;<?php if ($foot1==0) {echo 'color:'.$blanco.';';} ?> font-weight:bold;">
					<td>
					</td>	
					<td align="center" >
						<?php echo number_format($tpublic,0) ?>
					</td>
					<td align="center" >
						<?php echo number_format($tpresen,0) ?>
					</td>
					<td align="center" >
						<?php echo number_format($thoras,0) ?>
					</td>
					<td align="center" >
						<?php echo number_format($trevisi,0) ?>
					</td>
					<td align="center" >
						<?php echo number_format($tcursos,0) ?>
					</td>
					<td align="left" >
					</td>
				</tr>

			</table>
		</div>

		</div>	
<?php } ?>			
	
</resultado>

				
				
				