<?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=(int)$iddet; ?>

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

<?php if(empty($xuser_cedula)){$xuser_cedula='9999999999';} ?>

<?php
if($modu!='' and $modu==$docu)
{$docu='';} 


?>

<?php $docux=$docu; ?>
<?php if($docux=='NOXX'){$docu='NO';} ?>
<?php if($docux=='FCXX'){$docu='FC'; $limit1=50; $cair='';} ?>
<?php if($docux=='PCXX'){$docu='PC'; $limit1=50; $cair='';} ?>
<?php if($docux=='IEBX'){$docu='IB'; $limit1=50; $enti='';} ?>
<?php if($docux=='TFIX'){$docu='TF'; $limit1=50; $enti='';} ?>
<?php if($docux=='RPXX'){$docu='RP'; $limit1=12; $cair='';} ?>
<?php if($docux=='FPXX'){$docu='FP'; $limit1=15;} ?>
<?php if($docux=='ATXX'){$docu='AT'; $limit1=40;} ?>
<?php if($docux=='DB10'){$docu='DB%'; } ?>

<?php if($pant==''){$pant='PANT0';}?>
<?php if(!@mb_stristr('PANT.IMPR.MODI',substr($pant,0,4))){return;} ?>
<?php if($user_codigo==''){echo ('<msgalert>Usuario desconectado...</msgalert>');}?>
<?php $xmodi=0; if(mb_stristr($pant,'MODI')){$xmodi=1;} ?>

<?php
if($fecha2==''){$fecha2=$fechaa;}
if($numero1==''){$numero1='1';}
if($numero2==''){$numero2='999999999';}

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

$gris1='gainsboro';
?>
<?php
if($docux=='ATXX')
{
   $fecha2=$fecha;
} 
?>




<?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_cont=0;
$ver_cele=0;
$ver_para=0;
$ver_modi=0;
$ver_chnc=0;
$ver_abono=0;
$ver_saldo=0;
$ver_invep=0;
$ver_valor=1;
$ver_subtot=1;
// $ver_total=1;
$tsaldo=0;

$dias_apro=30;
$dias_anul=180;
$dias_clon=150;



if($cfg_empr=='imcp' and date('Y-m-d')<='2020-12-30')
{$dias_clon=360;}

if($cfg_empr=='imcp' and date('Y-m-d')<='2021-04-30')
{$dias_anul=500;}


if($cfg_empr=='tfle' and date('Y-m-d')<='2021-04-30')
{$dias_anul=720;}

if($cfg_empr=='prs1' and date('Y-m-d')<='2021-04-30')
{$dias_anul=3650;}

if($cfg_empr=='pcs1' and date('Y-m-d')<='2022-03-30')
{$dias_anul=3650;}

if($cfg_empr=='pcs1' and date('Y-m-d')<='2023-03-30')
{$dias_anul=30*16;}

if($cfg_empr=='pcs1' and date('Y-m-d')<='2023-04-30')
{$dias_anul=30*16;}

if($cfg_empr=='sawo')
{$dias_anul=3650;}


if($cfg_empr=='imcp' and date('Y-m-d')<='2023-04-30')
{$dias_anul=30*19;}



if($cfg_empr=='demo')
{$dias_clon=360;}

// $dias_edit=30;
// $dias_anul=360;
$fecha_rpro=date('Y-m-01');
if(date('d')<=15)
{$fecha_rpro=date('Y-m-01',strtotime ('-1 month'));}

if($cfg_empr=='imcp' and date('Y-m-d')<='2024-05-31')
{$fecha_rpro=date('Y-m-01',strtotime ('-2 month'));}

if($cfg_empr=='pec1' and date('Y-m-d')<='2024-05-31')
{$fecha_rpro=date('Y-m-01',strtotime ('-2 month'));}


$dias_rpro=30;
$dias_guia=30;
$dias_fact=30;
if($empr_codigo=='imcp')$dias_fact=90;

if($user_email=='ptama@hotmail.com'){$dias_anul=365*2;}
if($user_email=='vicore@hotmail.com'){$dias_anul=365;}
if($user_email=='m.eryluisa75@hotmail.com'){$dias_anul=365*2;}
if($user_email=='peggytama@gmail.com' and $empr_codigo=='pisa' ){$dias_anul=365*8;}
if($empr_codigo=='hg01' ){$dias_anul=365;}

if($empr_codigo=='pcs1' and date('Y-m-d')<='2023-03-30'){$dias_anul=30*15;}
if($empr_codigo=='imcp' and date('Y-m-d')<='2023-11-28'){$dias_anul=30*12;}


if(date('Ymd')<"20200731" and $cfg_empr=='mzlj' and $docu=='PF10'){$dias_clon=240;}





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

// echo '<r><msgalert>'.'CONS='.$user_cons.'</r></msgalert>';


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_tipo=='clie' and substr($docu,0,2)=='CM')
{
  $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_para=0; 
 $ver_guia=0; 
 $ver_doco=0; 
 $ver_cont=0; 
} 

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


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

// if($ver_modi==1){$user_anul=0; $user_elim=0;}


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

if($idnum1=='undefined'){$idnum1='';}

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



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

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

// if($tabla=="")
// {$tabla=r_fiel('docu',substr($docu,0,2).'00','tabla');}  


$entilabel='ENTIDAD';
if($tabla=="")
{
	if($docu=='DD'){$tabla='cont';}
	if($docu=='DDMM'){$tabla='cont';}
	
	if($docu=='FC'){$tabla='vtas';}
	if($docu=='NC'){$tabla='vtas';}

  if($docu=='CM'){$tabla='comi';}
	
// 	if($docu=='OP'){$tabla='clie';}
	if($docu=='PC'){$tabla='clie';}
	if($docu=='PF'){$tabla='clie';}
	if($docu=='CA'){$tabla='carr';}
	
	if($docu=='FP'){$tabla='comp';}
	if($docu=='NP'){$tabla='comp';}
	
	if($docu=='AC'){$tabla='caja';}
	if($docu=='AP'){$tabla='caja';}
	if($docu=='GR'){$tabla='guia';}
	if($docu=='RP'){$tabla='retp';}
	if($docu=='RC'){$tabla='retc';}

	if($docu=='TF'){$tabla='tfin';}
	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=='SS'){$tabla='susa'; $entilabel='EMPLEADO';}
  if($docu=='NO'){$tabla='nomi'; }
  if($docu=='CE'){$tabla='empl'; $entilabel='EMPLEADO';}
  
	if($docu=='AT'){$tabla='atvd';}
  
}

  if($modu!='' and $modu!=undefined){$tabla=strtolower($modu);}  

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



