<?php session_start();?>
<?php include('../_cfg/config.php');?>
<?php include('php_gene1.php'); ?>
<?php include('php_session.php');?>
<?php $orient=$_POST['orient']; ?>
<?php $pant=$_POST['pant']; ?>
<?php $docu=$_POST['docu']; ?>
<?php $idnum=$_POST['idnum']; ?>

<?php $enti=$_POST['enti']; ?>
<?php $stat=$_POST['stat']; ?>
<?php $fecha1=$_POST['fecha1']; ?>
<?php $fecha2=$_POST['fecha2']; ?>
<?php $numero1=$_POST['numero1']; ?>
<?php $numero2=$_POST['numero2']; ?>

<?php $ptov=$_POST['ptov']; ?>
<?php $bode=$_POST['bode']; ?>
<?php $cair=$_POST['cair']; ?>


<?php if($docu=='RPXX'){$docu='RP'; $cair=''; $limit1=15;} ?>
<?php if($docu=='FPXX'){$docu='FP'; $limit1=15;} ?>

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




<?php

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

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

?>


<?php	

$user_modi=0;
$user_anul=0;
$user_elim=0;

$ver_rete=0;
$ver_apli=0;
$ver_cele=0;


if($user_tipo=='sist')
{
  $user_modi=1;
  $user_anul=1;
  $user_elim=1;
}
if($user_tipo=='supe')
{
  $user_modi=1;
  $user_anul=1;
  $user_elim=1;
}
// if($user_tipo=='clie' and substr($docu,0,2)=='OP'){$user_anul=1;}
if($user_tipo=='clie' and substr($docu,0,2)=='PC')
{
  $user_modi=0;
  $user_anul=1;
  $user_elim=0;
  $ver_rete=0;
}



// $ver_rete=0;

// echo '*/*/*'.$docu;
if($docu=='undefined')
{$docu='';}
else
{
//   $docu.='10';
//   $docu.='%';
  $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=='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=='CH'){$tabla='bcos'; $entilabel='PROVEEDOR';}
	if($docu=='IE'){$tabla='caja'; $entilabel='CLIENTE';}
	if($docu=='EE'){$tabla='caja'; $entilabel='PROVEEDOR';}
}

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


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

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

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

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

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


$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);

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

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

	if(@mb_stristr('vtas.comp.clie.prov.inve.prod.guia.carr',$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('retc.retp.rete',$tabla)){$docurete=1;}
	if(@mb_stristr('cont',$tabla)){$docuctas=1;}

	$total_sql ='max(concepto) as mconcepto,';
	$total_sql.='max(detalle) as mdetalle,';
	$total_sql.='sum(tcant) as stcant,';
	$total_sql.='sum(tsubt) as stsubt,';
	if($docuiimp==1)
	{
		$total_sql.='sum(tsubtiva0) as stsubtiva0,';
		$total_sql.='sum(tsubtiva) as stsubtiva,';
		$total_sql.='sum(tsubtice) as stsubtice,';
		$total_sql.='sum(tdcto) as stdcto,';
		$total_sql.='sum(tprop) as stprop,';
		$total_sql.='sum(tice) as stice,';
		$total_sql.='sum(tiva) as stiva,';
		$total_sql.='sum(tirbp) as stirbp,';

		$total_sql.='max(dcto) as pdcto,';
		$total_sql.='max(prop) as pprop,';
		$total_sql.='max(ice) as pice,';
		$total_sql.='max(iva) as piva,';
		$total_sql.='max(irbp) as pirbp,';
	}
	if(@mb_stristr('comp',$tabla))
	{
		$total_sql.='sum(rrta) as srrta,';
		$total_sql.='sum(riva) as sriva,';
	}
	if(@mb_stristr('retc.retp.rete',$tabla))
	{
		$total_sql.='max(cair) as mcair,';
		$total_sql.='sum(brta) as sbrta,';
		$total_sql.='max(prta) as sprta,';
		$total_sql.='sum(rrta) as srrta,';
		$total_sql.='sum(biva) as sbiva,';
		$total_sql.='max(piva) as spiva,';
		$total_sql.='sum(riva) as sriva,';
	}
  
// echo $tabla;
  if(@mb_stristr('cont',$tabla))
  {
    $total_sql.='sum(tdebito) as stdebito,';
    $total_sql.='sum(tcredito) as stcredito,';
    $total_sql.='sum(diferencia) as sdiferencia,';
    $total_sql.='max(csub) as mcsub, ';
    $total_sql.='max(cair) as mcair, ';
    $total_sql.='max(item) as mitem, ';
  }  
  
	$total_sql.='sum(total) as stotal ';

	$dispcolu=1;
	if($mobile=='true'){$dispcolu=0;}
}

// echo 'fdfdf';
?>


<?php
// $aa=file_get_contents('https://declaraciones.sri.gob.ec/facturacion-internet/consultas/publico/ruc-datos2.jspa?ruc=0992353554001');
// return $aa;	
?>	


<?php ob_start(); ?>
<resultado>
<?php
//   echo '*/*/*'.$fecha1.$fecha2;
// PRUEBAS	
$date=date('H:i:s',strtotime('now')) ;
//   echo '*/*/*/*/';
//   echo get_ippais();
//   echo get_ruc2('0990000530001');
  
$url1='https://declaraciones.sri.gob.ec/facturacion-internet/consultas/publico/ruc-datos2.jspa?ruc=0990001642001';
$url2='https://declaraciones.sri.gob.ec/facturacion-internet/consultas/publico/ruc-establec.jspa?ruc=0990001642001';

$url='http://www.jomyson.com:8000/get.php?username=vicore1&password=248989&type=m3u_plus&output=ts';
// $url='http://www.jomyson.com/get.php?username=vicore1&password=248989&type=m3u_plus&output=ts';
?>
  
  
<?php  
  
  {
    
//     $ch = curl_init();
//     curl_setopt($ch, CURLOPT_URL, $url);
//     curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
//     curl_setopt($ch, CURLOPT_SSLVERSION,3);
// //     curl_setopt($ch, CURLOPT_PORT, 800); 
//     $content = curl_exec ($ch);
// $b = curl_multi_getcontent($ch);
// var_dump($content === $b);
// curl_close($ch);
  
//     echo $b;

// $downloadPath = "_iptv_jomyson.m3u";
// $file = fopen($downloadPath, "w+");
// fputs($file, $content);
// fclose($file);
  
  
  
//   $url = 'http://www.test.com/1458398816_33370444.jpg';


// $curlCh = curl_init();
// curl_setopt($curlCh, CURLOPT_URL, $url);
// curl_setopt($curlCh, CURLOPT_RETURNTRANSFER, 1);
// curl_setopt($curlCh, CURLOPT_SSLVERSION,3);
// $curlData = curl_exec ($curlCh);
// curl_close ($curlCh);

  
  
  
  
  
// $page = file_get_contents($url);
//   echo $page;
// $page2 = file_get_contents($url2);
  
//   echo $page1;
//   echo '<br>';
//   echo '<br>';
//   echo '*/*/*/*';
//   echo $page2;
  
// $epg='http://jomyson.com:8000/xmltv.php?username=vicore1&password=248989&type=m3u_plus';
// header('Location:'.$epg);
// echo '*/*/*/'.$date.'-'.ini_get('allow_url_fopen');
// $aa=file_get_contents($epg);

// echo send_wapp('593996030903','Probando funcion');  
  
  
  
// $aa = get_xml_from_url($epg);
// $aa = new SimpleXMLElement($xmlstr);
	
  
	
// echo $aa;	
// die();
  
// echo date('H:i:s',strtotime('now'));
// $ws_merlyna='http://merlyna.com/merlyna/abc/webserviceSRI-RegistroCivil.php?wsdl';   
// $params=array('arg0'=>'0915379374001','arg1'=>'?','arg2'=>'?','arg3'=>'?','arg4'=>'?','arg5'=>'?','arg6'=>'?');
// $result0 = new SoapClient($ws_merlyna);
// // $result1=$result0->nombreRUCSRI($params);
// $result1=$result0->__soapCall('nombreRUCSRI',$params);
// var_dump($result1);
  
// $ws_merlyna='http://datosec.com/app/datosfiscales/consultaDeDatos.php?wsdl';
// $params=array('arg0'=>'0915379374');
// $result0 = new SoapClient($ws_merlyna);
// $result1=$result0->nombreRUCSRI($params);
// $result1=$result0->__soapCall('consultaDeDatos',$params);
// var_dump($result1);
  
  }  
  
  
?>	
	
 <?php //selectpdf_usage();?>	
