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

<?php $fechadtr=get_fechadtr(); ?>

<?php foreach($_POST as $campo => $valor){${$campo}=$valor;} ?>

<?php //foreach($_POST as $campo => $valor){setcookie($campo,$valor);} ?>

<?php $dispcolu=1; ?>
<?php $iddet=$iddet*1; ?>


<?php $xuser_cedula=r_fiel('user',$user,'cedula'); ?>
<?php $user_cargo=r_fiel('user',$user,'cargo'); ?>

<?php $docux=$docu; ?>
<?php if($docux=='IEBX'){$docu='IB'; $limit1=50; $enti='';} ?>
<?php if($docux=='RPXX'){$docu='RP'; $limit1=15; $cair='';} ?>
<?php if($docux=='FPXX'){$docu='FP'; $limit1=15;} ?>
<?php if($docux=='ATXX'){$docu='AT'; $limit1=100;} ?>

<?php if($pant==''){$pant='PANT0';}?>

<?php if(!@mb_stristr('PANT.IMPR',substr($pant,0,4))){return;} ?>

<?php //if($user_codigo==''){die('<msgalert>Usuario desconectado...</msgalert>');}?>
<?php if($user_codigo==''){echo ('<msgalert>Usuario desconectado...</msgalert>');}?>
<?php //if($pant=='PANT2'){echo('<msgalert>NO HAY DATOS PARA CONSULTAR</msgalert>');}?>


<?php
//   $paraiddet=$iddet;
//   ini_set('memory_limit', '512M');

if($fecha1==''){$fecha1='2010-01-01';}
if($fecha2==''){$fecha2=$fechaa;}
if($numero1==''){$numero1='1';}
if($numero2==''){$numero2='999999999';}

$numero1=fillzero($numero1);
$numero2=fillzero($numero2);

$gris1='gainsboro';

?>


<?php	

$user_nuev=0;
$user_cons=0;
$user_modi=0;
$user_anul=0;
$user_elim=0;
$user_proc=0;
$user_clon=0;

$cel_stat=0;
$ver_rete=0;
$ver_guia=0;
$ver_apli=0;
$ver_fact=0;
$ver_doco=0;
$ver_cele=0;
$ver_abono=0;
$ver_saldo=0;
$ver_valor=1;
$ver_subtot=1;
// $ver_total=1;
$tsaldo=0;

$dias_anul=180;
// $dias_anul=360;
$dias_rpro=30;
$dias_guia=30;
$dias_fact=15;

if($user_email=='ptama@hotmail.com'){$dias_anul=365;}
if($user_email=='vicore@hotmail.com'){$dias_anul=365;}


$docuacce=$docu;  
include('php_useracce.php');


if($user_tipo=='supe')
{
  $user_nuev=1;
  $user_cons=1;
  $user_modi=1;
  $user_anul=1;
  $user_elim=1;
  $user_clon=1;
}

if($user_tipo=='clie' and substr($docu,0,2)=='PC')
{
  $user_nuev=1;
  $user_cons=1;
  $user_modi=0;
  $user_anul=1;
  $user_elim=0;
  $user_clon=0;
  
  $ver_rete=0;
//   $ver_fact=0;
}

if($user_tipo=='clie' and substr($docu,0,2)=='FC')
{
  $user_nuev=0;
  $user_cons=1;
  $user_modi=0;
  $user_anul=0;
  $user_elim=0;
  $user_clon=0;
  $ver_rete=0;
}

if($user_nuev==1){$user_cons=1;}

if(mb_stristr('IMPR1',$pant))
{ 
 $ver_rete=0; 
 $ver_apli=0; 
 $ver_fact=0; 
 $ver_cele=0; 
 $ver_guia=0; 
   $ver_doco=0; 
} 

if(mb_stristr('PANT3.IMPR3',$pant))
{ 
 $ver_rete=0; 
 $ver_apli=0; 
 $ver_fact=0; 
 $ver_cele=0; 
 $ver_guia=0; 
//    $ver_doco=0; 
//    $mconcepto.=$mdetalle;
} 


if(@mb_stristr('retc.retp.caja.bcos.',$tabla)){$user_clon=0;}


//   $user_modi=0;
//   $user_anul=0;


if($docu=='undefined')
{$docu='';}
else
{
  $docu=trim(substr($docu,0,4));
}

if(strlen($docu)==4)
{$tabla=r_fiel('docu',$docu,'tabla');}
else
{$tabla=r_fiel('docu',substr($docu,0,2).'10','tabla');}  


$entilabel='ENTIDAD';
if($tabla=="")
{
	if($modu=='CONT'){$tabla='cont';}

	if($docu=='IB'){$tabla='inve'; $entilabel='PROVEEDOR';}
	if($docu=='EB'){$tabla='inve'; $entilabel='CLIENTE';}
	if($docu=='DC'){$tabla='bcos'; $entilabel='CLIENTE';}
	if($docu=='PR'){$tabla='bcos'; $entilabel='CLIENTE';}
	if($docu=='CH'){$tabla='bcos'; $entilabel='PROVEEDOR';}
	if($docu=='IE'){$tabla='caja'; $entilabel='CLIENTE';}
	if($docu=='EE'){$tabla='caja'; $entilabel='PROVEEDOR';}
  
	if($docu=='AT'){$tabla='atvd';}
  
}

// echo '*/*/*'.$docu.$tablas;


if(@mb_stristr('acce.atvd.',$tabla)){$entilabel='USUARIO';}
if(@mb_stristr('vtas.clie.carr.retc.guia.',$tabla)){$entilabel='CLIENTE';}
if(@mb_stristr('comi.inve',$tabla)){$entilabel='ENTIDAD';}
if(@mb_stristr('prod',$tabla)){$entilabel='TALLER';}
if(@mb_stristr('comp.prov.retp.',$tabla)){$entilabel='PROVEEDOR';}
if(@mb_stristr('nomi.roln.suel',$tabla)){$entilabel='EMPLEADO';}
if(@mb_stristr('RC.',substr($docu,0,2))){$entilabel='CLIENTE';}
if(@mb_stristr('RP.',substr($docu,0,2))){$entilabel='PROVEEDOR';}


if($tabla=='acce'){$user_anul=0;$user_elim=0;}


if(@mb_stristr('vtas.retp.guia.clie.rolp',$tabla)){$cel_stat=1;}

if(@mb_stristr('vtas.retp.guia.rolp',$tabla) and @mb_stristr('sist.supe',$user_tipo) and $vercele=='true')
{$ver_cele=1;}

if($vercele!='true'){$ver_cele=0;}

if(substr($pant,0,4)=='IMPR' and $vercele!='true'){$ver_cele=0; $cel_stat=0;}

if(@mb_stristr('clie',$tabla))
{$ver_fact=1;}

if(@mb_stristr('guia.inve',$tabla))
{$ver_doco=1;}

if(@mb_stristr('vtas.',$tabla))
{$ver_doco=1;}

if(@mb_stristr('vtas.comp',$tabla) and substr($docu,0,1)=='F' and $versaldo=='true')
{$ver_saldo=1;}

if($versaldo!='true'){$ver_saldo=0;}

if(@mb_stristr('vtas.inve',$tabla) and mb_stristr('F.E',substr($docu,0,1)) and $empr_guia==1 and $verguia=='true')
{$ver_guia=1;}

if($verguia!='true'){$ver_guia=0;}

if((@mb_stristr('vtas',$tabla) or (@mb_stristr('comp',$tabla) and $empr_cont==1)) and $verrete=='true')
{$ver_rete=1;}

if($verrete!='true'){$ver_rete=0;}

if(@mb_stristr('retc.retp.rete.caja.bcos',$tabla))
{$ver_apli=1;}

if(@mb_stristr('atvd.plan',$tabla) and $user_cargo=='ASIS')
{$ver_valor=0;}


if(@mb_stristr('comp',$tabla) and $docu!='FP11')
{$ver_cele=0; $cel_stat=0;}

if(@mb_stristr('vtas.comp',$tabla) and mb_stristr('NC.NP',substr($docu,0,2)))
{$ver_apli=1;}

if(mb_stristr('FP03.FP11',$docu)){$cel_stat=1;}
if(mb_stristr('FP03.FP11',$docu) and $vercele=='true'){$ver_cele=1;}

if($docu=='RBCO'){$ver_apli=0;}

if($docux=='IEBX'){$ver_doco=0;}
if($docux=='RPXX'){$ver_cele=0;}
if($mobile=='true' and $orient=='V'){$ver_guia=0;}

if(substr($pant,0,4)=='IMPR')
{
  $user_anul=0;
  $user_elim=0;
  $user_clon=0;
  $ver_cele=0;
  $ver_rete=0;
  $ver_doco=0;
//   $ver_guia=0;
}


$xfontsize=12;
// if($mobile=='true' and $orient=='V'){$xfontsize=40;}
// if($mobile=='true' and $orient=='H'){$xfontsize=12;}
if($orient=='V'){$xfontsize=40;}
if($orient=='H'){$xfontsize=12;}

$hpant1 =ceil($screenh*0.30);
$hpant11=ceil($screenh*0.10);
$hpant2 =ceil($screenh*0.30);
// $vpant2 =ceil($screenv*0.30);

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

// TOTALES
{
	$docuitem=0;
	$docuiimp=0;
// 				$docuinve=0;
	$docudocu=0;
	$docurete=0;
	$docuctas=0;

	if(@mb_stristr('vtas.comp.clie.prov.carr.inve.prod.guia',$tabla)){$docuitem=1;}
	if(@mb_stristr('vtas.comp.clie.prov.carr',$tabla)){$docuiimp=1;}
// 				if(mb_stristr('inve.prod.guia',$tabla)){$docuinve=1;}
// 	if(@mb_stristr('caja.bcos.retc.retp.rete',$tabla)){$docudocu=1;}
	if(@mb_stristr('caja.bcos',$tabla)){$docudocu=1;}
	if(@mb_stristr('comi',$tabla)){$docuitem=1;}
	if(@mb_stristr('retc.retp.rete',$tabla)){$docurete=1;}
	if(@mb_stristr('cont',$tabla)){$docuctas=1;}
  
  $total_sql=sql_total($tabla);

	if($mobile=='true'){$dispcolu=0;}
  if(substr($pant,0,4)=='IMPR'){$dispcolu=1;}  
// 	if($pant=='PANT3'){$dispcolu=0;}
}

?>



<?php ob_start(); ?>
<resultado>
  
<?php	val_usercodigo(); ?>