if(@mb_stristr('acce.atvd.',$tabla)){$entilabel='USUARIO'; $enti=r_fiel('user',$user,'user_cedula');}
// if(@mb_stristr('acce.atvd.',$tabla)){$entilabel='USUARIO'; }
if(@mb_stristr('vtas.clie.retc.dxco.guia.carr.',$tabla)){$entilabel='CLIENTE';}
if(@mb_stristr('comp.prov.retp.dxpa',$tabla)){$entilabel='PROVEEDOR';}
if(@mb_stristr('comi.inve',$tabla)){$entilabel='ENTIDAD';}
if(@mb_stristr('prod',$tabla)){$entilabel='TALLER';}
// if(@mb_stristr('nomi.nvdd.roln.suel',$tabla)){$entilabel='EMPLEADO';}
// if(@mb_stristr('nomi',$tabla)){$entilabel='EMPLEADO';}
if(@mb_stristr('susa.nomi.empl',$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.prod',$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(@mb_stristr('vtas',$tabla) and @mb_stristr('sist.supe',$user_tipo) and $pagorapi=='true')
{$ver_para=1;}

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

if($pagorapi!='true'){$ver_para=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(@mb_stristr('vtas.comp',$tabla) and (substr($docu,0,1)=='F' or substr($docu,0,1)=='N') and $verinvep=='true')
{$ver_invep=1;}

if(@mb_stristr('dxco.dxpa',$tabla) and substr($docu,0,1)=='A' 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('vtas.comp.caja.bcos.retp.retc.dxco.dxpa.inve.prod.susa.empl',$tabla) and $vercont=='true')
{$ver_cont=1;}

if(@mb_stristr('cont',$tabla) and $verdife=='true')
{$ver_dife=1;}

if(@mb_stristr('cont',$tabla) and $verdiar=='true')
{$ver_diar=1;}

if($vermodi=='true')
{$ver_modi=1;}

if($verchnc=='true')
{$ver_chnc=1;}

if($sinctas=='true')
{$sin_ctas=1;}

if(mb_stristr($pant,'IMPR'))
{
  $ver_modi=0;
  $user_anul=0;
  $user_elim=0;
}

if($ver_modi==1)
{
  $ver_rete=0;
  $ver_guia=0;
  $ver_apli=0;
  $ver_fact=0;
  $ver_doco=0;
  $ver_cont=0;
  $ver_cele=0;
  //$ver_para=0;
  $ver_abono=0;
  $ver_saldo=0;
  $ver_invep=0;
  
  $user_anul=0;
  $user_elim=0;
  
//   $ver_modi=1;
}
  

if($proc=='contab')
{
  $ver_cont=1;
  $ver_rete=0;
  $ver_guia=0;
  $ver_apli=0;
  $ver_fact=0;
  $ver_doco=0;
  $ver_cele=0;
  //$ver_para=0;
  $ver_abono=0;
  $ver_saldo=0;
  $ver_invep=0;
  
  $user_anul=0;
  $user_elim=0;
}

		if($impor!=""){$docu=substr($docu,0,2); $fecha1='20100101'; $fecha2=date('Y-m-d');}

if($proc=='diariotr')
{
  $docu='DTR%';
  $fecha1='2000-01-01';
  $fecha2='3000-01-01';
  $ver_cont=0;
  $ver_rete=0;
  $ver_guia=0;
  $ver_apli=0;
  $ver_fact=0;
  $ver_doco=0;
  $ver_cele=0;
  //$ver_para=0;
  $ver_abono=0;
  $ver_saldo=0;
  $ver_invep=0;
  
  $user_anul=0;
  $user_elim=0;
}


if($formato==2){$tabla='cont';}


if(@mb_stristr('FP03.FP11',$docu)){$cel_stat=1;}
if(@mb_stristr('FP03.FP11',$docu) and $vercele=='true'){$ver_cele=1;}
if(substr($docu,0,2)!="DD"){$ver_dife=0;}

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

if($docux=='IEBX'){$ver_doco=0;}
if($docux=='RPXX'){$ver_cele=0;}



//     echo '<msgsistemas>';

//       echo 'AQUIIIIIII->';
//       echo $docu;
//       echo 'AQUIIIIIII->';
//       echo $docuacce;
//       echo 'AQUIIIIIII->';
//       echo $pant;
//   echo '</msgsistemas>';




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_para=0;
  $ver_rete=0;
//   $ver_doco=0;
  $ver_cont=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);
$hpant2 =ceil($screenh*0.50);
// $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;
	$docunvdd=0;
	$docuiimp=0;
// 				$docuinve=0;
	$docudocu=0;
	$docurete=0;
	$docuctas=0;
  
  $xipuni=1;

	if(@mb_stristr('vtas.comp.clie.prov.carr.inve.prod.guia.nomi.susa.tfin.',$tabla)){$docuitem=1;}
	if(@mb_stristr('empl',$tabla)){$docunvdd=1;}
	if(@mb_stristr('vtas.comp.clie.prov.carr.prod',$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.dxco.dxpa',$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;}

     
     
     

     $xipuni=1;
    if(@mb_stristr('vtas.clie.carr',$tabla) and false)
    {
//         $docuacce='PREC';
//         include('php_useracce.php');
//         $xipuni=$user_cons;
//         $tsubt=$user_cons;

//         $docuacce=$docu;
//         include('php_useracce.php');
         $ver_prec=0;
        if(mb_stristr('sist.supe',$user_tipo))
        {$ver_prec=1;}
        {
             
        $sql_prec ='select * from acce1 left join acce2 on idnum1=idnum2 ';
        $sql_prec.='where numero="'.$user_codigo.'" ';
        $sql_prec.='and left(docum,2) in ("FC","PF","PC")';
        $sql_prec.='and (nuevo=1 or modi=1 or cons=1)';
        $sql_prec.='limit 1';
         $res_prec=msql_query($sql_prec,$link_vcrx);
        if(msql_num_rows($res_prec)!=0){$ver_prec=1;}
        }
         
//         $xipuni=$ver_prec;
//         $tsubt=$ver_prec;
      
         if($user_tipo=='sist')
         {
              
        $xipuni=0;
        $tsubt=0;
         }
      
        if(substr($pant,0,4)=='IMPR')
        {
//           $user_anul=0;
//           $user_elim=0;
//           $user_clon=0;
//           $ver_cele=0;
//           $ver_rete=0;
//           $ver_cont=0;
        }
      
    }
  
     
    if(@mb_stristr('inve.prod.tfin',$tabla))
    {
        $docuacce='COST';
        include('php_useracce.php');
//         $user_cons=0;
        $xipuni=$user_cons;
        $tsubt=$user_cons;

        $docuacce=$docu;
        include('php_useracce.php');
      
        if(substr($pant,0,4)=='IMPR')
        {
          $user_anul=0;
          $user_elim=0;
          $user_clon=0;
          $ver_cele=0;
          //$ver_para=0;
          $ver_rete=0;
        //   $ver_doco=0;
          $ver_cont=0;
        //   $ver_guia=0;
        }
      
    }
  $sql_total=sql_total($tabla);

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

?>

<?php
// echo '*/*/*/*/----'.$tabla;

  if(mb_stristr('PANT0',$pant))
  {
     $sql_pyme='alter table empr0 add column empr_pyme varchar(1)';
     msql_query($sql_pyme,$link_vcrx);
       
     $sql_pyme='update empr0 set empr_pyme=1 where empr_codigo!="jwib"';
     msql_query($sql_pyme,$link_vcrx);
       
    $sql_enti='update enti0 set enti_descri=trim(enti_descri)';
    $res_enti=msql_query($sql_enti,$link_vcrx);
       
    $sql_enti='update enti0 set enti_descri=replace(enti_descri,"<td>","") where enti_descri like "%<td>%"';
    $res_enti=msql_query($sql_enti,$link_vcrx);
       
    $sql_enti='update enti0 set enti_descri=replace(enti_descri,"  "," ") where instr(enti_descri,"  ")>0 ';
    $res_enti=msql_query($sql_enti,$link_vcrx);
  }



?>
<?php

?>

<?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	val_usercodigo(); ?>
  
<?php $ptabla='item'; include('vrsetlist.php'); ?>
<?php $ptabla='ctas'; include('vrsetlist.php'); ?>
<?php $ptabla='ctab'; include('vrsetlist.php'); ?>
<?php $ptabla='cair'; include('vrsetlist.php'); ?>
<?php $ptabla='suco'; include('vrsetlist.php'); ?>
<?php $ptabla='caja'; include('vrsetlist.php'); ?>
<?php $ptabla='fpag'; include('vrsetlist.php'); ?>
<?php $ptabla='lote'; include('vrsetlist.php'); ?>
<?php $pidtxt='dl_impor'; $pdocu='FP'; $pcolu='impor'; include('vrsetlist.php'); ?>
<?php $pidtxt='dl_pret'; $pdocu='RP'; $pcolu='puni'; $pwhere='(puni>0)'; include('vrsetlist.php'); ?>
<?php //$pidtxt='dl_impor'; $pdocu='FP'; $pcolu='impor'; include('vrsetlist.php'); ?>
  
<?php if(@mb_stristr('invi.clie.prov',$user_tipo) or $user_tipo=='') {}else{?>
<?php } ?>
<?php if($fecha1==''){ ?>
  <?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  } ?>
<?php $fecha2=date('Y-m-01',strtotime ('today')); ?>
<?php $fecha2=date('Y-m-d',strtotime ('today')); ?>

		<div id="pant0" style="border:solid 2px; overflow:auto; width:99%;">
   <?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>Consulta de Documentos</titulo>
                </td>
              </tr>
            <tr>
              <?php
                 $pidtxt='fechar'; $pcaption='Fecha'; $pdefa=0;  $psize=$xfontsize; $pobj=3;
                 $poptions='0,Fechas;1,Hoy;2,Semana;3,Periodo;4,Mes;5,Año;';
                 $ponchange='fechar();';
                 include('vrselopt.php');
              ?>
            </tr>
            <tr>
              <?php $pidtxt='fecha1'; $pcaption='Fec. Ini.'; $pdefa=$fecha1; $psize=$xfontsize; include('vrgetfec.php'); ?>
            </tr>
            <tr>
              <?php $pidtxt='fecha2'; $pcaption='Fec. Fin'; $pdefa=$fecha2; $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='docu'; $pcaption='docu'; $ptabla='docu';  $psize=$xfontsize; $pdefa=$docu;  $pobj=3;  $pnotob=0; 
                   $pwhere='(docu_tipo="TRAN")';  $ponblur="vali_docu();";
                   if(@mb_stristr('invi.clie.prov',$user_tipo) or $user_tipo==''){$phide=1;}
                   if(strlen($docu)==4){$preado=1;}                          
                   include('vrgetcod.php'); ?>              
              </tr>
              <tr>
                <?php $pidtxt='enti'; $pcaption=$entilabel; $ptabla='enti'; $pnotob="1"; $psize=$xfontsize; $pdefa=$enti;  $pobj=3; 
                   if(@mb_stristr('invi.clie.prov',$user_tipo) or $user_tipo==''){$pexact=1;}             
                   include('vrgetcod.php'); ?>
              </tr>

              <?php //if($cfg_empr=='demo'){ ?>
              <?php if(@mb_stristr('demo.srie',$cfg_empr)){ ?>
               <tr style="display:none;" class="tran comp">
                <?php $pidtxt='toenti'; $pcaption='CLIENTE'; $ptabla='enti'; $pnotob="1"; $psize=$xfontsize; $pdefa='';  $pobj=3; 
                   if(@mb_stristr('invi.clie.prov',$user_tipo) or $user_tipo==''){$pexact=0;$pdatalist=1;}             
                   include('vrgetcod.php'); ?>
              </tr>
               <?php } ?>

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

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

		     <tr style="display:none;" class="tran bcos">
                <?php $pidtxt='ctab'; $pcaption='CTA.BANC.'; $ptabla='ctab'; $pnotob="1"; $psize=$xfontsize; $pobj=3; $pclass='bcos'; 
                include('vrgetcod.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="0"; $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="tran cont comp">
              <?php $pidtxt='ctas'; $pcaption='CUENTA'; $ptabla='ctas'; $psize=$xfontsize; $pobj=3; $pclass='cont'; include('vrgetcod.php'); ?>
            </tr>
            <tr style="display:none;" class="tran cont comp">
		    <?php $pcaption='SIN-CTA.';   $pidtxt='sinctas'; $pclass='tran cont comp'; include('vrchkbox.php'); ?>
            </tr>
            <tr style="display:none;" class="tran vtas">
              <?php $pidtxt='ptov'; $pcaption='PTO.VTA.'; $ptabla='ptov'; $psize=$xfontsize; $pobj=3; $pclass='vtas'; $pnotob=1; include('vrgetcod.php'); ?>
            </tr>
            <tr style="display:none;" class="tran inve">
              <?php $pidtxt='bode'; $pcaption='BODEGA'; $ptabla='bode'; $psize=$xfontsize;  $pobj=3; $pclass='inve tfin'; include('vrgetcod.php'); ?>
            </tr>
            <tr style="display:none;" class="tran guia">
              <?php $pidtxt='placa'; $pcaption='PLACA'; $ptabla='vhcl'; $psize=$xfontsize;  $pobj=3; $pclass='guia'; include('vrgetcod.php'); ?>
            </tr>
            <tr style="display:none;" class="tran bcos">
              <?php //$pidtxt='ctab'; $pcaption='CTA:BANC.'; $ptabla='ctab'; $psize=$xfontsize;  $pobj=3; $pclass='ctab'; include('vrgetcod.php'); ?>
            </tr>
            <tr style="display:none;" class="tran comp">
              <?php $pidtxt='suco'; $pcaption='SUCO'; $ptabla='suco'; $psize=$xfontsize;  $pobj=3; $pclass='comp'; include('vrgetcod.php'); ?>
            </tr>
            <tr style="display:none;" class="tran 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="tran comp retc retp">
              <?php //$pidtxt='pret'; $pcaption='%RET'; $psize=$xfontsize;  $pobj=3; $pclass='retc retp'; $plist='dl_pret'; include('vrgetval.php'); ?>
            </tr>
            <?php if($empr_impo==1){?>
            <tr style="display:none;" class="tran comp impo">
              <?php $pidtxt='impor'; $pcaption='Import.'; $psize=$xfontsize;  $pobj=3; $pclass='comp'; $plist='dl_impor'; $plong=10; include('vrgettxt.php'); ?>
            </tr>
            <tr style="display:none;" class="tran comp impo">
              <?php //$pidtxt='peso'; $pcaption='Peso KG'; $psize=$xfontsize;  $pobj=3; $pclass='comp'; $preado=1; include('vrgettxt.php'); ?>
            </tr>
            <?php } ?>
            <tr style="display:none;" class="tran comp">
              <?php $pidtxt='tpro'; $pcaption='T.PROV'; $ptabla='tpro'; $psize=$xfontsize; $plong=4; $pobj=3; $pclass='tpro'; include('vrgetcod.php'); ?>
            </tr>
            <tr style="display:none;" class="tran 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="tran vtas inve">
              <?php $pidtxt='lsub'; $pcaption='LINEA'; $ptabla='lsub'; $psize=$xfontsize; $plong=4; $pobj=3; $pclass='vtas inve'; $pvalue='-'; include('vrgetcod.php'); ?>
            </tr>
            <?php if(mb_stristr('pcs1.prs1',$cfg_empr)){?>
            <tr style="display:none;" class="tran 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(mb_stristr('tgck.sawo.ztej',$cfg_empr)){?>
            <tr style="display:none;" class="tran vtas ">
              <?php $pidtxt='vhcl'; $pcaption='VHCL'; $ptabla='vhcl'; $psize=$xfontsize; $plong=4; $pobj=3; $pclass='vtas'; $pnotob="1"; include('vrgetcod.php'); ?>
            </tr>
            <?php } ?>
            <?php if($empr_comi==1){ ?>
            <tr style="display:none;" class="tran vtas">
              <?php $pidtxt='vndd'; $pcaption='VENDEDOR'; $ptabla='vndd'; $psize=$xfontsize; $pobj=3; $pclass='vtas';  include('vrgetcod.php'); ?>
            </tr>
            <?php } ?>
              
          </table>

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

          <?php
              $pidtxt='repo'; $pcaption='Reporte';  $psize=$xfontsize; $pdefa=$docu;   $pvalue=$pdefa; $pobj=1;  $pnotob=0; 
               $poptions ='';
               $poptions.='1,Resumen;3,Detalle;';
               if(@mb_stristr('invi.clie.prov',$user_tipo) or $user_tipo==''){$phide=1;}
               include('vrselopt.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_docu("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='verchnc'; $pcaption='Ch.NO.Cob..'; $ponclick=''; $psize=$xfontsize; $pdefa=0; $pclass="tran bcos"; $phide=1; include('vrchkbox.php'); ?>
              <?php if($mobile=='true'){?>        
              </td>
              <td valign="top">
              <?php }else{ ?>
              </tr>
              <tr style="display:none;" >
              <?php } ?>
                
              <?php $pidtxt='verrete'; $pcaption='Reten.'; $ponclick=''; $psize=$xfontsize; $pdefa=0; $pclass="tran vtas comp reem"; $phide=1; include('vrchkbox.php'); ?>
              <?php if($mobile=='true'){?>        
              </td>
              <td valign="top">
              <?php }else{ ?>
              </tr>
              <tr style="display:none;" >
              <?php } ?>
                
              <?php $pidtxt='versaldo'; $pcaption='Saldos'; $ponclick=''; $psize=$xfontsize; $pdefa=0;   $pclass="tran vtas comp dxco dxpa impo reem"; $phide=1; include('vrchkbox.php'); ?>
              <?php if($mobile=='true'){?>        
              </td>
              <td valign="top">
              <?php }else{ ?>
              </tr>
              <tr style="display:none;" >
              <?php } ?>
                 
              <?php if($empr_inve==1){ ?>
              <?php $pidtxt='verinvep'; $pcaption='Inv.Pend.'; $ponclick=''; $psize=$xfontsize; $pdefa=0;   $pclass="tran vtas comp ncre"; $phide=1; include('vrchkbox.php'); ?>
              <?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="tran 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="tran vtas guia retp ncre reem "; $phide=1; include('vrchkbox.php'); ?>
              <?php if($mobile=='true'){?>        
              </td>
              <td valign="top">
              <?php }else{ ?>
              </tr>
              <tr style="display:none;" >
              <?php } ?>


              <?php $pidtxt='verdiar'; $pcaption='Todos'; $ponclick=''; $psize=$xfontsize; $pdefa=0; $pclass="tran cont"; $phide=1; include('vrchkbox.php'); ?>
              <?php if($mobile=='true'){?>        
              </td>
              <td valign="top">
              <?php }else{ ?>
              </tr>
              <tr style="display:none;" >
              <?php } ?>

              <?php $pidtxt='verdife'; $pcaption='Difer.'; $ponclick=''; $psize=$xfontsize; $pdefa=0; $pclass="tran cont"; $phide=1; include('vrchkbox.php'); ?>
              <?php if($mobile=='true'){?>        
              </td>
              <td valign="top">
              <?php }else{ ?>
              </tr>
              <tr style="display:none;" >
              <?php } ?>

              <?php $pidtxt='vercont'; $pcaption='Contab.'; $ponclick=''; $psize=$xfontsize; $pdefa=0;
                 $pclass="tran vtas comp caja bcos retp retc dxco dxpa inve ncre nomi empl reem"; $phide=1; 
                  include('vrchkbox.php');
              ?>
              <?php if($mobile=='true'){?>        
              </td>
              <td valign="top">
              <?php }else{ ?>
              </tr>
              <tr style="display:none;" >
              <?php } ?>

              <?php $pidtxt='vermodi'; $pcaption='Modif.'; $ponclick=''; $psize=$xfontsize; $pdefa=0; $phide=1;
                  $pclass="tran comp caja bcos plan clie inve prod impo reem ncre";  
                  include('vrchkbox.php'); ?>
              <?php if($mobile=='true'){?>        
              </td>
              <td valign="top">
              <?php }else{ ?>
              </tr>
              <tr style="display:none;" >
              <?php } ?>

              <?php if($cfg_empr=='msg1')
                  {$pidtxt='pagorapi'; $pcaption='Pago'; $ponclick=''; $psize=$xfontsize; $pdefa=0; $pclass="vtas ncre"; $phide=1; include('vrchkbox.php');} ?>
                   
              <?php if($mobile=='true'){?>        
              </td>
              <td valign="top">
              <?php }else{ ?>
              </tr>
              <tr style="display:none;" >
              <?php } ?>


              <?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_docu("PANT1",'.'document.getElementById("docu").value'.')'; $psize=$xfontsize; include('vrbutton.php'); ?>
            <?php $pidtxt='acepta'; $pcaption='Aceptar '; $psize=$xfontsize; 
            $ponclick='info_docu("PANT"+document.getElementById("repo").value,'.'document.getElementById("docu").value'.')'; 
            include('vrbutton.php'); ?>
            </td>  
              
              
            <?php if($mobile!='true'){?>        
            </tr>
            <tr>
            <?php } ?>              
              
            <td style="display:;">
		<?php $pidtxt='imprim'; $pcaption='Imprimir '; 
//           $ponclick='info_docu("IMPR1",'.'document.getElementById("docu").value'.')'; 
          $ponclick='info_docu("IMPR"+document.getElementById("repo").value,'.'document.getElementById("docu").value'.')'; 
       
             $psize=$xfontsize; 
            include('vrbutton.php'); ?>
            </td>  
              
            <?php if($mobile!='true'){?>        
            </tr>
            <tr>
            <?php } ?>              

              
            <?php //if($empr_zeus==1){ ?> 
              <td class="" align="left" valign="middle" style="display:;">
              <?php $pidtxt='ride'; $pcaption='RIDE'; $psize=$xfontsize; $ponclick='prnt_ride();';  include('vrbutton.php'); ?>
              </td>
            <?php //} ?>
              
            <?php if($mobile!='true'){?>        
            </tr>
            <tr>
            <?php } ?>              

              
            <?php if($empr_zeus==1){ ?> 
              <td class="tran retc" align="left" valign="middle" style="display:none;">
              <?php $pidtxt='zeus'; $pcaption='ZEUS'; $psize=$xfontsize; $ponclick='down_zeus();';  include('vrbutton.php'); ?>
              </td>
            <?php } ?>
              
            <?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_docu('PANT1',document.getElementById('docu').value);"; 
                  $psize=$xfontsize; include('vrbutton.php');
                 ?>
            <?php } ?>
            </td>  
                
             </tr>            
            <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-100).'px;';}
          ?> 
					<?php if($orient=='V'){echo'height:'.($hpant2-75).'px;';}
                                 else{echo'height:'.($hpant2-80).'px;';}  ?> 
           "></div>
		<div id="pant9"></div>
<?php } ?>			



<?php if(mb_stristr('PANT1.IMPR1.PANT3.IMPR3',$pant)){ ?>



<?php if($fecha1==''){$fecha1=date('Y-01-01',strtotime ('-365 days'));} ?>
<?php if($tabla=='susa'){$fecha1=date('Y-m-01',strtotime ('-48 month')); $docuitem=0;} ?>

<?php 
//    if($fecha1==''){$fecha1='2010-01-01';}

    if($fechar=='1'){$fecha1=$fechaa; $fecha2=$fechaa;}
    if($fechar=='2'){$fecha1=date('Y-m-d',strtotime('last monday')); $fecha2=$fechaa;}
    if($fechar=='3'){$fecha1=$fechaa; $fecha2=$fechaa;}
    if($fechar=='4'){$fecha1=date('Y-m-01'); $fecha2=$fechaa;}
    if($fechar=='5'){$fecha1=date('Y-01-01'); $fecha2=$fechaa;}
                                                   
?>

<?php
                                                   
                                                   
  if(mb_stristr('PANT1.',$pant) and mb_stristr('inve',$tabla) and $cfg_empr=='hfre')
  {
    $sql_hfre='update inve2 left join item0 on item=item_codigo set puni=0.000001 where item_lsub not like "INAG%"';
    $res_hfre=msql_query($sql_hfre,$link_vcrx);
  }
  if(mb_stristr('PANT1.',$pant) and mb_stristr('comp',$tabla))
  {
    $sql_hfre='update comp1 set suco="-" where suco="" or suco is null';
    $res_hfre=msql_query($sql_hfre,$link_vcrx);
  }
  if(mb_stristr('PANT1.',$pant) and mb_stristr('vtas.clie',$tabla))
  {
    crea_vndd0();
  }
  if(mb_stristr('PANT1.',$pant) and mb_stristr('comp.retc',$tabla))
  {
    $fechace=date('Y-m-01',strtotime('-7 month'));
//     $fechace=date('Y-m-01',strtotime('-12 month'));
    if($fecha1>=$fechace)
    {
      $tice='';
      if($docu=='FP10'){$tice='01';}
      if($docu=='NP10'){$tice='04';}
      if($docu=='FP05'){$tice='05';}
      if($docu=='RCLI'){$tice='07';}
//          echo '*/*/*/ TICE :'.$tice;
      if(!empty($tice))
      {upl_claves2($tice,$fecha1,$fecha2);}
      if(!empty($tice))
      {
//   echo '<msgalert>';
//   echo '*/*/*/'.$docu.$tice;
//   echo '</msgalert>';
      }
    }
  }
//   echo '<msgalert>';
//   echo '*/*/*/'.$docu.$tice;
//   echo '</msgalert>';
?>


<?php                                                   
  $sql_stat ='update '.$tabla.'1 set status="-" ';
  $sql_stat.=' where (status="" or status is null) ';
  $sql_stat.=' and (fecha between "'.$fecha1.'" and "'.$fecha2.'")';
//   msql_query($sql_stat,$link_vcrx); 
?>

<?php                                                   
  $sql_fech ='update '.$tabla.'1 set fecha=idate ';
  $sql_fech.=' where (fecha is null) ';
  msql_query($sql_fech,$link_vcrx); 
?>

	<?php
    { 

    if(@mb_stristr('acce',$tabla))
    {
      gen_axu1();
      $fecha1='2000-01-01';
      $fecha2='2100-01-01';
    }      
       
       if($docux=='NOXX')
       {
          $fecha2=date('Y-m-t',strtotime($fecha2));
          $fecha1=date('Y-m-01',strtotime($fecha2.' -1 month'));
       }
  
       if(mb_stristr('FCXX.PCXX',$docux) and mb_stristr('demo',$cfg_empr))
       {
//           $fecha2=date('Y-m-t',strtotime($fecha2));
//           $fecha1=date('Y-m-01',strtotime($fecha2.' -1 month'));
          $fecha1=date('Ymd');
          $fecha1='2020-08-01';
          $fecha2=date('Ymd');
       }
  
		$sql_pant ='select * from '.$tabla.'12 ';
		$sql_pant.=' where ( (fecha between "'.$fecha1.'" and "'.$fecha2.'") ';
//       if(substr($docu,0,2)=='IC'){ $sql_pant.=' or (fechadepo between "'.$fecha1.'" and "'.$fecha2.'")';}
      $sql_pant.=')';
		$sql_pant.=' and (numero between "'.$numero1.'" and "'.$numero2.'")';

      
//     if($proc=='contab')
    if($proc=='contab' or $ver_cont==1)
    {
      $fechatr=get_fechadtr();
      $sql_contab ='select * from '.$tabla.'1 left join '.$tabla.'2 on idnum1=idnum2 ';
      $sql_contab.=' where (fecha between "'.$fecha1.'" and "'.$fecha2.'")';
      $sql_contab.=' and (numero between "'.$numero1.'" and "'.$numero2.'")';
      $sql_contab.=' and fecha>"'.$fechatr.'"';
      if($docu!='')
      {$sql_contab.=' and docu like "'.$docu.'%"';}
      if($proc=='')
      {$sql_contab.=' and (status="O" or status="X") ';}
      
      $res_contab=msql_query($sql_contab,$link_vcrx);
      while($aso_contab=msql_fetch_assoc($res_contab))
      {gen_contab($aso_contab['docu'],$aso_contab['idnum1']);}
    }
    
      
    if($ver_diar==1 and $tabla=='cont')
    {$docu='';}
      
    if($ver_dife==1 and $tabla=='cont')
    {
      $sql_pant.=' and idnum1 in  ';
      $sql_pant.=' (select idnum1 from cont11 ';
      $sql_pant.=' where fecha>="'.$fecha1.'" and fecha<="'.$fecha2.'" and abs(tcant)>1/100) ';
         
//       $sql_pant.=' and idnum1 in  ';
//       $sql_pant.=' (select idnum1, sum(cant) as tcant from cont1 left join cont2 on idnum1=idnum2 ';
//       $sql_pant.=' where fecha>="'.$fecha1.'" and fecha<="'.$fecha2.'" and abs(tcant)>1/100 ';
//       $sql_pant.=' and (ctas="" or ctas is null) ';
//       $sql_pant.=' and status not in("O","X") ';
//       $sql_pant.=' ) ';
      $docu='';
    }
      
      
      
    if($ver_guia==1)
    {
      $sql_orig=$sql_pant;
      $sql_orig=str_replace('select *','select idnum1',$sql_orig);
      $sql_orig=str_replace($tabla.'12',$tabla.'1',$sql_orig);
      $sql_guia ='select idnum1,idfrom from guia1 ';
      $sql_guia.='where mdfrom="'.$tabla.'" and idfrom ';
      $sql_guia.='in ('.$sql_orig.') ';
    }

      
		if($impor!=""){$docu=substr($docu,0,2); $fecha1='20100101';}
      
      
		if($docu=="DDMM")
		{$sql_pant.=' and docu not like "DD%"';}
		else
		{$sql_pant.=' and docu like "'.$docu.'%"';}
      
    if($docux=='IEBX')
    {$sql_pant=str_replace('"'.$docu,'"%B',$sql_pant);}  
      
  
      
      
    if($docux=='TFIX')
    {$sql_pant=str_replace('"'.$docu,'"TFI%',$sql_pant);}  
      
    if($docux=='FCXX')
    {$sql_pant=str_replace('"'.$docu,'"FC',$sql_pant);}  
      
    if($docux=='PCXX')
    {$sql_pant=str_replace('"'.$docu,'"PC',$sql_pant);}  
      
    if($docux=='ATXX')
    {$sql_pant=str_replace('"'.$docu,'"AT%',$sql_pant);}  
      
    if($docux=='RPXX')
    {$sql_pant=str_replace('"'.$docu,'"RP',$sql_pant); $cair='';}  
      
    if($docux=='FPXX')
    {$sql_pant=str_replace('"'.$docu,'"FP',$sql_pant);}  
      
    if($docux=='NOXX')
    {$sql_pant=str_replace('"'.$docu,'"NOV2',$sql_pant);}  
      
      
//     if($modu=='VTAS')
//     {$sql_pant=str_replace('"'.$docu,'"',$sql_pant); $docu='';}  
    
//     if($modu=='COMP' and $docu=='')
//     if($modu=='COMP')
//     {$sql_pant=str_replace('"'.$docu,'"',$sql_pant); $docu='';}  
// echo '*/*/'.$modu;
// echo '*/*/'.$docu;
      

      if($user_tipo=="clie")
      {$sql_pant.=' and (enti like "'.substr($user_cedula,0,10).'%")';}


      $filt_enti='';  
      if($enti!=""){$sql_pant.=' and(enti like "'.substr($enti,0,10).'%" or enti_descri like "%'.$enti.'%")';}
      
      if($tabla=='nomi')
      {$sql_pant=str_replace('enti like','enti2 like',$sql_pant);}
      

      if($toenti!=""){$sql_pant.=' and(toenti like "'.substr($toenti,0,10).'%")';}
       
       
      if(substr($docu,0,2)=='AT' )
      {
         if(mb_stristr('sist.supe',$user_tipo))
         {$filt_enti.=' and(enti like "'.$enti.'%" or enti_descri like "%'.$enti.'%")';}
         else
         {$filt_enti.=' and(enti like "'.$xuser_cedula.'%" )';}
      }

      if(mb_stristr('nomi',$tabla))
      {$filt_enti='';  }
       
//       {if($enti!=""){$sql_pant.=' and(enti2 like "'.$enti.'%" )';}} 

      $sql_pant.=$filt_enti; 
      
    if(mb_stristr('saar.vare',$cfg_empr)) 
    {if($user_tipo=='admi'){$sql_pant.=' and(iuser="'.$user_codigo.'")';}}
      
      
// 		if($concepto!=""){$sql_pant.=' and(concepto like "%'.$concepto.'%")';}
		if($concepto!="")
          {
               $sql_pant.=' and(concepto like "%'.$concepto.'%" ';
               if($tabla=='comp')
               {$sql_pant.=' or itemce like "%'.$concepto.'%" ';}
               $sql_pant.=' or detalle like "%'.$concepto.'%")';
          }
		if($stat!=""){$sql_pant.=' and(status="'.$stat.'")';}
		if($vndd!="" and mb_stristr('vtas.clie',$tabla)){$sql_pant.=' and(vndd like "'.substr($vndd,0,10).'")';}
		if($ptov!="" and mb_stristr('vtas.clie',$tabla)){$sql_pant.=' and(ptov like "'.$ptov.'%")';}
		if($bode!="" and mb_stristr('inve',$tabla)){$sql_pant.=' and(bode="'.$bode.'")';}
		if($placa!="" and mb_stristr('guia',$tabla)){$sql_pant.=' and(placa="'.$placa.'")';}
		if($suco!="" and mb_stristr('comp.',$tabla)){$sql_pant.=' and(suco="'.$suco.'")';}
		if($cair!="" and mb_stristr('comp.retp.retc',$tabla)){$sql_pant.=' and(cair="'.$cair.'")';}
		if($pret!="" and mb_stristr('retp.retc',$tabla)){$sql_pant.=' and(puni="'.$pret.'")';}
         
		if($ctas!="" and mb_stristr('comp.cont',$tabla))
          {
               if($sin_ctas==0){$sql_pant.=' and(ctas like "'.$ctas.'%")';}
               if($sin_ctas==1){$sql_pant.=' and(ctas not like "'.$ctas.'%")';}
          }
         
		if($ctas=="" and mb_stristr('comp.cont',$tabla))
          {
//                if($sin_ctas==1){$sql_pant.=' and(ctas="" or ctas is null)';}
               if($sin_ctas==1){$sql_pant.=' and(ctas_descri="" or ctas_descri is null)';}
          }
         
// 		if(mb_stristr('bcos.caja',$tabla))
          {
               if($ver_chnc==1 and $tabla=='bcos' and substr($docu,0,2)=='CH'){$sql_pant.=' and(fcobro="" or fcobro is null)';}
          }
         
		if($item!="" and mb_stristr('vtas.comp.clie.prov.carr.inve.prod.tfin',$tabla)){$sql_pant.=' and(item like "'.$item.'%")';}
		if($impor!="" and mb_stristr('comp',$tabla)){$sql_pant.=' and(impor="'.$impor.'")';}
		if($caja!="" and mb_stristr('caja',$tabla)){$sql_pant.=' and(caja="'.$caja.'")';}
		if($ctab!="" and mb_stristr('bcos',$tabla)){$sql_pant.=' and(ctab="'.$ctab.'")';}
		if(strlen($lsub)>3 and mb_stristr('vtas.inve',$tabla)){$sql_pant.=' and(lsub="'.$lsub.'")';}
		if($zsub!="" and mb_stristr('vtas.',$tabla)){$sql_pant.=' and(zsub="'.$zsub.'")';}
		if($tpro!="" and mb_stristr('comp.',$tabla)){$sql_pant.=' and(tpro="'.$tpro.'")';}
    
		if(!empty($idnum1)){$sql_pant.=' and(idnum1="'.$idnum1.'")';}
      
		if($user_tipo=='invi'){$sql_pant.=' and (enti_emailce like "%'.$user_email.'%")';}

		if(mb_stristr('pcs1.prs1',$cfg_empr) and mb_stristr('vtas',$tabla) and $cntn!=""){$sql_pant.=' and(cntn like "%'.$cntn.'%")';}
// 		if($cfg_empr=='tgck' and mb_stristr('vtas',$tabla) and $vhcl!=""){$sql_pant.=' and(vhcl like "%'.$vhcl.'%")';}
		if(mb_stristr('tgck.sawo.ztej',$cfg_empr) and mb_stristr('vtas',$tabla) and $vhcl!=""){$sql_pant.=' and(vhcl like "%'.$vhcl.'%")';}
      
      
		$sql_pant=str_replace('select *','select *,'.$sql_total,$sql_pant);
		$sql_tpant=$sql_pant;
      
      
    $groupby=' group by idnum1 ';
		if(@mb_stristr('retc.retp.rete',$tabla))
		{$groupby=' group by ptoe,numero,fecha,enti ';}
// 		{$groupby=' group by ptoe,numero,fecha,enti,cair ';}
		

		if(mb_stristr('PANT3.IMPR3',$pant))
		{$groupby.=',iddet ';}
      
		$sql_pant.=$groupby;

      
//       echo '<msgalert>';
//       echo '*/*/*/'.$idnum1.$ver_modi;
//       echo '</msgalert>';
      
      
    if(mb_stristr('PANT',substr($pant,0,4)))
    {
      $xorder=' order by fecha desc,docu,ptoe,numero desc,idnum1 desc,iddet desc';
      if($ver_modi==1)
      {$xorder=' order by fecha desc,docu,ptoe,numero desc,idnum1 desc,item ';}
         
       if($tabla=='susa')
       {$xorder=str_replace('order by ','order by fecha2 desc,',$xorder);}
      
//       $sql_pant.=$xorder;
    }
    else
    {
         $xorder=' order by fecha,docu,ptoe,numero,idnum1,iddet ';
       if($tabla=='susa')
       {$xorder=str_replace('order by ','order by fecha2,',$xorder);}
    }
//     {$sql_pant.=' order by fecha,docu,ptoe,numero,idnum1,iddet ';}
         
      $sql_pant.=$xorder;
//          echo $sql_pant;
      
    if($limit1>0)  
    {$sql_pant.=' limit '.$limit1;}
     
    if($user_cons==0)
    {$sql_pant='';$sql_tpant='';}

      
    $res_pant=msql_query($sql_pant,$link_vcrx);
		$res_tpant=msql_query($sql_tpant,$link_vcrx);
// 		$res_tpant=msql_query($sql_pant,$link_vcrx);
      
    if(mb_stristr('RPRO.RCLI',$docu))
    {
      $sql_tpantr=$sql_tpant.' group by cair,puni order by ccair,puni ';
//          echo '<br>*/*/'.$sql_tpantr;
  		$res_tpantr=msql_query($sql_tpantr,$link_vcrx);
    }
      
		$docuok=@msql_result($res_tpant,0,'docuok');
		$mconcepto=@msql_result($res_tpant,0,'mconcepto');
		$mdetalle=@msql_result($res_tpant,0,'mdetalle');
		$tcant=@msql_result($res_tpant,0,'stcant');
		$tsubt=@msql_result($res_tpant,0,'stsubt');
		$lconcepto=@msql_result($res_tpant,0,'lconcepto');
      

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

		if(@mb_stristr('comp.prov.inve.impo',$tabla))
		{
			$trrta=@msql_result($res_tpant,0,'srrta');
			$triva=@msql_result($res_tpant,0,'sriva');
  		     $mimpor=@msql_result($res_tpant,0,'mimpor');
		}			

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


    if($ver_saldo==1){$mconcepto='';}
    if($ver_modi==1 and mb_stristr('OP10',$docu)){$mconcepto='';}
    if($ver_modi==1){$user_anul=0; $user_elim=0;}
      
      
		if(@mb_stristr('cont',$tabla))
		{
			$mcsub=@msql_result($res_tpant,0,'mcsub');
			$mcair=@msql_result($res_tpant,0,'mcair');
			$mitem=@msql_result($res_tpant,0,'mitem');
//       $tsaldoi=l@msql_result($res_tpant,0,'saldoi');
			$tdebito=@msql_result($res_tpant,0,'tdeb');
			$tcredito=@msql_result($res_tpant,0,'tcre');
//       $tsaldo=l@msql_result($res_tpant,0,'saldo');
			$tdiferencia=@msql_result($res_tpant,0,'sdiferencia');
		}			

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

      
		if(@mb_stristr('vtas.clie.carr.inve.prod.tfin',$tabla))
		{
			$mclor=@msql_result($res_tpant,0,'mclor');
			$mtlla=@msql_result($res_tpant,0,'mtlla');
		}			

      
		$total=@msql_result($res_tpant,0,'stotal');
		$tdocu=@msql_num_rows($res_pant);
       
      
    if(@mb_stristr('guia',$tabla))
    {
      $tsubt=0;
    }
      
    if(@mb_stristr('inve',$tabla))
    {
      $tsubt=$tsubt*$xipuni;
      $total=$total*$xipuni;
    }
      
      
    if(@mb_stristr('atvd.plan',$tabla))
    {
      $tsubt=0;
      $total=0;
    }
      
    if($docux=='IEBX')
    {
      $ver_doco=0;
      $tsubt=0;
      $total=0;
    }

    if($docux=='TFIX')
    {
      $ver_doco=0;
      $tsubt=0;
      $total=0;
    }

    if($docux=='FCXX')
    {
      $ver_doco=0;
//       $tsubt=0;
//       $total=0;
    }

    if($docux=='PCXX')
    {
      $ver_doco=0;
//       $tsubt=0;
//       $total=0;
    }

    if($docux=='NOXX')
    {
      $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) and 1==1){ ?>
<?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}}

/* @media print {body {font-size:50%;}} */
  
@media print {
/*     font-size {transform: scale(.7);} */
/*     table {page-break-inside: avoid;} */
}  
  
/* @page { @bottom-left { content: counter(page) "/" counter(pages); } }  */
 
/*    body {counter-reset: page;}
    .page-count:after{
        counter-increment: page;
        content: "Page " counter(page) " of " counter(pages);
    } 
   */

/* a::after {
  content: " (" attr(href) ")";
}   */
/*  
@page {
   @top-right {
    content: counter(page) " / " counter(pages);
   } */
/*   @tfoot::after{ content: counter(page) " / " counter(pages);} */
}
  
/*   
@media print {
  #body {
    transform:scale(.5,.5);-ms-transform:scale(.5,.5);-webkit-transform:scale(.5,.5)
  }
}  
  
   */
  /* 	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:; ">
<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%" style="font-size:<?php {echo $xfontsize*1.3;} ?>px;">
    <?php if($pant=='IMPR1'){echo 'CONSULTA DE DOCUMENTOS';}else{echo 'CONSULTA DE REGISTROS';}; ?>
  </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>
        <td width="20%"  style="font-weight:bold;"  >DOCUMENTO</td>
        <td style="font-weight:bold;"><?php if($docu!=''){echo $docu.' - '.r_fiel('docu',$docu);}else{echo $modu.' - '.r_fiel('modu',$modu);} ?></td>
      </tr>  
      <?php if(mb_stristr('comp.retp.retc',$tabla) and 1==2){ ?>
      <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>  
      <tr>
        <td style="font-weight:bold;">VENDEDOR</td>
        <td><?php if($vndd==''){echo 'TODOS';}else{echo r_fiel('vndd',$vndd);}; ?></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.tfin',$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>
        <td style="font-weight:bold;">NUMEROS</td>
        <td><?php echo $numero1.' - '.$numero2; ?></td>
      </tr>  
      <tr>
        <td style="font-weight:bold;"><?php echo $entilabel?></td>
        <td><?php if($enti==''){echo 'TODOS';}else{echo $enti.' - '.r_fiel('enti',$enti);}; ?></td>
      </tr>  
      <?php //if(mb_stristr('comp',$tabla) and $cfg_empr=='demo' and $toenti!=''){ ?>
      <?php if(mb_stristr('comp',$tabla) and mb_stristr('demo.srie',$cfg_empr) and $toenti!=''){ ?>
      <tr>
        <td style="font-weight:bold;"><?php echo 'CLIENTE'?></td>
        <td><?php if($toenti==''){echo 'TODOS';}else{echo $toenti.' - '.r_fiel('enti',$toenti);}; ?></td>
      </tr>  
      <?php } ?>
      <?php if(mb_stristr('vtas.comp.clie.prov.inve',$tabla) and $item!=''){ ?>
      <tr>
        <td style="font-weight:bold;"><?php echo 'ITEM'?></td>
        <td><?php if($item==''){echo 'TODOS';}else{echo $item.' - '.r_fiel('item',$item);}; ?></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($suco!=''){ ?>
      <tr>
        <td style="font-weight:bold;">SUCO</td>
        <td><?php echo $suco.' - '.r_fiel('suco0',$suco); ?></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($pret>0){ ?>
      <tr>
        <td style="font-weight:bold;">% RETEN.</td>
        <td><?php echo number_format($pret,2).'%'; ?></td>
      </tr>  
      <?php } ?>
      <?php if($impor!=''){ ?>
      <tr>
        <td style="font-weight:bold;">IMPORTACION</td>
        <td><?php echo $impor; ?></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>
        <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">
        <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'){ ?>
      <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>
      <?php $total=abs($tdebito)-abs($tcredito);?>
      <?php $tsubt=0;?>
      <?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(mb_stristr('RPRO.RCLI',$docu) and 1==2){ ?>
          
        <?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 } ?>
      
      
      <?php if($total!=0){ ?>
      <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>
    
      <?php if(mb_stristr('RPRO.RCLI',$docu)){ ?>
      <?php $colret=0;?>
        <table id="" class="1" border="1"
           align="center" cellpadding="3" width="100%"
           style="font-size:<?php {echo $xfontsize;} ?>px;
            border-collapse:collapse;background-color:snow; position:;">
        <tr>
          <td width="50%" valign="top">
            <table id="" class="2" border="1"
               align="center" cellpadding="3" width="100%"
               style="font-size:<?php {echo $xfontsize;} ?>px;
                border-collapse:collapse;background-color:snow; position:;">
        <?php while($aso_pantr=msql_fetch_assoc($res_tpantr)){?>
          <?php if(mb_stristr($aso_pantr['ccair'],'IVA') and $colret==0){ $colret++; ?>
            </table>
            </td>
            <td width="50%" valign="top">
            <table id="" class="3" border="1"
               align="center" cellpadding="3" width="100%" 
               style="font-size:<?php {echo $xfontsize;} ?>px;
                border-collapse:collapse;background-color:snow; position:;">
          <?php } ?>
          <tr align="right" >
            <td style="font-weight:bold;">
              <?php //echo $aso_pantr['ccair'].' : '.number_format($aso_pantr['puni'],2).'%'; ?>
              <?php echo $aso_pantr['ccair']; ?>
            </td>
             <?php if(mb_stristr($aso_pantr['ccair'],'IVA')){ ?>
            <td><?php echo number_format(abs($aso_pantr['sbiva']),2).''; ?></td>
            <td><?php echo number_format(abs($aso_pantr['sriva']),2); ?></td>
               <?php }else{ ?>
            <td><?php echo number_format(abs($aso_pantr['sbrta']),2).''; ?></td>
            <td><?php echo number_format(abs($aso_pantr['srrta']),2); ?></td>
               <?php } ?>
          </tr>
        <?php } ?>
            </table>
          </td>
        </tr>
      
        </table>
      <?php } ?>
              
  </td>
  
</tr>  
  
<tr>
  <td></td>
  <td>
      
    
  </td>
</tr>  

</table>

<hr>
<?php } ?>  
  
<?php 
                                                   
// explain_sql($sql_pant);
// explain_sql($sql_tpant);
?>
  
  
<?php //$dispcolu=0; ?>
<?php $tmaxwidth=''; ?>  
<!-- class="ListaTabla header_fijo"       -->
		<table id="tpant1" class="pant1 <?php if(mb_stristr($pant,'PANT')){echo 'ListaTabla header_fijo';}?> " 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 id="tpant1h" 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;" >
					<th onclick="sortTable(this,0);" style="display:none;"><?php  $ccol++; ?></th>
          <?php if(substr($pant,0,4)=='PANT'){ ?>
					<th onclick="sortTable(this,0<?php  $ccol++; ?>);" title="Imprimir" style="position:;">I</th>
          <?php } ?>
          
          <?php if($dispcolu!=0){ ?>
          
          <?php if(substr($pant,0,4)=='PANT' and $user_clon==1){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Copiar">C</th>
          <?php } ?>
          
          <?php if(substr($pant,0,4)=='PANT'){?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Editar">E</th>
          <?php } ?>
          
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php echo 'font-size:'.($xfontsize*0.8).';';?>">DOCU</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php echo 'font-size:'.($xfontsize*0.8).';';?>">PTOE</th>
          <?php } ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');"><?php if($mobile=='true'){echo 'NUM.';}else{echo 'NUMERO';} ?></th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">FECHA</th>
          <?php if($dispcolu!=0){?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="letter-spacing:1px;">CED/RUC</th>
          <?php } ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="letter-spacing:5px;max-width:"><?php echo $entilabel; ?></th>

          
          
					<?php if(@mb_stristr('carr',$tabla)){?>
            <?php if($dispcolu!=0){?>
              <th onclick="sortTable(this,<?php echo $ccol++; ?>);">FACTURAR</th>
              <th onclick="sortTable(this,<?php echo $ccol++; ?>);">NOMBRE</th>
            <?php } ?>
					<?php } ?>
          
					<?php if(@mb_stristr('acce',$tabla)){?>
            <?php if($dispcolu!=0){?>
              <th onclick="sortTable(this,<?php echo $ccol++; ?>);">TIPO</th>
              <th onclick="sortTable(this,<?php echo $ccol++; ?>);">E-MAIL</th>
            <?php } ?>
					<?php } ?>
          
          
					<?php if(@mb_stristr('atvd.plan',$tabla)){?>
  					<?php if(mb_stristr('PANT3.IMPR3',$pant)){?>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="">
              <?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++; ?>,'N');">HORAS</th>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" style="<?php if($tsubt==0){echo'display:none;';} ?>">VALOR</th>
					<?php } ?>

					<?php if(@mb_stristr('atvd',$tabla)){?>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>);"></th>
					<?php } ?>
          
					<?php if(@mb_stristr('plan',$tabla)){?>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>);">EMP.</th>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');">VALOR</th>
					<?php } ?>
          
					<?php if(@mb_stristr('guia',$tabla)){?>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>);">PLACA</th>
					<?php } ?>
          
					<?php if(@mb_stristr('susa',$tabla)){?>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>);">C.SUB</th>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>);">CARGO</th>
					<?php } ?>
          
          
          
          <?php if($docuitem==1){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');"
						style="<?php echo 'font-size:'.($xfontsize*0.8).';' ?>">CANT.</th>
               </th>	
				  <?php } ?>


          <?php if(($docuitem==1 or @mb_stristr('retp.retc.rete.',$tabla)) and mb_stristr('PANT1.IMPR1',$pant)){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');"
              style="<?php if((($tsubt==0  or $xipuni==0) and !mb_stristr('retp.retc.rete',$tabla))){echo'display:none;';}?><?php echo 'font-size:'.($xfontsize*0.8).';' ?>">
              <?php  $label = 'SUB-TOT'; ?>
            <?php if(@mb_stristr('retp.retc.rete',$tabla)){$label='CAIR';} ?>
                  <?php echo $label; ?>
          </th>	
				  <?php } ?>

          <?php if($docuitem==1 and mb_stristr('PANT3.IMPR3',$pant)){ ?>
               <?php $lblcant='Cant.'; ?>
      
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);"
						style="<?php echo 'font-size:'.($xfontsize*0.8).';' ?>">Umdd</th>
               </th>	
      
               <?php if($tabla=='inve'){?>
               <th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" title="Ingreso">Ingr.</th>
               <th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" title="Egreso">Egre.</th>
               <?php $lblcant=''; ?>
               <?php } ?>
               <?php if($dispcolu==1){?>         
               <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Código">Código</th>
               <?php } ?>
               <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Descripción">Descrip.</th>
               <?php if($tabla=='susa'){?>
               <th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" title="Sueldo">Sueldo</th>
               <?php }else{ ?>
               <th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" title="Prec.Unitario" style="<?php if($xipuni==0){echo'display:none;';}?>">P.Uni</th>
               <?php } ?>
				<?php } ?>

          <?php if($docunvdd==1 and mb_stristr('PANT3.IMPR3',$pant)){ ?>
               <th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" title="Sueldo">Valor</th>
				<?php } ?>
     
     
         
         <?php if(@mb_stristr('susa',$tabla)){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');"
						style="<?php echo 'font-size:'.($xfontsize).';' ?>">SUELDO</th>
               </th>	
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');"
						style="<?php echo 'font-size:'.($xfontsize*0.8).';' ?>">ANTICIPO</th>
               </th>	
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');"
						style="<?php echo 'font-size:'.($xfontsize*0.8).';' ?>">ALIM</th>
               </th>	
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');"
						style="<?php echo 'font-size:'.($xfontsize*0.8).';' ?>">MOVIL</th>
               </th>	
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');"
						style="<?php echo 'font-size:'.($xfontsize*0.8).';' ?>">COMIS</th>
               </th>	
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');"
						style="<?php echo 'font-size:'.($xfontsize*0.8).';' ?>">D.13</th>
               </th>	
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');"
						style="<?php echo 'font-size:'.($xfontsize*0.8).';' ?>">D.14</th>
               </th>	
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');"
						style="<?php echo 'font-size:'.($xfontsize*0.8).';' ?>">F.RES</th>
               </th>	
         <?php } ?>
          
					<?php if($docuiimp==1){?>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" style="<?php if($tdcto==0 or $xipuni==0){echo'display:none;';}?> <?php echo 'font-size:'.($xfontsize*0.8).'; text-decoration:underline;' ?>">DCTO</th>	
						<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" style="<?php if($tssid==0 or $xipuni==0){echo'display:none;';}?> <?php echo 'font-size:'.($xfontsize*0.8).'; text-decoration:underline;' ?>">SSID</th>	
						<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" style="<?php if($tice==0 or $xipuni==0){echo'display:none;';}?> <?php echo 'font-size:'.($xfontsize*0.8).'; font-style:italic;' ?> ">ICE</th>	
						<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" style="<?php if($tsubtiva0==0 or $xipuni==0){echo'display:none;';}?> <?php echo 'font-size:'.($xfontsize*0.8).';' ?>">SUBT-IVA0</th>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" style="<?php if($tsubtiva==0 or $xipuni==0){echo'display:none;';}?> <?php echo 'font-size:'.($xfontsize*0.8).';' ?>">SUBT-IVA</th>	
						<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" style="<?php if($tprop==0 or $xipuni==0){echo'display:none;';}?> <?php echo 'font-size:'.($xfontsize*0.8).';' ?>">PROP</th>	
						<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" style="<?php if($tiva==0 or $xipuni==0){echo'display:none;';}?> <?php echo 'font-size:'.($xfontsize*0.8).'; font-style:italic;' ?>">IVA</th>	
						<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" style="<?php if($tirbp==0 or $xipuni==0){echo'display:none;';}?> <?php echo 'font-size:'.($xfontsize*0.8).'; font-style:italic;' ?>">IRBP</th>
					<?php }?>
          
         <?php if(@mb_stristr('FP15.DA16',$docu)){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');">Peso Net.</th>
				<?php } ?>        

          
					<?php if(@mb_stristr('retc.retp.rete',$tabla)){?>
            <?php if($dispcolu!=0){?>
              <th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');">B.Rta.</th>
            <?php } ?>
              <th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');">%Rta.</th>
            <?php if($dispcolu!=0){?>
              <th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');">R.Rta.</th>
            <?php } ?>
            <?php if($dispcolu!=0){?>
              <th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');">B.IVA</th>
            <?php } ?>
              <th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');">%IVA</th>
            <?php if($dispcolu!=0){?>
              <th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');">R.IVA</th>
            <?php } ?>
					<?php } ?>
          
          
          <?php if($docuctas==1 and mb_stristr('PANT3.IMPR3',$pant)){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Cuenta">Cuenta</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Descripción">Descrip.</th>
				  <?php } ?>
          
          
					<?php if($docuctas==1){?>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');">DEBITOS</th>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');">CREDITOS</th>
					<?php } ?>

          
          <th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" style="<?php if($total==0){echo'display:none;';} ?>">
            <?php if($tabla=='cont'){echo 'DIFER.';}else{echo 'TOTAL';} ?>
          </th>

          <?php if($docudocu==1 and mb_stristr('PANT3.IMPR3',$pant)){ ?>
            <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Documento">Docum.</th>
            <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Numero">Numer.</th>
            <th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" title="Numero">Cantidad</th>
            <?php if(mb_stristr('dxco.dxpa',$tabla)){?>
            <th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" title="Numero">Valor</th>
				    <?php } ?>
				  <?php } ?>
          
          <?php if($docurete==1 and mb_stristr('PANT3.IMPR3',$pant)){ ?>
				  <?php } ?>
          
          <?php if($dispcolu!=0){?>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="letter-spacing:5px;max-width:;<?php if($mconcepto==''){echo'display:none;';}?>">CONCEPTO</th>
          <?php } ?>

          <?php if($empr_cont==1 and @mb_stristr('comp',$tabla)){ ?>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="RISE" style="font-size:<?php echo $xfontsize*0.8;?>px;">R</th>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Sustento del Comprobante">SC</th>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Forma de Pago">FP</th>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Codigo Anexo Imp.Renta" style="font-size:<?php echo $xfontsize*0.8;?>px;">CAIR</th>
					<?php }?>
          
          <?php if(@mb_stristr('comp.retc.',$tabla)){ ?>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Autorización" style="font-size:<?php echo $xfontsize*0.8;?>px;">AUT</th>
					<?php }?>

          
          <?php if(substr($docu,0,3)=='ICH'){ ?>
             <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Fecha Depósito">Fec.Depo.</th>
             <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Cta.Banc Depósito">Cta.Depo.</th>
             <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Numero Depósito">#.Depo.</th>
          <?php } ?>
          
          <?php if(substr($docu,0,2)=='CH'){ ?>
             <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Beneficiario">Benefic.</th>
          <?php } ?>
          <?php if($tabla=='bcos'){ ?>
             <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Fecha Banco">Fec.Banco</th>
          <?php } ?>
          
					 <?php if(mb_stristr('inve.prod.tfin',$tabla) and $mobile!='true'){?>
               <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Lote" style="<?php if($mlote==''){echo 'display:none;';} ?>">Lote</th>
               <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Serie" style="<?php if($mserie==''){echo 'display:none;';} ?>">#Serie</th>
						<?php } ?>

					 <?php if(mb_stristr('vtas.clie.carr.inve.prod.tfin',$tabla) and $mobile!='true'){?>
               <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Color" style="<?php if($mclor==''){echo 'display:none;';} ?>">Color</th>
               <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Talla" style="<?php if($mtlla==''){echo 'display:none;';} ?>">Talla</th>
						<?php } ?>
         
          
          
          <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Status">ST</th>

          <?php if($user_apro==1){?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);"
							title="
							<?php if($user_apro==1){echo 'Aprobar';}?>
							<?php //if($user_elim==1){echo '/Eliminar';}?>
							">
						<?php if($user_apro==1){echo 'A';}?>
                              <?php //if($user_elim==1){echo '/X';}?>
					</th>
          <?php } ?>

          <?php if($user_anul==1 or $user_elim==1){?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);"
							title="
							<?php if($user_anul==1){echo 'Anular';}?>
							<?php if($user_elim==1){echo '/Eliminar';}?>
										 ">
						<?php if($user_anul==1){echo 'O';}?><?php if($user_elim==1){echo '/X';}?>
					</th>
          <?php } ?>



          <?php if($ver_modi==1){ ?>
               <?php if($tabla=='clie' and mb_stristr('PANT3',$pant)){ ?>
                <th onclick="sortTable(this,<?php echo $ccol++; ?>);">Cant.</th>
                <th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($xipuni==0){echo'display:none;';}?>">P.Uni.</th>
                <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Modif.">M.</th>
               <?php } ?>
               <?php if($tabla=='inve' and mb_stristr('PANT3',$pant) and mb_stristr('IB10',$docu)){ ?>
                <th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($xipuni==0){echo'display:none;';}?>">P.Uni.</th>
                <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Modif.">M.</th>
               <?php } ?>
               <?php if($tabla=='prod' and mb_stristr('PANT3',$pant) ){ ?>
                <th onclick="sortTable(this,<?php echo $ccol++; ?>);">Cant.</th>
                <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Modif.">M.</th>
               <?php } ?>
               <?php if($tabla=='comp' and mb_stristr('PANT1',$pant)){ ?>
               <?php if($empr_impo==1){ ?>
                <th onclick="sortTable(this,<?php echo $ccol++; ?>);">IMPO.</th>

                  <?php } ?>
                <th onclick="sortTable(this,<?php echo $ccol++; ?>);">SuCo.</th>
                <th onclick="sortTable(this,<?php echo $ccol++; ?>);">FPag.</th>
                <th onclick="sortTable(this,<?php echo $ccol++; ?>);">Atrz.</th>
                <th onclick="sortTable(this,<?php echo $ccol++; ?>);">Enti_3ro</th>
                <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Modif.">M.</th>
               <?php } ?>
               <?php if($tabla=='comp' and mb_stristr('PANT3',$pant)){ ?>
                <th onclick="sortTable(this,<?php echo $ccol++; ?>);">Item</th>
                <th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="display:;">FC</th>
                <th onclick="sortTable(this,<?php echo $ccol++; ?>);">CAIR</th>
                <th onclick="sortTable(this,<?php echo $ccol++; ?>);">Cuenta</th>
                <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Modif.">M.</th>
               <?php } ?>
               <?php if($tabla=='bcos' and mb_stristr('PANT3',$pant)){ ?>
                <th onclick="sortTable(this,<?php echo $ccol++; ?>);">Cuenta</th>
                <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Modif.">M.</th>
               <?php } ?>
          <?php } ?>
          
          
          <?php if(mb_stristr('pcs1.prs1',$cfg_empr) and mb_stristr('vtas',$tabla) and 1==2){ ?>
             <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(mb_stristr('tgck.sawo.ztej',$cfg_empr) and mb_stristr('vtas',$tabla) and 1==1){ ?>
             <th onclick="sortTable(this,<?php echo $ccol++; ?>);">VHCL</th>
          <?php } ?>
          
          <?php if($ver_rete==1){ ?>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Reten.</th>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Num.Ret.</th>
<!--   					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">CAIR</th> -->
<!--   					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');">Rta</th> -->
<!--   					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');">IVA</th> -->
					<?php }?>

               

          <?php 
//                    if($ver_saldo==1)
                    if(mb_stristr('vtas.comp',$tabla) and $ver_saldo==1 and mb_stristr($pant,'PANT') )
                    { 
?>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Saldo</th>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Caja</th>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');">Efectivo</th>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');">Compensa</th>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);"></th>
					<?php }?>
          
          <?php if($ver_guia==1){ ?>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Num.Guia</th>
					<?php }?>
          
          <?php if($ver_apli==1){ ?>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="">Aplica</th>
					<?php }?>

          <?php if($empr_zeus==1){ ?>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="">Zeus</th>
					<?php }?>

          
          <?php if($ver_fact==1){ ?>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Factura">Fact.</th>
					<?php }?>


          <?php if($ver_doco==1 and ($tabla=='caja' or $tabla=='bcos')){ ?>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="">Dest.</th>
					<?php }?>


          <?php if($ver_doco==1 and $tabla=='inve'){ ?>
					<?php }?>

          <?php if(mb_stristr('IB10.EB10',$docu)){ ?>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="">#FACT.</th>
					<?php }?>
          <?php if(mb_stristr('IB12.EB12',$docu)){ ?>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title=""># N/C</th>
					<?php }?>
          <?php if(mb_stristr('IB13.EB13',$docu)){ ?>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="">Bod.2</th>
					<?php }?>

          <?php if($ver_doco==1){ ?>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Documento Relacionado">Doc.Rel.</th>
					<?php }?>

          <?php if(mb_stristr('FC.FP.NC',substr($docu,0,2)) and $ver_invep==1){ ?>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" title="Inventario Pendiente">I.P.</th>
					<?php }?>

          <?php if($ver_cont==1){ ?>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" title="Diario Contab.">Cont.</th>
					<?php }?>

          
          <?php //if($ver_cele==1){ ?>
          <?php if($ver_cele==1 or $cel_stat==1){ ?>
             <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Status Comp.Elect.">ST.CE.</th>
          <?php } ?>

          <?php if($empr_impo==1 and $mimpor!=''){ ?>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($mimpor==''){echo'display:none;';}?>">IMPO</th>
          <?php } ?>

          
          <?php // modificar ?>
          <?php if($ver_modi==1){ ?>
              <?php if(substr($docu,0,3)=='ICH' and 1==2){ ?>
                 <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="">Fec.Depo</th>
                 <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="">Cta.Depo</th>
                 <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="">#.Depo</th>
              <?php } ?>
          <?php } ?>
          
          <?php // Pagos Rapidos ?>
          <?php if($ver_para==1){ ?>
                 <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="">Ret.Fta.</th>
                 <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="">Ret.Iva</th>
                 <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="">Comis.</th>
                 <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="">Tercero</th>
                 <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="">Factura</th>
                 <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="">Neto</th>
          <?php } ?> 
          
          <?php if($tabla=='plan'){ ?>
               <th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" title="">Avance</th>
          <?php } ?>

          <?php if($tabla=='prov' and $docu=='DA16'){ ?>
               <th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" title="">C.Local</th>
          <?php } ?>


          <?php if(substr($pant,0,4)=='PANT'){ ?>
          <?php $ccol++; ?>
          <th style="font-size:<?php echo $xfontsize*.5;?>px;" title="Descargar XLS">
            <a href="#" id="downxls1" onClick="javascript:fnExcelReport('tpant1',this,'<?php echo $cfg_empr.'_'.$docu.'_'.date('Ymd_His');?>');">XLS</a>
          </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(@msql_num_rows($res_pant)==0){?>
          <tr><td style="font-weight:bold;">
            <?php echo 'NO HAY DATOS'; ?>  
            <?php echo '<br>==>'.date('H:i:s'); ?>
            <?php //echo '<br>'.$docu.' /'.$enti; ?>
          </td></tr>
        <?php }?>
        <?php if($docu=='' and $ver_dife==0 and $tabla!='cont' and $modu==''){?>
          <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 while($aso_pant=@msql_fetch_assoc($res_pant)){ ?>
				<?php $crow++; ?> 
				<?php $tipoid=$aso_pant['enti_tipoid']; ?>
				<?php $tiporuc=$aso_pant['enti_tiporuc']; ?>
				<?php $struc=$aso_pant['enti_struc']; ?>
				<?php $status=$aso_pant['status']; ?>
				<?php $stat_descri=$aso_pant['stat_descri']; ?>
				<?php $stfin=$aso_pant['stfin']; ?>
				<?php $claveacc=$aso_pant['claveacc']; ?>
				<?php $firmafec=$aso_pant['firmafec']; ?>
				<?php $recepmsj=$aso_pant['recepmsj']; ?>
				<?php $autormsj=$aso_pant['autormsj']; ?>
				<?php $autornum=$aso_pant['autornum']; ?>
				<?php $emailfec=$aso_pant['emailfec']; ?>
        <?php $duni=@$aso_pant['item_duni']; ?>
        <?php $dpre=@$aso_pant['item_dpre']; ?>
        <?php $dval=@$aso_pant['item_dval']; ?>
        <?php $id_trfila=fillzero($crow);?> 
       
        <?php
         if($cfg_empr=='tfle' and $aso_pant['docu']=='ATV1')
         {tfle_getplan($aso_pant['docu'],$aso_pant['idnum1']);}
        ?>    
            
        <?php
          $stcele=0;
          $stambi=substr($aso_pant['claveacc'],23,1);
//           if(mb_stristr($autormsj,'RECHAZ')){$autormsj='RECHAZADA';}else{$autormsj='';}
          if(mb_stristr($autormsj,'DEVUEL')){$autormsj='DEVUELTA';}else{$autormsj='';}
//           if($stambi==''){$stambi=0;}                                                
          if($claveacc!=''){$stcele=$stambi.'1:EMI';}
          if($firmafec!=''){$stcele=$stambi.'2:FIR';}
          if($recepmsj!=''){$stcele=$stambi.'3:SRI';}
          if($autormsj!=''){$stcele=$stambi.'4:DEV';}
          if($autornum!=''){$stcele=$stambi.'5:AUT';}
        ?>
        
     
        
				<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;'; } ?> 
                   height:auto;min-height:auto;
                   "
            <?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'){?> 
				{info_docu('PANT2','<?php echo $aso_pant['docu']; ?>','<?php echo $aso_pant['idnum1']; ?>','','<?php if($ver_diar==1){echo '2';} ?>');}
                    <?php } ?> 
										<?php if($touchs=='true'){?>
										<?php } ?>
										 "
						>
          
          <?php
            $idocu=$aso_pant['docu'];
            $iidnum=$aso_pant['idnum1'];
            $docutabla=$aso_pant['docu_tabla'];
                                                          
//             if($docutabla=='cont')
//             if($tabla=='cont' and substr($idocu,0,2)!='DD')
            if($tabla=='cont' and !mb_stristr('DD.DT',substr($idocu,0,2)))
            {
              $iidnum=$aso_pant['idfrom']; $iformato='3';
            }

          ?>
          <td style="display:none;"><?php echo fillzero($crow,5); ?></td>
          <?php if(substr($pant,0,4)=='PANT'){ ?>
					<td align="center" style="position:;">
					<?php
                $claveacce=$aso_pant['claveacce'];
                $pidtxt='i_'.$crow; $psize=$xfontsize;
                $pidnum=$aso_pant['idnum1'];
                $pcaption='Imprimir';
                $pabrev='I';
                if($claveacce=='')
                {$ponclick='{window.open("?prnt=1&docu='.$idocu.'&idnum='.$iidnum.'&formato='.$iformato.'","_blank")}';}
                else
                {$ponclick='{window.open("?prnt=1&clave='.$claveacce.'","_blank")}';}
                if($docu=='PLA1')
                {$ponclick='{window.open("/lib/tfle_repo2.php?fini='.$aso_pant['fecha'].'&clie='.$aso_pant['enti'].'&tipo=comp&ffin='.$aso_pant['fecha'].'&recu=","_blank")}';}
//                 if(mb_stristr($pant,'PANT') and $mobile!='true'){include('vrbutton.php');}
                if(mb_stristr($pant,'PANT') and $mobile!='true' and $docu=='PLA1'){include('vrbutton.php');}
          ?>
					</td>
          <?php } ?>
          
          
          <?php if($dispcolu!=0){?>
          <?php //if(substr($pant,0,4)=='PANT'){ ?>
          <?php if(substr($pant,0,4)=='PANT' and $user_clon==1){ ?>
              <td align="center">
              <?php if($user_clon==1 and days_diff($aso_pant['fecha'],$fechaa)<=$dias_clon and $aso_pant['atrztipo']!='E'){ ?>
                <?php
                  $pcaption='Copiar: '.$aso_pant['docu'].'-'.$aso_pant['numero']; $pabrev='C';
                  $pidtxt='c_'.$crow; $pname='itr_fila'; $psize=$xfontsize;
                  $pidnum=$aso_pant['idnum1'];$pdocu=$aso_pant['docu'];
                  $ponclick="clon_docu('".$aso_pant['docu']."','".$aso_pant['idnum1']."','','".$pcaption."');";
                  if(mb_stristr($pant,'PANT1')){include('vrbutton.php');}
                ?>                              
              <?php } ?>
              </td>
          <?php } ?>

          
          
          <?php if(substr($pant,0,4)=='PANT'){?>
					<td align="center" title="<?php echo 'ID:'.$aso_pant['idnum1'];?>"
							onclick="
                                        <?php if(substr($pant,0,1)=='P' and $touchs=='false'){?>
                                        {info_docu('PANT2','<?php echo $aso_pant['docu']; ?>','<?php echo $aso_pant['idnum1']; ?>');}
                                        <?php } ?>
										 ">
            
              <?php
                                           //echo "Fecha = ".$aso_pant['stfin'];
              if($docu!='PLA1')
              {
                   $stfin=$aso_pant['stfin'];
                   
                   
                   if($cfg_empr=='imcp' and substr($docu,0,2)=='DD' and date('Y-m-d')<="2022-02-15")
                   {
                        $dias_anul=400; 
                        $stfin=0;
                   }
                   
                   if($cfg_empr=='hg01' and date('Y-m-d')<="2022-12-31")
                   {
                        $dias_anul=400; 
                        $stfin=0;
                   }
                   
                  if(!mb_stristr('FROX',$status)
                     and ($user_anul==1 or $user_modi==1)
                     and $stfin!=1
                     and $firmafec==''
                     and $autornum==''
                     and mb_stristr($pant,'PANT')
                     and days_diff($aso_pant['fecha'],$fechaa)<=$dias_anul)
                  {
                    $pcaption='Editar : '.$aso_pant['docu'].'-'.$aso_pant['numero'];
                    $pabrev='E';
                    $pidtxt='e_'.$crow.'_'.$iddet; $pname='itr_fila'; $psize=$xfontsize;
                    $pidnum=$aso_pant['idnum1'];$pdocu=$aso_pant['docu'];
    //                 $ponclick='{window.open("?scri=regi_docu&docu='.$aso_pant['docu'].'&idnum1='.$aso_pant['idnum1'].'","_blank")}';
                    $ponclick='{window.open("?scri=regi_docu&docu='.$idocu.'&idnum1='.$iidnum.'","_blank")}';
                    include('vrbutton.php');
                  }
              }
                                           
            
            
            ?>
            
            <?php
              if($docu=='PLA1')
              {
                $pidtxt='e_'.$crow; $psize=$xfontsize;
                $pidnum=$aso_pant['idnum1'];
                $pcaption='Editar: '.$aso_pant['docu'].'-'.$aso_pant['numero']; $pabrev='E';
                $ponclick='{window.open("/lib/vrpla.php?prnt=1&docu='.$idocu.'&idnum='.$iidnum.'","_blank")}';
                if(mb_stristr($pant,'PANT')){include('vrbutton.php');}
              }
                           
                                           
            ?>
					</td> 
          <?php } ?>
          <?php } ?>
          
          <?php if($dispcolu!=0){?>
					<td align="center" style="font-size:<?php echo ($xfontsize*0.8);?>px;"
							title="<?php echo $aso_pant['docu_descri']; ?>">
						<?php echo $aso_pant['docu']; ?>
					</td>
          <?php } ?>
          
          <?php if($dispcolu!=0){?>
          <td align="center" style="font-size:<?php echo $xfontsize*0.8;?>px;"
							title="<?php
                       if(mb_stristr('comp.retc.retp.guia.dxpa.dxco',$tabla)){echo $aso_pant['ptoe'];}
                       if(mb_stristr('vtas.clie',$tabla)){echo $aso_pant['ptov_descri'];}
                       if(mb_stristr('inve.prod.tfin',$tabla)){echo $aso_pant['bode_descri'];}
                       if(mb_stristr('bcos',$tabla)){echo $aso_pant['ctab_descri'];}
                       if(mb_stristr('caja',$tabla)){echo $aso_pant['caja_descri'];}
                     ?>">
            <?php
               if($mobile=='true'){}
               else
               {
                 if(mb_stristr('comp.retc.retp.guia.dxpa.dxco',$tabla))
                 {echo $aso_pant['ptoe'];}

                 if(mb_stristr('comi',$tabla))
                 {echo $aso_pant['ptoe'];}

                 if(mb_stristr('vtas.clie',$tabla))
                 {echo $aso_pant['ptov'];}
                 
                 if(mb_stristr('bcos',$tabla))
                 {echo $aso_pant['ctab'];}
                 
                 if(mb_stristr('caja',$tabla))
                 {echo $aso_pant['caja'];}
                 
                 if(mb_stristr('inve.prod.tfin',$tabla))
                 {echo $aso_pant['bode'];}
               }
          ?>
					</td>
          <?php } ?>
          
					<td align="center" title="<?php echo 'ID-'.$aso_pant['idnum1'].' : '.$aso_pant['ptonumero']; ?>" style="font-weight:bold;">
            <?php if(!mb_stristr('comp.retc',$tabla)){ ?>
						  <div class="hidden"><?php echo $aso_pant['ptoe'].fillzero($aso_pant['numero'],9); ?></div>
            <?php } ?>
						<?php 
               echo '<a href="?prnt=1&docu='.$idocu.'&idnum='.$iidnum.'&formato='.$iformato.'" target="_blank">';
               if($mobile=='true'){echo intval($aso_pant['numero']);}
               else{echo $aso_pant['numero'];}
               echo '</a>';
            ?>
                  
                  
					<?php $enti_maxlen=400;?>
					<?php $enti_codigo=$aso_pant['enti'];?>
					<?php $enti_descri=$aso_pant['enti_descri'];?>
					<?php $toenti=$aso_pant['toenti'];?>
					<?php $toentidescri=r_fiel('enti',$toenti);?>
                  
               <?php $fechar= $aso_pant['fecha'];?>
               <?php $fechadmy= $aso_pant['fechadmy'];?>
                  
                  
               <?php 
                  if(mb_stristr('nomi.empl',$tabla) )
                  {
                     if(mb_stristr('PANT1.IMPR1',$pant))
                     {
                        $enti_codigo=$aso_pant['enti'];
                        $enti_descri=$cfg_descri;
                     }
                     if(mb_stristr('PANT3.IMPR3',$pant))
                     {$enti_codigo=$aso_pant['enti2'];}
                  }
                ?>   
                  
					</td>
               
					<td align="center">
						<div style="display:none;"><?php echo $fechar; ?></div>
						<div class="noxls"><?php echo $fechadmy; ?></div>
					</td>
          <?php if($dispcolu!=0){ ?>
<?php
              $href='';              
              if((mb_stristr('vtas.clie.prod.',$tabla) or $docu=='EB10' or $docu=='IB12'))              
              {$href='?elbl=1&codigo='.$enti_codigo.'&tipo=" target="_blank"';}
?>          
          
					<td align="center" 
							title="<?php if($tipoid=='R'){ echo 'RUC:'.$tiporuc.'-'.$struc;}else{echo 'ID:'.$tipoid;};?>">
            <?php if(!empty($href)){echo '<a href="'.$href.'">';} ?>
						<?php echo substr($enti_codigo,0,10); ?>
            <?php if(!empty($href)){echo '</a>';} ?>
					</td>
          <?php } ?>

          
          <?php if(substr($pant,0,4)=='PANT'){?>
					<?php $enti_descri =split_words($enti_descri);?>
          <?php } ?>
					
					<td style="<?php if($mobile!='true' and strlen(trim($enti_descri))>20){echo 'font-size:'.($xfontsize-2).'px;';} ?>"
							title="<?php echo '/RS: '.$aso_pant['enti_razsoc']; ?>">
						<?php if($mobile=='true'){echo substr($enti_descri,0,20);}else{echo $enti_descri;} ?>
					</td>
          
					 <?php if($tabla=='carr'){?>
						<td align="center">
							<?php echo $toenti; ?>
						</td>
						<td align="center">
							<?php echo $toentidescri; ?>
						</td>
               
               
               
          <?php } ?>
          
					<?php if(mb_stristr('acce',$tabla)){?>
						<td align="center"> 
							<?php echo $aso_pant['user_tipo']; ?>
						</td>
						<td align="center"> 
							<?php echo $aso_pant['user_email']; ?>
						</td>
					<?php } ?>	

					<?php if(@mb_stristr('atvd',$tabla) and 1==2){?>
						<td align="center"> 
							<?php echo $aso_pant['enti2']; ?>
						</td>
						<td align="center"> 
							<?php echo r_fiel('enti',$aso_pant['enti2']); ?>
						</td>
					<?php } ?>
          
					<?php if(@mb_stristr('atvd.plan',$tabla)){?>
  					<?php if(mb_stristr('PANT3.IMPR3',$pant)){?>
          
                              <?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 } ?>

                              <?php if(substr($pant,0,4)=='PANT'){?>
                              <?php $asubd=split_words($asubd,100); ?>
                              <?php } ?>
                              <td><?php echo $enti2_descri; ?></td>
                              <td><?php echo $lsub1d.' / '.$lsub2d; ?></td>
                              <td title="<?php echo $asub; ?>"><?php echo ($asubd); ?></td>
  					<?php } ?>
          
						<td align="right"> 
							<?php echo number_format($aso_pant['stcant'],$duni); ?>
						</td>
               
          <?php if($dispcolu!=0){?>
						<td align="center" style="<?php if($tsubt==0 or $xipuni==0){echo'display:none;';} ?>"> 
							<?php echo number_format($aso_pant['puni'],$dpre); ?>
						</td>
          <?php } ?>
					<?php } ?>
          

					<?php if(@mb_stristr('guia',$tabla)){?>
              <?php $placa=$aso_pant['placa'];  ?>
              <?php $placades=r_fiel('vhcl',$placa);  ?>
              
						<td align="center"  title="<?php echo $placades;?>"> 
							<?php echo $placa; ?>
						</td>
					<?php } ?>

					<?php if(@mb_stristr('atvd.plan',$tabla)){?>
              <?php $empr1=$aso_pant['empr1'];  ?>
						<td align="center"> 
							<?php echo $empr1; ?>
						</td>
					<?php } ?>

					<?php if(@mb_stristr('plan',$tabla)){?>
              <?php $valorpla=$aso_pant['valorpla'];  ?>
						<td align="right"> 
							<?php echo number_format($valorpla,2); ?>
						</td>
					<?php } ?>

         <?php if(@mb_stristr('susa',$tabla)){ ?>
             <td align="left" style="">
              <?php echo $aso_pant['csub']; ?>
             </td>	
             <td align="left" style="">
              <?php echo $aso_pant['cargo']; ?>
             </td>	
         <?php } ?>
               
          <?php if($docuitem==1){ ?>
					    <td align="right" style="font-style:italic;  ">
						  <?php echo number_format(abs($aso_pant['stcant']),2); ?>
					    </td>	
				  <?php } ?>

          
         <?php $stsubt=abs($aso_pant['stsubt']); ?>
         <?php if(@mb_stristr('susa',$tabla)){ ?>
            <?php $stsubt=$aso_pant['msueldo'];?>
         <?php } ?>
               
               
          
          <?php if(($docuitem==1 or @mb_stristr('retp.retc.rete',$tabla)) and mb_stristr('PANT1.IMPR1',$pant)){ ?>
            <?php if(mb_stristr('retp.retc.rete',$tabla)){?>
					    <td align="left" style="border-right:dotted 1px;" title="<?php echo $aso_pant['cair'].'-'.$aso_pant['cair_descri']; ?>">
					 	  <?php echo $aso_pant['mcair']; ?>
					    </td>	
            <?php }else{?>
					    <td align="right" style="font-weight:bold;font-style:italic; <?php if($tsubt==0  or $xipuni==0){echo 'display:none;';}?>">
						  <?php echo number_format($stsubt,2); ?>
					    </td>	
            <?php }?>
					<?php } ?>

          
				<?php if($docuitem==1 and mb_stristr('PANT3.IMPR3',$pant)){ ?>
					<?php $item_codigo=trim($aso_pant['item']);?>
					<?php $item_ce=trim(@$aso_pant['itemce']);?>
					<?php $item_descri=trim($aso_pant['item_descri']);?>
					<?php $item_descri=str_replace(substr($item_codigo,0,-1),'',$item_descri);?>
               
					    <td align="center" style="font-style:; <?php echo 'font-size:'.$xfontsize*0.8; ?> ">
						  <?php echo $umdd; ?>
					    </td>	

          
         <?php if(@mb_stristr('nomi.empl',$tabla)){ ?>
					<?php $item_codigo=trim($aso_pant['nvdd']);?>
					<?php $item_descri=trim($aso_pant['nvdd_descri']);?>
         <?php } ?>
               
               
          
			<?php $item_puni=$aso_pant['puni'];?>
          <?php if($dpre==0){$dpre=2;}?>
          <?php if(substr($item_codigo,0,4)=='9900'){$item_descri=$aso_pant['cair_descri'];}?>
          <?php if(substr($pant,0,4)=='PANT'){?>
					<?php $item_descri =split_words($item_descri);?>
          <?php } ?>
                         
          <?php //$cant=number_format(abs($aso_pant['cant']),$duni); ?>
          <?php $cant=(($aso_pant['cant'])); ?>
          <?php if($tabla=='inve'){?>
            <?php if(substr($aso_pant['docu'],0,1)=='I'){$ingr=abs($cant);$egre=0;}else{$ingr=0;$egre=abs($cant);}?>
            <?php //if($mobile=='true'){$egre='('.$egre.')';} ?>
            <td align="right"><?php if($ingr!=0){echo number_format($ingr,$duni);} ?></td>
            <td align="right"><?php if($egre!=0){if($mobile=='true'){echo '(';} echo number_format($egre,$duni); if($mobile=='true'){echo ')';}}?></td>
            <?php $cant=$cant*0; ?>
            <?php $cant=''; ?>
          <?php } ?>
          
          <?php if($dispcolu!=0){?>
					<td title="<?php echo $aso_pant['itemce']; ?>">
						<?php echo $item_codigo ?>
					</td>
          <?php } ?>
					<td title="<?php echo $aso_pant['itemce']; ?>"
								style="<?php if(strlen(trim($item_descri))>20){echo 'font-size:'.($xfontsize*.8).'px';} ?>">
						<?php echo $item_descri; ?>
					</td>
					<td align="right" style="<?php if($xipuni==0){echo 'display:none;';} ?>">
						<?php echo number_format(abs($item_puni),$dpre); ?>
            <?php if($mobile=='true' and $aso_pant['iva']!=0){echo 'I';} ?>
					</td>
               
          

				<?php } ?>

         <?php if(@mb_stristr('susa',$tabla)){ ?>
						<td align="right" style="">
							<?php echo number_format(abs($aso_pant['msueldo']),2); ?>
						</td>	
						<td align="right" style="">
							<?php echo number_format(abs($aso_pant['valanti']),2); ?>
                                   <?php echo '-';?>
							<?php echo number_format(abs($aso_pant['poranti']),2); ?>
						</td>	
						<td align="right" style="">
							<?php echo number_format(abs($aso_pant['alimentacion']),2); ?>
						</td>	
						<td align="right" style="">
							<?php echo number_format(abs($aso_pant['movilizacion']),2); ?>
						</td>	
						<td align="right" style="">
							<?php echo number_format(abs($aso_pant['comision']),2); ?>
						</td>	
						<td align="center" style="">
							<?php echo $aso_pant['de13']; ?>
						</td>	
						<td align="center" style="">
							<?php echo $aso_pant['de14']; ?>
						</td>	
						<td align="center" style="">
							<?php echo $aso_pant['fres']; ?>
						</td>	
         <?php } ?>
          
					<?php if($docuiimp){ ?>
						<td align="right" style="<?php if($tdcto==0 or $xipuni==0){echo'display:none;';}else{echo'text-decoration:underline;';}?> font-style:italic;" title="<?php echo number_format($aso_pant['dcto'],2).'%';?>">
							<?php echo number_format(abs($aso_pant['stdcto']),2); ?>
						</td>	
						<td align="right" style="<?php if($tssid==0 or $xipuni==0){echo'display:none;';}else{echo'text-decoration:underline;';}?> font-style:italic;">
							<?php echo number_format(abs($aso_pant['stssid']),2); ?>
						</td>	
						<td align="right" style="<?php if($tice==0 or $xipuni==0){echo'display:none;';}?> font-style:italic;">
							<?php echo number_format(abs($aso_pant['stice']),2); ?>
						</td>	
						<td align="right" style="<?php if($tsubtiva0==0 or $xipuni==0){echo'display:none;';}?>">
							<?php echo number_format(abs($aso_pant['stsubtiva0']),2); ?>
						</td>	
						<td align="right" style="<?php if($tsubtiva==0 or $xipuni==0){echo'display:none;';}?>">
							<?php echo number_format(abs($aso_pant['stsubtiva']),2); ?>
						</td>	
						<td align="right" style="<?php if($tprop==0 or $xipuni==0){echo'display:none;';}?> font-style:italic;">
							<?php echo number_format(abs($aso_pant['stprop']),2); ?>
						</td>	
						<td align="right" style="<?php if($tiva==0 or $xipuni==0){echo'display:none;';}?> font-style:italic;">
							<?php echo number_format(abs($aso_pant['stiva']),2); ?>
						</td>	
						<td align="right" style="<?php if($tirbp==0 or $xipuni==0){echo'display:none;';}?> font-style:italic;">
							<?php echo number_format(abs($aso_pant['stirbp']),2); ?>
						</td>	
				<?php } ?>
         <?php if(mb_stristr('FP15.DA16',$docu)){ ?>
						<td align="right" style="font-style:italic;">
							<?php echo number_format($aso_pant['speso'],2);?>
						</td>	
				<?php } ?>        
					<?php if(mb_stristr('retc.retp.rete',$tabla)){?>
          <?php if($dispcolu!=0){?>
						<td align="right" style="font-style:italic;"> 
							<?php echo number_format(abs($aso_pant['sbrta']),2); ?>
						</td>
          <?php } ?>
						<?php if(ceil($aso_pant['sprta'])==floor($aso_pant['sprta'])){$dval=0;}else{$dval=2;}?>
						<td align="center" style=" font-size:<?php echo $xfontsize-2;?>px;"> 
							<?php echo number_format(abs($aso_pant['sprta']),$dval).'%'; ?>
						</td>
          <?php if($dispcolu!=0){?>
						<td align="right" style="border-right:dotted 1px;">
							<?php echo number_format(abs($aso_pant['srrta']),2); ?>
						</td>
          <?php } ?>
          <?php if($dispcolu!=0){?>
						<td align="right" style="font-style:italic;"> 
							<?php echo number_format(abs($aso_pant['sbiva']),2); ?>
						</td>
          <?php } ?>
						<?php if(ceil($aso_pant['spiva'])==floor($aso_pant['spiva'])){$dval=0;}else{$dval=2;}?>
						<td align="center" style=" font-size:<?php echo $xfontsize-2;?>px;"> 
							<?php echo number_format(abs($aso_pant['spiva']),$dval).'%'; ?>
						</td>
          <?php if($dispcolu!=0){?>
						<td align="right" style="border-right:dotted 1px;">
							<?php echo number_format(abs($aso_pant['sriva']),2); ?>
						</td>
          <?php } ?>
					<?php } ?>	

          <?php $stotal=$aso_pant['stotal']; ?>
          <?php $sdifer=$aso_pant['sdiferencia']; ?>
          
				<?php if($docuctas==1 and mb_stristr('PANT3.IMPR3',$pant)){ ?>
					<?php $ctas_codigo=$aso_pant['ctas'];?>
					<?php $ctas_descri=$aso_pant['ctas_descri'];?>
          <?php if(substr($pant,0,4)=='PANT'){?>
					<?php $ctas_descri =split_words($ctas_descri);?>
          <?php } ?>
					<td title="<?php echo $aso_pant['ctas']; ?>">
						<?php echo $aso_pant['ctas']; ?>
					</td>
					<td title="<?php echo $aso_pant['ctas_descri']; ?>"
								style="<?php if(strlen(trim($aso_pant['ctas_descri']))>20){echo 'font-size:'.($xfontsize*.8).'px';} ?>">
						<?php echo $ctas_descri; ?>
					</td>
          <?php //$sdifer=0;?>
				<?php } ?>
          
          
					<?php if($docuctas==1){?>
						<td align="right"> 
							<?php echo number_format(abs($aso_pant['stdebito']),2); ?>
						</td>
						<td align="right"> 
							<?php echo number_format(abs($aso_pant['stcredito']),2); ?>
						</td>

            <?php $stotal=$sdifer; ?>
          
					<?php } ?>	
            <?php $href=''; ?>          
            <?php if(substr($docu,0,2)=='CH'){$href='?ch10=1&docu='.$aso_pant['docu'].'&idnum='.$aso_pant['idnum1'].'" target="_blank"';} ?>
					<td align="right" style="font-weight:bold; <?php if($total==0){ echo 'display:none;';}?><?php if($sdifer!=0){ echo 'color:red;';}?>"> 
            <?php if(!empty($href)){echo '<a href="'.$href.'">';} ?>
						<?php echo number_format(abs($stotal),2); ?>
            <?php if(!empty($href)){echo '</a>';} ?>
					</td>

				<?php if(($docudocu==1) and mb_stristr('PANT3.IMPR3',$pant)){ ?>
					<?php $docum_codigo=$aso_pant['docum'];?>
					<?php $docum_descri=$aso_pant['docum_descri'];?>
					<?php $numer=fillzero($aso_pant['numer']);?>
					<?php $canti=$aso_pant['cant'];?>
					<?php $puni=$aso_pant['puni'];?>
					<td align="center" title="<?php echo $docum_descri; ?>">
						<?php echo $docum_codigo; ?>
					</td>
					<td align="center">
						<?php echo $numer; ?>
					</td>
					<td align="center">
						<?php echo $canti; ?>
					</td>
            <?php if(mb_stristr('dxco.dxpa',$tabla)){?>
            <td align="center">
              <?php echo $puni; ?>
            </td>
				    <?php } ?>
				<?php } ?>
          
					<?php $concepto_maxlen =40;?>
          <?php if(mb_stristr('retp.retc.rete',$tabla)){$concepto_maxlen=17*3;} ?>
          <?php $concepto = trim($aso_pant['concepto']); ?>
          <?php if(mb_stristr('PANT3.IMPR3',$pant)){?>
          <?php $concepto = trim($aso_pant['concepto']).' /'.trim($aso_pant['detalle']); ?>
          <?php } ?>
          <?php if(substr($pant,0,4)=='PANT'){?>
          <?php $concepto = split_words($concepto); ?>
          <?php } ?>
          <?php if($dispcolu!=0){?>
          <td style="<?php if($mconcepto==''){echo'display:none;';}?>max-width:;
										 <?php if(strlen($concepto)>$concepto_maxlen){echo 'font-size:'.($xfontsize*.8).'px';} ?>"
							title="<?php echo trim($aso_pant['concepto']); ?>"
							>
						<?php echo $concepto; ?>
					</td>
          <?php } ?>
          
          <?php if($empr_cont==1 and mb_stristr('comp',$tabla)){ ?>
  					<td align="center" title=""><?php if($aso_pant['enti_rise']==1){echo 'S';}else{echo 'N';}; ?></td>
  					<td align="center" title="<?php echo trim($aso_pant['suco_descri']); ?>"><?php echo $aso_pant['suco']; ?></td>
  					<td align="center" title="<?php echo trim($aso_pant['fpag_descri']); ?>"><?php echo $aso_pant['fpag']; ?></td>
  					<td align="center" title="<?php echo trim($aso_pant['cair_descri']); ?>"><?php echo $aso_pant['cair']; ?></td>
					<?php }?>
          
          <?php if(mb_stristr('comp.retc',$tabla)){ ?>
  					<td align="center" title="<?php echo trim($aso_pant['atrz'].$aso_pant['autornum']); ?>">
              <div class="hidden">
              <?php echo trim($aso_pant['atrztipo'].$aso_pant['enti_descri'].$aso_pant['atrz'].$aso_pant['autornum']); ?>
              </div>
              <?php echo trim($aso_pant['atrztipo']); ?>
            </td>
					<?php }?>
  
          <?php if(substr($docu,0,3)=='ICH'){ ?>
              <?php $fechadepo=$aso_pant['fechadepo']; ?>
              <?php $ctabdepo=$aso_pant['ctabdepo']; ?>
              <?php $numedepo=$aso_pant['numedepo']; ?>
                         
              <?php //if($fechadepo<'20000101'){$fechadepo='';} ?>
  
            <?php if($ver_modi==1){ ?>
            <?php $pidtxt='fechadepo'.$iidnum ; $pcaption=''; $pdefa=$fechadepo; $psize=$xfontsize; $pobj=1; include('vrgetfec.php'); ?>
            <?php $pidtxt='ctabdepo'.$iidnum ; $pcaption=''; $pdefa=$ctabdepo;  $pobj=1; $ptabla='ctab'; $plist='dl_ctab'; include('vrgetcod.php'); ?>
            <?php $pidtxt='numedepo'.$iidnum ; $pcaption=''; $pdefa=$numedepo; $psize=$xfontsize; $pobj=1; include('vrgetnum.php'); ?>
            <?php }else{ ?>
  
              <?php 
                if(!empty($numedepo)) 
                {
                  $sql_depo='select * from bcos1 ';
                  $sql_depo.='where docu like "DB%" and numero="'.$numedepo.'" and fecha>="'.$fecha.'"';
                  $sql_depo.=' and status!="O" and status!="X"';
                  $res_depo=msql_query($sql_depo,$link_vcrx);
                  $docudepo=msql_result($res_depo,0,'docu');
                  $idnumdepo=msql_result($res_depo,0,'idnum1');
                  
                }
              ?>

  					<td align="center" title="">
                  <?php if(!empty($fechadepo)){ ?>
                  <?php echo date('y-m-d', strtotime($fechadepo)); ?>
                  <?php } ?>
               </th>
  					<td align="center" title=""><?php echo $ctabdepo; ?></th>
  					<td align="center" title="">
                      <a href="<?php echo 'http://'.$cfg_empr.'.vcrxol.com/print1.php?prnt=1&docu='.$docudepo.'&idnum='.$idnumdepo.'&formato='.$formato;?>"  target="_blank" >
                      <?php echo $numedepo; ?>
                      </a>
            </th>
            <?php } ?>
          <?php } ?>

          <?php if(substr($docu,0,2)=='CH'){ ?>
  					<td align="left" title="">
                  <?php  echo $aso_pant['benefic']; ?>
               </td>
          <?php } ?>
          <?php if($tabla=='bcos'){ ?>
              <?php $fcobro=$aso_pant['fcobro']; ?>
  
            <?php if($ver_modi==1){ ?>
            <?php $pidtxt='fcobro_'.$aso_pant['idnum1'] ; $pcaption=''; $pdefa=$fcobro; $psize=$xfontsize; $pobj=1; include('vrgetfec.php'); ?>

            <?php }else{ ?>
  					<td align="center" title="">
                  <?php  echo $fcobro; ?>
               </td>
            <?php } ?>
          <?php } ?>

					 <?php if(mb_stristr('inve.prod.tfin',$tabla) and $mobile!='true'){?>
						<td align="center" style="<?php if($mlote==''){echo 'display:none;';} ?>">
							<?php echo $aso_pant['lote']; ?>
						</td>
						<td style="<?php if($mserie==''){echo 'display:none;';} ?>">
							<?php echo $aso_pant['numserie']; ?>
						</td>
						<?php } ?>


          
<?php
            $clor_codigo=$aso_pant['item_clor'];
            $clor_descri='';
            $clor_hexa='';
            if((int)$clor_codigo>0)
            {
              $sql_clor='select * from clor0 where clor_codigo="'.$clor_codigo.'"';
              $res_clor=msql_query($sql_clor,$link_vcrx);
              $clor_descri=msql_result($res_clor,0,'clor_descri');
              $clor_hexa=msql_result($res_clor,0,'clor_hexa');
            }
                                                        
?>        
        
          <?php if(mb_stristr('vtas.clie.carr.inve.prod.tfin',$tabla) ){?>
				  	<td align="center" style="font-size:80%; font-weight:bold; color:black; background:<?php echo $clor_hexa; ?>;<?php if($mclor==''){echo 'display:none;';} ?>"><?php echo substr($clor_descri,0,5); ?></td>
				  	<td align="center" style="<?php if($mtlla==''){echo 'display:none;';} ?>"><?php echo substr(r_fiel('tlla',$aso_pant['item_tlla']),0,5); ?></td>
          <?php } ?>
          
					<?php if(substr($docu,0,2)=='EB'){?>
					<td style="color:red; font-size:1.8em;">
                              <?php
                                    $salitem=sal_item($aso_pant['item'],'',$aso_pant['fecha'],$aso_pant['bode'],$aso_pant['lote']);
                                   if($salitem[4]<0)
                                   {echo ' *';}
                              ?>
                         </td>
                         <?php } ?>


          <?php if($aso_pant['status']!='O' and $aso_pant['status']!='X'){$tnumero++;}  ?>
		<td align="center" title="<?php echo $stat_descri;?>">
               <?php echo $aso_pant['status']; ?>
          </td>


          <?php if($user_apro==1){ ?>
          <td align="center">
               <?php
               if(mb_stristr('PF.PC',substr($aso_pant['docu'],0,2)))
               {
                    if($aso_pant['status']=='-' and days_diff($aso_pant['fecha'],$fechaa)<=($dias_apro))
                    {
                         $pcaption='Aprobar: '.$aso_pant['docu'].'-'.$aso_pant['numero']; $pabrev='A';
                         $pidtxt='a_'.$crow; $pname='itr_fila'; $psize=$xfontsize;
                         $pidnum=$aso_pant['idnum1']; $pdocu=$aso_pant['docu'];
                         $ponclick="apro_docu('".$aso_pant['docu']."','".$aso_pant['idnum1']."','".$iddet."','".$aso_pant['numero']."','tr_fila".$crow."');";
                         if(mb_stristr($pant,'PANT')){include('vrbutton.php');}
                    }
               }
               ?>
          </td>
          <?php } ?>


          <?php if($user_anul==1 or $user_elim==1){ ?>
          <td align="center">
					<?php
            $iddet=0;
            if(mb_stristr($groupby,'iddet'))
            {$iddet=$aso_pant['iddet'];}
                                                          
               if(!mb_stristr('FROX',$aso_pant['status']) and ($user_anul==1 or $user_modi==1) and days_diff($aso_pant['fecha'],$fechaa)<=$dias_anul)
               {
                    $pcaption='Anular: '.$aso_pant['docu'].'-'.$aso_pant['numero'];
     if($iddet!=0){$pcaption.=' /'.$iddet;}
     $pabrev='O';
                    $pidtxt='o_'.$crow.'_'.$iddet; $pname='itr_fila'; $psize=$xfontsize;
                    $pidnum=$aso_pant['idnum1'];$pdocu=$aso_pant['docu'];
                    $ponclick="anul_docu('".$aso_pant['docu']."','".$aso_pant['idnum1']."','".$iddet."','".$aso_pant['numero']."','tr_fila".$crow."');";
     if(mb_stristr($pant,'PANT')){include('vrbutton.php');}
               }

               if($aso_pant['status']=='O' and $user_elim==1 and $aso_pant['autornum']=='' and days_diff($aso_pant['fecha'],$fechaa)<=($dias_anul+90))
               {
                    $pcaption='Eliminar: '.$aso_pant['docu'].'-'.$aso_pant['numero']; $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']."','".$iddet."','".$aso_pant['numero']."','tr_fila".$crow."');";
     if(mb_stristr($pant,'PANT')){include('vrbutton.php');}
               }
					?>
          </td>
          <?php } ?>

          <?php if($tabla=='plan') { ?>
             <td align="center">
              <?php echo number_format($aso_pant['avance'],0).'%'; ?>
             </td> 
          <?php } ?>




          <?php if(mb_stristr('IB13.EB13',$docu)){ ?>
              <?php
                if($docu=='EB13')
                {
                  $sql_ib13='select * from inve1 where idfrom="'.$aso_pant['idnum1'].'" and docu="IB13" and status!="X" ';
                  $res_ib13=msql_query($sql_ib13,$link_vcrx);
                  $iddesti=@msql_result($res_ib13,0,'idnum1');
                  $docudesti=@msql_result($res_ib13,0,'docu');
                  $numedesti=@msql_result($res_ib13,0,'numero');
                  
//                   echo $sql_ib13;
                  if(msql_num_rows($res_ib13)==0)
                  {
                      $xcaption='';
                      $xonclick='';
                      if(mb_stristr($pant,'PANT'))
                      {
                        $xcaption='Transferir: '.$aso_pant['docu'].'-'.$aso_pant['numero']; 
                        $xonclick="clon_docu('".$aso_pant['docu']."','".$aso_pant['idnum1']."','IB13','".$xcaption."');";
                      }
                      echo '<td align="center" style="font-size:'.$xfontsize*(1).'px;" title="'.$xcaption.'" >';
//                       echo '<div class="hidden">'.'000000000'.'</div>';
                      echo '<a href="#" onclick="'.$xonclick.'">';
//                       echo 'GEN-TRANSF';
                      echo $aso_pant['bode2'];  
                      echo '</a>';
                      echo '</td>';
                  }
                  else
                  {
                    echo '<td align="center">';
//                     echo '<a href="?prnt=1&docu=IB13&idnum='.$iddesti.'&formato=" target="_blank">';
                    echo $aso_pant['bode2'];  
//                     echo '</a>'
                    echo '</td>';
                  }
                }
                else
                {
                  echo '<td align="center">';
                  echo $aso_pant['bode2'];
                  echo '</td>';
                }
              ?>
<!--               </td> -->
          <?php } ?>


          <?php if($ver_modi==1){ ?>
               <?php if($tabla=='bcos' and mb_stristr('PANT1',$pant)){ ?>
                     <td>
                     <?php $pcaption='Modif';  $pabrev='M'; $ponclick='_modi1("'.$aso_pant['docu'].'",'.$aso_pant['idnum1'].');'; include('vrbutton.php'); ?>
                     <span style="font-size:10px;"><div id="error_<?php echo $aso_pant['idnum1'];?>"></div></span>
                     <?php //}else{ ?>
                     <?php //} ?>
                     </td>

             <?php } ?>

               <?php if($tabla=='plan' and mb_stristr('PANT1',$pant)){ ?>
                     <?php $pidtxt='avance_'.$aso_pant['idnum1']; $pdefa=$aso_pant['avance']; $pobj=1; $plong=5; include('vrgetval.php'); ?>
                     <td>
                     <?php $pcaption='Modif';  $pabrev='M'; $ponclick='_modi1("'.$aso_pant['docu'].'",'.$aso_pant['idnum1'].');'; include('vrbutton.php'); ?>
                     <span style="font-size:10px;"><div id="error_<?php echo $aso_pant['idnum1'];?>"></div></span>
                     <?php //}else{ ?>
                     <?php //} ?>
                     </td>

             <?php } ?>

               <?php //if($tabla=='clie' and mb_stristr('PANT3',$pant) and $numero1==$numero2){ ?>
               <?php if($tabla=='clie' and mb_stristr('PANT3',$pant)){ ?>

                     <?php if($status=='-'){ ?>
                           <?php $xcant=$aso_pant['cant']; ?>
                           <?php $xpuni=$aso_pant['puni']; ?>
                           <?php $xduni =decimaldigit($xcant)+1; ?>
                           <?php $xdval =decimaldigit($xpuni)+1; ?>
                          <?php $pcaption=$aso_pant['cant']; $pidtxt='cant_'.$aso_pant['idnum1'].'_'.$aso_pant['iddet']; $pdefa=number_format($xcant,$xduni,'.',''); $pobj=1; include('vrgetval.php'); ?>
                          <?php $pcaption=$aso_pant['puni']; $pidtxt='puni_'.$aso_pant['idnum1'].'_'.$aso_pant['iddet']; $pdefa=number_format($xpuni,$xdval,'.','');; $pobj=1; include('vrgetval.php'); ?>
                          <td>
                          <?php $pcaption='Modif';  $pabrev='M'; $ponclick='_modi1("'.$aso_pant['docu'].'",'.$aso_pant['idnum1'].','.$aso_pant['iddet'].');'; include('vrbutton.php'); ?>
                          <span style="font-size:10px;"><div id="error_<?php echo $aso_pant['idnum1'].'_'.$aso_pant['iddet'];?>"></div></span>
                          </td>
                      <?php } ?>
                     <?php if($status=='F'){ ?>
                           <td></td>
                           <?php $xlote=$aso_pant['lote']; ?>
                          <?php $pcaption=$aso_pant['lote']; $pidtxt='lote_'.$aso_pant['idnum1'].'_'.$aso_pant['iddet']; $pdefa=$xlote; $plist='dl_lote'; $pobj=1; $plong=10; include('vrgettxt.php'); ?>
                          <td>
                          <?php $pcaption='Modif';  $pabrev='M'; $ponclick='_modi1("'.$aso_pant['docu'].'",'.$aso_pant['idnum1'].','.$aso_pant['iddet'].');'; include('vrbutton.php'); ?>
                          <span style="font-size:10px;"><div id="error_<?php echo $aso_pant['idnum1'].'_'.$aso_pant['iddet'];?>"></div></span>
                          </td>
                      <?php } ?>
                     <?php if(mb_stristr('-F',$status)) { ?>
                         <td></td>
                         <td></td>
                         <td></td>
                      <?php } ?>
              <?php } ?>


               <?php if($tabla=='inve' and mb_stristr('PANT1',$pant) and mb_stristr('IB10.EB10',$docu) ){ ?>
                      <?php $xnumfac=$aso_pant['numfac']; ?>
                     <?php $pcaption=$aso_pant['nummfac']; $pidtxt='numfac_'.$aso_pant['idnum1']; $pdefa=$xnumfac; $pphold='#Factura'; $pobj=1; include('vrgetnum.php'); ?>
                     <td>
                     <?php $pcaption='Modif';  $pabrev='M'; $ponclick='_modi1("'.$aso_pant['docu'].'",'.$aso_pant['idnum1'].');'; include('vrbutton.php'); ?>
                     <span style="font-size:10px;"><div id="error_<?php echo $aso_pant['idnum1'];?>"></div></span>
                     <?php //}else{ ?>
                     <?php //} ?>
                     </td>
              <?php } ?>



               <?php if($tabla=='inve' and mb_stristr('PANT3',$pant) and mb_stristr('IB10',$docu) ){ ?>
                      <?php $xcant=$aso_pant['cant']; ?>
                      <?php $xpuni=$aso_pant['puni']; ?>
                      <?php $xduni =decimaldigit($xcant)+1; ?>
                      <?php $xdval =decimaldigit($xpuni)+1; ?>
                     <?php //$pcaption=$aso_pant['cant']; $pidtxt='cant_'.$aso_pant['idnum1'].'_'.$aso_pant['iddet']; $pdefa=number_format($xcant,$xduni,'.',''); $pobj=1; include('vrgetval.php'); ?>
                     <?php $pcaption=$aso_pant['puni']; $pidtxt='puni_'.$aso_pant['idnum1'].'_'.$aso_pant['iddet']; $pdefa=number_format($xpuni,$xdval,'.',''); $pobj=1; include('vrgetval.php'); ?>
                     <td>
                     <?php $pcaption='Modif';  $pabrev='M'; $ponclick='_modi1("'.$aso_pant['docu'].'",'.$aso_pant['idnum1'].','.$aso_pant['iddet'].');'; include('vrbutton.php'); ?>
                     <span style="font-size:10px;"><div id="error_<?php echo $aso_pant['idnum1'].'_'.$aso_pant['iddet'];?>"></div></span>
                     <?php //}else{ ?>
                     <?php //} ?>
                     </td>
              <?php } ?>

               <?php if($tabla=='prod' and mb_stristr('PANT3',$pant) ){ ?>
                      <?php $xcant=$aso_pant['cant']; ?>
                      <?php $xpuni=$aso_pant['puni']; ?>
                      <?php $xduni =decimaldigit($xcant)+1; ?>
                      <?php $xdval =decimaldigit($xpuni)+1; ?>
                     <?php $pcaption=$aso_pant['cant']; $pidtxt='cant_'.$aso_pant['idnum1'].'_'.$aso_pant['iddet']; $pdefa=number_format($xcant,$xduni,'.',''); $pobj=1; include('vrgetval.php'); ?>
                     <?php //$pcaption=$aso_pant['puni']; $pidtxt='puni_'.$aso_pant['idnum1'].'_'.$aso_pant['iddet']; $pdefa=number_format($xpuni,$xdval,'.','');; $pobj=1; include('vrgetval.php'); ?>
                     <td>
                     <?php $pcaption='Modif';  $pabrev='M'; $ponclick='_modi1("'.$aso_pant['docu'].'",'.$aso_pant['idnum1'].','.$aso_pant['iddet'].');'; include('vrbutton.php'); ?>
                     <span style="font-size:10px;"><div id="error_<?php echo $aso_pant['idnum1'].'_'.$aso_pant['iddet'];?>"></div></span>
                     <?php //}else{ ?>
                     <?php //} ?>
                     </td>
              <?php } ?>

               <?php if($tabla=='comp' and mb_stristr('PANT1',$pant)){ ?>
                     <?php $pcaption='Impor.';  $pidtxt='impo_'.$aso_pant['idnum1']; $pdefa=$aso_pant['impor']; $pobj=1; $plist='dl_impor'; $plong=5; if($empr_impo==0){$phide=1;} include('vrgettxt.php'); ?>
                     <?php $pcaption=$aso_pant['suco_descri'];  $ptabla='suco'; $pidtxt='suco_'.$aso_pant['idnum1']; $pdefa=$aso_pant['suco']; $pobj=1; $plist='dl_suco'; include('vrgetcod.php'); ?>
                     <?php $pcaption=$aso_pant['fpag_descri'];  $ptabla='fpag'; $pidtxt='fpag_'.$aso_pant['idnum1']; $pdefa=$aso_pant['fpag']; $pobj=1; $plist='dl_fpag'; include('vrgetcod.php'); ?>
                     <?php 
                     $atrznume=$aso_pant['claveacc'];
                     if($atrznume!='')
                     {
                        echo '<td>';
                        echo '<span style="font-size:10px;">'.substr($atrznume,39).'</span>';
                        echo '<span style="display:none">';
                        $pcaption=''; $pidtxt='atrz_'.$aso_pant['idnum1']; $pdefa=$aso_pant['atrz']; $pobj=1; $plong=10; $phide=1; include('vrgetnum.php');      
                        echo '</span>';
                        echo '</td>';
                     }
                     else
                     {$pcaption=''; $pidtxt='atrz_'.$aso_pant['idnum1']; $pdefa=$aso_pant['atrz']; $pobj=1; $plong=10; include('vrgetnum.php');}
                     ?>
                     <?php //$pcaption=$aso_pant['toenti'];  $ptabla='enti'; $pidtxt='toenti_'.$aso_pant['idnum1']; $pdefa=$aso_pant['toenti']; $pobj=1; $plist='dl_enti'; include('vrgetcod.php'); ?>
                     <?php $pcaption=$aso_pant['enti_xcp'];  $ptabla='enti'; $pidtxt='enti_xcp_'.$aso_pant['idnum1']; $pdefa=$aso_pant['enti_xcp']; $pobj=1; $plist='dl_enti'; include('vrgetcod.php'); ?>
                     <td>
                     <?php //$pcaption='Modif';  $pabrev='M'; $ponclick='_modi1('.$aso_pant['idnum1'].');'; include('vrbutton.php'); ?>
                     <?php //if($repo=='1'){ ?>
                     <?php $pcaption='Modif';  $pabrev='M'; $ponclick='_modi1("'.$aso_pant['docu'].'",'.$aso_pant['idnum1'].');'; include('vrbutton.php'); ?>
                     <span style="font-size:10px;"><div id="error_<?php echo $aso_pant['idnum1'];?>"></div></span>
                     <?php //}else{ ?>
                     <?php //} ?>
                     </td>

             <?php } ?>
               <?php if($tabla=='comp' and mb_stristr('PANT3',$pant)){ ?>
                     <?php $pcaption=$aso_pant['item_descri'];  $ptabla='item'; $pidtxt='item_'.$aso_pant['idnum1'].'_'.$aso_pant['iddet']; $pdefa=$aso_pant['item']; $pobj=1; $plist='dl_item'; include('vrgetcod.php'); ?>
                     <?php //$pcaption=$aso_pant['facon']; $plong=5; $pphold='facon';  $pidtxt='facon_'.$aso_pant['idnum1'].'_'.$aso_pant['iddet']; $pdefa=$aso_pant['facon']; $pobj=1;  include('vrgetval.php'); ?>
                      <td></td>
                     <?php $pcaption=$aso_pant['cair_descri'];  $pphold=''; $ptabla='cair'; $pidtxt='cair_'.$aso_pant['idnum1'].'_'.$aso_pant['iddet']; $pdefa=$aso_pant['cair']; $pobj=1; $plist='dl_cair'; include('vrgetcod.php'); ?>
                     <?php $pcaption=$aso_pant['ctas_descri'];  $pphold=''; $ptabla='ctas'; $pidtxt='ctas_'.$aso_pant['idnum1'].'_'.$aso_pant['iddet']; 
                                                                   $pdefa=$aso_pant['ctas']; $pobj=1; $plist='dl_ctas'; 
//                                                                    if(days_diff($aso_pant['fecha'],$fechaa)<=$dias_anul)
//                                                                    {$preado=1;}
                                                                   include('vrgetcod.php'); ?>
                     <td>
                        
                     <?php $pcaption='Modif';  $pabrev='M'; $ponclick='_modi1("'.$aso_pant['docu'].'",'.$aso_pant['idnum1'].','.$aso_pant['iddet'].');'; include('vrbutton.php'); ?>
                     <span style="font-size:10px;"><div id="error_<?php echo $aso_pant['idnum1'].'_'.$aso_pant['iddet'];?>"></div></span>
                        
                     </td>

             <?php } ?>
               <?php if($tabla=='bcos' and mb_stristr('PANT3',$pant)){ ?>
                     <?php $pcaption=$aso_pant['ctas_descri'];  $ptabla='ctas'; $pidtxt='ctas_'.$aso_pant['idnum1']; $pdefa=$aso_pant['ctas']; $pobj=1; $plist='dl_ctas'; include('vrgetcod.php'); ?>
                     <td>
                     <?php $pcaption='Modif';  $pabrev='M'; $ponclick='_modi1("'.$aso_pant['docu'].'",'.$aso_pant['idnum1'].','.$aso_pant['iddet'].');'; include('vrbutton.php'); ?>
                     <span style="font-size:10px;"><div id="error_<?php echo $aso_pant['idnum1'].'_'.$aso_pant['iddet'];?>"></div></span>
                     </td>

             <?php } ?>
          <?php } ?>



          <?php if(mb_stristr('pcs1.prs1',$cfg_empr) and mb_stristr('vtas',$tabla) and 1==2){?>
				  	<td align="center"><?php echo $aso_pant['cntn']; ?></td>
				  	<td align="center"><?php echo date('d/M/y',strtotime($aso_pant['cntnf1'])); ?></td>
				  	<td align="center"><?php echo date('d/M/y',strtotime($aso_pant['cntnf2'])); ?></td>
          <?php } ?>
          <?php if(mb_stristr('tgck.sawo.ztej',$cfg_empr) and mb_stristr('vtas',$tabla) and 1==1){?>
				  	<td align="center"><?php echo $aso_pant['vhcl']; ?></td>
          <?php } ?>
  
  
          <?php
            if($ver_rete==1)
            { 

              $sql_rete ='select *, ';
              $sql_rete.=' sum(total) as stotal,';
              $sql_rete.=' max(cair*1) as max_cair,';
              $sql_rete.=' max(prta) as por_rta, ';
              $sql_rete.=' max(piva) as por_iva';
              if(mb_stristr('comp',$tabla))
              {$sql_rete.=' from retp12 ';}
              else
              {$sql_rete.=' from retc12 ';}
              $sql_rete.=' where enti like "'.substr($aso_pant['enti'],0,10).'%"';
              $sql_rete.=' and docum="'.$aso_pant['docu'].'"';
              $sql_rete.=' and ptoem="'.$aso_pant['ptoe'].'"';
              $sql_rete.=' and numer="'.$aso_pant['numero'].'"';
              $sql_rete.=' and status!="O"';
              $sql_rete.=' group by idnum1';
              $sql_rete.=' order by fecha desc';
              $res_rete=msql_query($sql_rete,$link_vcrx);
//                  echo $sql_rete;
                 
                $rete_idnum=@msql_result($res_rete,0,'idnum1');
                $rete_docu=@msql_result($res_rete,0,'docu');
                $rete_nume=@msql_result($res_rete,0,'numero');
                $rete_cair=@msql_result($res_rete,0,'max_cair');
                $rete_valor=abs(@msql_result($res_rete,0,'stotal'));
                 
              if(mb_stristr('comp',$tabla))
              {
                 $sql_comp ='select *, max(cair*1) as max_cair,  ';
                 $sql_comp.='sum(tsubtiva0+tsubtiva) as base_rta, ';
                 $sql_comp.='sum(tiva) as base_iva ';
                 $sql_comp.=' from comp12 ';
                 $sql_comp.=' where idnum1='.$aso_pant['idnum1'].' ';
               //   $sql_comp.=' group by idnum1';
                 $sql_comp.=' group by idnum1, cair';
                 $sql_comp.=' order by cair ';
                 $res_comp=msql_query($sql_comp,$link_vcrx);
//                  echo $sql_comp;
                 ?>  
          
     
              <td width="1%" colspan="" align="" style="font-size:<?php echo $xfontsize * 0.75; ?>px;">
                   
                   <?php if(1==2){ ?>                   
                      <?php $crow=0; ?>
                     <?php msql_data_seek($res_comp,0); ?>
                      <?php while($aso_comp=@msql_fetch_assoc($res_comp)){ ?>
                      <?php $crow++; ?>
                      <?php $cair=$aso_comp['cair']; ?>
                      <?php $base_rta=$aso_comp['base_rta']; ?>
                      <?php $porc_rta=$aso_comp['prrta']; ?>
                      <?php $porc_rta=$aso_comp['cair_porc']; ?>
                      <div>
                        <span align="left" style="display:table-cell"><?php echo $cair; ?></span>
                        <span align="right" style="display:table-cell"><?php echo number_format($base_rta,2,'.',''); ?></span>
                        <span align="right" style="display:table-cell"><?php echo @number_format($porc_rta,2); ?>%</span>
                      </div>
                      <?php } ?>

                      <?php $crow=0; ?>
                     <?php msql_data_seek($res_comp,0); ?>
                      <?php while($aso_comp=@msql_fetch_assoc($res_comp)){ ?>
                      <?php $crow++; ?>
                      <?php $cair=$aso_comp['cair']; ?>
                      <?php $base_iva=$aso_comp['base_iva']; ?>
                      <?php $porc_iva=$aso_comp['priva']; ?>
                     <?php if($base_iva!=0 or $porc_ivas!= 0){ ?>
                      <div>
                           <span align="left">IVA</span>
                           <span align="right"><?php echo @number_format($base_iva,2,'.',''); ?></span>
                           <span align="right"><?php echo number_format($porc_iva,2); ?>%</span>
                      </div>
                     <?php } ?>
                      <?php } ?>
                     <?php } ?>
                   
                <table1 width="99%" cellpadding="2" cellspacing="2" border=""
                       style="font-size:<?php echo $xfontsize * 0.75; ?>px;background-color:gainsboro;display:table;">
                      <?php $crow=0; ?>
                     <?php msql_data_seek($res_comp,0); ?>
                      <?php while($aso_comp=@msql_fetch_assoc($res_comp)){ ?>
                      <?php $crow++; ?>
                      <?php $cair=$aso_comp['cair']; ?>
                      <?php $base_rta=$aso_comp['base_rta']; ?>
                      <?php $porc_rta=$aso_comp['prrta']; ?>
                      <?php $porc_rta=$aso_comp['cair_porc']; ?>
                      <tr1 style="display:table-row;">
                        <td1 style="display:table-cell;"><?php echo $cair; ?></td1>
                        <td1 style="display:table-cell; border-left:1px solid;border-right:1px solid;" align="right"><?php echo number_format($base_rta,2,'.',''); ?></td1>
                        <td1 style="display:table-cell;" align="right"><?php echo @number_format($porc_rta,2); ?>%</td1>
                      </tr1>
                      <?php } ?>

                      <?php $crow=0; ?>
                     <?php msql_data_seek($res_comp,0); ?>
                      <?php while($aso_comp=@msql_fetch_assoc($res_comp)){ ?>
                      <?php $crow++; ?>
                      <?php $cair=$aso_comp['cair']; ?>
                      <?php $base_iva=$aso_comp['base_iva']; ?>
                      <?php $porc_iva=$aso_comp['priva']; ?>
                     <?php if($base_iva!=0 or $porc_ivas!= 0){ ?>
                      <tr1 style="display:table-row;">
                           <td1 style="display:table-cell;">IVA</td1>
                           <td1 style="display:table-cell;border-left:1px solid;border-right:1px solid;" align="right"><?php echo @number_format($base_iva,2,'.',''); ?></td1>
                           <td1 style="display:table-cell;" align="right"><?php echo number_format($porc_iva,2); ?>%</td1>
                        
                      </tr1>
                     <?php } ?>
                      <?php } ?>
                     
                     
              </table1>
                   
              </td>
                   
                  <?php
              }
              else
              {
                   echo '<td align="right">';
                   echo number_format($rete_valor,2);
                   echo '</td>';
              }
                 
              if(@msql_num_rows($res_rete)!=0)
              {
//                 msql_data_seek($res_rete,0);
//                 $rete_nume=fillzero($rete_nume);
//                 if($rete_nume!='')
                {
                  echo '<td>';
                  echo '<div class="hidden">'.$rete_nume.'</div>';
                  echo '<a href="?prnt=1&docu='.$rete_docu.'&idnum='.$rete_idnum.'&formato=" target="_blank">';
                  echo $rete_nume;
                  echo '</a>'.'</td>';
//                   echo '<td align="center">'.$rete_cair.'</td>';
//                   echo '<td align="center">'.'</td>';
//                   echo '<td align="center">';
//                   echo '<div class="hidden">'; echo fillzero(number_format(@msql_result($res_rete,0,'por_rta'),2),6).'</div>'; 
//                   echo number_format(@msql_result($res_rete,0,'por_rta'),2).'%'
//                        echo '</td>';
//                   echo '<td align="center">';
//                   echo '<div class="hidden">'; echo fillzero(number_format(@msql_result($res_rete,0,'por_iva'),2),6).'</div>'; 
//                   echo number_format(@msql_result($res_rete,0,'por_iva'),0).'%'.
//                        echo '</td>';
                }
              }
              else
              {
                 echo '<td align="center" style="font-size:'.$xfontsize*(0.8).'px;">';
//                  if(mb_stristr('comp',$tabla)  and !mb_stristr('FROX',$aso_pant['status']) and days_diff($aso_pant['fecha'],$fechaa)<=$dias_rpro)
                 if(mb_stristr('comp',$tabla)  and !mb_stristr('FROX',$aso_pant['status']) and $aso_pant['fecha']>=$fecha_rpro )
                 {
                      echo '<div class="hidden">'.'000000000'.$aso_pant['idnum1'].'</div>';
                      $xcaption='';
                      $xonclick='';
                      if(mb_stristr($pant,'PANT'))
                      {
                        $xcaption='Generar RETENCION para : '.$aso_pant['docu'].'-'.$aso_pant['numero']; 
                        $xonclick="clon_docu('".$aso_pant['docu']."','".$aso_pant['idnum1']."','RPRO','".$xcaption."');";
                        echo '<a href="#" onclick="'.$xonclick.'" title="Ret.AUTOMATICA">';
                        echo 'AUT';
                        echo '</a>';
                        echo '. .';
                        echo '<a href="?scri=regi_rpro&docu='.$aso_pant['docu'].'&idnum='.$aso_pant['idnum1'].'" target="_blank" title="Ret.SEMI-AUTO">';
                        echo 'SEMI';
                        echo '</a>';
                      }
                 }
                 else
                 {echo 'NO-RET.';}
                 echo '</td>';
              }
            }
          ?>

  
  
					<?php if($ver_saldo==1){ ?>
              <?php
                $sdocu=$aso_pant['docu'];
                $saldo=0;
                $script='';
                if(mb_stristr('FC.NV.FP.AC.AP',substr($sdocu,0,2)))               
                {
                     $saldo0=0.01;
                  $saldo=sal_docu($sdocu,$aso_pant['idnum1']);
                    $sal_enti=0;
                     
                     if(substr($docu,0,2)=='FC' and mb_stristr('imcp',$cfg_empr)){$xsalenti=1;}
//                      $xsalenti=1;
                     if($saldo>$saldo0 and $xsalenti==1)
                     {$sal_enti=sal_enti($aso_pant['enti']);}
                     
                  $script='';
                  if(mb_stristr('sist.supe',$user_tipo) and $user_tipo!='')
                  {
                    if(mb_stristr('FC.AC',substr($sdocu,0,2)))               
                    {$script='vrcobro0.php';}
                    if(mb_stristr('FP.AP',substr($sdocu,0,2)))               
                    {$script='vrpago0.php';}
                  }  
                }
                $tsaldo=$tsaldo+$saldo;
                $saldo=round($saldo,6)
              ?>
  
          <td align="right">
				  <div class="hidden"><?php echo fillzero(number_format($saldo,2,'.',''),15); ?></div>
            <?php
              if(abs($saldo)>1/100)
              {echo '<a href="?scri=regi_copa&docu='.$aso_pant['docu'].'&idnum='.$aso_pant['idnum1'].'" target="_blank">';}
             echo number_format($saldo,2);
              if(abs($saldo)>1/100)
              {echo '</a>';}
              
               
               if($saldo>$saldo0 and $sal_enti[5]>$saldo0)
               {echo '<br>A: '.number_format($sal_enti[5],2);}
                    
               $minval_anti=1;
               if($saldo<abs($minval_anti)*(-1) and $user_codigo==2)
               {
//                       $xcaption='';
//                       $xonclick='';
//                       if(mb_stristr($pant,'PANT'))
//                       {
//                         $xcaption='Anticipo : '.$aso_pant['enti'].'-'.$aso_pant['enti_descri']; 
//                         $xonclick="clon_docu('".$aso_pant['docu']."','".$aso_pant['idnum1']."','AC10','".$xcaption."');";
//                       }
//                       echo '<td align="center" style="font-size:'.$xfontsize*(0.8).'px;" title="'.$xcaption.'" >';
//                       echo '<div class="hidden">'.'000000000'.'</div>';
//                       echo '<a href="#" onclick="'.$xonclick.'">';
//                       echo 'GEN-ANTI';
//                       echo '</a>';
//                       echo '</td>';
               }
            ?>
          </td>
               <?php 
               //if($tabla=='clie' and mb_stristr('PANT3',$pant) )
//                 if($user_codigo==2)
//                echo '**'.$saldo;
               if(mb_stristr('vtas.comp',$tabla) and $ver_saldo==1 and mb_stristr($pant,'PANT') )
                  { ?>
                    <?php $maxcompensa = 5; ?>
                      <?php $caja=$aso_pant['caja']; ?>
                      <?php $efectivo=$aso_pant['efectivo']; ?>
                      <?php $compensa=$aso_pant['compensa']; ?>
                      <?php //$fecha0=date('Y-m-d',strtotime($aso_pant['fecha'].' +1 day ')); ?>

                     <?php if(abs(round($saldo,2))>=1/100 and 1==1){?>
                     <?php //if(($saldo)!=0){?>
                     <?php $pcaption=$caja;  $ptabla='caja'; $pidtxt='caja_'.$aso_pant['idnum1'];  $pobj=1; $plist='dl_caja'; include('vrgetcod.php'); ?>
                     <?php $pcaption=$efectivo; $pidtxt='efectivo_'.$aso_pant['idnum1'];  $pobj=1; $plong=strlen($saldo*1000); include('vrgetval.php'); ?>
                    <?php if(abs($saldo)<$maxcompensa){?>
                     <?php $pcaption=$compensa; $pidtxt='compensa_'.$aso_pant['idnum1'];  $pobj=1; $plong=strlen($maxcompensa*1000); include('vrgetval.php'); ?>
                    <?php }else{echo '<td></td>';} ?>
                     <td>
                     <?php $pcaption='Modif';  $pabrev='M'; $ponclick='_modi1("'.$aso_pant['docu'].'",'.$aso_pant['idnum1'].');'; include('vrbutton.php'); ?>
                     <span style="font-size:10px;"><div id="error_<?php echo $aso_pant['idnum1'];?>"></div></span>
                     </td>
                     <?php }else{ ?>
                     <td align="center"><?php echo $caja; ?></td>
                     <td align="right"><?php if($efectivo!=0){echo number_format($efectivo,2);} ?></td>
                     <td></td>
                     <?php } ?>
                <?php } ?>


					<?php } ?>
  
          <?php
            if($ver_guia==1)
            { 
              $sql_guia ='select * ';
              $sql_guia.=' from guia1 ';
              $sql_guia.=' where idfrom="'.$aso_pant['idnum1'].'"';
              $sql_guia.=' and mdfrom="'.$tabla.'"';              
              $sql_guia.=' and status!="O"';
              $sql_guia.=' and status!="X"';
              $sql_guia.=' order by fecha desc';
              $sql_guia.=' limit 1';
              $res_guia=msql_query($sql_guia,$link_vcrx);
              
              if(@msql_num_rows($res_guia)!=0)
              {
                $guia_idnum=@msql_result($res_guia,0,'idnum1');
                $guia_docu=@msql_result($res_guia,0,'docu');
                $guia_ptoe=@msql_result($res_guia,0,'ptoe');
                $guia_nume=@msql_result($res_guia,0,'numero');
                $guia_fecha=@msql_result($res_guia,0,'fecha');
                $guia_clave=@msql_result($res_guia,0,'claveacc');
                $guia_autor=@msql_result($res_guia,0,'autornum');
                
                if($guia_autor=='' and $aso_pant['status']!='O')
                {
                  echo '<td align="center" style="font-size:'.$xfontsize*(0.8).'px;" title=" Editar:'.$guia_docu.'-'.$guia_ptoe.'-'.$guia_nume.'">';
                  echo '<div class="hidden">'.$guia_nume.'</div>';
                  echo '<a href="?scri=regi_docu&docu='.$guia_docu.'&idnum1='.$guia_idnum.'" target="_blank">';
                  echo $guia_nume;
                  echo '</a>';
                  echo '</td>';
                }
                else
                {
                  echo '<td align="center" style="font-size:'.$xfontsize*(0.8).'px;" title=" Imprimir:'.$guia_docu.'-'.$guia_ptoe.'-'.$guia_nume.'">';
                  echo '<div class="hidden">'.$guia_nume.'</div>';
                  echo '<a href="?prnt=1&docu='.$guia_docu.'&idnum='.$guia_idnum.'&formato=" target="_blank">';
                  echo $guia_nume;
                  echo '</a>';
                  echo '</td>';
                }
                
              }
              else
              {
                if($aso_pant['status']=='O' or days_diff($aso_pant['fecha'],$fechaa)>$dias_guia)
                {
                  echo '<td align="center" style="font-size:'.$xfontsize*(0.8).'px;">';
                  echo '<div class="hidden">'.'000000000'.'</div>';
                  echo 'NO-GUIA';
                  echo '</td>';
                }
                else
                {
                  $xcaption='';
                  $xonclick='';
                  if(mb_stristr($pant,'PANT'))
                  {
                    $xcaption='Generar GUIA para: '.$aso_pant['docu'].'-'.$aso_pant['numero']; 
                    $xonclick="clon_docu('".$aso_pant['docu']."','".$aso_pant['idnum1']."','GR10','".$xcaption."');";
                  }
                  echo '<td align="center" style="font-size:'.$xfontsize*(0.8).'px;" title="'.$xcaption.'">';
                  echo '<div class="hidden">'.'000000000'.'</div>';
                  echo '<a href="#" onclick="'.$xonclick.'">';
                  echo 'GEN-GUIA';
                  echo '</a>';
                  echo '</td>';
                }
              }
            }
          ?>

            <?php if(mb_stristr('IB10.EB10.IB12',$docu) ){ ?>
              <?php
//                echo '*/*'.$aso_pant['docu'];
               $sql_fact='';
                     $res_fact='';
                     $docuvtas='';
                     $ptoevtas='';
                     $idvtas='';
                     $fecfac='';
               
               
                  if($aso_pant['docu']=='IB10')
                  {
                     $sql_fact ='select * from comp1 where numero="'.$aso_pant['numfac'].'" ';
                     $sql_fact.=' and status not in("O","X")';
                     $sql_fact.=' and enti like "'.substr($aso_pant['enti'],0,10).'%"';
                  }
                  if($aso_pant['docu']=='EB10')
                  {
                     $sql_fact ='select * from vtas1 where docu like "FC%" and numero="'.$aso_pant['numfac'].'" ';
                     $sql_fact.=' and status not in("O","X")';
                  }
                  if($aso_pant['docu']=='IB12')
                  {
                     $sql_fact ='select * from vtas1 where docu like "NC%" and numero="'.$aso_pant['numfac'].'" ';
                     $sql_fact.=' and status not in("O","X")';
                  }
                     $res_fact=msql_query($sql_fact,$link_vcrx);
                     $docuvtas=@msql_result($res_fact,0,'docu');
                     $ptoevtas=@msql_result($res_fact,0,'ptoe');
                     $idvtas=@msql_result($res_fact,0,'idnum1');
                     $fecfac=@msql_result($res_fact,0,'fecha');
                  echo '<td align="center" title="'.$docuvtas.'-'.$ptoevtas.'-'.$aso_pant['numfac'].'" >';
                  if($idvtas!='')
                  {echo '<a href="?prnt=1&docu='.$docuvtas.'&idnum='.$idvtas.'&formato=" target="_blank" >';}
                  echo ($aso_pant['numfac']);
                  if($idvtas!='')
                  {echo '</a>';}
//                   if($aso_pant['fecha']!=$fecfac)
                  if(substr($aso_pant['fecha'],0,7)!=substr($fecfac,0,7))
                  {$xbold='font-weight:bold;color:darkred;';}else{$xbold='';}
                                                             
                  echo '<br>'.'<span style="font-size:90%;'.$xbold.'">'.$fecfac.'</span>';
                  echo '</td>';
              ?>
          <?php } ?>

					<?php if(substr($aso_pant['docu'],0,2)=='EB' and mb_stristr('PANT3.IMPR3',$pant)){?>
					<td style="color:red; font-size:1.8em;">
                              <?php
                                    $salitem=sal_item($aso_pant['item'],'',$aso_pant['fecha'],$aso_pant['bode'],$aso_pant['lote']);
                                   if($salitem[4]<0)
                                   {echo ' *';}
                              ?>
                         </td>
                         <?php } ?>


          <?php 
            if($ver_apli==1)
            { 
              $idfrom=$aso_pant['idfrom'];
              $mdfrom=$aso_pant['mdfrom'];
              $sql_apli ='select * ';
              $sql_apli.=' from '.$tabla.'2 ';
              $sql_apli.=' where idnum2 ="'.$aso_pant['idnum1'].'"';
              $sql_apli.=' order by iddet';
              
              if(substr($aso_pant['docu'],0,1)=='N')
              {
                $sql_apli ='select todocu as docum, toptoe as ptoem, tonume as numer ';
                $sql_apli.=' from '.$tabla.'1 ';
                $sql_apli.=' where idnum1 ="'.$aso_pant['idnum1'].'"';
//                 $sql_apli.=' order by iddet';
              }
              $res_apli=msql_query($sql_apli,$link_vcrx);
//               echo 	'***'.explain_sql($sql_apli);
              
              if(@msql_num_rows($res_apli)!=0)
              {
                $apli_enti=$aso_pant['enti'];
                $apli_docu=@msql_result($res_apli,0,'docum');
                $apli_ptoe=@msql_result($res_apli,0,'ptoem');
                $apli_nume=@msql_result($res_apli,0,'numer');
                $apli_tabl=r_fiel('docu',$apli_docu,'tabla');
                
                $sql_from ='select * from '.$apli_tabl.'1';
                $sql_from.=' where status!="X"';
                $sql_from.=' and enti like "'.substr($apli_enti,0,10).'%" ';
                $sql_from.=' and docu="'.$apli_docu.'" and ptoe="'.$apli_ptoe.'" and numero="'.$apli_nume.'" ';
                $sql_from.=' order by idnum1 desc';
                $res_from= msql_query($sql_from,$link_vcrx);
                $idfrom=@msql_result($res_from,0,'idnum1');
//                    echo '*/*/'.$sql_from;
                if($idfrom!='')
                {
                  echo '<td align="center" title="'.$apli_docu.'-'.$apli_ptoe.'-'.$apli_nume.'">';
                  if($idfrom!='')
                  {echo '<a href="?prnt=1&docu='.$apli_docu.'&idnum='.$idfrom.'&formato=" target="_blank">';}
                  echo ($apli_nume);
//                   echo '*/';
                  if($idfrom!='')
                  {echo '</a>';}
                  echo '</td>';
                }
                else
                {
                  $xaplica='';
                  if((int)$apli_nume>0)
                  {$xaplica.=$apli_docu.'-'.$apli_ptoe.'-'.$apli_nume;}
                  $xaplica.=' /'.$aso_pant['ctas'].' - '.$aso_pant['ctas_descri'];

                  
                  echo '<td>';
                  echo split_words($xaplica,30);
//                   echo '*/'.$sql_from;
                  echo '</td>';
                }
                
              }
              else
              { 
                  echo '<td>';
                  echo 'NO-APLI';
                  echo '</td>';
               } 
              
              
            }
          ?>


          <?php if($empr_zeus==1) { ?>
             <td>
              <span style="display:none;"><?php echo $aso_pant['zeus']; ?></span> 
              <?php $pidtxt='zeus_'.$aso_pant['idnum1']; $pcaption=''; $pdefa=$aso_pant['zeus']; $ptabla='retc1'; $pline=$aso_pant['idnum1']; $pcolu='zeus'; include('vrchkbox.php'); ?>	
            </td> 
          <?php } ?>
    
          <?php 
            if($ver_fact==1)
            { 
              $tablaf='vtas';
              $sql_apli ='select * ';
              $sql_apli.=' from '.$tablaf.'1 ';
              $sql_apli.=' where status!="X"';
              $sql_apli.=' and idfrom ="'.$aso_pant['idnum1'].'"';
              $sql_apli.=' and mdfrom ="'.$tabla.'"';
              $sql_apli.=' and status!="O"';
              $sql_apli.=' and status!="X"';
              $sql_apli.=' order by fecha desc';
              $sql_apli.=' limit 1';
              $res_apli=msql_query($sql_apli,$link_vcrx);
              if(@msql_num_rows($res_apli)!=0)
              {
                $apli_idnum=@msql_result($res_apli,0,'idnum1');
                $apli_docu=@msql_result($res_apli,0,'docu');
                $apli_ptoe=@msql_result($res_apli,0,'ptoe');
                $apli_nume=@msql_result($res_apli,0,'numero');
                $apli_fecha=@msql_result($res_apli,0,'fecha');
                $apli_clave=@msql_result($res_apli,0,'claveacc');
                $apli_autor=@msql_result($res_apli,0,'autornum');
                if($apli_autor=='' and $aso_pant['status']!='O' and !mb_stristr('clie.prov',$user_tipo))
                {
                  echo '<td align="center" style="font-size:'.$xfontsize*(0.8).'px;" title=" Editar:'.$apli_docu.'-'.$apli_ptoe.'-'.$apli_nume.'">';
                  echo '<div class="hidden">'.$apli_nume.'</div>';
                  {echo '<a href="?scri=regi_docu&docu='.$apli_docu.'&idnum1='.$apli_idnum.'" target="_blank">';}
                  echo $apli_nume;
                  {echo '</a>';}
                  echo '</td>';
                }
                else
                {
                  echo '<td align="center" style="font-size:'.$xfontsize*(0.8).'px;" title="Imprimir'.$apli_docu.'-'.$apli_ptoe.'-'.$apli_nume.'">';
                  echo '<div class="hidden">'.$apli_nume.'</div>';
                  {echo '<a href="?prnt=1&docu='.$apli_docu.'&idnum='.$apli_idnum.'&formato=" target="_blank">';}
                  echo $apli_nume;
                  {echo '</a>';}
                  echo '</td>';
                }
                
              }
              else
              { 
                if(!mb_stristr('clie.prov',$user_tipo))
                {
                  if($aso_pant['status']=='O' or days_diff($aso_pant['fecha'],$fechaa)>$dias_fact)
                  {
                    echo '<td align="center" style="font-size:'.$xfontsize*(0.8).'px;">';
                    echo '<div class="hidden">'.'000000000'.'</div>';
                    echo 'NO-FACT';
                    echo '</td>';
                  }
                  else
                  {
                      $xcaption='';
                      $xonclick='';
                      if(mb_stristr($pant,'PANT'))
                      {
                        $xcaption='Facturar: '.$aso_pant['docu'].'-'.$aso_pant['numero']; 
                        $xonclick="clon_docu('".$aso_pant['docu']."','".$aso_pant['idnum1']."','FC10','".$xcaption."');";
                      }
                      echo '<td align="center" style="font-size:'.$xfontsize*(0.8).'px;" title="'.$xcaption.'" >';
                      echo '<div class="hidden">'.'000000000'.'</div>';
                      echo '<a href="#" onclick="'.$xonclick.'">';
                      echo 'GEN-FACT';
                      echo '</a>';
                      echo '</td>';
                  }
                } 
              }
            }
          ?>


          <?php if($ver_doco==1 and ($tabla=='caja' or $tabla=='bcos')){ ?>
              <td>
              <?php echo $aso_pant['caba2']; ?>
              </td>
          <?php } ?>




          <?php 
            if($ver_doco==1)
            { 
              $tablao=$aso_pant['mdfrom'];
              $sql_doco ='select * ';
              $sql_doco.=' from '.strtolower($tablao).'1 ';
              $sql_doco.=' where status!="X"';
              $sql_doco.=' and idnum1 ="'.$aso_pant['idfrom'].'"';
              $res_doco=msql_query($sql_doco,$link_vcrx);
              
              if(@msql_num_rows($res_doco)!=0)
              {
                $doco_idnum=@msql_result($res_doco,0,'idnum1');
                $doco_docu=@msql_result($res_doco,0,'docu');
                $doco_ptoe=@msql_result($res_doco,0,'ptoe');
                $doco_nume=@msql_result($res_doco,0,'numero');
                $doco_clave=@msql_result($res_doco,0,'claveacc');
                {
                  echo '<td align="center" style="font-size:'.$xfontsize*(0.8).'px;" title="'.$doco_docu.'-'.$doco_ptoe.'-'.$doco_nume.'">';
                  {echo '<a href="?prnt=1&docu='.$doco_docu.'&idnum='.$doco_idnum.'&formato=" target="_blank">';}
                  echo substr($doco_docu,0,2).'-'.$doco_nume;
                  {echo '</a>';}
                  echo '</td>';
                }
              }
              else
              { 
                
                if(!empty($iddesti))
                {
                  echo '<td align="center" style="font-size:'.$xfontsize*(0.8).'px;">';
                  echo '<a href="?prnt=1&docu=IB13&idnum='.$iddesti.'&formato=" target="_blank">';
                  echo substr($docudesti,0,2).'-'.$numedesti;
                  echo '</a>';
                  echo '</td>';
                }
                else
                {
                  echo '<td align="center" style="font-size:'.$xfontsize*(0.8).'px;">';
                  echo 'NO-DOC.';
                  echo '</td>';
                }
                  
               } 
              
              
            }
          ?>

          <?php if(mb_stristr('FC.NC',substr($docu,0,2)) and $ver_invep==1){ ?>
               <?php $unidinve=unid_inve($docu,$aso_pant['idnum1']);?>
               <?php $uniddife=$aso_pant['stcant']-$unidinve; ?>
                <td align="right" style="<?php if($unidinve!=0 and $uniddife!=0){echo 'text-decoration: underline;';} ?>">
                   <?php echo number_format($uniddife,$duni); ?>
                </td>
			<?php }?>

          <?php if(mb_stristr('FP',substr($docu,0,2)) and $ver_invep==1){ ?>
               <?php $unidinve=unid_inve($docu,$aso_pant['idnum1'],'',1);?>
               <?php //$uniddife=$aso_pant['stcant']-$unidinve; ?>
               <?php $uniddife=($aso_pant['stotal'])-($unidinve); ?>
                <td align="right" style="<?php if($unidinve!=0 and $uniddife!=0){echo 'text-decoration: underline;';} ?>">
                   <?php echo number_format($uniddife,2); ?>
                </td>
			<?php }?>


          <?php 
            if($ver_cont==1)
            { 
              $ingresodifer=vtas_ingr_difer($aso_pant['docu'],$aso_pant['idnum1']);
                 
              $tablao='cont';
              $sql_doco ='select * ';
              $sql_doco.=' from '.strtolower($tablao).'1 ';
              $sql_doco.=' where status!="X"';
//               $sql_doco.=' and idnum1 ="'.$aso_pant['idfrom'].'"';
              $sql_doco.=' and idfrom ="'.$aso_pant['idnum1'].'"';
              $sql_doco.=' and mdfrom ="'.$tabla.'"';
//               $sql_doco.=' order by fecha desc';
              $res_doco=msql_query($sql_doco,$link_vcrx);
//               if(@msql_num_rows($res_doco)!=0)
              {
                $doco_idnum='0'.@msql_result($res_doco,0,'idnum1');
                $doco_idfrom=@msql_result($res_doco,0,'idfrom');
                $doco_docu=@msql_result($res_doco,0,'docu');
                {
                  echo '<td align="center" style="font-size:'.$xfontsize*(0.8).'px;" title="">';
                  {echo '<a href="?prnt=1&docu='.$aso_pant['docu'].'&idnum='.$aso_pant['idnum1'].'&formato=3" target="_blank">';}
                  echo ($doco_idnum);
                  {echo '</a>';}
                  if($ingresodifer==1){echo '-ID';}
                  echo '</td>';
                }
              }
//               else
//               { 
//                   echo '<td align="center" style="font-size:'.$xfontsize*(0.8).'px;">';
//                   echo 'NO-CONT.';
//                   echo '</td>';
//                } 
              
              
            }
          ?>
    
  
  
  
					<?php //if($ver_cele==1){ ?>
					<?php if($ver_cele==1 or $cel_stat==1){ ?>
          <td style="font-size:<?php if($orient=='V'){ echo ($xfontsize*.99).'%;'; }else{echo ($xfontsize-2).'px;'; } ?>;" >
            <div class="hidden"><?php echo substr($stcele,0,2).$aso_pant['ptonumero'];?></div>
            <?php
              if($ver_cele==1)
              {
                if(substr($aso_pant['claveacc'],23,1)==1){echo 'PRUEBAS';}
                if(substr($aso_pant['claveacc'],23,1)==2){echo 'PRODUCCION';}
                if(substr($aso_pant['claveacc'],23,1)=='' and $aso_pant['status']!='O' )
                {
                  $pidtxt='btngencla'.$aso_pant['idnum1']; $pcaption='CLAVE'; $psize=8;
                  $ptitle='Genera Clave : '.$aso_pant['docu'].'-'.$aso_pant['ptonumero'];
                  $ponclick="{if(confirm('Generar Clave ".$aso_pant['docu'].'-'.$aso_pant['ptonumero']."?')){php_func('gen_claveacc(".$aso_pant['docu'].",".$aso_pant['idnum1'].")');}}";
                  include('vrbutton.php');
                }

                if(mb_stristr('vtas.retp.guia.comp',$tabla))
                {
                  if($aso_pant['firmafec']!="" and $aso_pant['autornum']=="")
                  {echo '<br>F: '.$aso_pant['firmafec'];};

                  if($aso_pant['autornum']!="")
                  {echo '<br>A: '.$aso_pant['autorfec'];}
                  else
                  {
                    if($aso_pant['status']!='O')
                    {
                      $recepmsj=$aso_pant['recepmsj'];
                      $recepmsj=split_words($recepmsj);
                      $autormsj=$aso_pant['autormsj'];
                      $autormsj=split_words($autormsj);
                      $recepmsj=trim($recepmsj);
                      $autormsj=trim($autormsj);
                      if(mb_stristr($recepmsj,'EXTEMPO')){$recepmsj='EXTEMPORANEA';}
                      if(mb_stristr($recepmsj,'ERROR :CLAVE ACCESO REGISTRADA'))
                      {echo '<div style="background-color:seagreen;color:snow;">'.'RECIBIDA'.'</div>';}
                      else
                      {echo '<div style="background-color:gold;color:black;">'.'PENDIENTE:'.$recepmsj.$autormsj.'</div>';}
                    }
                  };
                }

//                 if(($aso_pant['firmafec']!="" or mb_stristr('PF.PC.OP',substr($aso_pant['docu'],0,2))) and $aso_pant['claveacc']!="" and $aso_pant['status']!='O')
                if((mb_stristr('FC.PF.PC.OP',substr($aso_pant['docu'],0,2))) and $aso_pant['claveacc']!="" and $aso_pant['status']!='O')
                {
                  if($emailfec!='')
                  {$emailfec=date('Y-m-d H:i',strtotime($emailfec));}
                  $pidtxt='btnmail'.$aso_pant['idnum1']; $pcaption='@: '.$emailfec; $psize=$xfontsize-2;
                  $ptitle='Enviar Mail .'.$aso_pant['docu'].'-'.$aso_pant['ptonumero'];
                  $ponclick="{if(confirm('Enviar Mail ".$aso_pant['docu'].'-'.$aso_pant['ptonumero']."?')){php_func('mail_ce(".$aso_pant['claveacc'].")');}}";
                  include('vrbutton.php');
                }
              }
              else
              {
                $style='';
                $ponclick='';
                if(substr($stcele,1,1)==2){$xtitle=$aso_pant['firmafec']; $style='text-decoration:;';if(substr($pant,0,4)=='PANT'){$style.='background-color:lightgreen; font-weight:bold; ';}}
                if(substr($stcele,1,1)==3){$xtitle=$aso_pant['recepfec']; $style='font-style:italic;';if(substr($pant,0,4)=='PANT'){$style.='background-color:gold; font-weight:bold;';}}
                if(substr($stcele,1,1)==4){$xtitle=$aso_pant['autormsj']; $style='text-decoration:underline;';if(substr($pant,0,4)=='PANT'){$style.='background-color:darkred; font-weight:bold; ';}}
                if(substr($stcele,1,1)==5){$xtitle=$aso_pant['autorfec']; $style='text-decoration:;';if(substr($pant,0,4)=='PANT'){$style.='background-color:lightblue; font-weight:bold; ';}}
                if(@mb_stristr('1235',substr($stcele,1,1)) and substr($pant,0,4)=='PANT')
                {$ponclick="{if(confirm('Enviar Mail ".$aso_pant['docu'].'-'.$aso_pant['ptonumero']."?')){php_func('mail_ce(".$aso_pant['claveacc'].")');}}";}
                echo '<div  title="'.$xtitle.'" style="'.$style.'" >';
                if(@mb_stristr('1235',substr($stcele,1,1)) and substr($pant,0,4)=='PANT'){echo '<a href="javascript:'.$ponclick.'" style="color:black;">';}
                if($ver_cele==1)
                {echo '@:'.$emailfec;}
                else
                {echo $stcele;if($emailfec>='2010'){echo '@';}}  
                if(substr($stcele,0,1)==0){echo ':'.$aso_pant['atrztipo'];}
                if(@mb_stristr('1235',substr($stcele,1,1)) and substr($pant,0,4)=='PANT'){echo '</a>';}
                echo '</div>';
              }
                                              
            ?>                                                   
					</td>
					<?php } ?>


          <?php if($ver_para==1)  { ?>
                 <?php 
                    $prrta   = 0.00 ;
                    $priva   = 0.00 ;
                    $comi    = 0.00 ;
                    $tercero = 0.00 ;
                    $subneto = 0.00 ;
                    $factura = 0.00 ;
                    $neto    = 0.00 ;
                    $poriva  = 0.00 ;
                    $valiva  = 0.00 ;
                    $firma   = 0.00 ;
               
                    $subneto = $aso_pant['puni']*$aso_pant['cant'];
                    $poriva  = $aso_pant['iva'];
                    $tsubnet = $subneto + ($subneto*$poriva)/100 ;
                    $valiva  = ($subneto*$poriva)/100 ;
            
                    $prrta   = $aso_pant['prrta'] ;
                    $priva   = $aso_pant['priva'] ;
                    $comi    = $aso_pant['comi']  ;
                    $tercero = $aso_pant['tercero']  ;
                   
                    $valren  = ($subneto*($prrta/100)) ;
                    $valiva  = ($valiva*($priva/100)) ;
                    $firma   = $subneto * ($comi /100) ;
            
                    $factura = $tsubnet - $valren - $valiva - $firma;
                    $neto    = $factura - $tercero;
                    $factura = number_format($factura,2);
                    $neto    = number_format($neto,2);
                          
            
                    $pcaption="Renta"   ; $pidtxt='prrta_'.$aso_pant['idnum1']   ; $pvalue=$prrta   ; $pobj=1; $plong=5; $psize=8; include('vrgetval.php'); ?>
                 <?php $pcaption="IVA"     ; $pidtxt='priva_'.$aso_pant['idnum1']   ; $pvalue=$priva   ; $pobj=1; $plong=5; $psize=8; include('vrgetval.php'); ?>
                 <?php $pcaption="Comi"    ; $pidtxt='comi_'.$aso_pant['idnum1']    ; $pvalue=$comi    ; $pobj=1; $plong=5; $psize=8; include('vrgetval.php'); ?>
                 <?php $pcaption="Tercero" ; $pidtxt='tercero_'.$aso_pant['idnum1'] ; $pvalue=$tercero ; $pobj=1; $plong=5; $psize=8; include('vrgetval.php'); ?>
             <td align="center"><B> <?php echo $factura;?></B></td>
             <td align="center"><B> <?php echo $neto;?></B></td>
             <td>
               <?php 
                  $pidtxt='btngraba'.$aso_pant['idnum1']; $pcaption='Pago'; $psize=8;
                  $ptitle='Graba Pagos';
                  $ponclick='_modi1("'.$aso_pant['docu'].'",'.$aso_pant['idnum1'].','.$aso_pant['iddet'].')';
                  include('vrbutton.php');
               ?>
             </td>
          <?php } ?>


  
          <?php if($empr_impo==1 and $mimpor!=''){ ?>
          <td align="center">
            <?php echo $aso_pant['impor'];?>
          </td>
          <?php if($docu=='DA16'){?>
          <td align="right">
            <?php echo number_format($aso_pant['costol1'],2);?>
          </td>
          <?php } ?>
          <?php } ?>

        <?php if(substr($pant,0,4)=='PANT'){ ?>
<!--           <td></td> -->
				<?php } ?>
  
        </tr>
				<?php } ?>
			</tbody>
		<?php } ?>	
  
      <?php $timew2=date('U'); ?>
      <?php { // FOOT ?>
			<tfoot id="tpant1f" style="<?php echo $tdisplay; ?><?php if($mobile!='true'){echo 'max-width:'.($screenw-20).'px;';} ?>;background-color:<?php echo $gris1; ?>; font-size:<?php echo $xfontsize*.80;?>px;">
				<tr style="border-top:solid 1px;border-bottom:solid 1px;">
					<th style="display:none;"<?php $ccol--; ?>></th>
          <?php if(substr($pant,0,4)=='PANT'){?>
					<th <?php $ccol--; ?>></th>
          <?php } ?>
          <?php if(substr($pant,0,4)=='PANT' and $user_clon==1){?>
					<th <?php $ccol--; ?>></th>
          <?php } ?>
          <?php if($dispcolu!=0){?>
          <?php if(substr($pant,0,4)=='PANT'){?>
					<th <?php $ccol--; ?>></th>
          <?php } ?>
					<th <?php $ccol--; ?>></th>
					<th <?php $ccol--; ?>></th>
          <?php } ?>
					<th <?php $ccol--; ?>><?php echo ($tnumero).'/'.($crow); ?></th>
					<th <?php $ccol--; ?>></th>
          <?php if($dispcolu!=0){?>
					<th <?php $ccol--; ?>></th>
          <?php } ?>
					<th <?php $ccol--; ?>style="max-width:;letter-spacing:5px; "><?php if($dispcolu==0){echo 'TOTAL';}else{echo 'TOTALES';} ?></th>
          
				<?php if($docuitem==1){ ?>
					<th align="right" style="<?php if($tsubt==0 or 1==2){echo'display:;';}?>"><?php$ccol--;?> <?php echo number_format($tcant,2); ?></th>			
				<?php } ?>
          
          
          <?php if(($docuitem==1 or @mb_stristr('retp.retc.rete',$tabla)) and mb_stristr('PANT1.IMPR1',$pant)){ ?>
					<th <?php $ccol--; ?>align="right" style="<?php if(($tsubt==0 or $xipuni==0)  and !mb_stristr('retp.retc.rete',$tabla)){echo'display:none;';}?>">
            <?php if(@mb_stristr('retp.retc.rete',$tabla)){?>
            <?php }else{?>
		  				<?php echo number_format(abs($tsubt),2); ?>
            <?php }?>               
					</th>	
            <?php }?>               
          <?php //$tcant=number_format(abs($tcant),2); ?>
					<?php if($docuitem==1 and mb_stristr('PANT3.IMPR3',$pant)){ ?>
              <th<?php $ccol--; ?>></th>
            <?php if($tabla=='inve'){?>
              <th<?php $ccol--; ?>></th>
              <th<?php $ccol--; ?>></th>
              <?php //$tcant=$tcant*0; ?>
              <?php //$tcant=''; ?>
            <?php } ?>
            <th<?php $ccol--; ?>></th>
            <th<?php $ccol--; ?>></th>
            <th<?php $ccol--; ?>></th>
					<?php } ?>
					<?php if($docuiimp==1){ ?>
						<th <?php $ccol--; ?>align="right" style="<?php if($tdcto==0 or $xipuni==0){echo'display:none;';}?> font-style:italic;text-decoration:underline;">
							<?php echo number_format(abs($tdcto),2); ?>
						</th>	
						<th <?php $ccol--; ?>align="right" style="<?php if($tssid==0 or $xipuni==0){echo'display:none;';}?> font-style:italic;text-decoration:underline;">
							<?php echo number_format(abs($tssid),2); ?>
						</th>	
						<th <?php $ccol--; ?>align="right" style="<?php if($tice==0 or $xipuni==0){echo'display:none;';}?> font-style:italic;">
							<?php echo number_format(abs($tice),2); ?>
						</th>	
						<th <?php $ccol--; ?>align="right" style="<?php if($tsubtiva0==0 or $xipuni==0){echo'display:none;';}?>">
							<?php echo number_format(abs($tsubtiva0),2); ?>
						</th>
						<th <?php $ccol--; ?>align="right" style="<?php if($tsubtiva==0 or $xipuni==0){echo'display:none;';}?>">
							<?php echo number_format(abs($tsubtiva),2); ?>
						</th>	
						<th <?php $ccol--; ?>align="right" style="<?php if($tprop==0 or $xipuni==0){echo'display:none;';}?> font-style:italic;">
							<?php echo number_format(abs($tprop),2); ?>
						</th>	
						<th <?php $ccol--; ?>align="right" style="<?php if($tiva==0 or $xipuni==0){echo'display:none;';}?> font-style:italic;">
							<?php echo number_format(abs($tiva),2); ?>
						</th>	
						<th <?php $ccol--; ?>align="right" style="<?php if($tirbp==0 or $xipuni==0){echo'display:none;';}?> font-style:italic;">
							<?php echo number_format(abs($tirbp),2); ?>
						</th>	
				<?php } ?>
					<?php if($docuctas==1){ ?>
						<th <?php $ccol--; ?>align="right" style="<?php if($tdebito==0){echo'display:;';}?>">
							<?php echo number_format(abs($tdebito),2); ?>
						</th>	
						<th <?php $ccol--; ?>align="right" style="<?php if($tcredito==0){echo'display:;';}?>">
							<?php echo number_format(abs($tcredito),2); ?>
						</th>	
              <?php $total=abs($tdebito)-abs($tcredito);?>
              <?php $tdifer=abs($tdebito)-abs($tcredito);?>
				<?php } ?>
					<?php if($docuctas==1 and mb_stristr('PANT3.IMPR3',$pant)){ ?>
          <th<?php $ccol--; ?>></th>
          <?php $ccol--; ?>
					<?php } ?>
					<?php if(@mb_stristr('guia',$tabla)){?>
          <th<?php $ccol--; ?>></th>
          <?php } ?>
					<?php if(@mb_stristr('retc.retp.rete',$tabla)){ ?>
          <?php if($dispcolu!=0){?>
						<th <?php $ccol--; ?>align="right" style="font-style: ;">
							<?php echo number_format(abs($tbrta),2); ?>
						</th>	
          <?php } ?>
						<th <?php $ccol--; ?>></th>
          <?php if($dispcolu!=0){?>
						<th <?php $ccol--; ?>align="right" style="font-style:italic;">
							<?php echo number_format(abs($trrta),2); ?>
						</th>	
          <?php } ?>
          <?php if($dispcolu!=0){?>
						<th <?php $ccol--; ?>align="right">
							<?php echo number_format(abs($tbiva),2); ?>
						</th>	
          <?php } ?>
						<th <?php $ccol--; ?>></th>
          <?php if($dispcolu!=0){?>
						<th <?php $ccol--; ?>align="right" style="font-style:italic;">
							<?php echo number_format(abs($triva),2); ?>
						</th>	
          <?php } ?>
            <?php $ccol--;?>
					<?php } ?>
					<?php if(@mb_stristr('atvd.plan',$tabla)){?>
            <th<?php $ccol--; ?>><?php echo number_format($tcant,2);?></th>
            <th<?php $ccol--; ?>></th>
          <?php } ?>

                         
         <?php if(@mb_stristr('FP15.DA16',$docu)){ ?>
          <th <?php $ccol--; ?>></th>
          <?php } ?>          
                         
					<th <?php $ccol--; ?> align="right" style="<?php if($total==0){echo'display:none;';}?>">
						<?php echo number_format(abs($total),2); ?>
					</th>
          
          <?php if($empr_cont==1 and @mb_stristr('comp',$tabla)){ ?>
          <th <?php $ccol--; ?>></th>
          <th <?php $ccol--; ?>></th>
          <th <?php $ccol--; ?>></th>
          <th <?php $ccol--; ?>></th>
          <th <?php $ccol--; ?>></th>
          <th <?php $ccol--; ?>></th>
          <?php } ?>          

          <?php if(@mb_stristr('comp.retc',$tabla)){ ?>
          <th <?php $ccol--; ?>></th>
          <?php } ?>          
          
          <?php if($ver_rete==1){ ?>
          <th <?php $ccol--; ?>></th>
          <th <?php $ccol--; ?>></th>
          <th <?php $ccol--; ?>></th>
          <th <?php $ccol--; ?>></th>
          <?php } ?>
          
          <?php if($ver_saldo==1){ ?>
          <th <?php $ccol--; ?>></th>
					<th <?php $ccol--; ?> align="right" style="<?php if($total==0){echo'display:;';}?>">
						<?php echo number_format(abs($tsaldo),2); ?>
					</th>
          <?php } ?>
          
          <?php $ccol--;?>
          <?php if($ccol<0){$ccol=0;}?>
          <?php if(mb_stristr($pant,'PANT') or 1==1){?>
          <?php echo str_repeat('<th></th>',$ccol); ?>
          <?php } ?>
				</tr>
        
        
				<?php if($tnumero>0){?>
				<tr style="border-top:solid 1px;border-bottom:solid 1px;">
					<th style="display:none;"></th>
          <?php if(substr($pant,0,4)=='PANT'){?>
					<th></th>
          <?php } ?>
          <?php if(substr($pant,0,4)=='PANT' and $user_clon==1){?>
					<th></th>
          <?php } ?>
          <?php if($dispcolu!=0){?>
          <?php if(substr($pant,0,4)=='PANT'){?>
					<th></th>
          <?php } ?>
					<th></th>
					<th></th>
          <?php } ?>
					<th></th>
					<th></th>
          <?php if($dispcolu!=0){?>
					<th></th>
          <?php } ?>
					<th style="letter-spacing:5px;"><?php if($dispcolu==0){echo'PROM.';}else{echo 'PROMEDIOS';}?></th>
          
				<?php if($docuitem==1){ ?>
					<th align="right" style="<?php if($tsubt==0 or 1==2){echo'display:;';}?>"><?php$ccol--;?> <?php echo number_format($tcant/$tnumero,2); ?></th>			
				<?php } ?>
          
          <?php if(($docuitem==1 or @mb_stristr('retp.retc.rete',$tabla)) and mb_stristr('PANT1.IMPR1',$pant)){ ?>
          
					<th align="right" style="<?php if(($tsubt==0 or $xipuni==0) and !mb_stristr('retp.retc.rete',$tabla)){echo'display:none;';}?>">
            <?php if(mb_stristr('retp.retc.rete',$tabla)){?>
					 	  
            <?php }else{?>              
  						<?php echo number_format(abs($tsubt/$tnumero),2); ?>
            <?php }?>               
					</th>
            <?php }?>               
					<?php if($docuitem==1 and mb_stristr('PANT3.IMPR3',$pant)){ ?>
              <th></th>
            <?php if($tabla=='inve'){?>
              <th></th>
              <th></th>
              <?php $tcant=0; ?>
            <?php } ?>
          <th></th>
          <th></th>
          <th></th>
					<?php } ?>
					<?php if($docuiimp==1){ ?>
						<th align="right" style="<?php if($tdcto==0 or $xipuni==0){echo'display:none;';}?> font-style:italic;text-decoration:underline;">
							<?php echo number_format(abs($tdcto/$tnumero),2); ?>
						</th>
						<th align="right" style="<?php if($tssid==0 or $xipuni==0){echo'display:none;';}?> font-style:italic;text-decoration:underline;">
							<?php echo number_format(abs($tssid/$tnumero),2); ?>
						</th>
						<th align="right" style="<?php if($tice==0 or $xipuni==0){echo'display:none;';}?> font-style:italic;">
							<?php echo number_format(abs($tice/$tnumero),2); ?>
						</th>
						<th align="right" style="<?php if($tsubtiva0==0 or $xipuni==0){echo'display:none;';}?>">
							<?php echo number_format(abs($tsubtiva0/$tnumero),2); ?>
						</th>
						<th align="right" style="<?php if($tsubtiva==0 or $xipuni==0){echo'display:none;';}?>">
							<?php echo number_format(abs($tsubtiva/$tnumero),2); ?>
						</th>
						<th align="right" style="<?php if($tprop==0 or $xipuni==0){echo'display:none;';}?> font-style:italic;">
							<?php echo number_format(abs($tprop/$tnumero),2); ?>
						</th>
						<th align="right" style="<?php if($tiva==0 or $xipuni==0){echo'display:none;';}?> font-style:italic;">
							<?php echo number_format(abs($tiva/$tnumero),2); ?>
						</th>
						<th align="right" style="<?php if($tirbp==0 or $xipuni==0){echo'display:none;';}?> font-style:italic;">
							<?php echo number_format(abs($tirbp/$tnumero),2); ?>
						</th>
					<?php }?>
					<?php if($docuctas==1){ ?>
						<th align="right" style="<?php if($tdebito==0){echo'display:;';}?>">
							<?php //echo number_format(abs($tdebito/$tnumero),2); ?>
						</th>	
						<th align="right" style="<?php if($tcredito==0){echo'display:;';}?>">
							<?php //echo number_format(abs($tcredito/$tnumero),2); ?>
						</th>	
				<?php } ?>

					<?php if(@mb_stristr('guia',$tabla)){?>
          <th></th>
          <?php } ?>
          <?php if(mb_stristr('retc.retp.rete',$tabla)){?>
          <?php if($dispcolu!=0){?>
						<th align="right" style="font-style: ;">
							<?php echo number_format(abs($tbrta/$tnumero),2); ?>
						</th>	
          <?php } ?>
						<th></th>
          <?php if($dispcolu!=0){?>
						<th align="right" style="font-style:italic;">
							<?php echo number_format(abs($trrta/$tnumero),2); ?>
						</th>	
						<th align="right" style="font-style: ;">
							<?php echo number_format(abs($tbiva/$tnumero),2); ?>
						</th>	
          <?php } ?>
						<th></th>
          <?php if($dispcolu!=0){?>
						<th align="right" style="font-style:italic;">
							<?php echo number_format(abs($triva/$tnumero),2); ?>
						</th>	
          <?php } ?>
					<?php } ?>
          
					<?php if(@mb_stristr('atvd.plan',$tabla)){?>
            <th></th>
            <th></th>
            <th></th>
            <th></th>
          <?php } ?>
          
         <?php if(@mb_stristr('FP15.DA16',$docu)){ ?>
            <th></th>
          <?php } ?>          
          
					<th align="right" style="<?php if($total==0){echo'display:none;';}?>">
						<?php echo number_format(abs($total/$tnumero),2); ?>
					</th>

          
          <?php if($empr_cont==1 and mb_stristr('comp',$tabla)){ ?>
          <th></th>
          <th></th>
          <th></th>
          <th></th>
          <th></th>
          <th></th>
          <th></th>
          <?php } ?>          

          <?php if(mb_stristr('comp.retc',$tabla)){ ?>
          <th></th>
          <?php } ?>          
          
          
          <?php if($ver_rete==1){ ?>
          <th></th>
          <th></th>
          <th></th>
          <th></th>
          <?php } ?>
          
          <?php if($ver_saldo==1){ ?>
                         <th></th>
					<th align="right" style="<?php if($total==0){echo'display:;';}?>">
						<?php echo number_format(abs($tsaldo)/$tnumero,2); ?>
					</th>
          <?php } ?>
          
          
          
          <?php if(mb_stristr($pant,'PANT') or 1==1){?>
          <?php echo str_repeat('<th></th>',$ccol); ?>
          <?php } ?>
				</tr>
				<?php}?>
			</tfoot>
			<?php } ?>	
		</table>