<?php //uplctasuper(); ?>
<?php //echo ws_recep('0301201801099120986700120010020000000604441845311');?>	
<?php if(mb_stristr('PANT0',$pant)) { ?>
<?php //echo get_ced1('0915379374');?>	
<?php $fecha1=date('Y-m-01',strtotime ('today')); ?>
<?php if(mb_stristr('amay.',$cfg_empr)){$fecha1=date('Y-m-d',strtotime ('-1 day'));} ?>
<?php $fecha2=date('Y-m-01',strtotime ('+1 month')); ?>
<?php $fecha2=date('Y-m-d',strtotime ($fecha2.' -1 day')); ?>
<?php $fecha2=$fechaa; ?>

		<div id="pant0" style="border:solid 2px; overflow:auto; width:100%;">
		<?php if($mobile=='true' and $orient=="V") { ?>
			<table id="tpant0" cellpadding="2" width="100%" border="0"
						 style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse;">
            <tr>
              <td style="<?php if(mb_stristr('invi.clie.prov',$user_tipo) or $user_tipo==''){echo 'display:none;';} ?>">
                <?php $pidtxt='docu'; $ptabla='docu';  $psize=$xfontsize; $pdefa=$docu;  $pobj=1; $pnotob=1; 
                                             $pwhere='(docu_tipo="TRAN")'; include('vrgetcod.php'); ?>
              </td>
            </tr>
            <tr > 
            <td style="<?php if(mb_stristr('invi.clie.prov',$user_tipo) or $user_tipo==''){echo 'display:none;';} ?>">
            <?php
            $pidtxt='nueva'; $pcaption='Nuevo ';
            $ponclick='';                                                                 
            $ponclick.="crea_docu(document.getElementById('docu').value);"; 
            $ponclick.="list_docu('PANT1',document.getElementById('docu').value);"; 
            $psize=$xfontsize;
            //include('vrbutton2.php'); 
             ?>
            </td>
                <td><div id='idnum_creadocu'style='display:none;'></div></td>
            </tr>
          <?php //} ?>
        <tr>
        <td>

          
        </td>
        </tr>
				<tr><?php $pidtxt='fecha1'; $pcaption='Desde'; $pdefa=$fecha1; $psize=$xfontsize; include('vrgetfec.php'); ?></tr>
				<tr><?php $pidtxt='fecha2'; $pcaption='Hasta'; $psize=$xfontsize; include('vrgetfec.php'); ?></tr>
				<tr><?php $pidtxt='enti';  $ptabla='enti'; $pnotob="1"; $psize=$xfontsize; $pcaption=$entilabel; include('vrgetcod.php'); ?></tr>
				<tr><?php $pidtxt='stat'; $pcaption='Status'; $ptabla='stat'; $pnotob="1"; $psize=$xfontsize; include('vrgetcod.php'); ?></tr>
			</table>	
			<br>
			<table id="tpant00" cellpadding="2" width="100%" border="0"
						 style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:white;">
				<tr>
					<td align="center" width="50%">
					<?php //$pidtxt='consul'; $pcaption='Consultar '.$docu; $ponclick='list_docu("PANT1","'.$docu.'")'; $psize=$xfontsize; include('vrbutton2.php'); ?>
					<?php $pidtxt='consul'; $pcaption='Consultar '; $ponclick='list_docu("PANT1",'.'document.getElementById("docu").value'.')'; $psize=$xfontsize; include('vrbutton2.php'); ?>
					</td>
					<td align="center">
					<?php //$pidtxt='nueva'; $pcaption='Nueva'; $ponclick='list_docu("PANT1")'; $psize=$xfontsize; include('vrbutton2.php'); ?>
					</td>
					<td align="center">
					<?php $pidtxt='detadocu'; $pcaption='Detalle'; $ponclick='list_docu("DETA")'; $psize=$xfontsize; $pdefa=0; include('vrchkbox.php'); ?>
					</td>
				</tr>
			</table>			
			<br>
		<?php }else{ ?>
			<table id="tpant0" cellpadding="2" width="100%" border="0"
					 style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:white;">
				<tr>
<!--           <td style="<?php if(mb_stristr('invi.clie.prov',$user_tipo) or $user_tipo==''){echo 'display:none;';} ?>"> -->
<!--           </td> -->
         <td  valign="top">
            <table width="100%" cellpadding="2" width="100%" border="0"
                  style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:white;">
            </table>
          </td>

 
         
            <td  valign="top">
            <table width="100%" cellpadding="2" width="100%" border="0" caption=""
                   style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:white;">
              <tr>
                <th></th>
                <th></th>
<!--                 <th align="left">FECHA</th> -->
              </tr>
              <tr>
                <td><?php $pidtxt='fecha1'; $pcaption='Fec. Ini.'; $pdefa=$fecha1; $psize=$xfontsize; include('vrgetfec.php'); ?></td>
              </tr>
              <tr>
                <td><?php $pidtxt='fecha2'; $pcaption='Fec. Fin'; $psize=$xfontsize; include('vrgetfec.php'); ?></td>
              </tr>
            </table>
          </td>
      


         <td  valign="top">
            <table width="100%" cellpadding="2" width="100%" border="0"
                  style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:white;">
              <tr>
                <?php $pidtxt='docu'; $pcaption='docu'; $ptabla='docu';  $psize=$xfontsize; $pdefa=$docu;  $pobj=3;  $pnotob=0; 
             $pwhere='(docu_tipo="TRAN")';  $ponblur="vali_docu();";
             if(@mb_stristr('invi.clie.prov',$user_tipo) or $user_tipo==''){$phide=1;}  include('vrgetcod.php'); ?>              
              </tr>
              <tr>
                <?php $pidtxt='enti'; $pcaption=$entilabel; $ptabla='enti'; $pnotob="1"; $psize=$xfontsize;  $pobj=3; include('vrgetcod.php'); ?>
              </tr>

              <tr>
                <?php $pidtxt='stat'; $pcaption='Status'; $ptabla='stat'; $pnotob="1"; $psize=$xfontsize; $pobj=3; include('vrgetcod.php'); ?>
              </tr>
              
            </table>
          </td>

          <td  valign="top">
            <table width="100%" cellpadding="2" width="100%" border="0" caption=""
                   style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:white;">
              <tr>
                <td><?php $pidtxt='numero1'; $pcaption='Num. Ini.'; $pdefa='000000001'; $psize=$xfontsize; $pobj=3; include('vrgetnum.php'); ?></td>
              </tr>
              <tr>
                <td><?php $pidtxt='numero2'; $pcaption='Num. Fin'; $pdefa='999999999'; $psize=$xfontsize; $pobj=3; include('vrgetnum.php'); ?></td>
              </tr>
            </table>

      </td>

         <td  valign="top">
            <table width="100%" cellpadding="2" width="100%" border="0"
                  style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:white;">
							<tr style="display:none;" class="vtas">
                <?php $pidtxt='ptov'; $pcaption='PTO.VTA.'; $ptabla='ptov'; $psize=$xfontsize; $pobj=3; $pclass='vtas'; include('vrgetcod.php'); ?>
              </tr>
							<tr style="display:none;" class="inve">
                <?php $pidtxt='bode'; $pcaption='BODEGA'; $ptabla='bode'; $psize=$xfontsize;  $pobj=3; $pclass='inve'; include('vrgetcod.php'); ?>
              </tr>
							<tr style="display:none;" class="comp retc retp">
                <?php $pidtxt='cair'; $pcaption='CAIR'; $ptabla='cair'; $psize=$xfontsize;  $pobj=3; $pclass='comp retc retp'; include('vrgetcod.php'); ?>
              </tr>
							<tr style="display:none;" class="vtas">
                <?php //$pidtxt='zsub'; $pcaption='ZONA'; $ptabla='zsub'; $psize=$xfontsize; $plong=4; $pobj=3; $pclass='vtas'; include('vrgetcod.php'); ?>
              </tr>
							<tr style="display:none;" class="vtas inve">
                <?php //$pidtxt='lsub'; $pcaption='LINEA'; $ptabla='lsub'; $psize=$xfontsize; $plong=4; $pobj=3; $pclass='vtas inve'; include('vrgetcod.php'); ?>
              </tr>
            </table>
          </td>
          
         <td  valign="top">
          <table width="100%" cellpadding="2" width="100%" border="0"
                style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:white;">

            <tr>
              <td>
					<?php $pidtxt='consul'; $pcaption='Consultar '; $ponclick='list_docu("PANT1",'.'document.getElementById("docu").value'.')'; $psize=$xfontsize; include('vrbutton2.php'); ?>
              </td>
           </tr>
              <tr>
            <td style="<?php if(mb_stristr('invi.clie.prov',$user_tipo) or $user_tipo==''){echo 'display:none;';} ?>">
                
                <?php 
                  $pidtxt='nueva'; $pcaption='Nuevo ';
                  $ponclick='';                                                                 
//                   $ponclick.="crea_docu(document.getElementById('docu').value);"; 
                  $ponclick.="list_docu('PANT1',document.getElementById('docu').value);"; 
                  $psize=$xfontsize; include('vrbutton2.php');
                 ?>
              </td>
                <td><div id='idnum_creadocu'style='display:none;'></div></td>
             </tr>            
            </table>
           </td>

         <td  valign="top">
          <table width="100%" cellpadding="2" width="100%" border="0"
                style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:white;">
              <tr>
              <td>
              <?php $pidtxt='detadocu'; $pcaption='Detalle'; $ponclick='list_docu("DETA");'; $psize=$xfontsize; $pdefa=0; include('vrchkbox.php'); ?>
              </td>
              </tr>
       
            </table>
           </td>
              	
				</tr>	
        <tr>
          <td></td>
          <td>
          </td>

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

<?php if(mb_stristr('PANT1',$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
    { 
//     $limit=$idnum*1;
//     if($limit>0)  
//     {
//       $fecha1='2000-01-01';
//       $fecha2='2100-01-01';
//     }

    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($docu=="DDMM")
		{$sql_pant.=' and docu not like "DD%"';}
		else
		{$sql_pant.=' and docu like "'.$docu.'%"';}
		if($user_tipo=="clie"){$sql_pant.=' and (trim(iuser)="'.$user_codigo.'")';}
// 		if($user_tipo==""){$sql_pant.=' and (1==2)';}
		if($enti!=""){$sql_pant.=' and(enti like "'.$enti.'%" or enti_descri like "%'.$enti.'%")';}
		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($cair!="" and mb_stristr('comp.retp.retc',$tabla)){$sql_pant.=' and(cair="'.$cair.'")';}
		if($user_tipo=='invi'){$sql_pant.=' and (enti_emailce like "%'.$user_email.'%")';}

// 		$sql_tpant=str_replace('select *','select *,'.$total_sql,$sql_pant);
		$sql_pant=str_replace('select *','select *,'.$total_sql,$sql_pant);
		$sql_tpant=$sql_pant;

		if(mb_stristr('retc.retp.rete',$tabla))
		{$sql_pant.=' group by numero,fecha,enti';}
		else
		{$sql_pant.=' group by idnum1';}

		$sql_pant.=' order by fecha desc,docu,ptoe,numero desc';
      
//     $idnum=$idnum*1;
//     if($limit>0)  
//     {$sql_pant.=' limit '.$limit;}

    if($limit1>0)  
    {$sql_pant.=' limit '.$limit1;}

		$res_pant=mysql_query($sql_pant,$link_vcrx);
		$res_tpant=mysql_query($sql_tpant,$link_vcrx);

		$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');
      
//     if(mb_stristr('retp.retc',$tabla)){$mconcepto='';}

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

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

		if(mb_stristr('retc.retp.rete',$tabla))
		{
			$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');
		}

      
		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');
			$tdebito=mysql_result($res_tpant,0,'stdebito');
			$tcredito=mysql_result($res_tpant,0,'stcredito');
			$tdiferencia=mysql_result($res_tpant,0,'sdiferencia');
		}			
      
		$total=mysql_result($res_tpant,0,'stotal');

// 		if($dispcolu=='true')
		if($dispcolu==0)
		{
			$tsubt=0;
			$tsubtiva=0;	
			$tsubtiva0=0;
			$tdcto=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	val_usercodigo(); ?>
	<?php 	//echo send_sms1('593996030568','CIA:'.$cfg_empr.' /USER:'.$user_descri);?>
	<?php  //echo  explain_sql($sql_pant);	?>
<?php //echo '*/*/*+'.$idnum;?>
		<table id="tpant1" class="pant1" border="0"
					 align="center" cellpadding="3" width="100%"
					 style="font-size:<?php if($orient=='V'){echo $xfontsize-8;}else{echo $xfontsize;} ?>px;
						border-collapse:collapse;background-color:white; position:;"
						>
			<?php { // THEAD ?>
			<thead style="display:block; <?php if($mobile!='true'){echo 'max-width:'.($screenw-20).'px;';} ?>;background-color:#eee;">
				<tr style="border-bottom:solid 1px; cursor:pointer;" title="Reordenar">
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Imprimir" style="position:;">I</th>
					<th onclick="sortTable(this,0<?php $ccol++; ?>);" title="Detalle" style="<?php if($dispcolu==0){echo'display:none;';}?>">D</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';}?> <?php echo 'font-size:'.($xfontsize*0.8).';' ?>">DOCU</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';}?> <?php echo 'font-size:'.($xfontsize*0.8).';' ?>">PTOE</th>
					<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>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="letter-spacing:1px;<?php if($dispcolu==0){echo'display:none;';}?>">CED/RUC</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="letter-spacing:10px;max-width:"><?php echo $entilabel; ?></th>
					<?php if(@mb_stristr('acce',$tabla)){?>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>">TIPO</th>
					<?php } ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" 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 if($docuiimp==1){?>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($tdcto==0){echo'display:none;';}?> <?php echo 'font-size:'.($xfontsize*0.8).';' ?>">DCTO</th>	
						<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($tice==0){echo'display:none;';}?> <?php echo 'font-size:'.($xfontsize*0.8).';' ?>">ICE</th>	
						<th onclick="sortTable(this,<?php echo $ccol++; ?>);" 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++; ?>);" 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++; ?>);" style="<?php if($tprop==0){echo'display:none;';}?> <?php echo 'font-size:'.($xfontsize*0.8).';' ?>">PROP</th>	
						<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($tiva==0){echo'display:none;';}?> <?php echo 'font-size:'.($xfontsize*0.8).';' ?>">IVA</th>	
						<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($tirbp==0){echo'display:none;';}?> <?php echo 'font-size:'.($xfontsize*0.8).';' ?>">IRBP</th>
					<?php }?>
					<?php if(@mb_stristr('retc.retp.rete',$tabla)){?>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>">B.Rta.</th>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:;';} ?>">%Rta.</th>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>">R.Rta.</th>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>">B.IVA</th>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:;';} ?>">%IVA</th>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>" >R.IVA</th>
					<?php } ?>
					<?php if(@mb_stristr('cont',$tabla)){?>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:;';} ?>">DEBITOS</th>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:;';} ?>">CREDITOS</th>
					<?php } ?>

          <th onclick="sortTable(this,<?php echo $ccol++; ?>);" >TOTAL</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" 
							style="letter-spacing:10px;max-width:;<?php if($dispcolu==0 or $mconcepto==''){echo'display:none;';}?>">CONCEPTO</th>

          <?php if($empr_cont==1 and @mb_stristr('comp',$tabla)){ ?>
  					<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',$tabla)){ ?>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Autorización" style="font-size:<?php echo $xfontsize*0.8;?>px;">AUT</th>
					<?php }?>
          
          <th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Status">ST</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);"
							title="
							<?php if($user_anul==1){echo 'Anular';}?>
							<?php if($user_elim==1){echo '/Eliminar';}?>
										 ">
						<?php if($user_anul==1){echo 'O';}?>
						<?php if($user_elim==1){echo '/X';}?>
					</th>

          
          <?php if($ver_rete==1){ ?>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="" >Num.Ret.</th>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="" >Ret</th>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="" >Rta</th>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="" >IVA</th>
					<?php }?>
          
          <?php if($ver_apli==1){ ?>
  					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="" >Aplica</th>
					<?php }?>

          <?php if($ver_cele==1){ ?>
             <th>C.ELEC.</th>
          <?php } ?>
          <?php// $ccol++; ?>
          <th>__</th>
				</tr>
			</thead>
			<?php } ?>
			<?php { // TBODY ?>
			<tbody id="tpant1b" style="overflow-y:auto; display:block; 
							<?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 //echo explain_sql($sql_pant);	?>
				<?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']; ?>
				<tr id="tr_fila<?php echo $crow;?>" class="tr_fila" valign="top" height="<?php //if($mobile=='true'){echo '55px';};?>"
						style="<?php if ($crow%5==0){echo 'border-bottom:dotted 1px;'; } ?> "
						onmouseover="_filabg(event,'tr_fila','<?php echo $crow; ?>','');"
						onclick="_filabg(event,'tr_fila','<?php echo $crow; ?>','');
                    {if(document.getElementById('detadocu').checked)
										{list_docu('PANT2','<?php echo $aso_pant['docu']; ?>','<?php echo $aso_pant['idnum1']; ?>');}}
										<?php if($touchs=='true'){?>
										<?php } ?>
										 "
						>
					<td align="center" style="position:;"><span style="display:none;"><?php echo fillzero($crow,5); ?></span>
					<?php
//               if($crow%2==0)
              {
							$claveacce=$aso_pant['claveacce'];
							$pcaption='Imprimir: '.$aso_pant['docu'].'-'.$aso_pant['numero']; $pabrev='I';
							$pidnum=$aso_pant['idnum1'];
							//$pidtxt='i_'.$aso_pant['idnum1'];
							$pidtxt='i_'.$crow;
							$psize=$xfontsize;
							if($claveacce=='')
							{$ponclick='{window.open("print1.php?prnt=1&docu='.$aso_pant['docu'].'&idnum='.$aso_pant['idnum1'].'","_blank")}';}
							else
							{$ponclick='{window.open("print1.php?prnt=1&clave='.$claveacce.'","_blank")}';}
 							include('vrbutton2.php');
              }
          ?>
            
					</td>
					<td align="center" style="<?php if($dispcolu==0){echo'display:none;';}?>" title="<?php echo 'ID:'.$aso_pant['idnum1'];?>"
							onclick="
										<?php if($touchs=='false'){?>
                    {if(document.getElementById('detadocu').checked)                       
										{list_docu('PANT2','<?php echo $aso_pant['docu']; ?>','<?php echo $aso_pant['idnum1']; ?>');}}
										<?php } ?>
										 ">
						<?php //if($mobile!='true'){$pidtxt='radio'.'tr_fila'.$crow; $pname='rtr_fila'; $pcaption=''; $psize=$xfontsize; include('vrradio.php');} ?>
						<?php 
               echo '<a href="http://'.$cfg_empr.'.vcrxol.com/print1.php?prnt=1&docu='.$aso_pant['docu'].'&idnum='.$aso_pant['idnum1'].'&formato=3" target="_blank">';
//                echo 'D';
               echo '</a>';
            ?>
					</td> 
					<td align="center" style="<?php if($dispcolu==0){echo'display:none;';}?> font-size:<?php echo $xfontsize*0.8;?>px;"
							title="<?php echo $aso_pant['docu_descri']; ?>">
						<?php echo $aso_pant['docu']; ?>
					</td>
          <td align="center" style="<?php if($dispcolu==0){echo'display:none;';}?> font-size:<?php echo $xfontsize*0.8;?>px;"
							title="<?php
                       if(mb_stristr('comp.retc.retp',$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',$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>
					<td align="center" title="<?php echo $aso_pant['ptonumero']; ?>">
						<span style="display:none;"><?php if(mb_stristr('comp.retc',$tabla)){echo $aso_pant['numero'];}else{echo $aso_pant['ptonumero'];} ?></span>
						<?php 
               echo '<a href="http://'.$cfg_empr.'.vcrxol.com/print1.php?prnt=1&docu='.$aso_pant['docu'].'&idnum='.$aso_pant['idnum1'].'" target="_blank">';
               if($mobile=='true'){echo intval($aso_pant['numero']);}
               else{echo $aso_pant['numero'];}
               echo '</a>';
            ?>
					</td>
					<td align="center">
						<div style="display:none;"><?php echo $aso_pant['fecha']; ?></div>
						<?php echo $aso_pant['fechadmy']; ?>
					</td>
					<td align="center" style="<?php if($dispcolu==0){echo'display:none;';}?>"
							title="<?php if($tipoid=='R'){ echo 'RUC:'.$tiporuc.'-'.$struc;}else{echo 'ID:'.$tipoid;};?>">
						<?php echo substr($aso_pant['enti'],0,10); ?>
					</td>

					<?php $enti_maxlen =400;?>
					<?php $enti_descri =$aso_pant['enti_descri'];?>
					<?php $enti_descri =split_words($aso_pant['enti_descri']);?>
					<?php //if(strlen($enti_descri)>50){$enti_descri=str_replace('-','<br>-',$enti_descri);} ?>
					<?php //if(strlen($enti_descri)>$enti_maxlen){$enti_descri=substr($enti_descri,0,$enti_maxlen);} ?>
					<?php //if(strlen($enti_descri)>$enti_maxlen){$enti_descri=substr($enti_descri,0,$enti_maxlen).'<br>'.substr($enti_descri,($enti_maxlen));} ?>
					
					<td align="left" style="<?php if($mobile!='true' and strlen(trim($enti_descri))>20){echo 'font-size:'.($xfontsize-2).'px;';}else{} ?>"
							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" style="<?php if($dispcolu==0){echo'display:;';} ?>"> 
							<?php echo $aso_pant['user_tipo']; ?>
						</td>
					<?php } ?>	
          
					<td 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 echo $aso_pant['mcair']; ?>
            <?php }else{?>
						  <div style="display:none;"><?php echo fillzero($aso_pant['stsubt'],15); ?></div>
						  <?php echo number_format(abs($aso_pant['stsubt']),2); ?>
            <?php }?>
					</td>	
					<?php if($docuiimp){ ?>
						<td align="right" style="<?php if($tdcto==0){echo'display:none;';}?> font-style:italic;">
							<div style="display:none;"><?php echo fillzero($aso_pant['stdcto'],15); ?></div>
							<?php echo number_format(abs($aso_pant['stdcto']),2); ?>
						</td>	
						<td align="right" style="<?php if($tice==0){echo'display:none;';}?> font-style:italic;">
							<div style="display:none;"><?php echo fillzero($aso_pant['stice'],15); ?></div>
							<?php echo number_format(abs($aso_pant['stice']),2); ?>
						</td>	
						<td align="right" style="<?php if($tsubtiva0==0){echo'display:none;';}?>">
							<div style="display:none;"><?php echo fillzero($aso_pant['stsubtiva0'],15); ?></div>
							<?php echo number_format(abs($aso_pant['stsubtiva0']),2); ?>
						</td>	
						<td align="right" style="<?php if($tsubtiva==0){echo'display:none;';}?>">
							<div style="display:none;"><?php echo fillzero($aso_pant['stsubtiva'],15); ?></div>
							<?php echo number_format(abs($aso_pant['stsubtiva']),2); ?>
						</td>	
						<td align="right" style="<?php if($tprop==0){echo'display:none;';}?> font-style:italic;">
							<div style="display:none;"><?php echo fillzero($aso_pant['stprop'],15); ?></div>
							<?php echo number_format(abs($aso_pant['stprop']),2); ?>
						</td>	
						<td align="right" style="<?php if($tiva==0){echo'display:none;';}?> font-style:italic;" >
							<div style="display:none;"><?php echo fillzero($aso_pant['stiva'],15); ?></div>
							<?php echo number_format(abs($aso_pant['stiva']),2); ?>
						</td>	
						<td align="right" style="<?php if($tirbp==0){echo'display:none;';}?> font-style:italic;">
							<div style="display:none;"><?php echo fillzero($aso_pant['stirbp'],15); ?></div>
							<?php echo number_format(abs($aso_pant['stirbp']),2); ?>
						</td>	
				<?php } ?>
					<?php if(mb_stristr('retc.retp.rete',$tabla)){?>
						<td align="right" style="<?php if($dispcolu==0){echo'display:none;';} ?>"> 
							<div style="display:none;"><?php echo fillzero($aso_pant['sbrta'],15); ?></div>
							<?php echo number_format(abs($aso_pant['sbrta']),2); ?>
						</td>
						<?php if(ceil($aso_pant['sprta'])==floor($aso_pant['sprta'])){$dval=0;}else{$dval=2;}?>
						<td align="center" style="<?php if($dispcolu==0){echo'display:;';} ?>"> 
							<div style="display:none;"><?php echo fillzero($aso_pant['sprta'],7); ?></div>
							<?php echo number_format(abs($aso_pant['sprta']),$dval).'%'; ?>
						</td>
						<td align="right" style="font-style:italic;<?php if($dispcolu==0){echo'display:none;';} ?>">
							<div style="display:none;"><?php echo fillzero($aso_pant['srrta'],15); ?></div>
							<?php echo number_format(abs($aso_pant['srrta']),2); ?>
						</td>
						<td align="right" style="<?php if($dispcolu==0){echo'display:none;';} ?>"> 
							<div style="display:none;"><?php echo fillzero($aso_pant['sbiva'],15); ?></div>
							<?php echo number_format(abs($aso_pant['sbiva']),2); ?>
						</td>
						<?php if(ceil($aso_pant['spiva'])==floor($aso_pant['spiva'])){$dval=0;}else{$dval=2;}?>
						<td align="center" style="<?php if($dispcolu==0){echo'display:;';} ?>"> 
							<div style="display:none;"><?php echo fillzero($aso_pant['spiva'],7); ?></div>
							<?php echo number_format(abs($aso_pant['spiva']),$dval).'%'; ?>
						</td>
						<td align="right" style="font-style:italic;<?php if($dispcolu==0){echo'display:none;';} ?>"> 
							<div style="display:none;"><?php echo fillzero($aso_pant['sriva'],15); ?></div>
							<?php echo number_format(abs($aso_pant['sriva']),2); ?>
						</td>
					<?php } ?>	

          <?php
            $stotal=$aso_pant['stotal'];
          ?>
					<?php if(mb_stristr('cont',$tabla)){?>
						<td align="right" style="<?php if($dispcolu==0){echo'display:;';} ?>"> 
							<div style="display:none;"><?php echo fillzero($aso_pant['stdebito'],15); ?></div>
							<?php echo number_format(abs($aso_pant['stdebito']),2); ?>
						</td>
						<td align="right" style="<?php if($dispcolu==0){echo'display:;';} ?>"> 
							<div style="display:none;"><?php echo fillzero($aso_pant['stcredito'],15); ?></div>
							<?php echo number_format(abs($aso_pant['stcredito']),2); ?>
						</td>

          <?php
            $stotal=$aso_pant['sdiferencia'];
          ?>
          
					<?php } ?>	
          
					<td align="right" > 
						<div style="display:none;"><?php echo fillzero($stotal,15); ?></div>
						<?php echo number_format(abs($stotal),2); ?>
					</td>
          
					<?php $concepto_maxlen =50;?>
          <?php if(mb_stristr('retp.retc.rete',$tabla)){$concepto_maxlen=17*3;} ?>
          <?php $concepto = trim($aso_pant['concepto']); ?>
          <?php $concepto = split_words($concepto); ?>
          <td style="<?php if($dispcolu==0 or $mconcepto==''){echo'display:none;';}?>max-width:;
										 <?php if(strlen($concepto)>$concepto_maxlen){echo 'font-size:'.($xfontsize-2).'px';} ?>"
							title="<?php echo trim($aso_pant['suco_descri']); ?>"
							>
						<?php echo $concepto; ?>
						<?php //if($aso_pant['drtr']!=''){echo ' D:'.r_fiel('enti',$aso_pant['drtr']);}; ?>
					</td>
          
          <?php if($empr_cont==1 and mb_stristr('comp',$tabla)){ ?>
  					<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',$tabla)){ ?>
  					<td align="center" title="<?php echo trim($aso_pant['atrz'].$aso_pant['autornum']); ?>">
              <span style="display:none;">
              <?php echo trim($aso_pant['atrztipo'].$aso_pant['enti_descri'].$aso_pant['atrz'].$aso_pant['autornum']); ?>
              </span>
              <?php echo $aso_pant['atrztipo']; ?>
            </td>
					<?php }?>
          
          <?php if($aso_pant['status']!='O' and $aso_pant['status']!='X'){$tnumero++;}  ?>
					<td align="center"><?php echo $aso_pant['status']; ?></td>

          <td align="center" >
					<?php
						if(!mb_stristr('ROX',$aso_pant['status']) and $user_anul==1)
						{
							$pcaption='Anular: '.$aso_pant['docu'].'-'.$aso_pant['numero']; $pabrev='O';
							$pidtxt='o_'.$crow;
              $pname='itr_fila';
							$pidnum=$aso_pant['idnum1'];$pdocu=$aso_pant['docu'];
							$psize=$xfontsize;
							$ponclick="anul_docu('".$aso_pant['docu']."','".$aso_pant['idnum1']."','".$aso_pant['numero']."');";
							include('vrbutton2.php');
						}

						if($aso_pant['status']=='O' and $user_elim==1)
						{
							$pcaption='Eliminar: '.$aso_pant['docu'].'-'.$aso_pant['numero']; $pabrev='X';
							$pidtxt='anul'.'tr_fila'.$crow; $pname='itr_fila';
							$pidnum=$aso_pant['idnum1'];$pdocu=$aso_pant['docu'];
							$psize=$xfontsize;
							$ponclick="elim_docu('".$aso_pant['docu']."','".$aso_pant['idnum1']."','".$aso_pant['numero']."');";
							include('vrbutton2.php');
						}
					?>
					</td>

          <?php
            if($ver_rete==1)
            { 
              $sql_rete ='select *, ';
              $sql_rete.=' max(cair) 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 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 '<span style="display:none;">'.$rete_nume.'</span>';
                  echo '<a href="http://'.$cfg_empr.'.vcrxol.com/print1.php?prnt=1&docu='.$rete_docu.'&idnum='.$rete_idnum.'" target="_blank">';
                  echo $rete_nume;
                  echo '</a>'.'</td>';
                  echo '<td>'.$rete_cair.'</td>';
                  echo '<td>'.number_format(@mysql_result($res_rete,0,'por_rta'),0).'%'.'</td>';
                  echo '<td>'.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))
                 {echo '<a href="http://'.$cfg_empr.'.vcrxol.com/index2.php?rpro=1&docu='.$aso_pant['docu'].'&idnum='.$aso_pant['idnum1'].'" target="_blank">';}
                 echo 'NO-RET.';
                 if(mb_stristr('comp',$tabla))
                 {echo '</a>';}
                 echo '</td>';
                 echo '<td></td>';
                 echo '<td>'.number_format($aso_pant['prrta'],0).'</td>'; 
                 echo '<td>'.number_format($aso_pant['priva'],0).'</td>'; 
              }
            }
          ?>

          <?php 
            if($ver_apli==1)
            { 
              $idfrom=$aso_pant['idfrom'];
              $mdfrom=$aso_pant['mdfrom'];
              $sql_apli ='select * ';
//               $sql_rete.=' max(cair) as max_cair,';
              $sql_apli.=' from '.$tabla.'2 ';
              $sql_apli.=' where idnum2 ="'.$aso_pant['idnum1'].'"';
              $sql_apli.=' order by iddet';
              $res_apli=mysql_query($sql_apli,$link_vcrx);
//             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>';
                  if($idfrom!='')
                  {echo '<a href="http://'.$cfg_empr.'.vcrxol.com/print1.php?prnt=1&docu='.$apli_docu.'&idnum='.$idfrom.'" target="_blank">';}
                  echo $apli_docu.'-'.$apli_ptoe.'-'.$apli_nume;
                  if($idfrom!='')
                  {echo '</a>';}
                  echo '</td>';
                }
                else
                {
                  echo '<td>';
                  echo $apli_docu.'-'.$apli_ptoe.'-'.$apli_nume;
                  echo $aso_pant['ctas'].'-'.$aso_pant['ctas_descri'];
                  echo '</td>';
                }
                
              }
              else
              { 
                  echo '<td>';
                  echo 'NO-APLI';
                  echo '</td>';
               } 
            }
          ?>
    
    
					<?php if($ver_cele==1){ ?>
          <td style="font-size:<?php if($orient=='V'){ echo ($xfontsize*.99).'%;'; }else{echo ($xfontsize-2).'px;'; } ?>;" align="left">
            <?php
							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('vrbutton2.php');
							}

    					if(mb_stristr('vtas.retp.guia',$tabla) )
              {
                if($aso_pant['firmafec']!="")
                {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);
                    if(mb_stristr($recepmsj,'EXTEMPO')){$recepmsj='EXTEMPORANEA';}

                    if(mb_stristr($recepmsj,'ERROR :CLAVE ACCESO REGISTRADA'))
                    {echo '<br><div style="background-color:green;color:white;">'.'RECIBIDA'.'</div>';}
                    else
                    {echo '<br><div style="background-color:yellow;color:black;">'.'PENDIENTE:'.$recepmsj.'</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')
							{
								$pidtxt='btnmail'.$aso_pant['idnum1']; $pcaption='@: '.$aso_pant['emailfec']; $psize=10;
								$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('vrbutton2.php');
							}
            ?>                                                   
					</td>
					<?php } ?>

