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

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

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

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

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

<?php if($docu==''){$docu='CAR1';} ?>

<?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
//   $paraiddet=$iddet;
//   ini_set('memory_limit', '512M');

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

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

$gris1='gainsboro';

$itemxlin=4;

if($mobile=='true' and $orient=='V')
{$itemxlin=1;}

$citem=0;

?>


<?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_modi=0;
$ver_abono=0;
$ver_saldo=0;
$ver_valor=1;
$ver_subtot=1;
// $ver_total=1;
$tsaldo=0;

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

// if($user_email=='ptama@hotmail.com'){$dias_anul=365;}
// if($user_email=='vicore@hotmail.com'){$dias_anul=365;}
// if($user_email=='m.eryluisa75@hotmail.com'){$dias_anul=365*2;}


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



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



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


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

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

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


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


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


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

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



$entilabel='ENTIDAD';
if($tabla=="")
{
	if($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=='IB'){$tabla='inve'; $entilabel='PROVEEDOR';}
	if($docu=='EB'){$tabla='inve'; $entilabel='CLIENTE';}
	if($docu=='DC'){$tabla='bcos'; $entilabel='CLIENTE';}
	if($docu=='PR'){$tabla='bcos'; $entilabel='CLIENTE';}
	if($docu=='CH'){$tabla='bcos'; $entilabel='PROVEEDOR';}
	if($docu=='IE'){$tabla='caja'; $entilabel='CLIENTE';}
	if($docu=='EE'){$tabla='caja'; $entilabel='PROVEEDOR';}
  
	if($docu=='AT'){$tabla='atvd';}
  
}

  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('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.roln.suel',$tabla)){$entilabel='EMPLEADO';}
if(@mb_stristr('RC.',substr($docu,0,2))){$entilabel='CLIENTE';}
if(@mb_stristr('RP.',substr($docu,0,2))){$entilabel='PROVEEDOR';}


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


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

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

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

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

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

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

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

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