<!-- <hr class="d-sm-none">     -->
      <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.MODI2',$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=(int)$iddet;
  if($iddet>0){$sql_pant2.=' and iddet="'.$iddet.'"';}
  $sql_pant2.=' order by iddet desc';
 
	$sql_tpant =str_replace('select *','select *,'.$sql_total,$sql_pant);
	if(mb_stristr('retc.retp.rete',$tabla)){$sql_tpant.=' group by fecha,numero,enti';}
	else	{$sql_tpant.=' group by idnum1';}
    
// 	$res_pant=msql_query($sql_pant,$link_vcrx); 
  {
//        echo '<msgsistemas>*/*/*/*'.$sql_tpant.'</msgsistemas>';
    $res_tpant=msql_query($sql_tpant,$link_vcrx); 
//     $tsubt=msql_result($res_tpant,0,'stsubt');
    $tsubt=msql_result($res_tpant,0,'stsubt');
    $tcant=msql_result($res_tpant,0,'stcant');
    $mdetalle=msql_result($res_tpant,0,'mdetalle');
    $ttotal=msql_result($res_tpant,0,'stotal');
    $tpeso=@msql_result($res_tpant,0,'speso');
    $tcostoe=@msql_result($res_tpant,0,'costoe1');
    $tseguro=@msql_result($res_tpant,0,'seguro1');
    $tflete=@msql_result($res_tpant,0,'flete1');
    
    $tcif=0;
    if($tseguro!=0 or $tflete!=0)
    {$tcif=$total+$tseguro+$tflete;}
    
//     if($tseguro!=0){$total=0;}

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

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

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

    
    if(mb_stristr('atvd.plan',$tabla))
    {
      $tsubt=0;
      $total=0;
      $ttotal=0;
    }
    
  }

}	?>