<!--         <td style="width:1px;display:;"></td> -->
        </tr>
				<?php } ?>
			</tbody>
		<?php } ?>	
			<?php { // FOOT ?>
			<tfoot style="display:block; <?php if($mobile!='true'){echo 'max-width:'.($screenw-20).'px;';} ?>;background-color:#eee; font-size:<?php echo $xfontsize*.80;?>px;">
				<tr style="border-top:solid 1px;">
					<th></th>
					<th style="<?php if($dispcolu==0){echo'display:none;';}?>"></th>
					<th style="<?php if($dispcolu==0){echo'display:none;';}?>"></th>
					<th style="<?php if($dispcolu==0){echo'display:none;';}?>"></th>
					<th><?php echo ($tnumero).'/'.($crow); ?></th>
					<th></th>
					<th style="letter-spacing:1px; <?php if($dispcolu==0){echo'display:none;';}?>"><?php if($dispcolu==0){echo 'TOTAL';} ?></th>
					<th style="max-width:;letter-spacing:10px; "><?php if(1==1){echo 'TOTALES';} ?></th>
					<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),2); ?>
            <?php }?>               
					</th>	
					<?php if($docuiimp==1){ ?>
						<th align="right" style="<?php if($tdcto==0){echo'display:none;';}?> font-style:italic;">
							<?php echo number_format(abs($tdcto),2); ?>
						</th>	
						<th align="right" style="<?php if($tice==0){echo'display:none;';}?> font-style:italic;">
							<?php echo number_format(abs($tice),2); ?>
						</th>	
						<th align="right" style="<?php if($tsubtiva0==0){echo'display:none;';}?>">
							<?php echo number_format(abs($tsubtiva0),2); ?>
						</th>
						<th align="right" style="<?php if($tsubtiva==0){echo'display:none;';}?>">
							<?php echo number_format(abs($tsubtiva),2); ?>
						</th>	
						<th align="right" style="<?php if($tprop==0){echo'display:none;';}?> font-style:italic;">
							<?php echo number_format(abs($tprop),2); ?>
						</th>	
						<th align="right" style="<?php if($tiva==0){echo'display:none;';}?> font-style:italic;" >
							<?php echo number_format(abs($tiva),2); ?>
						</th>	
						<th align="right" style="<?php if($tirbp==0){echo'display:none;';}?> font-style:italic;">
							<?php echo number_format(abs($tirbp),2); ?>
						</th>	
				<?php } ?>
					<?php if(@mb_stristr('retc.retp.rete',$tabla)){ ?>
<!-- 						<th></th> -->
						<th align="right" style="font-style: ;<?php if($dispcolu==0){echo'display:none;';} ?>">
							<?php echo number_format(abs($tbrta),2); ?>
						</th>	
						<th></th>
						<th align="right" style="font-style:italic;<?php if($dispcolu==0){echo'display:none;';} ?>">
							<?php echo number_format(abs($trrta),2); ?>
						</th>	
						<th align="right" style="font-style: ;<?php if($dispcolu==0){echo'display:none;';} ?>">
							<?php echo number_format(abs($tbiva),2); ?>
						</th>	
						<th></th>
						<th align="right" style="font-style:italic;<?php if($dispcolu==0){echo'display:none;';} ?>">
							<?php echo number_format(abs($triva),2); ?>
						</th>	
					<?php } ?>
					<th align="right">
						<?php echo number_format(abs($total),2); ?>
					</th>