<?php $tdisplay=''; ?>  
<?php if(substr($pant,0,4)=='PANT'){$tdisplay='display:block;';}?>  
  
  
<?php if(mb_stristr('PANT0',$pant)){ ?>
<?php if(@mb_stristr('invi.clie.prov',$user_tipo) or $user_tipo=='') {}else{?>
<?php } ?>
<?php $fecha1=date('Y-m-01',strtotime ('-5 days')); ?>
<?php if(mb_stristr('amay.',$cfg_empr)){$fecha1=date('Y-m-d',strtotime ('-1 day'));} ?>
<?php if(@mb_stristr('PLA.ATV',substr($docu,0,3))){$fecha1=date('Y-m-01',strtotime ('-180 day'));} ?>
<?php $fecha2=date('Y-m-01',strtotime ('today')); ?>

		<div id="pant0" style="border:solid 2px; overflow:auto; width:100%;">
		<?php { ?>
			<table id="tpant0" cellpadding="2" width="99%" border="0"
					 style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:snow;">
				<tr>
          <td  valign="top">
          <table width="100%" cellpadding="2" border="0" caption=""
                 style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:snow;">
              <tr>
                <?php if($mobile!='true'){?>        
                <td width="10%">
                </td>
                <?php } ?>
                <td colspan="2" align="center" <?php if($mobile=='false'){echo 'style="display:none;"';}else{echo 'style="text-transform:uppercase;font-weight:bold;font-family:arial;font-size:'.($xfontsize*1.2).';"';} ?> >
                  <titulo>Informes X Módulos</titulo>
                </td>
              </tr>
            <tr>
              <?php $pidtxt='fecha1'; $pcaption='Fec. Ini.'; $pdefa=$fecha1; $psize=$xfontsize; include('vrgetfec.php'); ?>
            </tr>
            <tr>
              <?php $pidtxt='fecha2'; $pcaption='Fec. Fin'; $psize=$xfontsize; include('vrgetfec.php'); ?>
            </tr>
            
            <tr><?php //$pidtxt='concepto';  $psize=$xfontsize; $pcaption='CONCEPTO'; $plong=20; include('vrgettxt.php'); ?></tr>
          <?php if($mobile!='true'){?>        
          </table>

          </td>
          <td valign="top">
            
            <table width="100%" cellpadding="2" border="0"
                  style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:snow;">
          
              <tr>
                <td width="10%"></td>
              </tr>
          <?php } ?>
              <tr>
                <?php $pidtxt='modu'; $pcaption='modulo'; $ptabla='modu';  $psize=$xfontsize; $pdefa=$docu;  $pobj=3;  $pnotob=0; 
                   $ponblur="vali_modu();opt_modu();";
                   if(strlen($modu)==4){$preado=1;}                          
                   include('vrgetcod.php'); ?>              
              </tr>

              <tr>
                <?php $pidtxt='repo'; $pcaption='Reporte';  $psize=$xfontsize; $pdefa=$docu;  $pobj=3;  $pnotob=0; 
                   $poptions ='';
                   $poptions.='idnum1,Transacción;';
                   include('vrselopt.php'); ?>              
              </tr>
          <?php if($mobile!='true'){?>        
            </table>
          </td>
          <td valign="top">
            
            <table width="100%" cellpadding="2" border="0" caption=""
                 style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:snow;">
            <tr>
              <td width="10%"></td>
            </tr>
          <?php } ?>
              
              <tr>
                <?php $pidtxt='docu'; $pcaption='docu'; $ptabla='docu';  $psize=$xfontsize; $pdefa=$docu;  $pobj=3;  $pnotob=0; $pclass='vtas comp'; 
                   $pwhere='(docu_tipo="TRAN")';  $ponblur="";
//                    if(@mb_stristr('invi.clie.prov',$user_tipo) or $user_tipo==''){$phide=1;}
                  $phide=1;
                   if(strlen($docu)==4){$preado=1;}                          
                   include('vrgetcod.php'); 
                ?>              
              </tr>
							<tr style="display:none;" class="vtas comp clie prov inve nomi caja bcos">
                <?php $pidtxt='enti'; $pcaption=$entilabel; $ptabla='enti'; $pnotob="1"; $psize=$xfontsize;  $pobj=3; $pclass='vtas comp clie prov inve nomi caja bcos'; 
//                    $plist='dl_enti';
                   if(@mb_stristr('invi.clie.prov',$user_tipo) or $user_tipo==''){$pexact=0;$pdatalist=1;}             
                   include('vrgetcod.php'); ?>
              </tr>

							<tr style="display:none;" class="vtas comp clie prov inve">
                <?php $pidtxt='item'; $pcaption='ITEM'; $ptabla='item'; $pnotob="1"; $psize=$xfontsize; $pobj=3; $pclass='vtas comp clie prov inve';
                include('vrgetcod.php'); ?>
              </tr>

							<tr style="display:none;" class="cont">
                <?php $pidtxt='ctas'; $pcaption='CUENTA'; $ptabla='ctas'; $pnotob="1"; $psize=$xfontsize; $pobj=3; $pclass='cont';
                include('vrgetcod.php'); ?>
              </tr>

							<tr style="display:none;" class="cont comp">
                <?php $pidtxt='nivel'; $pcaption='NIVEL'; $pnotob="1"; $psize=$xfontsize; $pobj=3; $pclass='cont';
//         $pdefa=5;
                $poptions='5;4;3';
//                 $poptn1=3; $poptn2=4;
                include('vrselopt.php'); ?>
              </tr>

              

          <?php if($mobile!='true'){?>        
            </table>
          </td>
          <td valign="top">
            
            <table width="100%" cellpadding="2" border="0" caption=""
                 style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:snow;">
            <tr>
              <td width="10%"></td>
            </tr>
          <?php } ?>
            <tr>
              <?php //$pidtxt='numero1'; $pcaption='Num. Ini.'; $pdefa='000000001'; $psize=$xfontsize; $pobj=3; include('vrgetnum.php'); ?>
            </tr>
            <tr>
              <?php //$pidtxt='numero2'; $pcaption='Num. Fin'; $pdefa='999999999'; $psize=$xfontsize; $pobj=3; include('vrgetnum.php'); ?>
            </tr>
            <tr>
              <?php //$pidtxt='stat'; $pcaption='Status'; $ptabla='stat'; $pnotob="1"; $psize=$xfontsize; $pobj=3; include('vrgetcod.php'); ?>
            </tr>
          <?php if($mobile!='true'){?>        
          </table>

          </td>
          <td valign="top" width="10%">

            <table width="100%" cellpadding="2" border="0"
                style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:snow; <?php if($mobile=='true'){echo 'display:none;';} ?>">
            <tr>
              <td width="10%"></td>
            </tr>
          <?php } ?>

            <tr style="display:none;" class="vtas">
              <?php $pidtxt='ptov'; $pcaption='PTO.VTA.'; $ptabla='ptov'; $psize=$xfontsize; $pobj=3; $pclass='vtas'; include('vrgetcod.php'); ?>
            </tr>
            <tr style="display:none;" class="inve">
              <?php $pidtxt='bode'; $pcaption='BODEGA'; $ptabla='bode'; $psize=$xfontsize;  $pobj=3; $pclass='inve'; include('vrgetcod.php'); ?>
            </tr>
            <tr style="display:none;" class="guia">
              <?php $pidtxt='placa'; $pcaption='PLACA'; $ptabla='vhcl'; $psize=$xfontsize;  $pobj=3; $pclass='guia'; include('vrgetcod.php'); ?>
            </tr>
            <tr style="display:none;" class="bcos">
              <?php $pidtxt='ctab'; $pcaption='CTA:BANC.'; $ptabla='ctab'; $psize=$xfontsize;  $pobj=3; $pclass='ctab'; include('vrgetcod.php'); ?>
            </tr>
            <tr style="display:none;" class="comp retc retp">
              <?php $pidtxt='cair'; $pcaption='CAIR'; $ptabla='cair'; $psize=$xfontsize;  $pobj=3; $pclass='comp retc retp'; include('vrgetcod.php'); ?>
            </tr>
            <tr style="display:none;" class="vtas">
              <?php $pidtxt='zsub'; $pcaption='ZONA'; $ptabla='zsub'; $psize=$xfontsize; $plong=4; $pobj=3; $pclass='vtas'; include('vrgetcod.php'); ?>
            </tr>
            <tr style="display:none;" class="vtas inve">
              <?php $pidtxt='lsub'; $pcaption='LINEA'; $ptabla='lsub'; $psize=$xfontsize; $plong=4; $pobj=3; $pclass='vtas inve'; include('vrgetcod.php'); ?>
            </tr>
            <?php if(mb_stristr('pcs1.prs1',$cfg_empr)){?>
            <tr style="display:none;" class="vtas ">
              <?php $pidtxt='cntn'; $pcaption='CNTN'; $ptabla='cntn'; $psize=$xfontsize; $plong=4; $pobj=3; $pclass='vtas'; $pnotob="1"; include('vrgetcod.php'); ?>
            </tr>
            <?php } ?>
            <?php if($cfg_empr=='tgck'){?>
            <tr style="display:none;" class="vtas ">
              <?php $pidtxt='vhcl'; $pcaption='VHCL'; $ptabla='vhcl'; $psize=$xfontsize; $plong=4; $pobj=3; $pclass='vtas'; $pnotob="1"; include('vrgetcod.php'); ?>
            </tr>
            <?php } ?>
          </table>

          <?php if($mobile!='true'){?>        
          </td>
          <td valign="top">
          <?php } ?>

            <table width="100%" cellpadding="2" border="0"
                style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:snow;">
              <tr>
                <td width="10%"></td>
              </tr>
              <tr>
              <?php if($mobile=='true'){?>        
              <td>
              <?php } ?>  
              <?php $pidtxt='detadocu'; $pcaption='Detalle'; $ponclick='info_modu("DETA");'; $psize=$xfontsize; $pdefa=0; $pclass=''; include('vrchkbox.php'); ?>
              <?php if($mobile=='true'){?>        
              </td>
              <td valign="top">
              <?php }else{ ?>
              </tr>
              <tr style="display:none;" >
              <?php } ?>
              <?php $pidtxt='saldo0'; $pcaption='Saldo 0'; $ponclick=''; $psize=$xfontsize; $pdefa=0; $pclass="cont"; $phide=1; include('vrchkbox.php'); ?>
              <?php //$pidtxt='verrete'; $pcaption='Reten.'; $ponclick=''; $psize=$xfontsize; $pdefa=0; $pclass="vtas comp"; $phide=1; include('vrchkbox.php'); ?>
              <?php if($mobile=='true'){?>        
              </td>
              <td valign="top">
              <?php }else{ ?>
              </tr>
              <tr style="display:none;" >
              <?php } ?>
              <?php $pidtxt='diariotr'; $pcaption='Diario TR'; $ponclick=''; $psize=$xfontsize; $pdefa=0; $pclass="cont"; $phide=1; include('vrchkbox.php'); ?>
              <?php //$pidtxt='versaldo'; $pcaption='Saldos'; $ponclick=''; $psize=$xfontsize; $pdefa=0; $pclass="vtas comp"; $phide=1; include('vrchkbox.php'); ?>
              <?php if($mobile=='true'){?>        
              </td>
              <td valign="top">
              <?php }else{ ?>
              </tr>
              <tr style="display:none;" >
              <?php } ?>
              <?php if($empr_guia==1){?>
              <?php //$pidtxt='verguia'; $pcaption='Guias'; $ponclick=''; $psize=$xfontsize; $pdefa=0; $pclass="vtas inve"; $phide=1; include('vrchkbox.php'); ?>
              <?php } ?>
              <?php if($mobile=='true'){?>        
              </td>
              <td valign="top">
              <?php }else{ ?>
              </tr>
              <tr style="display:none;" >
              <?php } ?>
                
              <?php //$pidtxt='vercele'; $pcaption='C.Elec.'; $ponclick=''; $psize=$xfontsize; $pdefa=0; $pclass="vtas guia retp comp ncre reem "; $phide=1; include('vrchkbox.php'); ?>
              <?php if($mobile=='true'){?>        
              </td>
              <?php } ?>  
              </tr>

              <?php if($mobile=='true'){?>        
              <tr><td><br></td></tr>
              <?php } ?>

            </table>

          <?php if($mobile!='true'){?>        
          </td>
          <td valign="top">
          <?php } ?>
                       
          <table width="100%" cellpadding="2" border="0"
                style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:snow;">

            <tr>
            <td style="display:;">
					<?php $pidtxt='acepta'; $pcaption='Aceptar '; $ponclick='info_modu("PANT1",'.'document.getElementById("modu").value'.')'; $psize=$xfontsize; include('vrbutton.php'); ?>
            </td>  
            <?php if($mobile!='true'){?>        
            </tr>
            <tr>
            <?php } ?>              
            <td>
            <?php if($user_tipo!='sist'){$phide=1;}; ?>
            <?php $pidtxt='acep3'; $pcaption='Acepta3 '; $ponclick='info_modu("PANT3",'.'document.getElementById("modu").value'.')'; $psize=$xfontsize;
//         include('vrbutton.php'); 
              ?>
            </td>  
            <?php if($mobile!='true'){?>        
            </tr>
            <tr>
            <?php } ?>              
            <td>
					<?php $pidtxt='imprim'; $pcaption='Imprimir '; $ponclick='info_modu("IMPR1",'.'document.getElementById("modu").value'.')'; $psize=$xfontsize; include('vrbutton.php'); ?>
            </td>  
            <?php if($mobile!='true'){?>        
            </tr>
            <tr>
            <?php } ?>              
            <td>
            

          <?php if(@mb_stristr('sist',$user_tipo) or $cfg_empr=='tfle')
                   { ?>            
                <?php 
                  $pidtxt='nueva'; $pcaption='Nuevo ';
            $ponclick='';
            $ponclick.="crea_docu(document.getElementById('docu').value);"; 
            $ponclick.="info_modu('PANT1',document.getElementById('docu').value);"; 
                  $psize=$xfontsize; include('vrbutton.php');
                 ?>
                
            <?php } ?>
              </td>
            <tr>
                <td><div id='idnum_creadocu'style='display:none;'></div></td>
            </tr>
            <?php if($mobile=='true'){?>        
              <tr><td><br></td></tr>
            <?php } ?>              
              
            </table>
         </td>

				</tr>	
			</table>
		<?php } ?>
		</div>	
		<div id="pant1" style="border:solid 1px; overflow:auto; font-family:arial;">
		<div id="tpant1b"></div>
    </div>
		<hr>
		<div id="pant11" style="border:solid 1px; overflow:auto; font-family:arial; display:none;"></div>
		<div id="pant2"  style="border:solid 1px; overflow:auto; font-family:arial; display:none;
					<?php if($orient=='V'){echo'min-height:'.($hpant2-75).'px;';}
                                 else{echo'min-height:'.($hpant2-90).'px;';}  ?> 
					<?php if($orient=='V'){echo'height:'.($hpant2-75).'px;';}
                                 else{echo'height:'.($hpant2-40).'px;';}  ?> 
           "></div>
		<div id="pant9"></div>
<?php } ?>			