<pant11>
	<div style="border-top:solid 1px;font-size:<?php echo $xfontsize; ?>px; <?php if($xmodi==1){echo 'display:none;';} ?>">
		<?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 : '.@msql_result($res_tpant,0,'idnum1'); ?>
          <br>
					<?php echo @msql_result($res_tpant,0,'docu_descri'); ?>
          <br>
					<?php echo 'NUM: '.@msql_result($res_tpant,0,'ptonumero'); ?>
				</td>
				<td>
					<div style="font-weight:bold;">
					<?php echo ''.substr(@msql_result($res_tpant,0,'enti_descri'),0,200); ?>
					</div>
					<div style="font-size:<?php if($mobile=='true' and strlen(@msql_result($res_tpant,0,'concepto')>100)){echo $xfontsize-16;}?>px" ;>
					<?php echo substr(@msql_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=@msql_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;">F.PAGO:</td>
                <td><?php echo @msql_result($res_tpant,0,'fpag_descri'); ?></td>
              </tr>
              <tr>
                <td align="right" style="font-weight:bold;">S.COMP.:</td>
                <td><?php echo @msql_result($res_tpant,0,'suco_descri'); ?></td>
              </tr>
              <tr>
                <td align="right" style="font-weight:bold;">No.Aut.:</td>
                <td><?php echo @msql_result($res_tpant,0,'atrz').@msql_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(@msql_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(@msql_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); ?></td>
            </tr>
	         </table>
			</td>
				<?php } ?>
        
        
				<?php if(@mb_stristr('cont',$tabla)) { ?>
				<td width="1%" 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 align="right">
                <td style="font-weight:bold;">DEBITOS:</td>
                <td><?php echo number_format($tdebito,2); ?></td>
              </tr>
              <tr  align="right" style="font-style:italic;">
                <td align="right" style="font-weight:bold;">CREDITOS:</td>
                <td><?php echo number_format($tcredito,2); ?></td>
              </tr>
              <?php if($tdifer!=0){ ?>
              <tr align="right">
                <td style="font-weight:bold;">DIFEREN.:</td>
                <td style="color:red;" ><?php echo number_format($tdifer,2); ?></td>
              </tr>
              <?php } ?> 
            </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 } ?>

  
<!-- datos hdd   -->
<div id="pant11a" style="display:none">
  <?php 
    $res_pant2=msql_query($sql_pant2,$link_vcrx);
    if(msql_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=msql_query($sql_pant2,$link_vcrx);
    }
    $campo=''; 
    $cfield=msql_num_fields($res_pant2);
//                                        echo '*/*/*/*/'.$cfield;$cfield=0;
    for($indx=0; $indx<$cfield; $indx++)
    {
      $nfield=@msql_field_name($res_pant2,$indx);
      $tfield=@msql_field_type($res_pant2,$indx);
      $vfield=@msql_result($res_pant2,0,$nfield);
      if(mb_stristr($nfield,'idate')){$vfield=substr($vfield,0,10);}
//       if(mb_stristr($vfield,'.')){$vfield=rtrim($vfield,'0'); $vfield.='0';}
      if($tfield=='real'){$vfield=rtrim($vfield,'0'); $vfield.='0';}
//          echo '*** '.$indx.' : '.$vfield;
      if(!empty($vfield))
      {
        $campo.='<input type="hidden" class="hdd"';
        $campo.='name="'.$nfield.'" ';
        $campo.='value="'.$vfield.'" ';
//         $campo.='tipo="'.$tfield.'" ';
        $campo.='/>';
        
        if(mb_stristr('RPRO.RCLI',$docu))
        {
          if($nfield=='cant'){$nfield='base';}
          if($nfield=='puni'){$nfield='porc';}
          if($nfield=='base' or $nfield=='porc')
          {
            $campo.='<input type="hidden" class="hdd"';
            $campo.='name="'.$nfield.'" ';
            $campo.='value="'.$vfield.'" ';
            $campo.='/>';
          }
        }  
      }  
    }
    echo $campo;
  ?>
</div>
  
<!--   cuadro totales -->
<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;
                <?php if ($tcif!=0){echo 'display:none;';} ?>
         ">
    <tr><td td width=""></td><td width="1%"></td></tr>
    <?php if($tcant!=0 and $docuitem==1){?>
    <tr>
      <td align="right">
        <input type="button" value="CANTIDAD" style="font-weight:bold;font-size:<?php echo $xfontsize;?>px;">
      </td>
      <td align="right" >
        <?php echo number_format(abs($tcant),2);?>
      </td>
    </tr>
    <?php } ?>
    <?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($ttotal!=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($ttotal),2);?>
      </td>
    </tr>
    <?php } ?>
    
    <?php if($empr_impo==1){?>
    </table>
  <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;
         ">
    <?php if($tpeso!=0){ ?>
      <tr>
        <td align="right">
          <input type="button" value="PESO KG" style="font-weight:bold;">
        </td>
        <td align="right" style="">
          <div style="min-width:<?php echo $xfontsize*3*2;?>px;;"></div>
          <?php echo ' '. number_format(abs($tpeso),2);?>
        </td>
      </tr>
    <?php } ?>
      <?php if(mb_stristr('DA16',$docu)){?>
        <tr>
          <td align="right">
            <input type="button" value="FOB" style="font-weight:bold;">
          </td>
          <td align="right" style="">
            <div style="min-width:<?php echo $xfontsize*3*2;?>px;;"></div>
            <?php echo ' '. number_format($total,2);?>
          </td>
        </tr>
        <tr>
          <td align="right">
            <input type="button" value="SEGURO" style="font-weight:bold;">
          </td>
          <td align="right" style="">
            <div style="min-width:<?php echo $xfontsize*3*2;?>px;;"></div>
            <?php echo ' '. number_format($tseguro,2);?>
          </td>
        </tr>
        <tr>
          <td align="right">
            <input type="button" value="FLETE" style="font-weight:bold;">
          </td>
          <td align="right" style="">
            <div style="min-width:<?php echo $xfontsize*3*2;?>px;;"></div>
            <?php echo ' '. number_format($tflete,2);?>
          </td>
        </tr>
        <tr>
          <td align="right">
            <input type="button" value="CIF" 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($tcif,2);?>
          </td>
        </tr>
      <?php } ?>
    <?php } ?>
    
    
  </table>