<!-- 					<th></th>
					<th></th>
					<th></th>
					<th></th> -->
          <?php echo str_repeat('<th></th>',$ccol-7); ?>
				</tr>
				<?php if($tnumero>0){?>
				<tr style="border-top:solid 1px;">
					<th></th>
					<th style="<?php if($dispcolu==0){echo'display:none;';}?>"></th>
					<th style="<?php if($dispcolu==0){echo'display:none;';}?>"></th>
					<th style="<?php if($dispcolu==0){echo'display:none;';}?>"></th>
					<th></th>
					<th></th>
					<th style="letter-spacing:1px; <?php if($dispcolu==0){echo'display:none;';}?>" ><?php if($dispcolu==0){echo'PROM.';}?></th>
					<th style="letter-spacing:5px;" ><?php if(1==1){echo'PROMEDIOS';}?></th>
					<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 if($docuiimp==1){ ?>
						<th align="right" style="<?php if($tdcto==0){echo'display:none;';}?> font-style:italic;">
							<?php echo number_format(abs($tdcto/$tnumero),2); ?>
						</th>
						<th align="right" style="<?php if($tice==0){echo'display:none;';}?> font-style:italic;">
							<?php echo number_format(abs($tice/$tnumero),2); ?>
						</th>
						<th align="right" style="<?php if($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(mb_stristr('retc.retp.rete',$tabla)){?>
<!-- 						<th></th> -->
						<th align="right" style="font-style: ;<?php if($dispcolu==0){echo'display:none;';} ?>">
							<?php echo number_format(abs($tbrta/$tnumero),2); ?>
						</th>	
						<th></th>
						<th align="right" style="font-style:italic;<?php if($dispcolu==0){echo'display:none;';} ?>">
							<?php echo number_format(abs($trrta/$tnumero),2); ?>
						</th>	
						<th align="right" style="font-style: ;<?php if($dispcolu==0){echo'display:none;';} ?>">
							<?php echo number_format(abs($tbiva/$tnumero),2); ?>
						</th>	
						<th></th>
						<th align="right" style="font-style:italic;<?php if($dispcolu==0){echo'display:none;';} ?>">
							<?php echo number_format(abs($triva/$tnumero),2); ?>
						</th>	
					<?php } ?>
					<th align="right" style="<?php if($total==0){echo'display:none;';}?> ">
						<?php echo number_format(abs($total/$tnumero),2); ?>
					</th>
<!-- 					<th></th>
					<th></th>
					<th></th>
					<th></th> -->
          <?php echo str_repeat('<th></th>',$ccol-7); ?>
				</tr>
				<?php}?>
			</tfoot>
			<?php } ?>	
		</table>
	</pant1>
	<?php //echo '***'.date('H:i:s') .'<br>';?>
				