<?php if(mb_stristr('PANT1.IMPR1',$pant)){ ?>
<?php 
  $sql_stat ='update '.$tabla.'1 set status="-" ';
  $sql_stat.=' where (status="" or status is null) ';
  $sql_stat.=' and (fecha between "'.$fecha1.'" and "'.$fecha2.'")';
//   mysql_query($sql_stat,$link_vcrx); 
?>

	<?php
    { 
// 		$sql_pant ='select * from '.$tabla.'12 ';
// 		$sql_pant.=' where (fecha between "'.$fecha1.'" and "'.$fecha2.'")';
// 		$sql_pant.=' and (numero between "'.$numero1.'" and "'.$numero2.'")';
   if($modu=='CONT')
   {
     
      $sql_where=' status!="X"';
//       $sql_where.=' fecha<="'.$fecha2.'"';
      if($ctas!=''){$sql_where.=' and ctas like "'.$ctas.'%"';}
      if($csub!=''){$sql_where.=' and csub like "'.$csub.'%"';}
     
//       if(mb_stristr('ssss.ssnn',$repo))
      {
        $sql_where.=' and status!="O"';
        if(mb_stristr('ssff',$repo)){$sql_where.=' and substring(ctas,1,1) in(1,2,3) ';}
        if(mb_stristr('rrii',$repo)){$sql_where.=' and substring(ctas,1,1) in(4,5,6) ';}
        
        $sql_pant='select cont12.*,';
        $sql_pant.=$nivel.' as nivel,';
        $sql_pant.='ctan'.$nivel.' as ctas_codi,';
        $sql_pant.='descri'.$nivel.' as ctas_desc,';
//         if(mb_stristr('ssss.ssnn',$repo))
        {
          $sql_pant.='sum(case when fecha<"'.$fecha1.'" then tcant end) as saldoi, ';
          $sql_pant.='sum(case when fecha>="'.$fecha1.'" and fecha<="'.$fecha2.'" then tdebito end) as stdebito, ';
          $sql_pant.='sum(case when fecha>="'.$fecha1.'" and fecha<="'.$fecha2.'" then tcredito end) as stcredito, ';
        }
        $sql_pant.='sum(tcant) as saldo';
        $sql_pant.=' from cont12';
        $sql_pant.=' where '.$sql_where;      

        $sql_tpant=$sql_pant;
        
        $sql_tpant1=$sql_pant;
        $sql_tpant1.=' group by ctan1 ';
        $sql_tpant1.=' order by ctan1 ';

        $sql_pant.=' group by ctan'.$nivel;
        
        if(mb_stristr('ssnn.ssff.rrii',$repo))
        {
          $xfniv=$nivel-1;	
          while ($xfniv>0)
          {
            $sql_pant.=' union ';
            $sql_pant.='select cont12.*,';
            $sql_pant.=$xfniv.' as nivel,';
            $sql_pant.='ctan'.$xfniv.' as ctas_codi,';
            $sql_pant.='descri'.$xfniv.' as ctas_desc,';
//             if(mb_stristr('ssss.ssnn',$repo))
            {
              $sql_pant.='sum(case when fecha<"'.$fecha1.'" then tcant end) as saldoi, ';
              $sql_pant.='sum(case when fecha>="'.$fecha1.'" and fecha<="'.$fecha2.'" then tdebito end) as stdebito, ';
              $sql_pant.='sum(case when fecha>="'.$fecha1.'" and fecha<="'.$fecha2.'" then tcredito end) as stcredito, ';
            }
            $sql_pant.='sum(tcant) as saldo ';
            $sql_pant.='from cont12 ';
            $sql_pant.='where '.$sql_where;
            $sql_pant.=' group by ctan'.$xfniv;
            $xfniv--;
          }	
        }
        $sql_pant.=' order by ctas_codi ';
        
      }
     
   }
      
     
    if($user_cons==0)
    {$sql_pant='';$sql_tpant='';}
      
    $res_pant=mysql_query($sql_pant,$link_vcrx);
		$res_tpant=mysql_query($sql_tpant,$link_vcrx);
    if(mb_stristr('ssff.rrii',$repo))
    {$res_tpant1=mysql_query($sql_tpant1,$link_vcrx);}

		$docuok=@mysql_result($res_tpant,0,'docuok');
		$mconcepto=@mysql_result($res_tpant,0,'mconcepto');
		$mdetalle=@mysql_result($res_tpant,0,'mdetalle');
		$tcant=@mysql_result($res_tpant,0,'stcant');
		$tsubt=@mysql_result($res_tpant,0,'stsubt');
		$lconcepto=@mysql_result($res_tpant,0,'lconcepto');
      

		if($docuiimp==1)
		{
			$tsubtiva0=@mysql_result($res_tpant,0,'stsubtiva0');
			$tsubtiva=@mysql_result($res_tpant,0,'stsubtiva');
			$tdcto=@mysql_result($res_tpant,0,'stdcto');
			$tssid=@mysql_result($res_tpant,0,'stssid');
			$tprop=@mysql_result($res_tpant,0,'stprop');
			$tice=@mysql_result($res_tpant,0,'stice');
			$tiva=@mysql_result($res_tpant,0,'stiva');
			$tirbp=@mysql_result($res_tpant,0,'stirbp');
		}

		if(@mb_stristr('comp',$tabla))
		{
			$trrta=@mysql_result($res_tpant,0,'srrta');
			$triva=@mysql_result($res_tpant,0,'sriva');
		}			

//     $docudocu  
		if(@mb_stristr('retc.retp.rete',$tabla))
		{
			$mcair=@mysql_result($res_tpant,0,'mcair');
			$tbrta=@mysql_result($res_tpant,0,'sbrta');
			$tbiva=@mysql_result($res_tpant,0,'sbiva');
			$tprta=@mysql_result($res_tpant,0,'sprta');
			$tpiva=@mysql_result($res_tpant,0,'spiva');
			$trrta=@mysql_result($res_tpant,0,'srrta');
			$triva=@mysql_result($res_tpant,0,'sriva');
      
      $mconcepto='';
      $mdetalle='';
		}

      
		if(@mb_stristr('cont',$tabla))
		{
			$mcsub=@mysql_result($res_tpant,0,'mcsub');
			$mcair=@mysql_result($res_tpant,0,'mcair');
			$mitem=@mysql_result($res_tpant,0,'mitem');
			$tsaldoi=@mysql_result($res_tpant,0,'saldoi');
			$tsaldo=@mysql_result($res_tpant,0,'saldo');
			$tdebito=@mysql_result($res_tpant,0,'stdebito');
			$tcredito=@mysql_result($res_tpant,0,'stcredito');
			$tdiferencia=@mysql_result($res_tpant,0,'sdiferencia');
		}			

		if(@mb_stristr('inve.prod',$tabla))
		{
			$mserie=@mysql_result($res_tpant,0,'mserie');
			$mlote=@mysql_result($res_tpant,0,'mlote');
		}			

      
		$total=@mysql_result($res_tpant,0,'stotal');
		$tdocu=@mysql_num_rows($res_pant);
      
    if(@mb_stristr('guia',$tabla))
    {
      $tsubt=0;
    }
      
    if(@mb_stristr('atvd.plan',$tabla))
    {
      $tsubt=0;
      $total=0;
    }
      
    if($docux=='IEBX')
    {
      $ver_doco=0;
      $tsubt=0;
      $total=0;
    }

      
// 		if($dispcolu=='true')
		if($dispcolu==0)
		{
			$tsubt=0;
			$tsubtiva=0;	
			$tsubtiva0=0;
			$tdcto=0;
			$tssid=0;
			$tprop=0;
			$tiva=0;
			$tice=0;
			$tirbp=0;

			$trrta=0;
			$triva=0;
		}

	
	}	?>

	
	<?php $crow=0; ?>
	<?php $ccol=0; ?>
	<?php $tnumero=0; ?>
	<?php //echo '***'.date('H:i:s') .'<br>';?>
  
  
	<pant1>
    
<?php if(mb_stristr('PANT3.IMPR3',$pant)){$mconcepto.=$mdetalle;} ?> 
    
<?php if(mb_stristr('IMPR1.IMPR3',$pant)){ ?>
<?php $xfontsize=$xfontsize*(1.2); ?>  
<?php $xfontfamily='font-family:arial;';  ?>
    
<!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 strtoupper($cfg_empr).' -  '.r_fiel('docu',$docu); ?></title>
<style type="text/css">
p.saltodepagina{page-break-after: always;}
#header{display:none;}
@font-face{font-family:'Barcode'; src:url('/_font/BarcodeFont.ttf') format('truetype');}
barcode{font-family:'Barcode';}
@media print {.noprint {display:none}}
@media screen{.noscreen {display:none}}
	
  /* 	top right bottom left */
@page
{
  size: A4 <?php if($pant=='IMPR3'){echo 'landscape';}else{echo 'portrait';} ?>;
  margin: 10mm 5mm 10mm 5mm;
}
</style>
</head>
<body>
<div style="font-size:<?php echo $xfontsize; ?>;<?php echo $xfontfamily;?> width:; ">
<?php 
  $repodes='INFORME';
  if($modu=='CONT' and $repo=='ssss'){$repodes='SUMAS Y SALDOS';}
  if($modu=='CONT' and $repo=='ssnn'){$repodes='SUMAS Y SALDOS (X NIVEL)';}
  if($modu=='CONT' and $repo=='ssff'){$repodes='SITUACION FINANCIERA';}
  if($modu=='CONT' and $repo=='rrii'){$repodes='RESULTADO INTEGRAL';}
?>
  
<table id="titulos" class="pant1" border="0"
       align="center" cellpadding="3" width="100%"
       style="font-size:<?php {echo $xfontsize;} ?>px;
        border-collapse:collapse;background-color:snow; position:;"
        >
<tr style="background-color:<?php echo $gris1; ?>; border-top:solid 2px; border-bottom:solid 2px; font-weight:bold">
  <td width="20%" align="" style="font-size:<?php {echo $xfontsize*1.3;} ?>px;">
    <?php echo $repodes;  ?>
  </td>
  <td width="60%" align="center" style="font-size:<?php {echo $xfontsize*1.3;} ?>px;">
    <?php echo r_fiel('enti',$cfg_ruc).'<br> RUC : '.$cfg_ruc; ?>
  </td>
  <td width="20%" align="right" style="font-size:<?php {echo $xfontsize*.7;} ?>px;">
    <?php echo 'USUARIO : '.$user_codigo.' - '.r_fiel('user',$user_codigo); ?>
    <br>
    <?php echo 'FECHA : '.date('D d/M/y'); ?> 
    <br>
    <?php echo 'HORA : '.date('H:i:s'); ?> 
  </td>
</tr>
</table>  
  
<table id="filtros" class="pant1" border="0"
       align="center" cellpadding="3" width="100%"
       style="font-size:<?php {echo $xfontsize*.75;} ?>px;
        border-collapse:collapse;background-color:snow; position:;"
        >
<tr>
  <td width="50%" valign="top">
    <table id="" class="" border="1"
       align="center" cellpadding="3" width="100%"
       style="font-size:<?php {echo $xfontsize;} ?>px;
        border-collapse:collapse;background-color:snow; position:;">
      <tr style="background-color:<?php echo $gris1; ?>;">
        <td align="center" colspan="2" style="font-weight:bold;">FILTROS</td>
      </tr>  
      <tr>
        <td style="font-weight:bold;">FECHAS </td>
        <td><?php echo date('d/M/y',strtotime($fecha1)).' - '.date('d/M/y',strtotime($fecha2)); ?></td>
      </tr>  
      <tr style="display:none;">
        <td width="20%"  style="font-weight:bold;"  >DOCUMENTO</td>
        <td style="font-weight:bold;"><?php echo $docu.' - '.r_fiel('docu',$docu); ?></td>
      </tr>  
      <?php if(mb_stristr('comp.retp.retc',$tabla)){ ?>
      <tr>
        <td style="font-weight:bold;">PTO.EMISION</td>
        <td><?php if($ptoe==''){echo 'TODOS';}else{echo r_fiel('ptoe',$ptoe);}; ?></td>
      </tr>  
      <?php } ?>
      <?php if(mb_stristr('vtas.clie.carr',$tabla)){ ?>
      <tr>
        <td style="font-weight:bold;">PTO.VENTA</td>
        <td><?php if($ptov==''){echo 'TODOS';}else{echo r_fiel('ptov',$ptov);}; ?></td>
      </tr>  
      <?php } ?>
      <?php if(mb_stristr('caja',$tabla)){ ?>
      <tr>
        <td style="font-weight:bold;">CAJA</td>
        <td><?php if($caja==''){echo 'TODOS';}else{echo r_fiel('caja',$caja);}; ?></td>
      </tr>  
      <?php } ?>
      <?php if(mb_stristr('bcos',$tabla)){ ?>
      <tr>
        <td style="font-weight:bold;">CTA.BANC.</td>
        <td><?php if($ctab==''){echo 'TODOS';}else{echo r_fiel('ctab',$ctab);}; ?></td>
      </tr>  
      <?php } ?>
      <?php if(mb_stristr('inve.prod',$tabla)){ ?>
      <tr>
        <td style="font-weight:bold;">BODEGA</td>
        <td><?php if($bode==''){echo 'TODOS';}else{echo r_fiel('bode',$bode);}; ?></td>
      </tr>  
      <?php } ?>
      <tr style="display:none;">
        <td style="font-weight:bold;">NUMEROS</td>
        <td><?php echo $numero1.' - '.$numero2; ?></td>
      </tr>  
      <?php if(mb_stristr('vtas.comp.clie.prov.inve.nomi.',$tabla)){ ?>
      <tr>
        <td style="font-weight:bold;"><?php echo $entilabel?></td>
        <td><?php if($enti==''){echo 'TODOS';}else{echo $enti;}; ?></td>
      </tr>  
      <?php } ?>
      <?php if(mb_stristr('cont.comp',$tabla)){ ?>
      <tr>
        <td style="font-weight:bold;"><?php echo 'CUENTAS'?></td>
        <td><?php if($ctas==''){echo 'TODOS';}else{echo $ctas.' - '.r_fiel('ctas',$ctas);}; ?></td>
      </tr>  
      <?php } ?>
      <?php if($cair!=''){ ?>
      <tr>
        <td style="font-weight:bold;">CAIR</td>
        <td><?php echo $cair.' - '.r_fiel('cair0',$cair); ?></td>
      </tr>  
      <?php } ?>
      <?php if($vhcl!=''){ ?>
      <tr>
        <td style="font-weight:bold;">VEHICULO</td>
        <td><?php echo $vhcl.' - '.r_fiel('vhcl',$vhcl); ?></td>
      </tr>  
      <?php } ?>
      <?php if($placa!=''){ ?>
      <tr>
        <td style="font-weight:bold;">PLACA</td>
        <td><?php echo $placa.' - '.r_fiel('vhcl',$placa); ?></td>
      </tr>  
      <?php } ?>
      <tr style="display:none;">
        <td style="font-weight:bold;">STATUS</td>
        <td><?php if($stat==''){echo 'TODOS';}else{echo r_fiel('stat',$stat);}; ?></td>
      </tr>  
    </table>
  </td>
  <td width="50%" valign="top">
    <table id="" class="" border="1"
       align="center" cellpadding="3" width="100%"
       style="font-size:<?php {echo $xfontsize;} ?>px;
        border-collapse:collapse;background-color:snow; position:;">
      <tr align="center" style="background-color:<?php echo $gris1; ?>;">
        <td colspan="2" style="font-weight:bold;">RESUMEN</td>
      </tr>  
      <tr align="right" style="display:none;">
        <td style="font-weight:bold;"><?php if($pant=='IMPR1'){echo 'DOCUMENTOS';}else{echo 'REGISTROS';}?></td>
        <td width="20%" style="font-weight:bold;" align="center"><?php echo $tdocu; ?></td>
      </tr>  
      <?php if($tabla=='cont'){ ?>
          <?php if(mb_stristr('ssss.ssnn',$repo)){ ?>
              <tr align="right">
                <td style="font-weight:bold;">INICIAL</td>
                <td><?php echo number_format(abs($tsaldoi),2); ?></td>
              </tr>
              <tr align="right">
                <td style="font-weight:bold;">DEBITOS</td>
                <td><?php echo number_format(abs($tdebito),2); ?></td>
              </tr>
              <tr align="right">
                <td style="font-weight:bold;">CREDITOS</td>
                <td><?php echo number_format(abs($tcredito),2); ?></td>
              </tr>
              <tr align="right">
                <td style="font-weight:bold;">SALDO</td>
                <td><?php echo number_format(abs($tsaldo),2); ?></td>
              </tr>
              <?php $total=abs($tdebito)-abs($tcredito);?>
              <?php $tsubt=0;?>
          <?php } ?>
          <?php if(mb_stristr('ssff.rrii',$repo)){ ?>
      <?php //echo explain_sql($sql_tpant1);?>
              <?php while($aso_tpant1=@mysql_fetch_assoc($res_tpant1)){ ?>
                <?php $ctas_codi=$aso_tpant1['ctas_codi']; ?>
                <?php $ctas_desc=$aso_tpant1['descri1']; ?>
                <?php $ctas_sald=$aso_tpant1['saldo']; ?>
                <?php if(mb_stristr('rrii',$repo)){$ctas_sald=$ctas_sald*(-1);} ?>
                <tr align="right">
                  <td style="font-weight:bold;"><?php echo $ctas_desc?></td>
                  <td><?php echo number_format($ctas_sald,2); ?></td>
                </tr>
              <?php } ?>
          <?php } ?>
      <?php } ?>
      <tr align="right" style="display:none;">
        <td style="font-weight:bold;">CANTIDAD</td>
        <td align="right"><?php echo number_format($tcant,2); ?></td>
      </tr>  
			<?php if(!@mb_stristr('retc.retp.rete.cont',$tabla)){?>
      <tr align="right">
        <td style="font-weight:bold;">SUB-TOT</td>
        <td><?php echo number_format(abs($tsubt),2); ?></td>
      </tr>  
      <?php } ?>
      <?php if($tdcto!=0){ ?>
      <tr align="right">
        <td style="font-weight:bold;">DESCUENTOS</td>
        <td><?php echo number_format($tdcto,2); ?></td>
      </tr>
      <?php } ?>
      <?php if($tssid!=0){ ?>
      <tr align="right">
        <td style="font-weight:bold;">SUBSIDIO</td>
        <td><?php echo number_format($tssid,2); ?></td>
      </tr>
      <?php } ?>
      <?php if($tice!=0){ ?>
      <tr align="right">
        <td style="font-weight:bold;">ICE</td>
        <td><?php echo number_format($tice,2); ?></td>
      </tr>
      <?php } ?>
      <?php if($tsubtiva0!=0){ ?>
      <tr align="right">
        <td style="font-weight:bold;">SUB-TOT IVA 0</td>
        <td><?php echo number_format($tsubtiva0,2); ?></td>
      </tr>
      <?php } ?>
      <?php if($tsubtiva!=0){ ?>
      <tr align="right">
        <td style="font-weight:bold;">SUB-TOT IVA</td>
        <td><?php echo number_format($tsubtiva,2); ?></td>
      </tr>
      <?php } ?>
      <?php if($tiva!=0){ ?>
      <tr align="right">
        <td style="font-weight:bold;">IVA</td>
        <td><?php echo number_format($tiva,2); ?></td>
      </tr>
      <?php } ?>
      <?php if($tbrta!=0){ ?>
      <tr align="right">
        <td style="font-weight:bold;">BASE RENTA</td>
        <td><?php echo number_format($tbrta,2); ?></td>
      </tr>
      <tr align="right">
        <td style="font-weight:bold;">RET. RENTA</td>
        <td><?php echo number_format($trrta,2); ?></td>
      </tr>
      <?php } ?>
      <?php if($tbiva!=0){ ?>
      <tr align="right">
        <td style="font-weight:bold;">BASE IVA</td>
        <td><?php echo number_format($tbiva,2); ?></td>
      </tr>
      <tr align="right">
        <td style="font-weight:bold;">RET. IVA</td>
        <td><?php echo number_format($triva,2); ?></td>
      </tr>
      <?php } ?>
      <?php if(abs($total)>0.01){ ?>
      <tr align="right">
        <td style="font-weight:bold;"><?php if($tabla=='cont'){echo 'DIFER.';}else{echo 'TOTAL';} ?></td>
        <td style="font-weight:bold; <?php if($tdiferencia!=0){ echo 'color:red;';}?>"><?php echo number_format(abs($total),2); ?></td>
      </tr>
      <?php } ?>
    </table>
  </td>
</tr>  

</table>

<hr>
<?php } ?>  
<?php   //explain_sql($sql_pant);	?>
<?php //$dispcolu=0; ?>
<?php $tmaxwidth=''; ?>
  
<?php if($modu=='CONT'){ ?>  
		<table id="tpant1" class="pant1" border="0"
					 align="center" cellpadding="3" width="100%"
					 style="font-size:<?php if($orient=='V'){echo $xfontsize-8;}else{echo $xfontsize;} ?>px;
						border-collapse:collapse;background-color:snow; position:; <?php if($pant=='IMPR' and 1==2 ){echo 'max-width:210mm;';}?>"
						>
			<?php { // THEAD ?>
			<thead style="<?php echo $tdisplay; ?><?php if($mobile!='true'){echo 'max-width:'.($screenw-20).'px;';} ?>;background-color:<?php echo $gris1; ?>;">
				<tr style="border-top:solid 1px;border-bottom:solid 1px; cursor:pointer;" title="Reordenar">
          <?php if(substr($pant,0,4)=='PANT'){?>
					<th onclick="sortTable(this,0<?php $ccol++; ?>);" title="Imprimir">I</th>
          <?php } ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">CODIGO</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">CUENTA</th>
          <?php if(mb_stristr('ssss.ssnn',$repo)){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">INICIAL</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">DEBITOS</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">CREDITOS</th>
          <?php } ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">SALDO</th>
          <?php if(mb_stristr('ssss.ssnn',$repo)){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">VARIAC.</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">% VAR.</th>
          <?php } ?>
          <?php if(mb_stristr('ssff.rrii',$repo)){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">%</th>
          <?php } ?>
				</tr>
			</thead>
			<?php } ?>
      
      <?php $timew1=date('U'); ?>
      
			<?php  {// TBODY ?>
			<tbody id="tpant1b" valign="top" style="overflow-y:auto; <?php echo $tdisplay; ?>; 
							<?php if($orient=='V'){echo'min-height:'.($hpant1-7).'px;';}		else{echo'min-height:'.($hpant1-75).'px;';}  ?> 
							<?php if($orient=='V'){echo'height:'.($hpant1-7)*(2.4).'px;';}	else{echo'height:'.($hpant1-75)*(2.4).'px;';}  ?> 
							">
        <?php if(@mysql_num_rows($res_pant)==0){?>
          <tr><td style="font-weight:bold;">NO HAY DATOS PARA ESTA CONSULTA</td></tr>
        <?php }?>
        <?php if($docu==''){?>
<!--           <tr><td style="font-weight:bold;color:red;">DEBE ESPECIFICAR UN DOCUMENTO</td></tr> -->
        <?php }?>
        <?php if($user_cons==0){?>
          <tr><td style="font-weight:bold;color:red;">NO TIENE ACCESO PARA CONSULTAR ==> <?php echo $docu.' - '.r_fiel('docu',$docu);?></td></tr>
        <?php }?>

        <?php $last_codi=''; ?>
        <?php $last_base=0; ?>
        <?php $last_niv1=0; ?>
				<?php while($aso_pant=@mysql_fetch_assoc($res_pant)){ ?>
				<?php $status=$aso_pant['status']; ?>
        <?php $id_trfila=fillzero($crow);?> 
        <?php $lineaok=1;?>
          <?php $xcodi=$aso_pant['ctas_codi'];?>
          <?php $xsaldoi=$aso_pant['saldoi']; ?>
          <?php $xtdeb=$aso_pant['stdebito']; ?>
          <?php $xtcre=$aso_pant['stcredito']; ?>
          <?php $xsaldo=$aso_pant['saldo']; ?>
          <?php $xvarval=$xsaldo-$xsaldoi; ?>
          <?php $xvarpor=$xvarval/$xsaldoi*100; ?>
          <?php if(mb_stristr('rrii',$repo)){$xsaldo=$xsaldo*(-1);}?>

        <?php if(abs($xsaldoi)<=0.01 and abs($xtdeb)<=0.01 and abs($xtcre)<=0.01 and abs($xsaldo)<=0.01){$lineaok=0;} ?>
        <?php if($xcodi==$last_codi){$lineaok=0;} ?>
        
        
        <?php if($last_niv1!=substr($xcodi,0,1)){?>
        <?php $last_niv1=substr($xcodi,0,1); ?>
        <?php $last_base=$xsaldo; ?>
        <?php } ?>
          <?php $xporpar=$xsaldo/$last_base*100; ?>
        
        <?php if($lineaok==1){ ?>
				<?php $crow++; ?> 
        
				<tr id="tr_fila<?php echo $crow;?>" class="tr_fila"  <?php //if($mobile=='true'){echo 'height="55px"';};?>
						style="<?php if($crow%5==0){echo 'border-bottom:dotted 1px;'; } ?>
                   <?php if($status=='O'){echo 'text-decoration:line-through;'; } ?>
                   "
            <?php if(substr($pant,0,1)=='P'){?> 
						onmouseover="_filabg(event,'tr_fila','<?php echo $crow; ?>','');"
  					<?php } ?>
						onclick="_filabg(event,'tr_fila','<?php echo $crow; ?>','');
                    <?php if(substr($pant,0,1)=='P'){?> 
                    {if(document.getElementById('detadocu').checked)
										{info_modu('PANT2','CONT','<?php echo $aso_pant['codigo']; ?>');}}
                    <?php } ?> 
										<?php if($touchs=='true'){?>
										<?php } ?>
										 "
						>

          
            <?php if(substr($pant,0,4)=='PANT'){?>
            <td align="center" title="Imprimir : <?php echo $xcodi; ?>">
              <?php 
                  $pidtxt='impri'.$crow;
                  $pcaption="Imprimir"; $pabrev="I";
                  include('vrbutton.php');
  //                echo '<a href="?prnt=1&docu='.$aso_pant['docu'].'&idnum='.$aso_pant['idnum1'].'" target="_blank">';
  //                if($mobile=='true'){echo intval($aso_pant['numero']);}
  //                else{echo $aso_pant['numero'];}
  //                echo '</a>';
              ?>
            </td>
            <?php } ?>
            <td>
              <div style="display:none;"><?php echo $xcodi.'0000000000000' ?></div>
              <?php echo $xcodi; ?>
            </td>
            <td>
              <div style="display:none;"><?php echo $aso_pant['ctas_desc'].'0000000000000'.$xcodi ?></div>
              <?php echo $aso_pant['ctas_desc']; ?>
            </td>
          <?php if(mb_stristr('ssss.ssnn',$repo)){ ?>
            <td align="right">
              <div style="display:none;"><?php echo fillzero($xsaldoi,15); ?></div>
              <?php echo number_format($xsaldoi,2); ?>
            </td>
            <td align="right">
              <div style="display:none;"><?php echo fillzero($xtdeb,15); ?></div>
              <?php echo number_format($xtdeb,2); ?>
            </td>
            <td align="right">
              <div style="display:none;"><?php echo fillzero($xtcre,15); ?></div>
              <?php echo number_format($xtcre,2); ?>
            </td>
          <?php } ?>
            <td align="right">
              <div style="display:none;"><?php echo fillzero($xsaldo,15); ?></div>
              <?php echo number_format($xsaldo,2); ?>
            </td>
          <?php if(mb_stristr('ssss.ssnn',$repo)){ ?>
            <td align="right">
              <div style="display:none;"><?php echo fillzero($xvarval,15); ?></div>
              <?php echo number_format($xvarval,2); ?>
            </td>
            <td align="right">
              <div style="display:none;"><?php echo fillzero($xvarpor,15); ?></div>
              <?php echo number_format($xvarpor,2).'%'; ?>
            </td>
          <?php } ?>
          <?php if(mb_stristr('ssff.rrii',$repo)){ ?>
            <td align="right">
              <div style="display:none;"><?php echo fillzero($xporpar,15); ?></div>
              <?php echo number_format($xporpar,2).'%'; ?>
            </td>
          <?php } ?>
        </tr>
          <?php } ?>
				<?php } ?>
			</tbody>
		<?php } ?>	
  
      <?php $timew2=date('U'); ?>
      <?php { // FOOT ?>
			<tfoot style="<?php echo $tdisplay; ?><?php if($mobile!='true'){echo 'max-width:'.($screenw-20).'px;';} ?>;background-color:<?php echo $gris1; ?>; font-size:<?php echo $xfontsize*1;?>px;">
				<tr style="border-top:solid 1px;border-bottom:solid 1px;">

          <?php if(substr($pant,0,4)=='PANT'){?>
					<th <?php $ccol--; ?>></th>
          <?php } ?>
					<th <?php $ccol--; ?>><?php echo($crow); ?></th>
					<th <?php $ccol--; ?> style="max-width:;letter-spacing:5px; " >TOTALES</th>
          <?php if(mb_stristr('ssss.ssnn',$repo)){ ?>
					<th <?php $ccol--; ?> align="right">
						<?php echo number_format($tsaldoi,2); ?>
					</th>
					<th <?php $ccol--; ?> align="right">
						<?php echo number_format($tdebito,2); ?>
					</th>
					<th <?php $ccol--; ?> align="right">
						<?php echo number_format($tcredito,2); ?>
					</th>
          <?php } ?>
					<th <?php $ccol--; ?> align="right">
						<?php echo number_format($tsaldo,2); ?>
					</th>
          
          <?php if($ccol<0){$ccol=0;}?>
          <?php if(mb_stristr($pant,'PANT')){?>
          <?php echo str_repeat('<th></th>',$ccol); ?>
          <?php } ?>
				</tr>
        
        
			</tfoot>
			<?php } ?>	
		</table>
  
<?php } ?>
  

      <msgsistemas <?php if($user_tipo!='sist' or 1==1){echo 'style="display:none;"';} ?> >
      <?php
//       if($user_tipo=='sist')
      {
        echo ' Recs: '.($crow) ; 
        echo ' Segs: '.($timew2-$timew1); 
        echo ' Speed: '.@(number_format($crow/($timew2-$timew1),2)) .' r/s'; 
      }
      ?> 
      </msgsistemas>
    
  
<?php if(mb_stristr('IMPR',$pant)){ ?>
  
</div>	
</body>	
<?php //////////////////////////////////////////////////////////	?>

</html>

  
<?php } ?>  
  
    
    
	</pant1>

  <?php //echo '***'.date('H:i:s') .'<br>';?>
				
<?php } ?>			
		