if(@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.nomi.',$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(mb_stristr($pant,'IMPR'))
{$ver_modi=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_abono=0;
  $ver_saldo=0;
  
  $user_anul=0;
  $user_elim=0;
  
  $ver_modi=1;
}
  


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($docu=='RBCO'){$ver_apli=0;}

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





if($mobile=='true' and $orient=='V'){$ver_guia=0;}

if(substr($pant,0,4)=='IMPR')
{
  $user_anul=0;
  $user_elim=0;
  $user_clon=0;
  $ver_cele=0;
  $ver_rete=0;
  $ver_doco=0;
  $ver_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;
	$docuiimp=0;
// 				$docuinve=0;
	$docudocu=0;
	$docurete=0;
	$docuctas=0;
  
  $xipuni=1;

	if(@mb_stristr('vtas.comp.clie.prov.carr.inve.prod.guia',$tabla)){$docuitem=1;}
	if(@mb_stristr('vtas.comp.clie.prov.carr',$tabla)){$docuiimp=1;}
// 				if(mb_stristr('inve.prod.guia',$tabla)){$docuinve=1;}
// 	if(@mb_stristr('caja.bcos.retc.retp.rete',$tabla)){$docudocu=1;}
	if(@mb_stristr('caja.bcos.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;}
  
    if(@mb_stristr('inve.prod',$tabla))
    {
        $docuacce='COST';
        include('php_useracce.php');
        $user_cons=0;
        $xipuni=$user_cons;
        $tsubt=$user_cons;

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

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

?>



<?php ob_start(); ?>
<resultado>
<?php	//val_usercodigo(); ?>
  
  
<?php $tdisplay=''; ?>  
<?php if(substr($pant,0,4)=='PANT'){$tdisplay='display:block;';}?>  
  

<?php if(mb_stristr('PANT0',$pant)){ ?>
  
<?php //$ptabla='item'; 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:100%;">
      <div align="center" style="align:center; text-transform:uppercase; font-weight:bold; font-family:arial;
                  font-size:<?php echo $xfontsize*1.2; ?>;
                  <?php if($mobile=='false'){echo 'display:none;';} ?>
                  ">
      <titulo>Catálogo de Productos</titulo>
      </div>
      
   <?php { ?>
			<table id="tpant0" cellpadding="2" width="99%" border="0"
					 style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:snow;">
              <tr>
        <?php if($mobile=='true'){?>        
        </tr>
        <tr>
        <?php } ?>
          <?php $pidtxt='lsub'; $psize=$xfontsize; $ptabla='lsub'; $pcaption='LINEA'; $pdefa=$lsub; 
          $ptodos=1; 
//        if(mb_stristr('orel',$cfg_empr)){$ptodos=0;}
          include('vrselopt.php'); ?>
        <?php if($mobile=='true'){?>        
        </tr>
        <tr>
        <?php } ?>
          <?php $pidtxt='mrca'; $psize=$xfontsize; $ptabla='mrca'; $pcaption='MARCA'; $pdefa=$mrca; $ptodos=1; include('vrselopt.php'); ?>
        <?php if($mobile=='true'){?>        
        </tr>
        <tr>
        <?php } ?>
                <?php
                    $pidtxt='docu'; $pcaption='docu'; $ptabla='docu';  $psize=$xfontsize; $pdefa=$docu;  $pobj=3;  $pnotob=0; 
                   $pwhere='(docu_tabla="carr")';  
//                    $ponblur="vali_docu();";
                   $phide=1;$preado=1; 
                   if(@mb_stristr('sist.admi.supe',$user_tipo) and $user_tipo!=''){$phide=0;}
//                    if(@mb_stristr('sist.admi.supe',$user_tipo) and $user_tipo!=''){$preado=0;}
//                    $phide=0;$preado=0;
                   include('vrgetcod.php');
                ?>              
        <?php if($mobile=='true'){?>        
        </tr>
        <tr>
        <?php } ?>
          <?php $pidtxt='orde'; $psize=$xfontsize;  $pcaption='ORDEN'; $pdefa='DESCRIPCION'; $phide=0;
          $poptions='Descripcion;Menor Precio;Mayor Precio;Nuevos;'; include('vrselopt.php'); ?>
        </tr>
      </table>
			<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 } ?>
              </tr>
            <tr><?php  $pidtxt='item'; $ptabla='item'; $psize=$xfontsize; $pcaption='ITEM';  $pobj=1; $phide=1; include('vrgetcod.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 } ?>
            <?php $pidtxt='buscar'; $psize=$xfontsize; $pcaption='BUSCAR'; $plong='100%'; $pobj=1; $pvalue=$buscar; 
                $ptabla='item'; $pcolu='descri';
                $ponclick="{document.getElementById('buscaok').onclick();}";
                include('vrgettxt.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>

              
          <?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 } ?>

          </table>

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

            <table width="100%" cellpadding="2" border="0"
                style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:snow;">
              <tr>
                <td width="10%"></td>
              </tr>
              <tr>
              <?php if($mobile=='true'){?>        
              <td>
              <?php } ?>  
              <?php $pidtxt='detadocu'; $pcaption='Detalle'; $ponclick='info_docu("DETA");'; $psize=$xfontsize; $pdefa=0;   $pclass=''; $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; $pclass="tran caja bcos "; $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='buscaok'; $pcaption='Buscar '; 
                $ponclick ='location.href=\'?scri=ctlg_item2\'';
                $ponclick.='+\'&buscar=\'+document.getElementById("buscar").value';
                $ponclick.='+\'&lsub=\'+document.getElementById("lsub").value';
                $ponclick.='+\'&mrca=\'+document.getElementById("mrca").value';
                $ponclick.='+\'&item=\'+document.getElementById("item").value';
                $ponclick.=';';
//                 $phref="?scri=ctlg_item2"; 
       
       $psize=$xfontsize; include('vrbutton.php'); ?>
            </td>  
            <?php if($mobile!='true'){?>        
            </tr>
            <tr>
            <?php } ?>              
            <td>
            <?php //if($user_tipo!='sist'){$phide=1;}; ?>
            <?php //if(mb_stristr($user_email,'jorue')){$phide=0;}; ?>
            <?php //if(mb_stristr($user_mail,'jorue')){$phide=0;}; ?>
            <?php //$pidtxt='acep3'; $pcaption='Acepta3 '; $ponclick='info_docu("PANT3",'.'document.getElementById("docu").value'.')'; $psize=$xfontsize; include('vrbutton.php'); ?>
            </td>  
            <?php if($mobile!='true'){?>        
            </tr>
            <tr>
            <?php } ?>              
            <td>
					<?php //$pidtxt='imprim'; $pcaption='Imprimir '; $ponclick='info_docu("IMPR1",'.'document.getElementById("docu").value'.')'; $psize=$xfontsize; include('vrbutton.php'); ?>
            </td>  
            <?php if($mobile!='true'){?>        
            </tr>
            <tr>
            <?php } ?>              
            <td>

          <?php 
       if(@mb_stristr('sist',$user_tipo) or $cfg_empr=='tfle'){ ?>            
                  <?php 
//                   $pidtxt='nueva'; $pcaption='Nuevo ';
//                   $ponclick='';
//                   $ponclick.="crea_docu(document.getElementById('docu').value);"; 
//                   $ponclick.="info_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;">
    <?php
                                 
      $sql_updt=' update item0 set item_mdlo=item_raiz where item_mdlo="" or item_mdlo is null';
      $res_updt=mysql_query($sql_updt,$link_vcrx);                                 
                                 
      $sql_ctlg ='select * from item00';
      $sql_ctlg.=' where item_status!="I" ';
      if($buscar!='')
      {
        $buscar=alltrim($buscar);
        $buscararray=split(' ',$buscar);
        for($cbus=0; $cbus<count($buscararray); $cbus++)
        {$sql_ctlg.=' and (item_descri like "%'.$buscararray[$cbus].'%" or item_codigo like "%'.$buscararray[$cbus].'%" or item_codigov like "%'.$buscararray[$cbus].'%") ';}
//         {$sql_ctlg.=' and item_descri like "%'.$buscararray[$cbus].'%"';}
      }
      if($lsub!='')
      {$sql_ctlg.=' and (item_lsub like "'.$lsub.'%")';}
      if($mrca!='')
      {$sql_ctlg.=' and (item_mrca = "'.$mrca.'")';}
      if($item!='')
      {$sql_ctlg.=' and (item_codigo = "'.$item.'%")';}
      if($mdlo!='')
      {$sql_ctlg.=' and (item_mdlo = "'.$mdlo.'%")';}

      if(mb_stristr('gnya.gmny',$cfg_empr))
      {
        $sql_ctlg.=' and item_puni>0 ';
        $sql_ctlg.=' and item_descri!="" ';
      }
                                 
      if(mb_stristr('gnya.gmny',$cfg_empr))
      {$sql_ctlg.=' group by item_mdlo ';}
                                 
      $sql_ctlg.=' order by ';
                                 
      if(mb_stristr('gnya.gmny',$cfg_empr)) {$sql_ctlg.=' item_mdlo,';}
                                 
      $sql_ctlg.=' item_descri,item_codigo ';
                                 
      $sql_ctlg.=' limit 100 ';
//       if($orde=='')
                                 
      $res_ctlg=mysql_query($sql_ctlg,$link_vcrx);
//        explain_sql($sql_ctlg);
//        echo $sql_ctlg;
                                 
                                 
    ?>  

    <table id="tpant0" cellpadding="2" width="99%" border="0"
       style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:snow;">
      
    <tr>
    
    <?php while($aso_ctlg=mysql_fetch_assoc($res_ctlg)){ ?>
      <?php $item_descri=$aso_ctlg['item_descri']; ?>
      <?php $item_codigo=$aso_ctlg['item_codigo']; ?>
      <?php $item_codigov=$aso_ctlg['item_codigov']; ?>
      <?php $item_raiz=$aso_ctlg['item_raiz']; ?>
      <?php $item_mdlo=$aso_ctlg['item_mdlo']; ?>
      <?php $marca_descri=$aso_ctlg['mrca_descri']; ?>
      
      <?php $xcodigov=$item_codigov; ?>
      <?php if(mb_stristr('gnya.gmny',$cfg_empr)){$xcodigov=$item_raiz;} ?>
      
      <?php if($citem%$itemxlin==0){echo '</tr><tr>';}?>
      <?php $citem++; ?>
            
      <td valign="top" width="<?php echo 100/$itemxlin; ?>%">
        
          <hr size="3" noshade  >
          <table id="tb<?php echo $item_codigo;?>" align="center" cellpadding="2" border="0" style="font-size:<?php echo $xfontsize; ?>px; border-collapse:collapse; " >
            <tr width="100%">
              <td align="center" valign="top">
                <div style="font-weight:bold;">
                <?php echo 'CODIGO : '.$xcodigov; ?>
                </div>
                <?php $pidtxt=$item_raiz; $ptabla='imgi'; $pcodigo=$item_raiz; include('vrsayimgs.php');?>
<!--               </td> -->
              
              <?php if($orient=='V'){ ?>
<!--               </tr> -->
<!--               <tr> -->
              <?php } ?>

<!--               <td align="center" valign="top" style="min-width:30%"> -->
                <div style="font-weight:;font-size:<?php echo $xfontsize; ?>;">
                <?php echo $item_descri; ?>
                </div>
                <div style="font-weight:bold;font-style:italic;">
                <?php echo $marca_descri; ?>
                </div>
              </td>
            </tr>
          </table>
          <hr size="2" noshade  >

      </td>
      
      
    <?php } ?>
    
    </tr>
      
    </table> 
      
		<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 
  $sql_stat ='update '.$tabla.'1 set status="-" ';
  $sql_stat.=' where (status="" or status is null) ';
  $sql_stat.=' and (fecha between "'.$fecha1.'" and "'.$fecha2.'")';
//   mysql_query($sql_stat,$link_vcrx); 
?>

	<?php
    { 

    if(@mb_stristr('acce',$tabla))
    {
      gen_axu1();
      $fecha1='2000-01-01';
      $fecha2='2100-01-01';
    }      
  
		$sql_pant ='select * from '.$tabla.'12 ';
		$sql_pant.=' where (fecha between "'.$fecha1.'" and "'.$fecha2.'")';
		$sql_pant.=' and (numero between "'.$numero1.'" and "'.$numero2.'")';

    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) ';
      $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);}
      
      
		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=='FCXX')
    {$sql_pant=str_replace('"'.$docu,'"FC',$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($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).'%")';}
      
		if(substr($docu,0,2)=='AT')
    {$sql_pant.=' and(enti like "'.$xuser_cedula.'%" )';}
    else
    {
      if($enti!=""){$sql_pant.=' and(enti like "'.$enti.'%" or enti_descri like "%'.$enti.'%")';}
//       if($fecha!=""){$sql_pant.=' and(fecha like "'.$fecha.'%")';}
    }
      
      
// 		if($concepto!=""){$sql_pant.=' and(concepto like "%'.$concepto.'%")';}
		if($concepto!=""){$sql_pant.=' and(concepto like "%'.$concepto.'%" or detalle like "%'.$concepto.'%")';}
		if($stat!=""){$sql_pant.=' and(status="'.$stat.'")';}
		if($ptov!="" and mb_stristr('vtas.clie',$tabla)){$sql_pant.=' and(ptov="'.$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($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)){$sql_pant.=' and(ctas like "'.$ctas.'%")';}
		if($item!="" and mb_stristr('vtas.comp.clie.prov',$tabla)){$sql_pant.=' and(item like "'.$item.'%")';}
		if($impor!="" and mb_stristr('comp',$tabla)){$sql_pant.=' and(impor="'.$impor.'")';}
		if($ctab!="" and mb_stristr('bcos',$tabla)){$sql_pant.=' and(ctab="'.$ctab.'")';}
		if($lsub!="" and mb_stristr('vtas.inve',$tabla)){$sql_pant.=' and(lsub="'.$lsub.'")';}
		if($zsub!="" and mb_stristr('vtas.',$tabla)){$sql_pant.=' and(zsub="'.$zsub.'")';}
		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.'%")';}
      
      
		$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 ';}
		
		if(@mb_stristr('nomi.',$tabla))
		{$groupby=' group by idnum1,iddet ';}

		if(mb_stristr('PANT3.IMPR3',$pant))
		{$groupby.=',iddet ';}
      
		$sql_pant.=$groupby;
            
    if(mb_stristr('PANT',substr($pant,0,4)))
    {$sql_pant.=' order by fecha desc,docu,ptoe,numero desc,idnum1 desc,iddet desc';}
    else
    {$sql_pant.=' order by fecha,docu,ptoe,numero,idnum1,iddet';}
      
    if($limit1>0)  
    {$sql_pant.=' limit '.$limit1;}
     
    if($user_cons==0)
    {$sql_pant='';$sql_tpant='';}

      
    $res_pant=mysql_query($sql_pant,$link_vcrx);
		$res_tpant=mysql_query($sql_tpant,$link_vcrx);
      
    if(mb_stristr('RPRO.RCLI',$docu))
    {
      $sql_tpantr=$sql_tpant.' group by cair,puni order by ccair,puni ';
  		$res_tpantr=mysql_query($sql_tpantr,$link_vcrx);
    }
      
//      echo explain_sql($sql_tpant);
//      echo explain_sql($sql_pant);

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

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

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

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

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

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

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

    if($docux=='FCXX')
    {
      $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 {
/*     body {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 {
  @page { margin: 0; }
  body { margin: 2cm; }
}  
   */
  /* 	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>  
      <?php } ?>
      <?php if(mb_stristr('caja',$tabla)){ ?>
      <tr>
        <td style="font-weight:bold;">CAJA</td>
        <td><?php if($caja==''){echo 'TODOS';}else{echo r_fiel('caja',$caja);}; ?></td>
      </tr>  
      <?php } ?>
      <?php if(mb_stristr('bcos',$tabla)){ ?>
      <tr>
        <td style="font-weight:bold;">CTA.BANC.</td>
        <td><?php if($ctab==''){echo 'TODOS';}else{echo r_fiel('ctab',$ctab);}; ?></td>
      </tr>  
      <?php } ?>
      <?php if(mb_stristr('inve.prod',$tabla)){ ?>
      <tr>
        <td style="font-weight:bold;">BODEGA</td>
        <td><?php if($bode==''){echo 'TODOS';}else{echo r_fiel('bode',$bode);}; ?></td>
      </tr>  
      <?php } ?>
      <tr>
        <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('vtas.comp.clie.prov',$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($cair!=''){ ?>
      <tr>
        <td style="font-weight:bold;">CAIR</td>
        <td><?php echo $cair.' - '.r_fiel('cair0',$cair); ?></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($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=mysql_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>
            <td><?php echo number_format(abs($aso_pantr['scant']),2); ?></td>
            <td><?php echo number_format(abs($aso_pantr['stotal']),2); ?></td>
          </tr>
        <?php } ?>
            </table>
          </td>
        </tr>
      
        </table>
      <?php } ?>
              
  </td>
  
</tr>  
  
<tr>
  <td></td>
  <td>
      
    
  </td>
</tr>  

</table>

<hr>
<?php } ?>  
<?php 
//   echo '*/*/*'.explain_sql($sql_pant);	
  ?>
<?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++; ?>);"><?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('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',$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('guia',$tabla)){?>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>);">PLACA</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 and !mb_stristr('retp.retc.rete',$tabla))){echo'display:none;';}?><?php echo 'font-size:'.($xfontsize*0.8).';' ?>">
            <?php if(@mb_stristr('retp.retc.rete',$tabla)){echo 'CAIR';}else{echo 'SUB-TOT';} ?>
          </th>	
				  <?php } ?>

          <?php if($docuitem==1 and mb_stristr('PANT3.IMPR3',$pant)){ ?>
            <?php $lblcant='Cant.'; ?>
            <?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 } ?>
            <th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" title="Cantidad"><?php echo $lblcant;?></th>
            <?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>
            <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Prec.Unitario">P.Uni</th>
				  <?php } ?>
          
          
					<?php if($docuiimp==1){?>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" style="<?php if($tdcto==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){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){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){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){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){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){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){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 } ?>
          
          
          
          <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Status">ST</th>
          <?php if($user_anul==1 or $user_elim==1){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);"
							title="
							<?php if($user_anul==1 or 1==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){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Modif.">Modif.</th>
          <?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($cfg_empr=='tgck' 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++; ?>);">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){ ?>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">Saldo</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($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'){ ?>
  					<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="Doc.Origen">Orig.</th>
					<?php }?>

          <?php if($ver_cont==1){ ?>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" 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 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(@mysql_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=@mysql_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
          $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'];
                  if($tabla=='cont' and substr($idocu,0,2)!='DD')
                  {$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 : '.$aso_pant['docu'].'-'.$aso_pant['numero'];
                $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');}
          ?>
					</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
              if($docu!='PLA1')
              {
                  if(!mb_stristr('FROX',$status)
                     and ($user_anul==1 or $user_modi==1)
                     and $aso_pant['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='.$aso_pant['docu'].'&idnum='.$aso_pant['idnum1'].'","_blank")}';
                $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',$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',$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='.$aso_pant['docu'].'&idnum='.$aso_pant['idnum1'].'" target="_blank">';
               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>';
            ?>
					</td>
					<td align="center">
						<div style="display:none;"><?php echo $aso_pant['fecha']; ?></div>
						<div class="noxls"><?php echo $aso_pant['fechadmy']; ?></div>
					</td>
          <?php if($dispcolu!=0){?>
					<td align="center" 
							title="<?php if($tipoid=='R'){ echo 'RUC:'.$tiporuc.'-'.$struc;}else{echo 'ID:'.$tipoid;};?>">
						<?php echo substr($aso_pant['enti'],0,10); ?>
					</td>
          <?php } ?>

					<?php $enti_maxlen=400;?>
					<?php $enti_descri=$aso_pant['enti_descri'];?>
          <?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(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="center"> 
							<?php echo number_format($aso_pant['stcant'],2); ?>
						</td>
          <?php if($dispcolu!=0){?>
						<td align="center" style="<?php if($tsubt==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(($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){echo 'display:none;';}?>">
						  <?php echo number_format(abs($aso_pant['stsubt']),2); ?>
					    </td>	
            <?php }?>
					<?php } ?>

          
				<?php if($docuitem==1 and mb_stristr('PANT3.IMPR3',$pant)){ ?>
					<?php $item_codigo=trim($aso_pant['item']);?>
					<?php $item_descri=trim($aso_pant['item_descri']);?>
					<?php $item_descri=str_replace(substr($item_codigo,0,-1),'',$item_descri);?>
          
					<?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 if($tabla=='inve'){?>
            <?php if(substr($aso_pant['docu'],0,1)=='I'){$ingr=$cant;$egre=0;}else{$ingr=0;$egre=$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 } ?>
          
					<td align="center"><?php echo $cant; ?></td>
          <?php if($dispcolu!=0){?>
					<td title="<?php echo $aso_pant['itemce']; ?>">
						<?php echo $aso_pant['item']; ?>
					</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">
						<?php echo number_format(abs($item_puni),$dpre); ?>
            <?php if($mobile=='true' and $aso_pant['iva']!=0){echo 'I';} ?>
					</td>
				<?php } ?>
          
          
					<?php if($docuiimp){ ?>
						<td align="right" style="<?php if($tdcto==0){echo'display:none;';}else{echo'text-decoration:underline;';}?> font-style:italic;">
							<?php echo number_format(abs($aso_pant['stdcto']),2); ?>
						</td>	
						<td align="right" style="<?php if($tssid==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){echo'display:none;';}?> font-style:italic;">
							<?php echo number_format(abs($aso_pant['stice']),2); ?>
						</td>	
						<td align="right" style="<?php if($tsubtiva0==0){echo'display:none;';}?>">
							<?php echo number_format(abs($aso_pant['stsubtiva0']),2); ?>
						</td>	
						<td align="right" style="<?php if($tsubtiva==0){echo'display:none;';}?>">
							<?php echo number_format(abs($aso_pant['stsubtiva']),2); ?>
						</td>	
						<td align="right" style="<?php if($tprop==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){echo'display:none;';}?> font-style:italic;">
							<?php echo number_format(abs($aso_pant['stiva']),2); ?>
						</td>	
						<td align="right" style="<?php if($tirbp==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 } ?>	
          
					<td align="right" style="font-weight:bold; <?php if($total==0){ echo 'display:none;';}?><?php if($sdifer!=0){ echo 'color:red;';}?>"> 
						<?php echo number_format(abs($stotal),2); ?>
					</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['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';}; ?></th>
  					<td align="center" title="<?php echo trim($aso_pant['suco_descri']); ?>"><?php echo $aso_pant['suco']; ?></th>
  					<td align="center" title="<?php echo trim($aso_pant['fpag_descri']); ?>"><?php echo $aso_pant['fpag']; ?></th>
  					<td align="center" title="<?php echo trim($aso_pant['cair_descri']); ?>"><?php echo $aso_pant['cair']; ?></th>
					<?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($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=mysql_query($sql_depo,$link_vcrx);
                  $docudepo=mysql_result($res_depo,0,'docu');
                  $idnumdepo=mysql_result($res_depo,0,'idnum1');
                  
                }
              ?>

  					<td align="center" title=""><?php echo date('d/M/y', strtotime($fechadepo)); ?></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($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_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($ver_modi==1){ ?>
          <td align="center">
					<?php
// 						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='Modif: '.$aso_pant['docu'].'-'.$aso_pant['numero'];
//               if($iddet!=0){$pcaption.=' /'.$iddet;}
              $pabrev='M';
							$pidtxt='m_'.$crow.'_'.$iddet; $pname='itr_fila'; $psize=$xfontsize;
							$pidnum=$aso_pant['idnum1'];$pdocu=$aso_pant['docu'];
							$ponclick="modi_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(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($cfg_empr=='tgck' 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.=' 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=mysql_query($sql_rete,$link_vcrx);
              if(@mysql_num_rows($res_rete)!=0)
              {
                $rete_idnum=@mysql_result($res_rete,0,'idnum1');
                $rete_docu=@mysql_result($res_rete,0,'docu');
                $rete_nume=@mysql_result($res_rete,0,'numero');
                $rete_cair=@mysql_result($res_rete,0,'max_cair');
//                 $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">';
//                   echo '<div class="hidden">'; echo fillzero(number_format(@mysql_result($res_rete,0,'por_rta'),2),6).'</div>'; 
                  echo number_format(@mysql_result($res_rete,0,'por_rta'),2).'%'.'</td>';
                  echo '<td align="center">';
//                   echo '<div class="hidden">'; echo fillzero(number_format(@mysql_result($res_rete,0,'por_iva'),2),6).'</div>'; 
                  echo number_format(@mysql_result($res_rete,0,'por_iva'),0).'%'.'</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)
                 {
                      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>';
                 echo '<td></td>';
                
                 echo '<td align="center">';
//                  echo '<div class="hidden">'; echo fillzero(number_format($aso_pant['prrta'],2),6).'</div>'; 
                 echo number_format($aso_pant['prrta'],0).'%</td>'; 
                 echo '<td align="center">';
//                  echo '<div class="hidden">'; echo fillzero(number_format($aso_pant['priva'],2),6).'</div>'; 
                 echo number_format($aso_pant['priva'],0).'%</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)))               
                {
                  $saldo=sal_docu($sdocu,$aso_pant['idnum1']);
                  $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="http://'.$cfg_empr.'.vcrxol.com/lib/'.$script.'?docu='.$aso_pant['docu'].'&idnum='.$aso_pant['idnum1'].'" target="_blank">';}
              echo number_format($saldo,2);
              if(abs($saldo)>1/100)
              {echo '</a>';}
            ?>
          </td>
					<?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=mysql_query($sql_guia,$link_vcrx);
              
              if(@mysql_num_rows($res_guia)!=0)
              {
                $guia_idnum=@mysql_result($res_guia,0,'idnum1');
                $guia_docu=@mysql_result($res_guia,0,'docu');
                $guia_ptoe=@mysql_result($res_guia,0,'ptoe');
                $guia_nume=@mysql_result($res_guia,0,'numero');
                $guia_fecha=@mysql_result($res_guia,0,'fecha');
                $guia_clave=@mysql_result($res_guia,0,'claveacc');
                $guia_autor=@mysql_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='.$apli_docu.'&idnum1='.$apli_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($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=mysql_query($sql_apli,$link_vcrx);
//               echo 	'***'.explain_sql($sql_apli);
              
              if(@mysql_num_rows($res_apli)!=0)
              {
                $apli_enti=$aso_pant['enti'];
                $apli_docu=@mysql_result($res_apli,0,'docum');
                $apli_ptoe=@mysql_result($res_apli,0,'ptoem');
                $apli_nume=@mysql_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= mysql_query($sql_from,$link_vcrx);
                $idfrom=@mysql_result($res_from,0,'idnum1');
                if($idfrom!='')
                {
                  echo '<td 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);
                  if($idfrom!='')
                  {echo '</a>';}
                  echo '</td>';
                }
                else
                {
                  $xaplica='';
                  if($apli_nume*1>0)
                  {$xaplica.=$apli_docu.'-'.$apli_ptoe.'-'.$apli_nume;}
                  $xaplica.=' /'.$aso_pant['ctas'].' - '.$aso_pant['ctas_descri'];

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

    
          <?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=mysql_query($sql_apli,$link_vcrx);
              if(@mysql_num_rows($res_apli)!=0)
              {
                $apli_idnum=@mysql_result($res_apli,0,'idnum1');
                $apli_docu=@mysql_result($res_apli,0,'docu');
                $apli_ptoe=@mysql_result($res_apli,0,'ptoe');
                $apli_nume=@mysql_result($res_apli,0,'numero');
                $apli_fecha=@mysql_result($res_apli,0,'fecha');
                $apli_clave=@mysql_result($res_apli,0,'claveacc');
                $apli_autor=@mysql_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 and $tabla=='inve'){ ?>
              <td>
              <?php echo $aso_pant['bode2']; ?>
              </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'].'"';
//               $sql_doco.=' and mdfrom ="'.$tabla.'"';
//               $sql_doco.=' order by fecha desc';
              $res_doco=mysql_query($sql_doco,$link_vcrx);
              if(@mysql_num_rows($res_doco)!=0)
              {
                $doco_idnum=@mysql_result($res_doco,0,'idnum1');
                $doco_docu=@mysql_result($res_doco,0,'docu');
                $doco_ptoe=@mysql_result($res_doco,0,'ptoe');
                $doco_nume=@mysql_result($res_doco,0,'numero');
                $doco_clave=@mysql_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
              { 
                  echo '<td align="center" style="font-size:'.$xfontsize*(0.8).'px;">';
                  echo 'NO-DOC.';
                  echo '</td>';
               } 
              
              
            }
          ?>
  
          <?php 
            if($ver_cont==1)
            { 
//               echo '*/*/*';
//               $tablao=$aso_pant['mdfrom'];
              $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=mysql_query($sql_doco,$link_vcrx);
//               if(@mysql_num_rows($res_doco)!=0)
              {
                $doco_idnum='0'.@mysql_result($res_doco,0,'idnum1');
                $doco_idfrom=@mysql_result($res_doco,0,'idfrom');
                $doco_docu=@mysql_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>';}
                  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($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(mb_stristr('1235',substr($stcele,1,1)) and substr($pant,0,4)=='PANT'){echo '</a>';}
                echo '</div>';
              }
                                              
            ?>                                                   
					</td>
					<?php } ?>


  
          <?php if($empr_impo==1 and $mimpor!=''){ ?>
          <td align="center">
            <?php echo $aso_pant['impor'];?>
          </td>
          <?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 or @mb_stristr('retp.retc.rete',$tabla)) and mb_stristr('PANT1.IMPR1',$pant)){ ?>
					<th <?php $ccol--; ?>align="right" style="<?php if($tsubt==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)){ ?>
            <?php if($tabla=='inve'){?>
              <th<?php $ccol--; ?>></th>
              <th<?php $ccol--; ?>></th>
              <?php $tcant=$tcant*0; ?>
              <?php $tcant=''; ?>
            <?php } ?>
            <th<?php $ccol--; ?>><?php echo $tcant; ?></th>
            <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){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){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){echo'display:none;';}?> font-style:italic;">
							<?php echo number_format(abs($tice),2); ?>
						</th>	
						<th <?php $ccol--; ?>align="right" style="<?php if($tsubtiva0==0){echo'display:none;';}?>">
							<?php echo number_format(abs($tsubtiva0),2); ?>
						</th>
						<th <?php $ccol--; ?>align="right" style="<?php if($tsubtiva==0){echo'display:none;';}?>">
							<?php echo number_format(abs($tsubtiva),2); ?>
						</th>	
						<th <?php $ccol--; ?>align="right" style="<?php if($tprop==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){echo'display:none;';}?> font-style:italic;">
							<?php echo number_format(abs($tiva),2); ?>
						</th>	
						<th <?php $ccol--; ?>align="right" style="<?php if($tirbp==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--; ?>></th>
            <th<?php $ccol--; ?>></th>
            <th<?php $ccol--; ?>></th>
            <th<?php $ccol--; ?>><?php echo $tcant;?></th>
            <?php $ccol--; ?>
          <?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>
          <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--; ?> 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 or @mb_stristr('retp.retc.rete',$tabla)) and mb_stristr('PANT1.IMPR1',$pant)){ ?>
          
					<th align="right" style="<?php if($tsubt==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)){ ?>
            <?php if($tabla=='inve'){?>
              <th></th>
              <th></th>
              <?php $tcant=0; ?>
            <?php } ?>
          <th></th>
          <th></th>
          <th></th>
          <th></th>
					<?php } ?>
					<?php if($docuiimp==1){ ?>
						<th align="right" style="<?php if($tdcto==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){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){echo'display:none;';}?> font-style:italic;">
							<?php echo number_format(abs($tice/$tnumero),2); ?>
						</th>
						<th align="right" style="<?php if($tsubtiva0==0){echo'display:none;';}?>">
							<?php echo number_format(abs($tsubtiva0/$tnumero),2); ?>
						</th>
						<th align="right" style="<?php if($tsubtiva==0){echo'display:none;';}?>">
							<?php echo number_format(abs($tsubtiva/$tnumero),2); ?>
						</th>
						<th align="right" style="<?php if($tprop==0){echo'display:none;';}?> font-style:italic;">
							<?php echo number_format(abs($tprop/$tnumero),2); ?>
						</th>
						<th align="right" style="<?php if($tiva==0){echo'display:none;';}?> font-style:italic;">
							<?php echo number_format(abs($tiva/$tnumero),2); ?>
						</th>
						<th align="right" style="<?php if($tirbp==0){echo'display:none;';}?> font-style:italic;">
							<?php echo number_format(abs($tirbp/$tnumero),2); ?>
						</th>
					<?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 } ?>
          
          
					<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 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=$iddet*1;
  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=mysql_query($sql_pant,$link_vcrx); 
  {
    $res_tpant=mysql_query($sql_tpant,$link_vcrx); 
    $tsubt=mysql_result($res_tpant,0,'stsubt');
    $tcant=mysql_result($res_tpant,0,'stcant');
    $mdetalle=mysql_result($res_tpant,0,'mdetalle');
    $total=mysql_result($res_tpant,0,'stotal');
    $tpeso=@mysql_result($res_tpant,0,'speso');
    $tcostoe=@mysql_result($res_tpant,0,'costoe1');
    $tseguro=@mysql_result($res_tpant,0,'seguro1');
    $tflete=@mysql_result($res_tpant,0,'flete1');
    
    $tcif=0;
    if($tseguro!=0 or $tflete!=0)
    {$tcif=$total+$tseguro+$tflete;}
    
//     if($tseguro!=0){$total=0;}

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

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

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

    
    if(mb_stristr('atvd.plan',$tabla))
    {
      $tsubt=0;
      $total=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 : '.@mysql_result($res_tpant,0,'idnum1'); ?>
          <br>
					<?php echo @mysql_result($res_tpant,0,'docu_descri'); ?>
          <br>
					<?php echo 'NUM: '.@mysql_result($res_tpant,0,'ptonumero'); ?>
				</td>
				<td>
					<div style="font-weight:bold;">
					<?php echo ''.substr(@mysql_result($res_tpant,0,'enti_descri'),0,200); ?>
					</div>
					<div style="font-size:<?php if($mobile=='true' and strlen(@mysql_result($res_tpant,0,'concepto')>100)){echo $xfontsize-16;}?>px" ;>
					<?php echo substr(@mysql_result($res_tpant,0,'concepto'),0,200); ?>
					</div>
				</td>
        
				<?php //if(@mb_stristr('vtas.retp.guia',$tabla) or @mb_stristr('FP03.FP11',$docu)){ ?>
				<?php if(@mb_stristr('vtas.retp.guia',$tabla)){ ?>
				<td style="font-weight:bold; font-size:80%" width="">
					<?php
            $claveacce=@mysql_result($res_tpant,0,'claveacc');
            $xambi=substr($claveacce,23,1);  
            $xambides='CLAVE : ';
            if($xambi==1){$xambides='PRUEBAS : ';}
            if($xambi==2){$xambides='PRODUCCION : ';}
//             if($claveacce!='')
            {echo $xambides.$claveacce;}
          ?>
				</td>
        <?php } ?>
        
				<?php if(@mb_stristr('vtas.comp',$tabla) and substr($docu,0,1)=='F'){ ?>
        <?php $xsaldo = sal_docu($docu,$idnum1); ?>
        <?php $xreten = sal_docu($docu,$idnum1,3); ?>
        <?php $xabono = $total-$xsaldo-$xreten; ?>
        
				<?php if($tabla=='comp' and $empr_cont==1){ ?>
				<td style="font-size:<?php echo $xfontsize*.80;?>px;">
            <table width="100%" cellpadding="2" border="0"
               style="font-size:<?php if($mobile=='true'){echo $xfontsize-8;}else{echo $xfontsize*.80;} ?>px; 
                      border-collapse:collapse; background-color:<?php echo $gris1; ?>;">
              <tr>
                <td align="right" style="font-weight:bold;">F.PAGO:</td>
                <td><?php echo @mysql_result($res_tpant,0,'fpag_descri'); ?></td>
              </tr>
              <tr>
                <td align="right" style="font-weight:bold;">S.COMP.:</td>
                <td><?php echo @mysql_result($res_tpant,0,'suco_descri'); ?></td>
              </tr>
              <tr>
                <td align="right" style="font-weight:bold;">No.Aut.:</td>
                <td><?php echo @mysql_result($res_tpant,0,'atrz').@mysql_result($res_tpant,0,'autornum'); ?></td>
              </tr>
            </table>
				</td>
          <?php if($xreten==0){ ?>
          <td align="right" width="1%">
            <table width="100%" cellpadding="2" border="0"
               style="font-size:<?php if($mobile=='true'){echo $xfontsize-8;}else{echo $xfontsize*.80;} ?>px; 
                      border-collapse:collapse; background-color:<?php echo $gris1; ?>;">
              <tr>
                <td align="right" style="font-weight:bold;">Ret.RTA.:</td>
                <td align="right"><?php echo number_format(@mysql_result($res_tpant,0,'prrta'),2); ?></td>
              </tr>
              <tr>
                <td align="right" style="font-weight:bold;">Ret.IVA.:</td>
                <td align="right"><?php echo number_format(@mysql_result($res_tpant,0,'priva'),2); ?></td>
              </tr>
            </table>
          </td>
          <?php } ?>
				<?php } ?>
				<td align="right" width="1%">
      		<table width="100%" cellpadding="2" border="0"
						 style="font-size:<?php if($mobile=='true'){echo $xfontsize-8;}else{echo $xfontsize*.80;} ?>px; 
										border-collapse:collapse; background-color:<?php echo $gris1; ?>;">
            <tr>
              <td align="right" style="font-weight:bold;">RETEN:</td>
              <td align="right"><?php echo number_format($xreten,2); ?></td>
            </tr>
            <tr>
              <td align="right" style="font-weight:bold;">ABONO:</td>
              <td align="right"><?php echo number_format($xabono,2); ?></td>
            </tr>
            <tr>
              <td align="right" style="font-weight:bold;">SALDO:</td>
              <td align="right"><?php echo number_format($xsaldo,2); ?></td>
            </tr>
	         </table>
			</td>
				<?php } ?>
        
        
				<?php if(@mb_stristr('cont',$tabla)) { ?>
				<td 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=mysql_query($sql_pant2,$link_vcrx);
    if(mysql_num_rows($res_pant2)==0)
    {
      $sql_pant2=substr($sql_pant2,0,strpos($sql_pant2,'and iddet')).' '.substr($sql_pant2,strpos($sql_pant2,'order by'));
      $res_pant2=mysql_query($sql_pant2,$link_vcrx);
    }
    $campo=''; 
    $cfield=mysql_num_fields($res_pant2);
    for($indx=0; $indx<$cfield; $indx++)
    {
      $nfield=mysql_field_name($res_pant2,$indx);
      $tfield=mysql_field_type($res_pant2,$indx);
      $vfield=@mysql_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';}
      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($tsubt!=0){?>
    <tr>
      <td align="right">
        <input type="button" value="SUB-TOTAL" style="font-weight:bold;font-size:<?php echo $xfontsize;?>px;">
      </td>
      <td align="right" >
        <?php echo number_format(abs($tsubt),2);?>
      </td>
    </tr>
    <?php } ?>
    <?php if($tdcto!=0){?>
    <tr>
      <td align="right">
        <input type="button" value="DSCTO." style="font-weight:bold;font-size:<?php echo $xfontsize;?>px;">
      </td>
      <td align="right" >
        <?php echo number_format(abs($tdcto)*-1,2);?>
      </td>
    </tr>
    <?php } ?>
    <?php if($tssid!=0){?>
    <tr>
      <td align="right">
        <input type="button" value="SSID." style="font-weight:bold;font-size:<?php echo $xfontsize;?>px;">
      </td>
      <td align="right" >
        <?php echo number_format(abs($tssid)*-1,2);?>
      </td>
    </tr>
    <?php } ?>
    <?php if($tsubtiva0!=0){?>
    <tr>
      <td align="right">
        <input type="button" value="S-TOT.IVA 0%" style="font-weight:bold;font-size:<?php echo $xfontsize;?>px;">
      </td>
      <td align="right" >
        <?php echo number_format(abs($tsubtiva0),2);?>
      </td>
    </tr>
    <?php } ?>
    <?php if($tsubtiva!=0){?>
    <tr>
      <td align="right">
        <input type="button" value="S-TOT.IVA" style="font-weight:bold;font-size:<?php echo $xfontsize;?>px;">
      </td>
      <td align="right" >
        <?php echo number_format(abs($tsubtiva),2);?>
      </td>
    </tr>
    <?php } ?>
    <?php if($tprop!=0){?>
    <tr>
      <td align="right">
        <input type="button" value="PROP." style="font-weight:bold;font-size:<?php echo $xfontsize;?>px;">
      </td>
      <td align="right" >
        <?php echo number_format(abs($tprop),2);?>
      </td>
    </tr>
    <?php } ?>
    <?php if($tice!=0){?>
    <tr>
      <td align="right">
        <input type="button" value="ICE" style="font-weight:bold;font-style:italic;font-size:<?php echo $xfontsize;?>px;">
      </td>
      <td align="right" style="font-style:italic;">
        <?php echo number_format(abs($tice),2);?>
      </td>
    </tr>
    <?php } ?>
    <?php if($tiva!=0){?>
    <tr>
      <td align="right">
        <input type="button" value="IVA" style="font-weight:bold;font-style:italic;font-size:<?php echo $xfontsize;?>px;">
      </td>
      <td align="right" style="font-style:italic;">
        <?php echo number_format(abs($tiva),2);?>
      </td>
    </tr>
    <?php } ?>
    <?php if($tirbp!=0){?>
    <tr>
      <td align="right">
        <input type="button" value="IVA" style="font-weight:bold;font-style:italic;font-size:<?php echo $xfontsize;?>px;">
      </td>
      <td align="right" style="font-style:italic;">
        <?php echo number_format(abs($tirbp),2);?>
      </td>
    </tr>
    <?php } ?>
    <?php if($tdebito!=0){?>
    <tr>
      <td align="right">
        <input type="button" value="DEBITOS" style="font-weight:bold;font-size:<?php echo $xfontsize;?>px;">
      </td>
      <td align="right" style="">
        <?php echo number_format(abs($tdebito),2);?>
      </td>
    </tr>
    <?php } ?>
    <?php if($tcredito!=0){?>
    <tr>
      <td align="right">
        <input type="button" value="CREDITOS" style="font-weight:bold;font-style:italic;font-size:<?php echo $xfontsize;?>px;">
      </td>
      <td align="right" style="font-style:italic;">
        <?php echo number_format(abs($tcredito),2);?>
      </td>
    </tr>
    <?php } ?>
    <?php if($tdifer!=0){?>
    <tr>
      <td align="right">
        <input type="button" value="DIFERENCIA" style="font-weight:bold;font-size:<?php echo $xfontsize;?>px;">
      </td>
      <td align="right" style="color:red;">
        <?php echo number_format(($tdifer),2);?>
      </td>
    </tr>
    <?php } ?>
    
    <?php if($total!=0){?>
    <tr>
      <td align="right">
        <input type="button" value="TOTAL" style="font-weight:bold;font-size:<?php echo $xfontsize*1.5;?>px;">
      </td>
      <td align="right" style=" font-size:<?php echo $xfontsize*1.5;?>px;">
        <div style="min-width:<?php echo $xfontsize*3*2;?>px;;"></div>
        <?php echo ' '. number_format(abs($total),2);?>
      </td>
    </tr>
    <?php } ?>
    
    <?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>


    
<pant2>
<?php $crow=0; ?>
<?php $ccol=0; ?>
  
  
<?php
                                       
  $sql_pant='select * from '.$tabla.'12 where idnum2="'.$idnum1.'" ';
  $sql_pant.=' order by iddet';
                                  
	if(@mb_stristr('retc.retp.rete',$tabla))
  {
	 $sql_pant ='select * from '.$tabla.'12 where status!="O" and concat(fecha,numero,enti) in ';	
	 $sql_pant.='(select concat(fecha,numero,enti) as numero from '.$tabla.'1 where idnum1="'.$idnum1.'") order by numer,cair';
	}
                                  
	if(@mb_stristr('acce',$tabla))
  {
    $sql_pant ='select * from '.$tabla.'12 ';	
    $sql_pant.='where idnum2="'.$idnum1.'" ';	
    $sql_pant.=' and docum_tabla !="" ';	
    $sql_pant.=' and docum_tabla is not null ';	
    $sql_pant.=' and docum in(select docu_codigo from docu0 where docu_status not in("I","X","O"))';    
    if($cfg_empr=='tfle')
    {
  //       $sql_pant.=' and docum_tabla not in("vtas","comp","inve","clie","prov","carr","nomi","csub","caja","bcos")';
        $sql_pant.=' and docum_tabla in("acce","plan","atvd","enti","xitem","asub")';
    }
    $sql_pant.='order by docum_tabla, docum';	
  } 
// 	if(mb_stristr('acce',$tabla)){$sql_pant.=' and docum in(select docu_codigo from docu0 where docu_status not in("I","X","O"))';}
	
//  	echo explain_sql($sql_pant);
	$res_pant=mysql_query($sql_pant,$link_vcrx);	
?>
<?php $numrows=@mysql_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($docuitem==1){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" title="Cantidad">Cant</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Código">Código</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Descripción">Descripción</th>
          <?php if($tabla!='guia'){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'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($cfg_empr=='tgck' and @mb_stristr('vtas',$tabla) and $xmvhcl!=''){?>
				   <th onclick="sortTable(this,<?php echo $ccol++; ?>);">VHCL</th>
         <?php } ?>
        
          <?php if($dispcolu!=0){?>
				<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="letter-spacing:5px;<?php if($mdetalle=='' ){echo'display:none;';}?>">DETALLE</th>
          <?php } ?>

       
        <?php if($empr_cont==1 and 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',$tabla) and $mobile!='true'){?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" >LOTE</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" ># SERIE</th>
				<?php } ?>
        <?php if(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=@mysql_fetch_assoc($res_pant)){ ?>
			<?php $crow++; ?>
			<?php $duni=$aso_pant['item_duni']; ?>
			<?php $dpre=$aso_pant['item_dpre']; ?>
			<?php $dval=$aso_pant['item_dval']; ?>
			<?php $docum=$aso_pant['docum']; ?>
			<?php $numer=$aso_pant['numer']; ?>
			<?php $ctas=$aso_pant['ctas']; ?>
			<?php $ctasdes=$aso_pant['ctas_descri']; ?>
			<?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 
          if(!mb_stristr('FROX',$aso_pant['status'])
             and $aso_pant['stfin']!=1
             and ($user_anul==1 or $user_modi==1)
             and $aso_pant['autornum']=='' 
             and $tabla!='acce'
             and mb_stristr($pant,'PANT')
             and days_diff($aso_pant['fecha'],$fechaa)<=$dias_anul)
          {
              $pcaption='Editar : '.$aso_pant['docu'].'-'.$aso_pant['numero'].'-'.$aso_pant['iddet']; 
              $pidtxt='e_'.$crow.'_'.$iddet; $pname='itr_fila'; $psize=$xfontsize;
              $pidnum=$aso_pant['idnum1'];$pdocu=$aso_pant['docu'];
//               $ponclick="elim_docu('".$aso_pant['docu']."','".$aso_pant['idnum1']."','".$aso_pant['iddet']."','".$aso_pant['numero']."','tr_filad".$crow."');";
              $ponclick="{document.getElementById('iddet').value=".$aso_pant['iddet'].";gath_idnum();}";
              $pabrev=$aso_pant['iddet'];
              include('vrbutton.php');
        ?>
        <?php }else{?>
        <?php echo $aso_pant['iddet']; ?>
        <?php }?>
          
          
				</td>
        
        
        
          <?php if($dispcolu!=0){?>
				<td align="center">
					<?php //$pidtxt='radio'.'tr_filad'.$crow; $pname='rtr_filad'; $pcaption=''; $psize=$xfontsize; include('vrradio.php'); ?>
				</td>
          <?php } ?>
        
					 <?php if( $tabla=='acce'){?>
						<td align="center">
							<?php echo $aso_pant['docum_tabla']; ?>
						</td>
						<td align="center">
							<?php echo $aso_pant['docum']; ?>
						</td>
          <?php if($dispcolu!=0){?>
						<td>
							<?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 if($docuitem==1){ ?>
					<td align="center"><?php echo number_format(abs($aso_pant['cant']),$duni); ?></td>
					<td title="<?php echo $aso_pant['itemce']; ?>" id="item<?php echo $aso_pant['iddet'];?>".>
						<?php echo $aso_pant['item']; ?>
					</td>
					<td title="<?php echo $aso_pant['itemce']; ?>"
								style="<?php if(strlen(trim($aso_pant['item_descri']))>20){echo 'font-size:'.($xfontsize*.8).'px';} ?>">
						<?php echo $aso_pant['item_descri']; ?>
					</td>
          <?php if($tabla!='guia'){ ?>
					<td align="right" 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){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){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){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){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){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){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 } ?>

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

					 <?php if($empr_cont==1 and 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',$tabla) and $mobile!='true'){?>
						<td align="center" >
							<?php echo $aso_pant['numlote']; ?>
						</td>
						<td>
							<?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              
						if(!mb_stristr('FROX',$aso_pant['status'])
               and $aso_pant['stfin']!=1
               and $aso_pant['autornum']=='' 
               and $tabla!='acce'
               and days_diff($aso_pant['fecha'],$fechaa)<=$dias_anul)
                {
                  $pcaption='Eliminar: '.$aso_pant['docu'].'-'.$aso_pant['numero'].'-'.$aso_pant['iddet']; $pabrev='X';
                  $pidtxt='x_'.$crow.'_'.$iddet; $pname='itr_fila'; $psize=$xfontsize;
                  $pidnum=$aso_pant['idnum1'];$pdocu=$aso_pant['docu'];
                  $ponclick="elim_docu('".$aso_pant['docu']."','".$aso_pant['idnum1']."','".$aso_pant['iddet']."','".$aso_pant['numero']."','tr_filad".$crow."');";
                  include('vrbutton.php');
                }
            ?>
						</td>
            <?php }?>
				</tr>
			<?php } ?>
			</tbody>	
		<?php } ?>
		<?php { // TFOOT ?>
			<tfoot id="detafoot" style="<?php echo $tdisplay; ?>">
				<tr style="border-top:solid 1px;background-color:<?php echo $gris1; ?>;">
					<th <?php $ccol--; ?>></th>
          <?php if($dispcolu!=0){?>
          <th><?php$ccol--;?></th>
          <?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($docuiimp==1){ ?>
					<th><?php$ccol--;?></th>
					<th><?php$ccol--;?>TOTALES</th>
					<th><?php$ccol--;?></th>
					<th align="right" style="<?php if($tsubt==0){echo'display:none;';}?>"><?php$ccol--;?> <?php echo number_format($tsubt,2); ?></th>			
					<th align="right" style="<?php if($tdcto==0){echo'display:none;';}?>text-decoration:underline;"><?php$ccol--;?> <?php echo number_format($tdcto,2); ?></th>	
					<th align="right" style="<?php if($tssid==0){echo'display:none;';}?>text-decoration:underline;"><?php$ccol--;?> <?php echo number_format($tssid,2); ?></th>	
					<th align="right" style="<?php if($tprop==0){echo'display:none;';}?>"><?php$ccol--;?> <?php echo number_format($tprop,2); ?></th>	
					<th align="right" style="<?php if($tice==0){echo'display:none;';}?> font-style:italic;"><?php$ccol--;?> <?php echo number_format($tice,2); ?></th>	
					<th align="right" style="<?php if($tiva==0){echo'display:none;';}?> font-style:italic;"><?php$ccol--;?> <?php echo number_format($tiva,2); ?></th>	
					<th align="right" style="<?php if($tirbp==0){echo'display:none;';}?> font-style:italic;"><?php$ccol--;?> <?php echo number_format($tirbp,2); ?></th>
				<?php } ?>
				<?php if($docudocu==1){ ?>
					<th><?php$ccol--;?></th>
					<th><?php$ccol--;?></th>
				<?php } ?>
				<?php if($docurete==1){ ?>
					<th><?php$ccol--;?></th>
					<th><?php$ccol--;?></th>
					<th><?php$ccol--;?></th>
				<?php } ?>
				<?php if($docuctas==1){ ?>
					<th><?php$ccol--;?></th>
					<th><?php$ccol--;?></th>
					<th><?php$ccol--;?> <?php echo number_format($tdebito,2); ?></th>
					<th style="font-style:italic;"><?php$ccol--;?> <?php echo number_format($tcredito,2); ?></th>
				<?php } ?>
          
        <?php if(mb_stristr('FP15.DA16',$docu)){ ?>
					<th><?php$ccol--;?> <?php echo number_format($tpeso,2); ?></th>
					<th><?php$ccol--;?></th>
				<?php } ?>        

          <?php if($total!=0 and $xipuni!=0){ ?>
          <th align="right" style=""><?php$ccol--;?><?php echo number_format($total,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=remove_href($obstart); ?>
<?php } ?>

<?php echo $obstart;	?>

		