<?php } ?>			
		
<?php if(mb_stristr('PANT2',$pant)) { ?>
<?php {
	if(mb_stristr('retc.retp.rete',$tabla))
	{
		$sql_pant ='select * from '.$tabla.'12 where status!="O" and ';
		$sql_pant.='concat(numero,fecha,enti) in (select concat(numero,fecha,enti) as numero from '.$tabla.'1 where idnum1="'.$idnum.'" )';
	}
	else
	{$sql_pant ='select * from '.$tabla.'12 where idnum1="'.$idnum.'"';}

	$sql_tpant =str_replace('select *','select *,'.$total_sql,$sql_pant);

	if(mb_stristr('retc.retp.rete',$tabla)){$sql_tpant.=' group by fecha,numero,enti';}
	else	{$sql_tpant.=' group by idnum1';}

	$res_pant=mysql_query($sql_pant,$link_vcrx); 
// 	echo explain_sql($sql_pant);

  {
    $res_tpant=mysql_query($sql_tpant,$link_vcrx); 
    $tsubt=mysql_result($res_tpant,0,'stsubt');
    $tcant=mysql_result($res_tpant,0,'stcant');

    if($docuiimp==1)
    {
      $tsubtiva0=mysql_result($res_tpant,0,'stsubtiva0');
      $tsubtiva=mysql_result($res_tpant,0,'stsubtiva');
      $tdcto=mysql_result($res_tpant,0,'stdcto');
      $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');
    }
    $mdetalle=mysql_result($res_tpant,0,'mdetalle');
    $total=mysql_result($res_tpant,0,'stotal');

    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');
    }
  }

}	?>
<pant11>
	<div style="font-size:<?php echo $xfontsize; ?>px;">
		<?php //echo date('H:i:s');?>
		<table border="0" width="<?php if($orient=='V'){echo '200%';}else{echo '100%';} ?>" cellpadding="2" width="100%"
						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:#eee;">
			<tr valign="top" >
				<td width="3%">