</div>
  
  
</pant11>

<?php
$mlote=@msql_result($res_tpant,0,'mlote');
$mserie=@msql_result($res_tpant,0,'mserie');
$mclor=@msql_result($res_tpant,0,'mclor');
$mtlla=@msql_result($res_tpant,0,'mtlla');
?>
    
<pant2>
<?php $crow=0; ?>
<?php $ccol=0; ?>
  
  
<?php
                                       
  $sql_pant='select * from '.$tabla.'12 where idnum2="'.$idnum1.'" ';
//   $xorder=' order by iddet';
  if($tabla=='prod'){$xorder=' order by item ';}
  $sql_pant.=$xorder;
                                       
     //docucair
//       $sql_pant.='group by cair ';
//      $sql_total=sql_total($tabla);
//      $sql_pant=str_replace('*','*,'.$sql_total,$sql_pant);
                                       
                                  
	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","susa","csub","caja","bcos")';
        $sql_pant.=' and docum_tabla in("acce","plan","atvd","enti","xitem","asub","susa")';
    }
    $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 '<msgalert>';                                       
// echo $sql_pant;                                       
// echo '</msgalert>';                                       
// 	echo '*/*/*/'.explain_sql($sql_pant);
                                       
	$res_pant=msql_query($sql_pant,$link_vcrx);	