<?php if(mb_stristr('PANT2',$pant)){ ?>
<?php {
	if(mb_stristr('retc.retp.rete',$tabla))
	{
		$sql_pant ='select * from '.$tabla.'12 where status!="O" and ';
		$sql_pant.='concat(numero,fecha,enti) in (select concat(numero,fecha,enti) as numero from '.$tabla.'1 where idnum1="'.$idnum1.'" )';
	}
	else
	{$sql_pant ='select * from '.$tabla.'12 where idnum1="'.$idnum1.'"';}

  $sql_pant.=' and( idnum1>0 and idnum1 is not null)';
    
  $sql_pant2=$sql_pant;
  $sql_pant2=str_replace('idnum1','idnum2',$sql_pant2);
  $sql_pant2=str_replace('*','*,fechadmy as fecha_descri ',$sql_pant2);
//   $sql_pant2=str_replace($tabla.'12',$tabla.'2',$sql_pant2);
  $iddet=$iddet*1;
  if($iddet>0){$sql_pant2.=' and iddet="'.$iddet.'"';}
  $sql_pant2.=' order by iddet desc';
 
	$sql_tpant =str_replace('select *','select *,'.$total_sql,$sql_pant);
	if(mb_stristr('retc.retp.rete',$tabla)){$sql_tpant.=' group by fecha,numero,enti';}
	else	{$sql_tpant.=' group by idnum1';}
    
// 	$res_pant=mysql_query($sql_pant,$link_vcrx); 
  {
    $res_tpant=mysql_query($sql_tpant,$link_vcrx); 
    $tsubt=mysql_result($res_tpant,0,'stsubt');
    $tcant=mysql_result($res_tpant,0,'stcant');
    $mdetalle=mysql_result($res_tpant,0,'mdetalle');
    $total=mysql_result($res_tpant,0,'stotal');

    //pcs1      
    $xmcntn=@mysql_result($res_tpant,0,'mcntn');
    //tgck
    $xmvhcl=@mysql_result($res_tpant,0,'mvhcl');
    
    if($docuiimp==1)
    {
      $tsubtiva0=mysql_result($res_tpant,0,'stsubtiva0');
      $tsubtiva=mysql_result($res_tpant,0,'stsubtiva');
      $tdcto=mysql_result($res_tpant,0,'stdcto');
      $tssid=mysql_result($res_tpant,0,'stssid');
      $tprop=mysql_result($res_tpant,0,'stprop');
      $tice=mysql_result($res_tpant,0,'stice');
      $tiva=mysql_result($res_tpant,0,'stiva');
      $tirbp=mysql_result($res_tpant,0,'stirbp');
    }

    if($tabla=='comp')
    {
      $trrta=mysql_result($res_tpant,0,'strrta');
      $triva=mysql_result($res_tpant,0,'striva');
    }

    if(mb_stristr('retc.retp.rete',$tabla))
    {
      $trrta=mysql_result($res_tpant,0,'srrta');
      $triva=mysql_result($res_tpant,0,'sriva');
    }
    
    if(mb_stristr('cont',$tabla))
    {
      $tdebito=mysql_result($res_tpant,0,'stdebito');
      $tcredito=mysql_result($res_tpant,0,'stcredito');
      $total=abs($tdebito)-abs($tcredito);
      $tdifer=abs($tdebito)-abs($tcredito);
    }
    
    if(mb_stristr('atvd.plan',$tabla))
    {
      $tsubt=0;
      $total=0;
    }
    
  }

}	?>
<pant11>
	<div style="border-top:solid 1px;font-size:<?php echo $xfontsize; ?>px;">
		<?php //echo date('H:i:s');?>
		<table border="0" width="<?php if($orient=='V'){echo '200%';}else{echo '100%';} ?>" cellpadding="2" 
						style="font-size:<?php if($orient=='V'){echo $xfontsize-12;}else{echo $xfontsize;} ?>px;
										max-height:<?php echo $hpant11-15; ?>px;
										border-collapse:collapse; background-color:<?php echo $gris1; ?>;">
			<tr valign="top" style="">
				<td width="1%">
      <?php //echo 	'***'.explain_sql($sql_tpant); ?>
				</td>
				<td style="font-weight:bold; font-size:80%" width="10%">
					<?php echo 'ID : '.@mysql_result($res_tpant,0,'idnum1'); ?>
          <br>
					<?php echo @mysql_result($res_tpant,0,'docu_descri'); ?>
          <br>
					<?php echo 'NUM: '.@mysql_result($res_tpant,0,'ptonumero'); ?>
				</td>
				<td>
					<div style="font-weight:bold;">
					<?php echo ''.substr(@mysql_result($res_tpant,0,'enti_descri'),0,200); ?>
					</div>
					<div style="font-size:<?php if($mobile=='true' and strlen(@mysql_result($res_tpant,0,'concepto')>100)){echo $xfontsize-16;}?>px" ;>
					<?php echo substr(@mysql_result($res_tpant,0,'concepto'),0,200); ?>
					</div>
				</td>
        
				<?php //if(@mb_stristr('vtas.retp.guia',$tabla) or @mb_stristr('FP03.FP11',$docu)){ ?>
				<?php if(@mb_stristr('vtas.retp.guia',$tabla)){ ?>
				<td style="font-weight:bold; font-size:80%" width="">
					<?php
            $claveacce=@mysql_result($res_tpant,0,'claveacc');
            $xambi=substr($claveacce,23,1);  
            $xambides='CLAVE : ';
            if($xambi==1){$xambides='PRUEBAS : ';}
            if($xambi==2){$xambides='PRODUCCION : ';}
//             if($claveacce!='')
            {echo $xambides.$claveacce;}
          ?>
				</td>
        <?php } ?>
        
				<?php if(@mb_stristr('vtas.comp',$tabla) and substr($docu,0,1)=='F'){ ?>
        <?php $xsaldo = sal_docu($docu,$idnum1); ?>
        <?php $xreten = sal_docu($docu,$idnum1,3); ?>
        <?php $xabono = $total-$xsaldo-$xreten; ?>
        
				<?php if($tabla=='comp' and $empr_cont==1){ ?>
				<td style="font-size:<?php echo $xfontsize*.80;?>px;">
            <table width="100%" cellpadding="2" border="0"
               style="font-size:<?php if($mobile=='true'){echo $xfontsize-8;}else{echo $xfontsize*.80;} ?>px; 
                      border-collapse:collapse; background-color:<?php echo $gris1; ?>;">
              <tr>
                <td align="right" style="font-weight:bold;">S.COMP.:</td>
                <td><?php echo @mysql_result($res_tpant,0,'suco_descri'); ?></td>
              </tr>
              <tr>
                <td align="right" style="font-weight:bold;">F.PAGO:</td>
                <td><?php echo @mysql_result($res_tpant,0,'fpag_descri'); ?></td>
              </tr>
              <tr>
                <td align="right" style="font-weight:bold;">No.Aut.:</td>
                <td><?php echo @mysql_result($res_tpant,0,'atrz').@mysql_result($res_tpant,0,'autornum'); ?></td>
              </tr>
            </table>
				</td>
          <?php if($xreten==0){ ?>
          <td align="right" width="1%">
            <table width="100%" cellpadding="2" border="0"
               style="font-size:<?php if($mobile=='true'){echo $xfontsize-8;}else{echo $xfontsize*.80;} ?>px; 
                      border-collapse:collapse; background-color:<?php echo $gris1; ?>;">
              <tr>
                <td align="right" style="font-weight:bold;">Ret.RTA.:</td>
                <td align="right"><?php echo number_format(@mysql_result($res_tpant,0,'prrta'),2); ?></td>
              </tr>
              <tr>
                <td align="right" style="font-weight:bold;">Ret.IVA.:</td>
                <td align="right"><?php echo number_format(@mysql_result($res_tpant,0,'priva'),2); ?></td>
              </tr>
            </table>
          </td>
          <?php } ?>
				<?php } ?>
				<td align="right" width="1%">
      		<table width="100%" cellpadding="2" border="0"
						 style="font-size:<?php if($mobile=='true'){echo $xfontsize-8;}else{echo $xfontsize*.80;} ?>px; 
										border-collapse:collapse; background-color:<?php echo $gris1; ?>;">
            <tr>
              <td align="right" style="font-weight:bold;">RETEN:</td>
              <td align="right"><?php echo number_format($xreten,2); ?></td>
            </tr>
            <tr>
              <td align="right" style="font-weight:bold;">ABONO:</td>
              <td align="right"><?php echo number_format($xabono,2); ?></td>
            </tr>
            <tr>
              <td align="right" style="font-weight:bold;">SALDO:</td>
              <td align="right"><?php echo number_format($xsaldo,2); ?></td>
            </tr>
	         </table>
			</td>
				<?php } ?>
        
        
				<?php if(@mb_stristr('cont',$tabla)) { ?>
				<td style="font-size:<?php echo $xfontsize*.80;?>px;">
            <table width="100%" cellpadding="2" border="0"
               style="font-size:<?php if($mobile=='true'){echo $xfontsize-8;}else{echo $xfontsize*.80;} ?>px; 
                      border-collapse:collapse; background-color:<?php echo $gris1; ?>;">
              <tr>
                <td align="right" style="font-weight:bold;">DEBITOS:</td>
                <td><?php echo number_format($tdebito,2); ?></td>
              </tr>
              <tr style="font-style:italic;">
                <td align="right" style="font-weight:bold;">CREDITOS:</td>
                <td><?php echo number_format($tcredito,2); ?></td>
              </tr>
              <tr>
                <td align="right" style="font-weight:bold;">DIFERENCIA:</td>
                <td><?php echo number_format($tdifer,2); ?></td>
              </tr>
            </table>
				</td>
				<?php } ?>
        

        
			</tr>
		</table>
	</div>
	<?php if($mobile=='true'){?>
	<div style="font-size:<?php echo $xfontsize; ?>px;">
		<table width="100%" cellpadding="2" border="0"
						 style="font-size:<?php if($mobile=='true'){echo $xfontsize-8;}else{echo $xfontsize;} ?>px;
										border-collapse:collapse; background-color:<?php echo $gris1; ?>;">
			<tr>
				<?php if($tsubt!=0){ ?><th align="center">SUBT:</th><?php }?>
				<?php if($tsubtiva0!=0){ ?><th align="center">SUBT-IVA0:</th><?php }?>
				<?php if($tsubtiva!=0){ ?><th align="center">SUBT-IVA:</th><?php }?>
				<?php if($tdcto!=0){ ?><th align="center">DCTO:</th><?php }?>
				<?php if($tssid!=0){ ?><th align="center">SSID:</th><?php }?>
				<?php if($tprop!=0){ ?><th align="center">PROP:</th><?php }?>
				<?php if($tice!=0){ ?><th align="center">ICE:</th><?php }?>
				<?php if($tiva!=0){ ?><th align="center">IVA:</th><?php }?>
				<?php if($tirbp!=0){ ?><th align="center">IRBP:</th><?php }?>
				<?php if($trrta!=0){ ?><th align="center">RENTA:</th><?php }?>
				<?php if($triva!=0){ ?><th align="center">IVA:</th><?php }?>
				<?php if($tdebito!=0){ ?><th align="center">DEBITOS:</th><?php }?>
				<?php if($tcredito!=0){ ?><th align="center">CREDITOS:</th><?php }?>
				<?php if($total!=0){ ?><th align="center">TOTAL:</th><?php }?>
			</tr>
			<tr>
					<?php if($tsubt!=0){ ?><td align="center"><?php echo number_format(abs($tsubt),2); ?></td><?php }?>
					<?php if($tsubtiva0!=0){ ?><td align="center"><?php echo number_format($tsubtiva0,2); ?></td><?php }?>
					<?php if($tsubtiva!=0){ ?><td align="center"><?php echo number_format($tsubtiva,2); ?></td><?php }?>
					<?php if($tdcto!=0){ ?><td align="center"><?php echo number_format($tdcto,2); ?></td><?php }?>
					<?php if($tssid!=0){ ?><td align="center"><?php echo number_format($tssid,2); ?></td><?php }?>
					<?php if($tprop!=0){ ?><td align="center"><?php echo number_format($tprop,2); ?></td><?php }?>
					<?php if($tice!=0){ ?><td align="center"><?php echo number_format($tice,2); ?></td><?php }?>
					<?php if($tiva!=0){ ?><td align="center"><?php echo number_format($tiva,2); ?></td><?php }?>
					<?php if($tirbp!=0){ ?><td align="center"><?php echo number_format($tirbp,2); ?></td><?php }?>
					<?php if($trrta!=0){ ?><td align="center"><?php echo number_format($trrta,2); ?></td><?php }?>
					<?php if($triva!=0){ ?><td align="center"><?php echo number_format($triva,2); ?></td><?php }?>
					<?php if($tdebito!=0){ ?><td align="center"><?php echo number_format($tdebito,2); ?></td><?php }?>
					<?php if($tcredito!=0){ ?><td align="center"><?php echo number_format($tcredito,2); ?></td><?php }?>
					<?php if($total!=0){ ?><td align="center"><?php echo number_format(abs($total),2); ?></td><?php }?>
			</tr>
		</table>
	</div>
	<?php } ?>

<div id="pant11a" style="display:none">
  <?php 
    $res_pant2=mysql_query($sql_pant2,$link_vcrx);
    if(mysql_num_rows($res_pant2)==0)
    {
      $sql_pant2=substr($sql_pant2,0,strpos($sql_pant2,'and iddet')).' '.substr($sql_pant2,strpos($sql_pant2,'order by'));
      $res_pant2=mysql_query($sql_pant2,$link_vcrx);
    }
    $campo=''; 
    $cfield=mysql_num_fields($res_pant2);
    for($indx=0; $indx<$cfield; $indx++)
    {
      $nfield=mysql_field_name($res_pant2,$indx);
      $vfield=@mysql_result($res_pant2,0,$nfield);
      if(mb_stristr($vfield,'.')){$vfield=rtrim($vfield,'0'); $vfield.='0';}
      if(!empty($vfield))
      {
        $campo.='<input type="hidden" class="hdd"';
        $campo.='name="'.$nfield.'" ';
        $campo.='value="'.$vfield.'" ';
        $campo.='/>';
      }  
    }
    echo $campo;
  ?>
</div>
  
  
<div id="pant11b" style="display:none">
  <table border="0" cellpadding="0" cellspacing="0" align="right"
         style="
                border-collapse:collapse
								padding:0px;
								margin:0px;
								width:100%;
								max-width:100%;
								font-family:arial;
								font-weight:bold;
								font-size:<?php echo $xfontsize*1.2;?>px;
         ">
    <tr><td td width=""></td><td width="1%"></td></tr>
    <?php if($tsubt!=0){?>
    <tr>
      <td align="right">
        <input type="button" value="SUB-TOTAL" style="font-weight:bold;font-size:<?php echo $xfontsize;?>px;">
      </td>
      <td align="right" >
        <?php echo number_format(abs($tsubt),2);?>
      </td>
    </tr>
    <?php } ?>
    <?php if($tdcto!=0){?>
    <tr>
      <td align="right">
        <input type="button" value="DSCTO." style="font-weight:bold;font-size:<?php echo $xfontsize;?>px;">
      </td>
      <td align="right" >
        <?php echo number_format(abs($tdcto)*-1,2);?>
      </td>
    </tr>
    <?php } ?>
    <?php if($tssid!=0){?>
    <tr>
      <td align="right">
        <input type="button" value="SSID." style="font-weight:bold;font-size:<?php echo $xfontsize;?>px;">
      </td>
      <td align="right" >
        <?php echo number_format(abs($tssid)*-1,2);?>
      </td>
    </tr>
    <?php } ?>
    <?php if($tsubtiva0!=0){?>
    <tr>
      <td align="right">
        <input type="button" value="S-TOT.IVA 0%" style="font-weight:bold;font-size:<?php echo $xfontsize;?>px;">
      </td>
      <td align="right" >
        <?php echo number_format(abs($tsubtiva0),2);?>
      </td>
    </tr>
    <?php } ?>
    <?php if($tsubtiva!=0){?>
    <tr>
      <td align="right">
        <input type="button" value="S-TOT.IVA" style="font-weight:bold;font-size:<?php echo $xfontsize;?>px;">
      </td>
      <td align="right" >
        <?php echo number_format(abs($tsubtiva),2);?>
      </td>
    </tr>
    <?php } ?>
    <?php if($tprop!=0){?>
    <tr>
      <td align="right">
        <input type="button" value="PROP." style="font-weight:bold;font-size:<?php echo $xfontsize;?>px;">
      </td>
      <td align="right" >
        <?php echo number_format(abs($tprop),2);?>
      </td>
    </tr>
    <?php } ?>
    <?php if($tice!=0){?>
    <tr>
      <td align="right">
        <input type="button" value="ICE" style="font-weight:bold;font-style:italic;font-size:<?php echo $xfontsize;?>px;">
      </td>
      <td align="right" style="font-style:italic;">
        <?php echo number_format(abs($tice),2);?>
      </td>
    </tr>
    <?php } ?>
    <?php if($tiva!=0){?>
    <tr>
      <td align="right">
        <input type="button" value="IVA" style="font-weight:bold;font-style:italic;font-size:<?php echo $xfontsize;?>px;">
      </td>
      <td align="right" style="font-style:italic;">
        <?php echo number_format(abs($tiva),2);?>
      </td>
    </tr>
    <?php } ?>
    <?php if($tirbp!=0){?>
    <tr>
      <td align="right">
        <input type="button" value="IVA" style="font-weight:bold;font-style:italic;font-size:<?php echo $xfontsize;?>px;">
      </td>
      <td align="right" style="font-style:italic;">
        <?php echo number_format(abs($tirbp),2);?>
      </td>
    </tr>
    <?php } ?>
    <?php if($tdebito!=0){?>
    <tr>
      <td align="right">
        <input type="button" value="DEBITOS" style="font-weight:bold;font-size:<?php echo $xfontsize;?>px;">
      </td>
      <td align="right" style="">
        <?php echo number_format(abs($tdebito),2);?>
      </td>
    </tr>
    <?php } ?>
    <?php if($tcredito!=0){?>
    <tr>
      <td align="right">
        <input type="button" value="CREDITOS" style="font-weight:bold;font-style:italic;font-size:<?php echo $xfontsize;?>px;">
      </td>
      <td align="right" style="font-style:italic;">
        <?php echo number_format(abs($tcredito),2);?>
      </td>
    </tr>
    <?php } ?>
    <?php if($tdifer!=0){?>
    <tr>
      <td align="right">
        <input type="button" value="DIFERENCIA" style="font-weight:bold;font-size:<?php echo $xfontsize;?>px;">
      </td>
      <td align="right" style="color:red;">
        <?php echo number_format(($tdifer),2);?>
      </td>
    </tr>
    <?php } ?>
    
    <?php if($total!=0){?>
    <tr>
      <td align="right">
        <input type="button" value="TOTAL" style="font-weight:bold;font-size:<?php echo $xfontsize*1.5;?>px;">
      </td>
      <td align="right" style=" font-size:<?php echo $xfontsize*1.5;?>px;">
        <div style="min-width:<?php echo $xfontsize*3*2;?>px;;"></div>
        <?php echo ' '. number_format(abs($total),2);?>
      </td>
    </tr>
    <?php } ?>
  </table>
</div>
  
  
</pant11>

  
    
<pant2>
<?php $crow=0; ?>
<?php $ccol=0; ?>
<?php
  $sql_pant='select * from '.$tabla.'12 where idnum2="'.$idnum1.'" ';
  $sql_pant.=' order by iddet';
                                  
	if(@mb_stristr('retc.retp.rete',$tabla))
  {
	 $sql_pant ='select * from '.$tabla.'12 where status!="O" and concat(fecha,numero,enti) in ';	
	 $sql_pant.='(select concat(fecha,numero,enti) as numero from '.$tabla.'1 where idnum1="'.$idnum1.'") order by numer,cair';
	}
                                  
	if(@mb_stristr('acce',$tabla))
  {
    $sql_pant ='select * from '.$tabla.'12 ';	
    $sql_pant.='where idnum2="'.$idnum1.'" ';	
    $sql_pant.=' and docum_tabla !="" ';	
    $sql_pant.=' and docum_tabla is not null ';	
    $sql_pant.=' and docum in(select docu_codigo from docu0 where docu_status not in("I","X","O"))';    
    if($cfg_empr=='tfle')
    {
  //       $sql_pant.=' and docum_tabla not in("vtas","comp","inve","clie","prov","carr","nomi","csub","caja","bcos")';
        $sql_pant.=' and docum_tabla in("acce","plan","atvd","enti","xitem","asub")';
    }
    $sql_pant.='order by docum_tabla, docum';	
  } 
// 	if(mb_stristr('acce',$tabla)){$sql_pant.=' and docum in(select docu_codigo from docu0 where docu_status not in("I","X","O"))';}
	
//  	echo explain_sql($sql_tpant);
	$res_pant=mysql_query($sql_pant,$link_vcrx);	
?>
<?php $numrows=@mysql_num_rows($res_pant); ?>
<?php $ccol=0; ?>
  
	<table id="tpant2" class="pant2" align="left" border="0" cellpadding="3" width="100%"
				 style="font-size:<?php if($orient=='V'){echo $xfontsize-8;}else{echo $xfontsize;} ?>px;
								overflow-x:hidden;
								border-collapse:collapse;background-color:snow;"
						 >
		<?php { // THEAD ?>
		<thead style="<?php echo $tdisplay; ?>">
			<tr style="border-bottom:solid 1px;background-color:<?php echo $gris1; ?>;">
				<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Linea">L</th>
          <?php if($dispcolu!=0){?>
				<th style="<?php echo $ccol++; ?>">D</th>	
          <?php } ?>
				<?php if($tabla=='acce'){?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Modulo</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Codigo</th>
          <?php if($dispcolu!=0){?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Documento</th>
          <?php } ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Nuevo</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Modif</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Anular</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Elim</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Consul</th>
				<?php } ?>
				<?php if($docuitem==1){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Cantidad">Cant</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Código">Código</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Descripción">Descripción</th>
          <?php if($tabla!='guia'){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Prec.Unitario">P.Uni</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Sub-Total" style="<?php if($tsubt==0){echo'display:none;';}?>">Sub-Tot</th>			
  				<?php } ?>
				<?php } ?>
				<?php if($docuiimp==1){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($tdcto==0){echo'display:none;';}?> text-decoration:underline;">Dcto.</th>	
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($tssid==0){echo'display:none;';}?> text-decoration:underline;">SSid.</th>	
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($tprop==0){echo'display:none;';}?>">Prop.</th>	
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($tice==0){echo'display:none;';}?> font-style:italic;">ICE</th>	
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($tiva==0){echo'display:none;';}?> font-style:italic;">IVA</th>	
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($tirbp==0){echo'display:none;';}?> font-style:italic;">IRBP</th>
	<!-- 				<th onclick="sortTable(this,3);" title="Precio Unitario">PVP</th> -->
				<?php } ?>
				<?php if($docudocu==1){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Documento</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Numero</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Cantidad</th>
				<?php } ?>
				<?php if($docurete==1){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Documento</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Numero</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Base Imponible</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Impuesto</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">% Ret.</th>
				<?php } ?>
        <?php if($docuctas==1){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Cuenta</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Contable</th>
          <th onclick="sortTable(this,<?php echo $ccol++; ?>);">Debitos</th>
          <th onclick="sortTable(this,<?php echo $ccol++; ?>);">Creditos</th>
          <th onclick="sortTable(this,<?php echo $ccol++; ?>);">C.Sub</th>
				<?php } ?>        
        <?php if(@mb_stristr('atvd.plan',$tabla)){?>
          <?php {?>
          <th onclick="sortTable(this,<?php echo $ccol++; ?>);">
            <?php if($tabla=='atvd'){echo 'CLIENTE';}?>
            <?php if($tabla=='plan'){echo 'RECURSO';}?>
          </th>
          <th onclick="sortTable(this,<?php echo $ccol++; ?>);">LINEA</th>
          <th onclick="sortTable(this,<?php echo $ccol++; ?>);">ACTIVIDAD</th>
          <?php } ?>
          <th onclick="sortTable(this,<?php echo $ccol++; ?>);">HORAS</th>
          <th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($tsubt==0){echo'display:none;';} ?>">VALOR</th>
        <?php } ?>

				<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($tsubt==0){echo'display:none;';} ?>"><?php if($docuctas==1){echo '';}else{echo 'TOTAL';} ?></th>

        <?php if(mb_stristr('pcs1.prs1',$cfg_empr) and @mb_stristr('vtas',$tabla) and $xmcntn!=''){?>
				   <th onclick="sortTable(this,<?php echo $ccol++; ?>);">CNTN</th>
				   <th onclick="sortTable(this,<?php echo $ccol++; ?>);">DESDE</th>
				   <th onclick="sortTable(this,<?php echo $ccol++; ?>);">HASTA</th>
         <?php } ?>
        <?php if($cfg_empr=='tgck' and @mb_stristr('vtas',$tabla) and $xmvhcl!=''){?>
				   <th onclick="sortTable(this,<?php echo $ccol++; ?>);">VHCL</th>
         <?php } ?>
        
          <?php if($dispcolu!=0){?>
				<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="letter-spacing:5px;<?php if($mdetalle=='' ){echo'display:none;';}?>">DETALLE</th>
          <?php } ?>

        <?php if($empr_cont==1 and $tabla=='comp'){?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Cuenta</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Contable</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">CAIR</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">%Rta</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">%IVA</th>
				<?php } ?>
        <?php if(mb_stristr('inve.prod',$tabla) and $mobile!='true'){?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" >LOTE</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" ># SERIE</th>
				<?php } ?>
        <?php if($user_modi==1){?>
				<th width="10%" align="center"><?php$ccol++;?> 
					<span style="display:none;">ELIMINAR</span>
					<?php
//           $pidtxt='f_elim';  $pcaption='ELIMINAR TODO';  $psize=$xfontsize; if($mobile=='true' or 1==1){$pabrev="X";}; $psize=$xfontsize+3;
// 					$ponclick="if(confirm('Limpiar Detalle ?')){php_func('del_deta(".$idnum1.")');hoja_clie('PANT0');};";
// 					include('vrbutton.php');
          ?>
				</th>
        <?php }?>
			</tr>
		</thead>
		<?php } ?>
		<?php { // TBODY ?>
    
		<tbody id="bodytpant2" style="overflow-y:auto;border-bottom:solid 1px;<?php echo $tdisplay; ?> 
					<?php if($orient=='V'){echo'min-height:'.($hpant2-75).'px;';}else{echo'min-height:'.($hpant2*.7).'px;';}  ?> 
					<?php if($orient=='V'){echo'height:'.($hpant2-75).'px;';}else{echo'height:'.($hpant2*.7).'px;';}  ?>">
      <?php // explain_sql($sql_pant);?>
			<?php while($aso_pant=@mysql_fetch_assoc($res_pant)){ ?>
			<?php $crow++; ?>
			<?php $duni=$aso_pant['item_duni']; ?>
			<?php $dpre=$aso_pant['item_dpre']; ?>
			<?php $dval=$aso_pant['item_dval']; ?>
			<?php if($dval==0){$dval=2;} ?>
			<?php if($dpre==0){$dpre=2;} ?>
			<?php if($duni==0){$duni=0;} ?>
			<?php if(ceil($aso_pant['cant'])!=floor($aso_pant['cant']) and $duni==0){$duni=2;} ?>
      <?php $id_trfila = 'tr_filad'.fillzero($crow,4); ?>
			<tr id="tr_filad<?php echo $crow;?>" class="tr_filad" valign="top" 
						style="<?php if($crow%5==0){echo 'border-bottom:dotted 1px;'; } ?><?php if($crow==$numrows){echo 'border-bottom:solid 2px;'; } ?>
									 font-size:<?php if($orient=='V'){echo $xfontsize-8;}else{echo $xfontsize;}?>"
						onmouseover="_filabg(event,'tr_filad','<?php echo $crow; ?>','');"
						onclick="_filabg(event,'tr_filad','<?php echo $crow; ?>','');"
						>
        
				<td align="center" style="font-size:80%;">
					<span style="display:none;"><?php echo fillzero($crow); ?></span>
          
          
          
        <?php 
          if(!mb_stristr('FROX',$aso_pant['status'])
             and $aso_pant['stfin']!=1
             and ($user_anul==1 or $user_modi==1)
             and $aso_pant['autornum']=='' 
             and $tabla!='acce'
             and mb_stristr($pant,'PANT')
             and days_diff($aso_pant['fecha'],$fechaa)<=$dias_anul)
          {
              $pcaption='Editar : '.$aso_pant['docu'].'-'.$aso_pant['numero'].'-'.$aso_pant['iddet']; 
              $pidtxt='e_'.$crow.'_'.$iddet; $pname='itr_fila'; $psize=$xfontsize;
              $pidnum=$aso_pant['idnum1'];$pdocu=$aso_pant['docu'];
//               $ponclick="elim_docu('".$aso_pant['docu']."','".$aso_pant['idnum1']."','".$aso_pant['iddet']."','".$aso_pant['numero']."','tr_filad".$crow."');";
              $ponclick="{document.getElementById('iddet').value=".$aso_pant['iddet'].";gath_idnum();}";
              $pabrev=$aso_pant['iddet'];
              include('vrbutton.php');
        ?>
        <?php }else{?>
        <?php echo $aso_pant['iddet']; ?>
        <?php }?>
          
          
				</td>
        
        
        
          <?php if($dispcolu!=0){?>
				<td align="center">
					<?php //$pidtxt='radio'.'tr_filad'.$crow; $pname='rtr_filad'; $pcaption=''; $psize=$xfontsize; include('vrradio.php'); ?>
				</td>
          <?php } ?>
        
					 <?php if( $tabla=='acce'){?>
						<td align="center">
							<?php echo $aso_pant['docum_tabla']; ?>
						</td>
						<td align="center">
							<?php echo $aso_pant['docum']; ?>
						</td>
          <?php if($dispcolu!=0){?>
						<td align="left">
							<?php echo $aso_pant['docum_descri']; ?>
						</td>
          <?php } ?>
						<td align="center">
							<?php 
                $pidtxt='chknuev'.$aso_pant['idnum2'].$aso_pant['iddet'];$pdefa=$aso_pant['nuev'];
                $ptabla="acce2"; $pline=$aso_pant['idnum2'].'-'.$aso_pant['iddet'];$pcolu="nuev";
                if($user_modi==0){$preado=1;}                                   
                include('vrchkbox.php');
              ?>	
						</td>
						<td align="center">
							<?php 
                $pidtxt='chkmodi'.$aso_pant['idnum2'].$aso_pant['iddet'];$pdefa=$aso_pant['modi'];
                $ptabla="acce2"; $pline=$aso_pant['idnum2'].'-'.$aso_pant['iddet'];$pcolu="modi";
                if($user_modi==0){$preado=1;}                                   
                include('vrchkbox.php');
              ?>	
						</td>
						<td align="center">
							<?php 
                $pidtxt='chkanul'.$aso_pant['idnum2'].$aso_pant['iddet'];$pdefa=$aso_pant['anul'];
                $ptabla="acce2"; $pline=$aso_pant['idnum2'].'-'.$aso_pant['iddet'];$pcolu="anul";
                if($user_modi==0){$preado=1;}                                   
                include('vrchkbox.php');
              ?>	
						</td>
						<td align="center">
							<?php 
                $pidtxt='chkelim'.$aso_pant['idnum2'].$aso_pant['iddet'];$pdefa=$aso_pant['elim'];
                $ptabla="acce2"; $pline=$aso_pant['idnum2'].'-'.$aso_pant['iddet'];$pcolu="elim";
                if($user_modi==0){$preado=1;}                                   
                include('vrchkbox.php');
              ?>	
						</td>
						<td align="center">
							<?php 
                $pidtxt='chkcons'.$aso_pant['idnum2'].$aso_pant['iddet'];$pdefa=$aso_pant['cons'];
                $ptabla="acce2"; $pline=$aso_pant['idnum2'].'-'.$aso_pant['iddet'];$pcolu="cons";
                if($user_modi==0){$preado=1;}                                   
                include('vrchkbox.php');
              ?>	
						</td>
            <td></td>
						<?php } ?>
        
        
        
				<?php if($docuitem==1){ ?>
					<td align="center"><?php echo number_format(abs($aso_pant['cant']),$duni); ?></td>
					<td align="left"  title="<?php echo $aso_pant['itemce']; ?>" id="item<?php echo $aso_pant['iddet'];?>".>
						<?php echo $aso_pant['item']; ?>
					</td>
					<td align="left" title="<?php echo $aso_pant['itemce']; ?>"
								style="<?php if(strlen(trim($aso_pant['item_descri']))>20){echo 'font-size:'.($xfontsize*.8).'px';} ?>">
						<?php echo $aso_pant['item_descri']; ?>
					</td>
          <?php if($tabla!='guia'){ ?>
					<td align="right">
						<div style="display:none;"><?php echo fillzero($aso_pant['puni'],15); ?></div>
						<?php echo number_format(abs($aso_pant['puni']),$dpre); ?>
					</td>
					<td align="right" style="font-weight:bold;<?php if($tsubt==0){echo'display:none;';} ?>">
						<div style="display:none;"><?php echo fillzero($aso_pant['tsubt'],15); ?></div>
						<?php echo number_format(abs($aso_pant['tsubt']),$dval); ?>
					</td>
  				<?php } ?>
        <?php } ?>
				<?php if($docuiimp==1){ ?>
					<td align="right" style="<?php if($tdcto==0){echo'display:none;';}else{echo'text-decoration:underline;font-style:italic;';} ?>" title="<?php echo number_format(abs($aso_pant['dcto']),$dval).'%'; ?>">
						<div style="display:none;"><?php echo fillzero($aso_pant['tdcto'],15); ?></div>
						<?php echo number_format(abs($aso_pant['tdcto']),$dval); ?>
					</td>
					<td align="right" style="<?php if($tssid==0){echo'display:none;';}else{echo'text-decoration:underline;font-style:italic;';} ?>" title="<?php echo number_format(abs($aso_pant['ssid']),$dval).'%'; ?>">
						<div style="display:none;"><?php echo fillzero($aso_pant['tssid'],15); ?></div>
						<?php echo number_format(abs($aso_pant['tssid']),$dval); ?>
					</td>
					<td align="right" style="<?php if($tprop==0){echo'display:none;';} ?>font-style:italic;" title="<?php echo number_format(abs($aso_pant['prop']),$dval).'%'; ?>">
						<div style="display:none;"><?php echo fillzero($aso_pant['tprop'],15); ?></div>
						<?php echo number_format(abs($aso_pant['tprop']),$dval); ?>
					</td>
					<td align="right" style="<?php if($tice==0){echo'display:none;';} ?>font-style:italic;" title="<?php echo number_format(abs($aso_pant['ice']),$dval).'%'; ?>">
						<div style="display:none;"><?php echo fillzero($aso_pant['tice'],15); ?></div>
						<?php echo number_format(abs($aso_pant['tice']),$dval); ?>
					</td>
					<td align="right" style="<?php if($tiva==0){echo'display:none;';} ?>font-style:italic;" title="<?php echo number_format(abs($aso_pant['iva']),$dval).'%'; ?>">
						<div style="display:none;"><?php echo fillzero($aso_pant['tiva'],15); ?></div>
						<?php echo number_format(abs($aso_pant['tiva']),$dval); ?>
					</td>
					<td align="right" style="<?php if($tirbp==0){echo'display:none;';} ?>font-style:italic;" title="<?php echo number_format(abs($aso_pant['irbp']),$dval); ?>">
						<div style="display:none;"><?php echo fillzero($aso_pant['tirbp'],15); ?></div>
						<?php echo number_format(abs($aso_pant['tirbp']),$dval); ?>
					</td>
				<?php } ?>
				<?php if($docudocu==1 or $docurete==1){ ?>
				<?php $duni=2;$dval=2; ?>
				<?php if($dispcolu==0){$docum=$aso_pant['docum'];}else{$docum=$aso_pant['docum_descri'];} ?>
				<?php if($dispcolu==0){$numer=$aso_pant['numer'];}else{$numer=$aso_pant['ptonumer'];} ?>
        
					<td align="center" style=""><?php echo $docum; ?></td>
					<td align="center" style=""><?php echo $numer; ?></td>
					<td align="center"><?php echo number_format(abs($aso_pant['cant']),$duni); ?></td>
        <?php } ?>
        
  				<?php if($docurete==1){ ?>
					<?php
						$cair='('.$aso_pant['cair'].')';
// 						if($aso_pant['puni']>=30 and $cair<300)
						if($aso_pant['biva']>0)
						{$cair_descri='IVA';}
						else
						{$cair_descri=$aso_pant['cair_descri']; $cair='<br>'.$cair;}
					?>
					<td align="center"><?php echo $cair_descri.' '.$cair; ?></td>
				
					<?php if(ceil($aso_pant['puni'])==floor($aso_pant['puni'])){$dval=0;}else{$dval=2;}?>
					<td align="right"><div style="display:none;"><?php echo fillzero($aso_pant['puni'],15); ?></div>
						<?php echo number_format(abs($aso_pant['puni']),$dval).'%'; ?></td>
						<?php $duni=2;$dval=2; ?>
					
					<?php } ?>

	      <?php if($docuctas==1){ ?>        
          <td><?php echo $aso_pant['ctas']; ?></td>
          <td><?php echo $aso_pant['ctas_descri']; ?></td>
          <td align="right"><div style="display:none;"><?php echo fillzero(($aso_pant['tdebito']),15); ?></div>
            <?php echo number_format(abs($aso_pant['tdebito']),2); ?></td>
          <td align="right" style="font-style:italic;"><div style="display:none;"><?php echo fillzero(($aso_pant['tcredito']),15); ?></div>
            <?php echo number_format(abs($aso_pant['tcredito']),2); ?></td>
  <!--         <td></td> -->
          <td><?php echo $aso_pant['csub_descri']; ?></td>
          <?php //$total=0; ?>
        <?php } ?>
        <?php if(@mb_stristr('atvd.plan',$tabla)){?>
          <?php {?>

            <?php $asub=$aso_pant['asub'];  ?>
            <?php $asubd=r_fiel('asub',$asub);  ?>

            <?php $lsub1=r_fiel('asub',$asub,'lsub'); ?>
            <?php $lsub1d=r_fiel('lsub',$lsub1); ?>

            <?php $lsub2=substr($asub,0,4).'-0000'; ?>
            <?php $lsub2d=r_fiel('asub',$lsub2); ?>

            <?php $enti2_descri=r_fiel('enti',$aso_pant['enti2']); ?>
        
            <?php if(substr($pant,0,4)=='PANT'){?>
            <?php $enti2_descri=split_words($enti2_descri);?>
            <?php } ?>

          <td align="left"> 
            <?php echo $enti2_descri; ?>
          </td>
          <td align="left"> 
            <?php echo  $lsub1d.' / '.$lsub2d; ?>
          </td>
          <td align="left"  title="<?php echo $asub; ?>"> 
            <?php echo split_words($asubd); ?>
          </td>
          <?php } ?>
          <td align="center"> 
            <?php echo number_format($aso_pant['cant'],2); ?>
          </td>
          <?php if($dispcolu!=0){?>
          <td align="center" style="<?php if($tsubt==0){echo'display:none;';} ?>"> 
            <?php echo number_format($aso_pant['puni'],2); ?>
          </td>
          <?php } ?>
        <?php } ?>

					<td align="right" style="<?php if($tsubt==0 or $total==0){echo'display:none;';}else{echo 'font-weight:bold;';} ?>">
						<div style="display:none;"><?php echo fillzero(($aso_pant['total']),15); ?></div>
						<?php echo number_format(abs($aso_pant['total']),$dval); ?>
					</td>
        
          <?php if(mb_stristr('pcs1.prs1',$cfg_empr) and mb_stristr('vtas',$tabla) and $xmcntn!=''){?>
				  	<td align="center"><?php echo $aso_pant['cntn']; ?></td>
				  	<td align="center"><?php if($aso_pant['cntn']!=''){echo date('d/M/y',strtotime($aso_pant['cntnf1']));} ?></td>
				  	<td align="center"><?php if($aso_pant['cntn']!=''){echo date('d/M/y',strtotime($aso_pant['cntnf2']));} ?></td>
          <?php } ?>
        
          <?php if($cfg_empr=='tgck' and mb_stristr('vtas',$tabla) and $xmvhcl!=''){?>
				  	<td align="center"><?php echo $aso_pant['vhcl']; ?></td>
          <?php } ?>
        
          <?php if($dispcolu!=0){?>
          <td align="left" style="<?php if($mdetalle=='' ){echo'display:none;';} ?>
            <?php if(strlen(trim($aso_pant['detalle']))>20){echo 'font-size:'.($xfontsize*.8).'px';} ?>">
							<?php if(trim($aso_pant['detalle'])!=trim($aso_pant['item_descri'])){echo $aso_pant['detalle'];};?>
          </td>
          <?php } ?>
        

					 <?php if($empr_cont==1 and $tabla=='comp' and $mobile!='true'){?>
						<td align="left">
							<?php echo $aso_pant['ctas']; ?>
						</td>
						<td align="left">
							<?php echo $aso_pant['ctas_descri']; ?>
						</td>
						<td align="center" title="<?php echo $aso_pant['cair_descri']; ?>">
							<?php echo $aso_pant['cair']; ?>
						</td>
						<?php if(ceil($aso_pant['prrta'])==floor($aso_pant['prrta'])){$dpor=0;}else{$dpor=2;}?>
						<td align="center" 
								title="<?php echo number_format($aso_pant['rrta'],2).''; ?>">
							<?php echo number_format($aso_pant['prrta'],$dpor).''; ?>
						</td>
						<?php if(ceil($aso_pant['priva'])==floor($aso_pant['priva'])){$dpor=0;}else{$dpor=2;}?>
						<td align="center" 
								title="<?php echo number_format($aso_pant['riva'],2).''; ?>">
							<?php echo number_format($aso_pant['priva'],$dpor).''; ?>
						</td>
						<?php } ?>
        
        
					 <?php if(mb_stristr('inve.prod',$tabla) and $mobile!='true'){?>
						<td align="center" >
							<?php echo $aso_pant['numlote']; ?>
						</td>
						<td align="left" >
							<?php echo $aso_pant['numserie']; ?>
						</td>
						<?php } ?>
        
        
        
            <?php if(($user_anul==1 or $user_modi==1) and mb_stristr($pant,'PANT')){?>
						<td align="center" style="" >
            <?php              
						if(!mb_stristr('FROX',$aso_pant['status'])
               and $aso_pant['stfin']!=1
               and $aso_pant['autornum']=='' 
               and $tabla!='acce'
               and days_diff($aso_pant['fecha'],$fechaa)<=$dias_anul)
                {
                  $pcaption='Eliminar: '.$aso_pant['docu'].'-'.$aso_pant['numero'].'-'.$aso_pant['iddet']; $pabrev='X';
                  $pidtxt='x_'.$crow.'_'.$iddet; $pname='itr_fila'; $psize=$xfontsize;
                  $pidnum=$aso_pant['idnum1'];$pdocu=$aso_pant['docu'];
                  $ponclick="elim_docu('".$aso_pant['docu']."','".$aso_pant['idnum1']."','".$aso_pant['iddet']."','".$aso_pant['numero']."','tr_filad".$crow."');";
                  include('vrbutton.php');
                }
            ?>
						</td>
            <?php }?>
				</tr>
			<?php } ?>
			</tbody>	
		<?php } ?>
		<?php { // TFOOT ?>
			<tfoot id="detafoot" style="<?php echo $tdisplay; ?>">
				<tr style="border-top:solid 1px;background-color:<?php echo $gris1; ?>;">
          <th><?php$ccol--;?></th>
          <th><?php$ccol--;?> </th>
					 <?php if( $tabla=='acce'){?>
						<?php } ?>
				<?php if($docuiimp==1){ ?>
					<th><?php$ccol--;?><?php echo number_format($tcant,2); ?></th>
					<th><?php$ccol--;?></th>
					<th><?php$ccol--;?>TOTALES</th>
					<th><?php$ccol--;?></th>
					<th align="right" style="<?php if($tsubt==0){echo'display:none;';}?>"><?php$ccol--;?> <?php echo number_format($tsubt,2); ?></th>			
					<th align="right" style="<?php if($tdcto==0){echo'display:none;';}?>text-decoration:underline;"><?php$ccol--;?> <?php echo number_format($tdcto,2); ?></th>	
					<th align="right" style="<?php if($tssid==0){echo'display:none;';}?>text-decoration:underline;"><?php$ccol--;?> <?php echo number_format($tssid,2); ?></th>	
					<th align="right" style="<?php if($tprop==0){echo'display:none;';}?>"><?php$ccol--;?> <?php echo number_format($tprop,2); ?></th>	
					<th align="right" style="<?php if($tice==0){echo'display:none;';}?> font-style:italic;"><?php$ccol--;?> <?php echo number_format($tice,2); ?></th>	
					<th align="right" style="<?php if($tiva==0){echo'display:none;';}?> font-style:italic;"><?php$ccol--;?> <?php echo number_format($tiva,2); ?></th>	
					<th align="right" style="<?php if($tirbp==0){echo'display:none;';}?> font-style:italic;"><?php$ccol--;?> <?php echo number_format($tirbp,2); ?></th>
				<?php } ?>
				<?php if($docudocu==1){ ?>
					<th><?php$ccol--;?></th>
					<th><?php$ccol--;?></th>
				<?php } ?>
				<?php if($docurete==1){ ?>
					<th><?php$ccol--;?></th>
					<th><?php$ccol--;?></th>
					<th><?php$ccol--;?></th>
				<?php } ?>
          
          
				<?php if($docuctas==1){ ?>
					<th><?php$ccol--;?></th>
					<th><?php$ccol--;?></th>
					<th><?php$ccol--;?> <?php echo number_format($tdebito,2); ?></th>
					<th style="font-style:italic;"><?php$ccol--;?> <?php echo number_format($tcredito,2); ?></th>
				<?php } ?>

          <th align="right" style=""><?php$ccol--;?><?php echo number_format($total,2);?></th>
          
          <?php$ccol--;?>
          <?php if($ccol<0){$ccol=0;}?>
          <?php echo str_repeat('<th></th>',$ccol); ?>
        </tr>
			</tfoot>
		<?php } ?>
	</table>
		<?php //echo date('H:i:s');?>
</pant2>
		
<?php } ?>	
</resultado>

<?php $obstart = ob_get_clean(); ?>
<?php //$obstart = alltrim($obstart) ?>
<?php $obstart = limpiahtml($obstart) ?>
<?php $obstart = str_replace('border="0"','',$obstart); ?>
<?php //$obstart = str_replace('> ','>',$obstart); ?>
<?php //$obstart = str_replace(' <','<',$obstart); ?>
<?php $obstart = str_replace('align="left"','',$obstart); ?>
<?php $obstart = str_replace('title=""','',$obstart); ?>
<?php $obstart = str_replace('position:;','',$obstart); ?>
<?php $obstart = str_replace('" "','""',$obstart); ?>
<?php //$obstart = str_replace('" ','"',$obstart); ?>
<?php //$obstart = str_replace(' "','"',$obstart); ?>
<?php $obstart = str_replace('onclick=""','',$obstart); ?>
<?php if(mb_stristr('IMPR1.IMPR3',$pant)){ ?>
  <?php //$obstart = str_replace('display:block','',$obstart); ?>
  <?php $obstart=remove_href($obstart); ?>
<?php } ?>

<?php echo $obstart;	?>

		