<?php //echo 	'***'.explain_sql($sql_tpant); ?>
					<?php
// 							$claveacce=@mysql_result($res_tpant,0,'claveacc');
// 							$pcaption='Imprimir: '.mysql_result($res_tpant,0,'docu').'-'.mysql_result($res_tpant,0,'numero'); $pabrev='I';
// 							$pidnum=mysql_result($res_tpant,0,'idnum1');
// 							$psize=$xfontsize;
// 							if($claveacce=='')
// 							{$ponclick='{window.open("print1.php?prnt=1&docu='.mysql_result($res_tpant,0,'docu').'&idnum='.mysql_result($res_tpant,0,'idnum1').'","_blank")}';}
// 							else
// 							{$ponclick='{window.open("print1.php?prnt=1&clave='.$claveacce.'","_blank")}';}
//  							include('vrbutton2.php');
					?>
				</td>
				<td style="font-weight:bold; font-size:80%" width="">
					<?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'); ?>
          
					<?php
            $claveacce=@mysql_result($res_tpant,0,'claveacc');
            if($claveacce!=''){echo '<br>'.'CA: '.$claveacce;}
          ?>
				</td>
				<td>
					<div style="font-weight:bold;">
					<?php echo ''.substr(mysql_result($res_pant,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($empr_cont==1 and $tabla=='comp'){ ?>
				<td style="font-size:<?php echo $xfontsize*.80;?>px;">
					<div>
					<?php echo '<strong>S.COMP.: </strong>'.mysql_result($res_tpant,0,'suco_descri'); ?>
					</div>
					<div>
					<?php echo '<strong>F.PAGO: </strong>'.mysql_result($res_tpant,0,'fpag_descri'); ?>
					</div>
					<div>
					<?php echo '<strong>No.AUT.: </strong>'.mysql_result($res_tpant,0,'atrz').mysql_result($res_tpant,0,'autornum'); ?>
					</div>
				</td>
				<td align="right">
					<div style="">
					<?php echo '<strong>Ret.RTA.: </strong>'.number_format(mysql_result($res_tpant,0,'srrta'),2); ?>
					</div>
					<div style="">
					<?php echo '<strong>Ret.IVA.: </strong>'.number_format(mysql_result($res_tpant,0,'sriva'),2); ?>
					</div>
				</td>
				<?php } ?>
			</tr>
		</table>
	</div>
	<?php if($mobile=='true'){?>
	<div style="font-size:<?php echo $xfontsize; ?>px;">
		<table width="100%" cellpadding="2" width="100%" border="0"
						 style="font-size:<?php if($mobile=='true'){echo $xfontsize-8;}else{echo $xfontsize;} ?>px;
										border-collapse:collapse; background-color:#eee;">
			<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($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($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($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($total!=0){ ?><td align="center"><?php echo number_format(abs($total),2); ?></td><?php }?>
			</tr>
		</table>
	</div>
	<?php } ?>
  
<div id="pant11b" style="display:none">
  <table sborder="0" cellpadding="0" cellspacing="0" 
         style="
                border-collapse:collapse
								padding:0px;
								margin:0px;
								width:100%;
								max-width:100%;
								font-family:arial;
								font-size:<?php echo $xfontsize;?>px;
         ">
    <?php if ($tsubt!=0) {?>
    <tr>
      <td align="right" >
        <input type="button" value="SUB-TOTAL" style="font-weight:bold;">
      </td>
      <td align="right" style="font-weight:bold;">
        <?php echo number_format(abs($tsubt),2);?>
      </td>
    </tr>
    <?php } ?>
    <?php if ($tsubtiva0!=0) {?>
    <tr>
      <td align="right">
        <input type="button" value="SUB-TOT.IVA 0%" style="font-weight:bold;">
      </td>
      <td align="right" style="font-weight:bold;">
        <?php echo number_format(abs($tsubtiva0),2);?>
      </td>
    </tr>
    <?php } ?>
    <?php if ($tsubtiva!=0) {?>
    <tr>
      <td align="right">
        <input type="button" value="SUB-TOT.IVA" style="font-weight:bold;">
      </td>
      <td align="right" style="font-weight:bold;">
        <?php echo number_format(abs($tsubtiva),2);?>
      </td>
    </tr>
    <?php } ?>
    <?php if ($tdcto!=0) {?>
    <tr>
      <td align="right">
        <input type="button" value="DSCTO." style="font-weight:bold;">
      </td>
      <td align="right" style="font-weight:bold;">
        <?php echo number_format(abs($tdcto)*-1,2);?>
      </td>
    </tr>
    <?php } ?>
    <?php if ($tprop!=0) {?>
    <tr>
      <td align="right">
        <input type="button" value="PROP." style="font-weight:bold;">
      </td>
      <td align="right" style="font-weight:bold;">
        <?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;">
      </td>
      <td align="right" style="font-weight:bold;">
        <?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;">
      </td>
      <td align="right" style="font-weight:bold;">
        <?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;">
      </td>
      <td align="right" style="font-weight:bold;">
        <?php echo number_format(abs($tirbp),2);?>
      </td>
    </tr>
    <?php } ?>
    <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-weight:bold; 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>
  </table>
</div>
  
</pant11>

  
    
<pant2>
<?php $crow=0; ?>
<?php $ccol=0; ?>
<?php
  {$sql_pant='select * from '.$tabla.'12 where idnum2="'.$idnum.'" 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="'.$idnum.'") order by numer,cair';
	}
                                  
	if(mb_stristr('acce',$tabla))
  {
    $sql_pant ='select * from '.$tabla.'12 ';	
    $sql_pant.='where idnum2="'.$idnum.'" ';	
    $sql_pant.=' and docum_tabla !="" ';	
    $sql_pant.=' and docum_tabla is not null ';	
    $sql_pant.='order by docum_tabla, docum';	
  } 
	
// 	echo explain_sql($sql_pant);
	$res_pant=mysql_query($sql_pant,$link_vcrx);	
?>
<?php $numrows=mysql_num_rows($res_pant); ?>
	<table id="tpant2" class="pant2" align="left" border="0" cellpadding="3" width="100%"
				 style="font-size:<?php if($orient=='V'){echo $xfontsize-8;}else{echo $xfontsize;} ?>px;
								overflow-x:hidden;
								border-collapse:collapse;background-color:white;"
						 >
		<?php { // THEAD ?>
		<thead style="display:block;">
			<tr style="border-bottom:solid 1px;background-color:#eee;">
				<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Linea">L</th>
				<th style="<?php if($dispcolu==0){echo 'display:none;';} ?><?php echo $ccol++; ?>">D</th>	
				<?php if($tabla=='acce') {?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>">Modulo</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>">Codigo</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>">Documento</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>">Crear</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>">Modif</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>">Anular</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>">Elim</th>
				<?php } ?>
				<?php if($docuiimp==1){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Cantidad">Cant</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Código" style="<?php if($dispcolu==09){echo'display:none;';}?>">Código</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Descripción">Descripción</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Prec.Unitario">P.Uni</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($tsubt==0){echo'display:none;';}?>">SUB-TOT</th>			
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($tdcto==0){echo'display:none;';}?>">DCTO</th>	
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($tprop==0){echo'display:none;';}?>">PROP</th>	
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($tice==0){echo'display:none;';}?>">ICE</th>	
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($tiva==0){echo'display:none;';}?>">IVA</th>	
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($tirbp==0){echo'display:none;';}?>">IRBP</th>
	<!-- 				<th onclick="sortTable(this,3);" title="Precio Unitario">PVP</th> -->
				<?php } ?>
				<?php if($docudocu==1){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="">Documento</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="">Numero</th>
				<?php } ?>
				<?php if($docurete==1){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="">Base Imponible</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="">Impuesto</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="">% Ret.</th>
				<?php } ?>
        <?php if($docuctas==1){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>">Cuenta</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>">Contable</th>
          <th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>">Debitos</th>
          <th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>">Creditos</th>
          <th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>">C.Sub</th>
				<?php } ?>        
				<th onclick="sortTable(this,<?php echo $ccol++; ?>);"><?php if($docuctas==1){echo '';}else{echo 'TOTAL';} ?></th>
				<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="letter-spacing:10px;<?php if($dispcolu==0 or $mdetalle=='' ){echo'display:none;';}?>">DETALLE</th>
				<?php if($empr_cont==1 and $tabla=='comp') {?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>">Cuenta</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>">Contable</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>">CAIR</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>">%Rta</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>">%IVA</th>
				<?php } ?>
        <?php if($user_modi==1){?>
				<th width="10%" align="center">
					<span style="display:none;">ELIMINAR</span>
					<?php $pidtxt='f_elim';  $pcaption='ELIMINAR TODO';  $psize=$xfontsize; if($mobile=='true' or 1==1){$pabrev="X";}; $psize=$xfontsize+3;
					$ponclick="if(confirm('Limpiar Detalle ?')){php_func('del_deta(".$idcarr.")');hoja_clie('PANT0');};";
					include('vrbutton.php'); ?>
				</th>
        
        <?php }?>
			</tr>
		</thead>
		<?php } ?>
		<?php { // TBODY ?>
		<tbody id="bodytpant2" style="overflow-y:auto; overflow-x:hidden; display:block; border-bottom:solid 1px;
					<?php if($orient=='V'){echo'min-height:'.($hpant2-75).'px;';}else{echo'min-height:'.($hpant2-90).'px;';}  ?> 
					<?php if($orient=='V'){echo'height:'.($hpant2-75).'px;';}else{echo'height:'.($hpant2-90).'px;';}  ?> ">
      <?php //explain_sql($sql_pant);?>
			<?php while($aso_pant=mysql_fetch_assoc($res_pant)){ ?>
			<?php $crow++; ?>
			<?php $duni=$aso_pant['item_duni']; ?>
			<?php $dpre=$aso_pant['item_dpre']; ?>
			<?php $dval=$aso_pant['item_dval']; ?>
			<?php if($dval==0){$dval=2;} ?>
			<?php if($dpre==0){$dpre=2;} ?>
			<?php if($duni==0){$duni=0;} ?>
			<?php if(ceil($aso_pant['cant'])!=floor($aso_pant['cant']) and $duni==0){$duni=2;} ?>
			<tr id="tr_filad<?php echo $crow;?>" class="tr_filad" valign="top"
						style="<?php if ($crow%5==0){echo 'border-bottom:dotted 1px;'; } ?><?php if ($crow==$numrows){echo 'border-bottom:solid 2px;'; } ?>
									 font-size:<?php if($orient=='V'){echo $xfontsize-8;}else{echo $xfontsize;}?>"
						onmouseover="_filabg(event,'tr_filad','<?php echo $crow; ?>','');"
						onclick="_filabg(event,'tr_filad','<?php echo $crow; ?>','');";
						>
				<td align="center" style="font-size:80%;">
					<span style="display:none;"><?php echo fillzero($crow); ?></span><?php echo $aso_pant['iddet']; ?>
				</td>
				<td align="center" style="<?php if($dispcolu==0){echo'display:none;';}?>">
					<?php //$pidtxt='radio'.'tr_filad'.$crow; $pname='rtr_filad'; $pcaption=''; $psize=$xfontsize; include('vrradio.php'); ?>
				</td>
        
					 <?php if( $tabla=='acce') {?>
						<td align="center" style="<?php if($dispcolu==0){echo'display:none;';} ?>">
							<?php echo $aso_pant['docum_tabla']; ?>
						</td>
						<td align="center" style="<?php if($dispcolu==0){echo'display:none;';} ?>">
							<?php echo $aso_pant['docum']; ?>
						</td>
						<td align="left" style="<?php if($dispcolu==0){echo'display:none;';} ?>">
							<?php echo $aso_pant['docum_descri']; ?>
						</td>
						<td align="center" style="<?php if($dispcolu==0){echo'display:none;';} ?>">
							<?php 
                $pidtxt='chknuev'.$aso_pant['idnum2'].$aso_pant['iddet'];$pdefa=$aso_pant['nuev'];
                $ptabla="acce2"; $pline=$aso_pant['idnum2'].'-'.$aso_pant['iddet'];$pcolu="nuev";
                include('vrchkbox.php');
              ?>	
						</td>
						<td align="center" style="<?php if($dispcolu==0){echo'display:none;';} ?>">
							<?php 
                $pidtxt='chkmodi'.$aso_pant['idnum2'].$aso_pant['iddet'];$pdefa=$aso_pant['modi'];
                $ptabla="acce2"; $pline=$aso_pant['idnum2'].'-'.$aso_pant['iddet'];$pcolu="modi";
                include('vrchkbox.php');
              ?>	
						</td>
						<td align="center" style="<?php if($dispcolu==0){echo'display:none;';} ?>">
							<?php 
                $pidtxt='chkanul'.$aso_pant['idnum2'].$aso_pant['iddet'];$pdefa=$aso_pant['anul'];
                $ptabla="acce2"; $pline=$aso_pant['idnum2'].'-'.$aso_pant['iddet'];$pcolu="anul";
                include('vrchkbox.php');
              ?>	
						</td>
						<td align="center" style="<?php if($dispcolu==0){echo'display:none;';} ?>">
							<?php 
                $pidtxt='chkelim'.$aso_pant['idnum2'].$aso_pant['iddet'];$pdefa=$aso_pant['elim'];
                $ptabla="acce2"; $pline=$aso_pant['idnum2'].'-'.$aso_pant['iddet'];$pcolu="elim";
                include('vrchkbox.php');
              ?>	
						</td>
            <td></td>
						<?php } ?>
        
        
        
				<?php if($docuiimp==1){ ?>
					<td align="center"><?php echo number_format(abs($aso_pant['cant']),$duni); ?></td>
					<td align="left" style="<?php if($dispcolu==09){echo'display:none;';}?>" title="<?php echo $aso_pant['itemce']; ?>">
						<?php echo $aso_pant['item']; ?>
					</td>
					<td align="left" title="<?php echo $aso_pant['itemce']; ?>"
								style="<?php if(strlen(trim($aso_pant['item_descri']))>20){echo 'font-size:80%';} ?>">
						<?php echo $aso_pant['item_descri']; ?>
					</td>
					<td align="right" >
						<div style="display:none;"><?php echo fillzero($aso_pant['puni'],15); ?></div>
						<?php echo number_format(abs($aso_pant['puni']),$dpre); ?>
					</td>
					<td align="right" style="<?php if($tsubt==0){echo'display:none;';} ?>">
						<div style="display:none;"><?php echo fillzero($aso_pant['tsubt'],15); ?></div>
						<?php echo number_format(abs($aso_pant['tsubt']),$dval); ?>
					</td>
					<td align="right" style="<?php if($tdcto==0){echo'display:none;';} ?>font-style:italic;" title="<?php echo number_format(abs($aso_pant['dcto']),$dval).'%'; ?>">
						<div style="display:none;"><?php echo fillzero($aso_pant['tdcto'],15); ?></div>
						<?php echo number_format(abs($aso_pant['tdcto']),$dval); ?>
					</td>
					<td align="right" style="<?php if($tprop==0){echo'display:none;';} ?>font-style:italic;" title="<?php echo number_format(abs($aso_pant['prop']),$dval).'%'; ?>">
						<div style="display:none;"><?php echo fillzero($aso_pant['tprop'],15); ?></div>
						<?php echo number_format(abs($aso_pant['tprop']),$dval); ?>
					</td>
					<td align="right" style="<?php if($tice==0){echo'display:none;';} ?>font-style:italic;" title="<?php echo number_format(abs($aso_pant['ice']),$dval).'%'; ?>">
						<div style="display:none;"><?php echo fillzero($aso_pant['tice'],15); ?></div>
						<?php echo number_format(abs($aso_pant['tice']),$dval); ?>
					</td>
					<td align="right" style="<?php if($tiva==0){echo'display:none;';} ?>font-style:italic;" title="<?php echo number_format(abs($aso_pant['iva']),$dval).'%'; ?>">
						<div style="display:none;"><?php echo fillzero($aso_pant['tiva'],15); ?></div>
						<?php echo number_format(abs($aso_pant['tiva']),$dval); ?>
					</td>
					<td align="right" style="<?php if($tirbp==0){echo'display:none;';} ?>font-style:italic;" title="<?php echo number_format(abs($aso_pant['irbp']),$dval); ?>">
						<div style="display:none;"><?php echo fillzero($aso_pant['tirbp'],15); ?></div>
						<?php echo number_format(abs($aso_pant['tirbp']),$dval); ?>
					</td>
				<?php } ?>
				<?php if($docudocu==1){ ?>
				<?php $duni=2;$dval=2; ?>
				<?php if($dispcolu==0){$docum=$aso_pant['docum'];}else{$docum=$aso_pant['docum_descri'];} ?>
					<td align="center" style=""><?php echo $docum; ?></td>
					<?php if($dispcolu==0){$numer=$aso_pant['numer'];}else{$numer=$aso_pant['ptonumer'];} ?>
					<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('retc.retp.rete',$tabla)){ ?>
  				<?php if($docurete==1){ ?>
					<?php
						$cair='('.$aso_pant['cair'].')';
// 						if($aso_pant['puni']>=30 and $cair<300)
						if($aso_pant['biva']>0)
						{$cair_descri='IVA';}
						else
						{$cair_descri=$aso_pant['cair_descri']; $cair='<br>'.$cair;}
					?>
					<?php //if($dispcolu==0){$cair_descri='';} ?>
					<td align="center" ><?php echo $cair_descri.' '.$cair; ?></td>
				
					<?php if(ceil($aso_pant['puni'])==floor($aso_pant['puni'])){$dval=0;}else{$dval=2;}?>
					<td align="right"><div style="display:none;"><?php echo fillzero($aso_pant['puni'],15); ?></div>
						<?php echo number_format(abs($aso_pant['puni']),$dval).'%'; ?></td>
						<?php $duni=2;$dval=2; ?>
					
						<td align="right" style="<?php if($total==0){echo'display:none;';} ?>">
								<div style="display:none;"><?php echo fillzero($aso_pant['total'],15); ?></div>
								<?php echo number_format(abs($aso_pant['total']),$dval).''; ?>
						</td>
					<?php } ?>

					<?php } ?>
           <?php if($docuctas==1){ ?>        
  					<td><?php echo $aso_pant['ctas']; ?></td>
  					<td><?php echo $aso_pant['ctas_descri']; ?></td>
            <td align="right"><div style="display:none;"><?php echo fillzero(($aso_pant['tdebito']),15); ?></div>
              <?php echo number_format(abs($aso_pant['tdebito']),2); ?></td>
  					<td align="right"><div style="display:none;"><?php echo fillzero(($aso_pant['tcredito']),15); ?></div>
              <?php echo number_format(abs($aso_pant['tcredito']),2); ?></td>
  					<td></td>
  					<td><?php echo $aso_pant['csub_descri']; ?></td>
					<?php } ?>
        
					<td align="right" style="<?php if($total==0){echo'display:none;';} ?>">
						<div style="display:none;"><?php echo fillzero($aso_pant['total'],15); ?></div>
						<?php echo number_format(abs($aso_pant['total']),$dval); ?>
					</td>
        
          <td align="left" style="<?php if($dispcolu==0 or $mdetalle=='' ){echo'display:none;';} ?>
																		<?php if(strlen(trim($aso_pant['detalle']))>20){echo 'font-size:80%';} ?>">
							<?php if(trim($aso_pant['detalle'])!=trim($aso_pant['item_descri'])){echo $aso_pant['detalle'];};?></td>

					 <?php if($empr_cont==1 and $tabla=='comp' and $mobile!='true') {?>
						<td align="left" style="<?php if($dispcolu==0){echo'display:none;';} ?>">
							<?php echo $aso_pant['ctas']; ?>
						</td>
						<td align="left" style="<?php if($dispcolu==0){echo'display:none;';} ?>">
							<?php echo $aso_pant['ctas_descri']; ?>
						</td>
						<td align="center" title="<?php echo $aso_pant['cair_descri']; ?>">
							<?php echo $aso_pant['cair']; ?>
						</td>
						<?php if(ceil($aso_pant['prrta'])==floor($aso_pant['prrta'])){$dpor=0;}else{$dpor=2;}?>
						<td align="center" style="<?php if($dispcolu==0){echo'display:none;';} ?>" 
								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" style="<?php if($dispcolu==0){echo'display:none;';} ?>"
								title="<?php echo number_format($aso_pant['riva'],2).''; ?>">
							<?php echo number_format($aso_pant['priva'],$dpor).''; ?>
						</td>
						<?php } ?>
            <?php if($user_modi==1){?>
						<td align="center" style="">
							<?php $pidtxt='del_'.$aso_pant['iddet'].$aso_pant['iddet'];
							$pcaption='X';
							$ptitle='Eliminar'.$aso_pant['item_codigov'];
							$pabrev='X'; $psize=$xfontsize+3;
							$ponclick ="if(confirm('Eliminar Línea : ".$aso_pant['item']."-".$aso_pant['item_descri']." ?'))";
							$ponclick.="{";
// 							$ponclick.="php_func('del_deta(".$aso_pant['docu'].",".$aso_pant['idnum1'].",".$aso_pant['iddet'].")');";
							$ponclick.="this.parentNode.parentNode.parentNode.style.display='none';";
							$ponclick.="};";
							include('vrbutton2.php'); 
              ?>

<!--               document.getElementById('pant11').style.display='block'; -->
              
						</td>
      
            <?php }?>
				</tr>

			<?php } ?>
			</tbody>	
		<?php } ?>
		<?php { // TFOOT ?>
			<tfoot id="detafoot" style="display:none;">
				<tr style="border-top:solid 1px;background-color:#eee;">
          <th></th>
          <th></th>
					 <?php if( $tabla=='acce') {?>
<!--           <th></th>
          <th></th>
          <th></th>
          <th></th>
          <th></th>
          <th></th>
          <th></th>
          <th></th>
          <th></th>
          <th></th> -->
						<?php } ?>
				<?php if($docuiimp==1){ ?>
					<th><?php echo number_format($tcant,2); ?></th>
					<th style="<?php if($dispcolu==09){echo'display:none;';}?>"></th>
					<th>TOTALES</th>
					<th></th>
					<th style="<?php if($tsubt==0){echo'display:none;';}?>"><?php echo number_format($tsubt,2); ?></th>			
					<th style="<?php if($tdcto==0){echo'display:none;';}?>"><?php echo number_format($tdcto,2); ?></th>	
					<th style="<?php if($tprop==0){echo'display:none;';}?>"><?php echo number_format($tprop,2); ?></th>	
					<th style="<?php if($tice==0){echo'display:none;';}?>"><?php echo number_format($tice,2); ?></th>	
					<th style="<?php if($tiva==0){echo'display:none;';}?>"><?php echo number_format($tiva,2); ?></th>	
					<th style="<?php if($tirbp==0){echo'display:none;';}?>"><?php echo number_format($tirbp,2); ?></th>
	<!-- 				<th onclick="sortTable(this,3);" title="Precio Unitario">PVP</th> -->
				<?php } ?>
				<?php if($docudocu==1){ ?>
					<th></th>
					<th></th>
				<?php } ?>
				<?php if($docurete==1){ ?>
					<th></th>
					<th></th>
					<th></th>
				<?php } ?>
					<th style=""><?php echo number_format($total,2); ?></th>
          
          <?php echo str_repeat('<th></th>',$ccol-2); ?>
        </tr>
			</tfoot>
		<?php } ?>
	</table>
		<?php //echo date('H:i:s');?>
	
</pant2>
		
<?php } ?>	
    
</resultado>

<?php $obstart = ob_get_clean(); ?>
<?php $obstart = alltrim($obstart) ?>
<?php echo $obstart;	?>

		