?>
<?php $numrows=@msql_num_rows($res_pant); ?>
<?php $ccol=0; ?>
<?php if($xmodi==1){$dispcolu=0;} ?>  
	<table id="tpant2" class="pant2"  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,0<?php  $ccol++; ?>);"></th>
				<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>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Infor</th>
				<?php } ?>
            <?php if($tabla=='nomi'){?>
            <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="">Cédula</th>
            <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="">Empleado</th>
            <?php $lblcant=''; ?>
            <?php } ?>
            <?php if($tabla=='empl'){?>
            <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="">Fecha</th>
            <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="">Código</th>
            <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="">Novedad</th>
            <th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" title="">Cant.</th>
            <th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" title="">Valor</th>
            <?php $lblcant=''; ?>
            <?php } ?>
				<?php if($docuitem==1){ ?>
					<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>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" title="Cantidad">Cant</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Unidad de Medida">Umdd</th>
          <?php if(!mb_stristr('guia.susa',$tabla)){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" title="Prec.Unitario" style="<?php if($xipuni==0){echo'display:none;';}?>">P.Uni</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" title="Sub-Total" style="<?php if($tsubt==0 or $xipuni==0){echo'display:none;';}?>">Sub-Tot</th>			
  				<?php } ?>
				<?php } ?>
				<?php if($docuiimp==1){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" style="<?php if($tdcto==0){echo'display:none;';}?> text-decoration:underline;">Dcto.</th>	
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" style="<?php if($tssid==0){echo'display:none;';}?> text-decoration:underline;">SSid.</th>	
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" style="<?php if($tprop==0){echo'display:none;';}?>">Prop.</th>	
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" style="<?php if($tice==0){echo'display:none;';}?> font-style:italic;">ICE</th>	
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" style="<?php if($tiva==0){echo'display:none;';}?> font-style:italic;">IVA</th>	
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" 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++; ?>,'N');">Cantidad</th>
          <?php  if(mb_stristr('dxco.dxpa',$tabla)){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');">Valor</th>
          <?php } ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Cuenta</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Contable</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++; ?>,'N');">Base Imponible</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');">Impuesto</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');">% 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++; ?>,'N');">Debitos</th>
          <th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');">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++; ?>,'N');">HORAS</th>
          <th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" style="<?php if($tsubt==0){echo'display:none;';} ?>">VALOR</th>
        <?php } ?>
         <?php if(mb_stristr('FP15.DA16',$docu)){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');">Peso Net.</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Arancel</th>
				<?php } ?>        
        
				<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" style="<?php if($tsubt==0 or $xipuni==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(mb_stristr('tgck.sawo.ztej',$cfg_empr) and @mb_stristr('vtas',$tabla) and $xmvhcl!=''){?>
				   <th onclick="sortTable(this,<?php echo $ccol++; ?>);">VHCL</th>
         <?php } ?>
        
        <?php if(@mb_stristr('vtas.clie.carr.inve.prod',$tabla)){?>
				   <th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($mclor==''){echo 'display:none;';} ?>">C</th>
				   <th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($mtlla==''){echo 'display:none;';} ?>">T</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 mb_stristr('comp.prov',$tabla)){?>
          <?php if($tabla=='comp'){?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Cuenta</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Contable</th>
          <?php } ?>
        
        
            <?php if(mb_stristr('DA16',$docu)){ ?>
              <th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');">AD-VALOR</th>
              <th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');">FODINFA</th>
              <th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');">IVA</th>
            <?php } ?>
          <?php if(!mb_stristr('FP15.FP16.DA16',$docu)){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">CAIR</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');">%Rta</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');">%IVA</th>
				  <?php } ?>
				<?php } ?>
        
        <?php if(mb_stristr('inve.prod.tfin',$tabla) and $mobile!='true'){?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($mlote==''){echo 'display:none;';} ?>">LOTE</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($mserie==''){echo 'display:none;';} ?>"># SERIE</th>
				<?php } ?>
        <?php if(mb_stristr('IB11.EB11',$docu) ){?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" >CAMBIO</th>
				<?php } ?>
        <?php if($user_modi==1){?>
				<th width="10%" align="center"><?php$ccol++;?> 
					<div class="hidden">ELIMINAR</div>
					<?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*.4).'px;';}  ?> 
					<?php if($orient=='V'){echo'height:'.($hpant2-75).'px;';}else{echo'height:'.($hpant2*.65).'px;';}  ?>">
      <?php //explain_sql($sql_pant);?>
			<?php while($aso_pant=@msql_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 $docum=$aso_pant['docum']; ?>
			<?php $numer=$aso_pant['numer']; ?>
			<?php $ctas=$aso_pant['ctas']; ?>
			<?php $uxpre=@$aso_pant['uxpre']; ?>
			<?php $facon=@$aso_pant['facon']; ?>
			<?php $cantumdd=@$aso_pant['cantumdd']; ?>
			<?php $pcp1=$aso_pant['puni']*$aso_pant['cant']*(1-$aso_pant['dcto']/100);?>
			<?php $umdd=$aso_pant['item_umdd']; ?>
			
			<?php $ctasdes=$aso_pant['ctas_descri']; ?>
      <?php //if(mb_stristr('comp.prov',$tabla)){$umdd='';} ?>
      <?php //if($uxpre*$facon!=1){$umdd='';} ?>
			<?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%;">
					<div class="hidden"><?php echo fillzero($aso_pant['iddet']); ?></div>
        </td>
        
				<td align="center" style="font-size:80%;">
        <?php 
               $stfin=$aso_pant['stfin'];                                                                

                   if($cfg_empr=='imcp' and substr($docu,0,2)=='DD' and date('Y-m-d')<="2022-02-15")
                   {
                        $dias_anul=400; 
                        $stfin=0;
                   }
                                                                
          if(!mb_stristr('FROX',$aso_pant['status'])
             and $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=='nomi'){ ?>
						<td align="center">
							<?php echo $aso_pant['enti2']; ?>
						</td>
						<td align="left">
							<?php echo $aso_pant['enti_descri']; ?>
						</td>
            <?php } ?>
        
            <?php if($tabla=='empl'){ ?>
						<td align="center">
							<?php echo $aso_pant['fecha2']; ?>
						</td>
						<td align="center">
							<?php echo $aso_pant['nvdd']; ?>
						</td>
						<td align="left">
							<?php echo $aso_pant['nvdd_descri']; ?>
						</td>
						<td align="right">
							<?php echo number_format($aso_pant['cant'],2); ?>
						</td>
						<td align="right">
							<?php echo number_format($aso_pant['puni'],2); ?>
						</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>
							<?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 align="center">
							<?php 
                $pidtxt='chkinfo'.$aso_pant['idnum2'].$aso_pant['iddet'];$pdefa=$aso_pant['info'];  
                $ptabla="acce2"; $pline=$aso_pant['idnum2'].'-'.$aso_pant['iddet'];$pcolu="info";
                if($user_modi==0){$preado=1;}                                   
                include('vrchkbox.php');
              ?>	
						</td>
            <td></td>
						<?php } ?>
        
            
            <?php $item_codigo=$aso_pant['item']; ?>
            <?php $item_descri=$aso_pant['item_descri']; ?>
          <?php
               if($aso_pant['item_status']=="I")
               {$item_descri.=' ==>(INACTIVO)';}
                         ?>                         
                    
            <?php if($tabla=='nomi'){?>
            <?php $item_codigo=$aso_pant['nvdd']; ?>
            <?php $item_descri=$aso_pant['nvdd_descri']; ?>
            <?php $dpre=4; ?>
            <?php } ?>
        
                    
          <?php  // si funciona  ?>                    
        <?php //$xipuni=0; ?>

				<?php if($docuitem==1){ ?>
					<td title="<?php echo $aso_pant['itemce']; ?>" id="item<?php echo $aso_pant['iddet'];?>".>
						<?php echo $item_codigo; ?>
					</td>
					<td title="<?php echo $aso_pant['itemce']; ?>"
								style="<?php if(strlen(trim($item_descri))>20){echo 'font-size:'.($xfontsize*.8).'px';} ?>">
						<?php echo $item_descri; ?>
					</td>
					<td align="center"><?php echo number_format(abs($aso_pant['cant']),$duni); ?></td>
					<td align="center"><?php echo $umdd; ?></td>
        
          <?php if(!mb_stristr('guia.susa',$tabla)){ ?>
					<td align="right" style="font-weight:bold;<?php if($xipuni==0){echo'display:none;';} ?>">
						<?php echo number_format(abs($aso_pant['puni']),$dpre); ?>
					</td>
					<td align="right" style="font-weight:bold;<?php if($tsubt==0 or $xipuni==0){echo'display:none;';} ?>">
						<?php echo number_format(abs($aso_pant['tsubt']),$dval); ?>
					</td>
  				<?php } ?>
        <?php } ?>
				<?php if($docuiimp==1){ ?>
					<td align="right" style="<?php if($tdcto==0 or $xipuni==0){echo'display:none;';}else{echo'text-decoration:underline;font-style:italic;';} ?>" title="<?php echo number_format(abs($aso_pant['dcto']),$dval).'%'; ?>">
						<?php echo number_format(abs($aso_pant['tdcto']),$dval); ?>
					</td>
					<td align="right" style="<?php if($tssid==0 or $xipuni==0){echo'display:none;';}else{echo'text-decoration:underline;font-style:italic;';} ?>" title="<?php echo number_format(abs($aso_pant['ssid']),$dval).'%'; ?>">
						<?php echo number_format(abs($aso_pant['tssid']),$dval); ?>
					</td>
					<td align="right" style="<?php if($tprop==0 or $xipuni==0){echo'display:none;';} ?>font-style:italic;" title="<?php echo number_format(abs($aso_pant['prop']),$dval).'%'; ?>">
						<?php echo number_format(abs($aso_pant['tprop']),$dval); ?>
					</td>
					<td align="right" style="<?php if($tice==0 or $xipuni==0){echo'display:none;';} ?>font-style:italic;" title="<?php echo number_format(abs($aso_pant['ice']),$dval).'%'; ?>">
						<?php echo number_format(abs($aso_pant['tice']),$dval); ?>
					</td>
					<td align="right" style="<?php if($tiva==0 or $xipuni==0){echo'display:none;';} ?>font-style:italic;" title="<?php echo number_format(abs($aso_pant['iva']),$dval).'%'; ?>">
						<?php echo number_format(abs($aso_pant['tiva']),$dval); ?>
					</td>
					<td align="right" style="<?php if($tirbp==0 or $xipuni==0){echo'display:none;';} ?>font-style:italic;" title="<?php echo number_format(abs($aso_pant['irbp']),$dval); ?>">
						<?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 if(mb_stristr('dxco.dxpa',$tabla)){?>
					<td align="center"><?php echo number_format(abs($aso_pant['puni']),2); ?></td>
        <?php } ?>
          <?php if($docudocu==1){ ?>
          <td><?php echo $ctas; ?></td>
          <td><?php echo $ctasdes; ?></td>
          <?php } ?>
        <?php } ?>
        
  				<?php if($docurete==1){ ?>
					<?php
						$cair='('.$aso_pant['cair'].')';
						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">
						<?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">
            <?php echo number_format(abs($aso_pant['tdebito']),2); ?></td>
          <td align="right" style="font-style:italic;">
            <?php echo number_format(abs($aso_pant['tcredito']),2); ?></td>
          <td title="<?php echo $aso_pant['csub_descri']; ?>"><?php echo $aso_pant['csub']; ?></td>
          <?php //$total=0; ?>
        <?php } ?>
        
	      <?php if(mb_stristr('FP15.DA16',$docu)){ ?>        
          <td align="right">
            <?php echo number_format($aso_pant['peso'],2); ?>
            </td>
          <td><?php echo $aso_pant['arcl']; ?></td>
        <?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> 
            <?php echo $enti2_descri; ?>
          </td>
          <td> 
            <?php echo  $lsub1d.' / '.$lsub2d; ?>
          </td>
          <td 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 } ?>
            
            <?php if(mb_stristr('susa',$tabla)){?>
               <?php $total=($aso_pant['msueldo']); ?>
					<td align="right" style="<?php if(($ttotal==0) or $xipuni==0){echo'display:;';}else{echo 'font-weight:bold;';} ?>">
						<?php echo number_format($total,$dval); ?>
					</td>
            <?php } ?>
            
            <?php $total=abs($aso_pant['total']); ?>
            <td align="right" style="<?php if(($ttotal==0) or $xipuni==0){echo'display:none;';}else{echo 'font-weight:bold;';} ?>">
               <?php echo number_format($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(mb_stristr('tgck.sawo.ztej',$cfg_empr) and mb_stristr('vtas',$tabla) and $xmvhcl!=''){?>
				  	<td align="center"><?php echo $aso_pant['vhcl']; ?></td>
          <?php } ?>

<?php
            $clor_codigo=$aso_pant['item_clor'];
            $clor_descri='';
            $clor_hexa='';
            if((int)$clor_codigo>0)
            {
              $sql_clor='select * from clor0 where clor_codigo="'.$clor_codigo.'"';
              $res_clor=msql_query($sql_clor,$link_vcrx);
              $clor_descri=msql_result($res_clor,0,'clor_descri');
              $clor_hexa=msql_result($res_clor,0,'clor_hexa');
            }
                                                        
?>        
        
          <?php if(mb_stristr('vtas.clie.carr.inve.prod',$tabla) ){?>
				  	<td align="center" style="font-size:80%; font-weight:bold; color:black; background:<?php echo $clor_hexa; ?>;<?php if($mclor==''){echo 'display:none;';} ?>"><?php echo substr($clor_descri,0,5); ?></td>
				  	<td align="center" style="<?php if($mtlla==''){echo 'display:none;';} ?>"><?php echo substr(r_fiel('tlla',$aso_pant['item_tlla']),0,5); ?></td>
          <?php } ?>
        
          <?php if($dispcolu!=0){?>
          <td 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'];};?>
            <?php
                              
        $detcantumdd='';                                                     
        if($uxpre*$facon!=0 and $uxpre*$facon!=1)
        {
          $detcantumdd.='<br>';
          $detcantumdd.=' ==> (';
          $detcantumdd.=number_format($uxpre,2);
          $detcantumdd.=' /';
          $detcantumdd.=number_format($facon,2);
          $detcantumdd.=') ';
          $detcantumdd.=number_format($cantumdd,2).' '.$aso_pant['item_umdd'];
          $detcantumdd.=' ($';
          $detcantumdd.=number_format($pcp1/$cantumdd,2);
          $detcantumdd.=') ';
        }  
        echo $detcantumdd                              
                              
            ?>
          </td>
          <?php } ?>
        
        

					 <?php if($empr_cont==1 and mb_stristr('comp.prov',$tabla) and $mobile!='true'){?>
        <?php  //  AQUI CAMBIAR CAIR ?>
            <?php if($tabla=='comp'){?>        
						<td>
							<?php echo $aso_pant['ctas']; ?>
						</td>
						<td>
							<?php echo $aso_pant['ctas_descri']; ?>
						</td>
            <?php } ?>
        
                <?php if(mb_stristr('DA16',$docu)){ ?>
                    <?php if(ceil($aso_pant['adva'])==floor($aso_pant['adva'])){$dpor=0;}else{$dpor=2;}?>
                    <td align="right" 
                        title="<?php echo number_format($aso_pant['adva'],2).''; ?>">
                      <?php echo number_format($aso_pant['adva'],$dpor).''; ?>
                    </td>

                    <?php if(ceil($aso_pant['fodi'])==floor($aso_pant['fodi'])){$dpor=0;}else{$dpor=2;}?>
                    <td align="right" 
                        title="<?php echo number_format($aso_pant['fodi'],2).''; ?>">
                      <?php echo number_format($aso_pant['fodi'],$dpor).''; ?>
                    </td>
                    <?php if(ceil($aso_pant['ivai'])==floor($aso_pant['ivai'])){$dpor=0;}else{$dpor=2;}?>
                    <td align="right" 
                        title="<?php echo number_format($aso_pant['ivai'],2).''; ?>">
                      <?php echo number_format($aso_pant['ivai'],$dpor).''; ?>
                      
                    </td>
               <?php } ?>
        
        
            <?php if(!mb_stristr('FP15.FP16.DA16',$docu)){ ?>
                <?php  if($user_modi==1 and 1==2){ ?>
                <?php $pidtxt='cair'; $ptabla='cair'; $pdefa=$aso_pant['cair'];   $psize=$xfontsize; $pobj=1; include('vrgetcod.php'); ?>
                <?php }else{ ?>
                <td align="center" title="<?php echo $aso_pant['cair_descri']; ?>">
                  <?php echo $aso_pant['cair']; ?>
                </td>
                <?php } ?>
                <?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 } ?>
        
        
					 <?php if(mb_stristr('inve.prod.tfin',$tabla) and $mobile!='true'){?>
						<td align="center" style="<?php if($mlote==''){echo 'display:none;';} ?>">
							<?php echo $aso_pant['lote']; ?>
						</td>
						<td align="" style="<?php if($mserie==''){echo 'display:none;';} ?>">
							<?php echo $aso_pant['numserie']; ?>
						</td>
						<?php } ?>
        
            <?php if(mb_stristr('IB11.EB11',$docu)){ ?>
            <?php $itemcambio=$aso_pant['cambio'].' - '.r_fiel('item',$aso_pant['cambio']); ?>
            <?php $itemcambio=split_words($itemcambio);?>
            <td><?php echo $itemcambio; ?></td>
            <?php } ?>
        
        
        
        
            <?php if(($user_anul==1 or $user_modi==1) and mb_stristr($pant,'PANT')){?>
						<td align="center" style="" >
              <?php
//                 echo '*'.$aso_pant['status'];
//                 echo '*'.$aso_pant['stfin'];
//                 echo '*'.$aso_pant['autornum'];
//                 echo '*'.$aso_pant['fecha'];
//                 echo '*'.$dias_anul;
              ?>
            <?php              
            // 101 karina brito plastivill
            
            $idate=$aso_pant['fecha'];
            $idate=$aso_pant['idate'];

//                echo '*/*/*'.$cfg_empr.$user_codigo;                                                            
//                echo '*/*/*'.$dias_anul;                                                            
//                echo '*/*/*'.$dias_anul;                                                            
                                                             
               if(
               (!mb_stristr('FROX',$aso_pant['status'])
               and $aso_pant['stfin']!=1
               and $aso_pant['autornum']=='' 
               and $tabla!='acce'
               and days_diff($idate,$fechaa)<=$dias_anul)
              or ($cfg_empr=='hfre' and $user_codigo==101)
              or ($cfg_empr=='hfre' and $user_codigo==130)
              )
                {
                  $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>
          <?php if($dispcolu!=0){?>
          <th><?php$ccol--;?></th>
          <?php } ?>
        <?php if(mb_stristr('nomi',$tabla)){ ?>
					<th><?php$ccol--;?></th>
					<th><?php$ccol--;?></th>
					<th><?php$ccol--;?>TOTALES</th>
					<th><?php$ccol--;?></th>
					<th><?php$ccol--;?></th>
					<th><?php$ccol--;?></th>
               <?php $tcant=0; ?>
				<?php } ?>
          
          <th><?php$ccol--;?> </th>
					 <?php if( $tabla=='acce'){?>
						<?php } ?>
				<?php if($docuitem==1 or $docuiimp==1){ ?>
<!-- 					<th><?php //$ccol--;  ?><?php //echo number_format($tcant,2); ?></th> -->
				<?php } ?>
               
				<?php if($docuitem==1 ){ ?>
					<th><?php$ccol--;?></th>
				<?php } ?>
               
				<?php if($docuiimp==1){ ?>
					<th><?php$ccol--;?>TOTALES</th>
					<th><?php$ccol--;?><?php echo number_format($tcant,2); ?></th>
					<th><?php$ccol--;?></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 } ?>
          
        <?php if(mb_stristr('FP15.DA16',$docu)){ ?>
					<th><?php$ccol--;?> <?php echo number_format($tpeso,2); ?></th>
					<th><?php$ccol--;?></th>
				<?php } ?>        

          <?php if($ttotal!=0 and $xipuni!=0){ ?>
          <th align="right" style=""><?php$ccol--;?><?php echo number_format($ttotal,2);?></th>
          <?php } ?>
          
          <?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('" ','"',$obstart); ?>
<?php //$obstart = str_replace(' "','"',$obstart); ?>
<?php //$obstart = str_replace('<div></div>','',$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(' "','"',$obstart); ?>
<?php $obstart = str_replace('onclick=""','',$obstart); ?>
<?php if(mb_stristr('IMPR1.IMPR3',$pant)){ ?>
  <?php //$obstart = str_replace('display:block','',$obstart); ?>
  <?php $obstart = str_replace('tfoot','tfoot1',$obstart); ?>
  <?php $obstart=remove_href($obstart); ?>
<?php } ?>

<?php echo $obstart;	?>

		