<?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 $anio1=$_POST['anio1']; ?>
<?php $anio2=$_POST['anio2']; ?>
<?php $sema1=$_POST['sema1']; ?>
<?php $sema2=$_POST['sema2']; ?>

<?php $orient=$_POST['orient']; ?>

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


<?php
// $fecha1=date('Y-m-d', strtotime($anio1.'s-01-01 '.($sema2-1).' weeks'));

$fecha1=fecha_ini($anio1,$sema1);
$fecha2=fecha_fin($anio2,$sema2);

// echo $fecha1.$fecha2;

?>



<?php
// function get_xml_from_url($url){
//     $ch = curl_init();

//     curl_setopt($ch, CURLOPT_URL, $url);
//     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//     curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');

//     $xmlstr = curl_exec($ch);
//     curl_close($ch);

//     return $xmlstr;
// }

?>


<?php	
	
$user_anul=0;
$user_elim=0;

$modi_docu=1;

if($user_tipo=='sist'){$user_anul=1;$user_elim=1;}
if($user_tipo=='supe'){$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_anul=1;}

$tabla=r_fiel('docu',$docu,'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';}
}

if(mb_stristr('vtas.clie.carr.retc.guia.',$tabla)){$entilabel='CLIENTE';}
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';}

$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.='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,';
// 	}
	$total_sql.='sum(total) as stotal ';

	$dispcolu=1;
	if($mobile=='true'){$dispcolu=0;}
	$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
// 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';
  
  
//     $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 $fecha1=date('Y-m-01',strtotime ('-12 month')); ?>
<?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;">
		<?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; display:none;">
				<tr><?php $pidtxt='fecha1'; $pcaption='Desde'; $pdefa=$fecha1; $psize=$xfontsize; include('vrgetfec.php'); ?></tr>
				<tr><?php $pidtxt='fecha2'; $pcaption='Hasta'; $pdefa=date('Y-m-t',strtotime($fecha1.' +12 month')); $psize=$xfontsize; include('vrgetfec.php'); ?></tr>
				<tr style="display:none;"><?php $pidtxt='enti';  $ptabla='enti'; $pnotob="1"; $psize=$xfontsize; $pcaption=$entilabel; include('vrgetcod.php'); ?></tr>
				<tr style="display:none;"><?php $pidtxt='stat'; $pcaption='Status'; $ptabla='stat'; $pnotob="1"; $psize=$xfontsize; include('vrgetcod.php'); ?></tr>
			</table>	
<!--       <br> -->
            <table width="100%" cellpadding="2" width="100%" border="0"
                   style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:white; display:;">
              <tr><td><br></td></tr>
              <tr>
                <td><?php $pidtxt='anio1'; $pcaption='Desde'; $pdefa='2019'; $psize=$xfontsize; $poptn1=2018; $poptn2=2021; include('vrselopt.php'); ?></td>
                <td><?php $pidtxt='sema1'; $pcaption=''; $pdefa=date('W',strtotime('-7 days')); $psize=$xfontsize; $poptn1=1; $poptn2=52; $pobj=1; include('vrselopt.php'); ?></td>
<!--               </tr> -->
<!--               <tr> -->
                <td><?php $pidtxt='anio2'; $pcaption='Hasta'; $pdefa='2019'; $psize=$xfontsize; $poptn1=2018; $poptn2=2021; include('vrselopt.php'); ?></td>
                <td><?php $pidtxt='sema2'; $pcaption=''; $pdefa=date('W', strtotime('14 days ')); $psize=$xfontsize; $poptn1=1; $poptn2=52; $pobj=1; include('vrselopt.php'); ?></td>
					<td align="center" width="">
					<?php $pidtxt='consul'; $pcaption='Consultar '; $ponclick='info_tfe1("PANT1","'.$docu.'")'; $psize=$xfontsize; include('vrbutton2.php'); ?>
					</td>
              </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 '; $ponclick='info_tfe1("PANT1","'.$docu.'")'; $psize=$xfontsize; include('vrbutton2.php'); ?>
					</td>
					<td align="center">
					<?php //$pidtxt='nueva'; $pcaption='Nueva'; $ponclick='info_tfe1("PANT1")'; $psize=$xfontsize; include('vrbutton2.php'); ?>
					</td>
					<td align="center" style="display:none;">
					<?php $pidtxt='detadocu'; $pcaption='Detalle'; $ponclick='info_tfe1("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>
            <table width="100%" cellpadding="2" width="100%" border="0"
                   style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:white; display:none;">
              <tr>
                <td><?php $pidtxt='fecha1'; $pcaption='Desde'; $pdefa=$fecha1; $psize=$xfontsize; include('vrgetfec.php'); ?></td>
              </tr>
              <tr>
                <td><?php $pidtxt='fecha2'; $pcaption='Hasta'; $pdefa=date('Y-m-t',strtotime($fecha1.' +12 month')); $psize=$xfontsize; include('vrgetfec.php'); ?></td>
              </tr>
            </table>
          </td>
          <td>
            <table width="100%" cellpadding="2" width="100%" border="0"
                   style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:white; display:;">
              <tr>
                <td><?php $pidtxt='anio1'; $pcaption='Desde'; $pdefa='2019'; $psize=$xfontsize; $poptn1=2018; $poptn2=2021; include('vrselopt.php'); ?></td>
                <td><?php $pidtxt='sema1'; $pcaption=''; $pdefa=date('W',strtotime('-7 days')); $psize=$xfontsize; $poptn1=1; $poptn2=52; $pobj=1; include('vrselopt.php'); ?></td>
              </tr>
              <tr>
                <td><?php $pidtxt='anio2'; $pcaption='Hasta'; $pdefa='2019'; $psize=$xfontsize; $poptn1=2018; $poptn2=2021; include('vrselopt.php'); ?></td>
                <td><?php $pidtxt='sema2'; $pcaption=''; $pdefa=date('W', strtotime('14 days ')); $psize=$xfontsize; $poptn1=1; $poptn2=52; $pobj=1; include('vrselopt.php'); ?></td>
              </tr>
            </table>
          </td>
          
          <td>
            <table width="100%" cellpadding="2" width="100%" border="0"
                  style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:white;">
              <tr style="display:none;">
                <td ><?php $pidtxt='enti'; $ptabla='enti'; $pnotob="1"; $psize=$xfontsize; $pcaption=$entilabel; include('vrgetcod.php'); ?></td>
              </tr>
              <tr style="display:none;">
                <td><?php  $pidtxt='stat'; $pcaption='Status'; $ptabla='stat'; $pnotob="1"; $psize=$xfontsize; include('vrgetcod.php'); ?></td>
              </tr>
            </table>
          </td>
          
         <td>
          <table width="100%" cellpadding="2" width="100%" border="0"
                style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:white;">
           <tr style="display:none;">
             <td>
          <?php $pidtxt='detadocu'; $pcaption='Detalle'; $ponclick='info_tfe1("DETA");'; $psize=$xfontsize; $pdefa=0; include('vrchkbox.php'); ?>
             </td>
            </tr>
            <tr>
          <?php $pidtxt='consul'; $pcaption='Consultar '; $ponclick='info_tfe1("PANT1","'.$docu.'")'; $psize=$xfontsize; include('vrbutton2.php'); ?>
           </tr>
            </table>
           </td>

          <td>

          <?php if(!mb_stristr('invi.clie.prov',$user_tipo) and $user_tipo!=''){?>
          <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'; $ptabla='docu';  $psize=$xfontsize; $pdefa=$docu;  $pobj=1; include('vrgetcod.php'); ?>
              </tr>
            
            <tr>
              
          <?php 
//             $pidtxt='nueva'; $pcaption='Nuevo '.$docu;
            $pidtxt='nueva'; $pcaption='Nuevo ';
// 			      $ponclick="if(confirm('Ordenar Pedido ?')){php_func('clie2vtas(".$idclie.",'+document.getElementById('enti2').value+')');hoja_clie('PANT0');};";
            $ponclick='';                                                                 
            $ponclick.="crea_docu(document.getElementById('docu').value);"; 
            $ponclick.="info_tfe1('PANT1',document.getElementById('docu').value,5);"; 
            $psize=$xfontsize; include('vrbutton2.php'); ?>
                <td><div id='idnum_creadocu'style='display:none;'></div></td>
             </tr>
              
         </tr>
         </table>
        
        <?php } ?>
          </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 mysql_query('update '.$tabla.'1 set status="-" where (status="" or status is null) and (fecha between "'.$fecha1.'" and "'.$fecha2.'")',$link_vcrx); ?>
	<?php { 
    $limit=$idnum*1;
  
    if($limit>0)  
    {
      $fecha1='2000-01-01';
      $fecha2='2100-01-01';
    }
      
  
		$sql_pant='select * from '.$tabla.'12 ';
		//$sql_pant.=' where (fecha between "'.$fecha1.'" and "'.$fecha2.'")';
		$sql_pant.=' where (fecha between "XXXX-XX-XX-1" and "XXXX-XX-XX-2")';
		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($user_tipo=='invi'){$sql_pant.=' and (enti_emailce like "%'.$user_email.'%")';}
  	if($user_tipo=='invi' and $user_codigo=='3'){$sql_pant.=' and (enti like "%C3481778%")';} //AFRIKAN
  	if($user_tipo=='invi' and $user_codigo=='4'){$sql_pant.=' and (enti like "%C01532679%")';} //BANAFOO

		$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';
		$sql_pant.=' order by fecha,docu,ptoe,numero desc';
    $idnum=$idnum*1;
    if($limit>0)  
    {$sql_pant.=' limit '.$limit;}
//   echo $sql_pant;

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

		$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  //$orient='V';?>



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

		<table id="tpant1" class="pant1" border="1"
					 align="center" border="0" cellpadding="3" width="100%"
					 style="font-size:<?php if($orient=='V'){echo $xfontsize-8;}else{echo $xfontsize;} ?>px;
						border-collapse:collapse;background-color:white;"
						>
			<?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="">
           <?php if($orient=='V'){?>  
					<th style="display:;" width="25%">FECHAS</th>
					<th onclick="sortTable(this,0);" width="65%">DETALLES</th>
          <?php }else{?>
					<th onclick="sortTable(this,0);">SEMANA</th>
					<th>LUNES</th>
					<th>MARTES</th>
					<th>MIERCOLES</th>
					<th>JUEVES</th>
					<th>VIERNES</th>
					<th>SABADO</th>
					<th>DOMINGO</th>
					<th>TOTAL</th>
          <?php }?>
					</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 $lsema=$aso_pant['fsema']; ?>
        <?php $gsema=0?>
        <?php //for($fechaa=$fecha1; $fechaa<=$fecha2; $fecha){ ?>
        <?php $xfecha= $fecha1; ?>
        <?php $lanio='';?>
        <?php $lmes='';?>
        <?php $lsema='';?>
        <?php $totcajsem=0;?>
        <?php $totcntsem=0;?>
        <?php $totcnt=0;?>
        <?php $totcaj=0;?>
            <?php $xsema=date('W',strtotime($xfecha));?>
         <tr style="border-top:solid 1px; <?php if(($xsema % 2)==0){echo 'background-color:#eee;';} ?>">
        <?php while($xfecha<=$fecha2) { ?>
          
            <?php $xanio=trim(date('Y',strtotime($xfecha)));?>
            <?php $xmes=date('m',strtotime($xfecha));?>
            <?php $xsema=date('W',strtotime($xfecha));?>
            <?php if($lsema!=$xsema){?>
          
              <?php if($lsema!=''){?>
              <?php if($orient=='V'){?>  
                <td>TOTAL
                </td>
              <?php } ?>     
                  <td>
                    <?php echo 'CAJAS:'.number_format($totcajsem,0); ?>
                    <br>
                    <?php echo 'CONTN:'.number_format($totcntsem,0); ?>
                    <?php $totcaj.=$totcajsem; ?>
                    <?php $totcnt.=$totcntsem; ?>
                    <?php $totcajsem=0; ?>
                    <?php $totcntsem=0; ?>
                 </td>
                  </tr>
                  <tr style="border-top:solid 1px; <?php if(($xsema % 2)==0){echo 'background-color:#eee;';} ?>">
               <?php } ?>     
       
              <td align="center"  style="font-size:<?php echo $xfontsize*2; ?>px; " width="5%" <?php if($orient=='V'){ echo ' colspan="2" ';}?> >
               <div style="display:none;"><?php echo $xfecha; ?></div>
               <?php echo $xsema; ?>
              </td>
                    
              <?php if($orient=='V'){?>  
<!--                  <td></td> -->
                </tr>
                <tr style="border-top:solid 1px; <?php if(($xsema % 2)==0){echo 'background-color:#eee;';} ?>">
              <?php } ?>     

              <?php $lsema=$xsema;?>
           <?php } ?>

              <?php if($orient=='V'){?>  
              <td style="display:none;"><?php echo $xfecha;?></td>
               <?php }else{?>     
              </td>
              <?php } ?>     
                    
                    
                    

            <?php if($orient=='V'){?>  
                <td align="center" valign="middle" width="<?php if($orient=='V'){echo'25%';}	else{echo'12%';} ?>" style="">
                <?php echo date('l',strtotime($xfecha)).'  '; ?>
                <br>
                <?php echo date('d-M-y',strtotime($xfecha)); ?>
                </td>
                <td align="center" valign="top" width="<?php if($orient=='V'){echo'65%';}	else{echo'12%';} ?>" style="">
            <?php }else{ ?>     
                <td align="center" valign="top" width="<?php if($orient=='V'){echo'10%';}	else{echo'12%';} ?>" style="">
                <?php echo date('d-M-y',strtotime($xfecha)); ?>
            <?php } ?>   
            <br>
              
            <?php $sql_pantf=$sql_pant; ?>
            <?php $sql_pantf=str_replace('XXXX-XX-XX-1',$xfecha,$sql_pantf); ?>
            <?php $sql_pantf=str_replace('XXXX-XX-XX-2',$xfecha,$sql_pantf); ?>
            <?php $res_pantf=mysql_query($sql_pantf,$link_vcrx); ?>
            <?php if($orient!='V'){?>
             <hr> 
              <?php } ?>
                  
      			<?php while($aso_pantf=mysql_fetch_assoc($res_pantf)){ ?>
              <?php $totcntsem++; ?>
              <?php $totcajsem = $totcajsem + $aso_pantf['tcant']; ?>
             <?php // echo ' '.date('d-M',$aso_pantf['fecha1']) ;?>
             <?php //echo ' '.date('d-M',strtotime($aso_pantf['fecha1'])) ;?>
<!--              <br>  -->
<!--              <br>  -->
             <?php //echo 'CANT.:'.number_format($aso_pantf['tcant'],0) ;?>
             <?php echo ' *** '.($aso_pantf['item_descri']) ;?>
             <br> 
             <br> 
             <?php echo ' HACIENDA : '.($aso_pantf['hacienda']) ;?>
<!--              <br>  -->
<!--              <br>  -->
            <?php  // echo ''.$aso_pantf['cntn'];?>  
<!--              <br>  -->
<!--              <br>  -->
            <?php  // echo ''.$aso_pantf['fecha'];?>  
            <?php  // echo ''.$aso_pantf['fecha1'];?>  
            <?php   //echo $aso_pantf['naviera'];?>  
              <?php $navi_descri= r_fiel('enti',$aso_pantf['naviera']);?>
              <?php $navi_logo= '../navi/'.$aso_pantf['naviera'].'.jpg';?>

              <?php if(file_exists($navi_logo)){ ?>
							<img src="<?php echo 'http://vcrxol.com/tfe1/navi/'.$aso_pantf['naviera'].'.jpg';?>" alt=""
									 title="<?php echo $navi_descri; ?>" style="width:90%; max-width:90%; max-height:10mm;">	
               <?php }else{ ?>  
                <?php echo $navi_descri; ?>              
               <?php } ?>  
              

            <br>
            <br>
                            <hr> 
               <br>

            <?php } ?>  

           <?php if($orient=='V'){?>  
              </td> 
              <tr style="border-top:solid 1px; <?php if (($xsema % 2)==0){echo 'background-color:#eee;';} ?>">
           <?php }else{?>     
            </td>
           <?php } ?>     
      
            <?php $xfecha=date('Y-m-d',strtotime($xfecha.' 1 day')); ?>
        <?php } ?>
        </tr>
        
<!-- 				<?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($orient=='V'){echo'height:'.($hpant1)*(.2).'px;';}	else{echo'height:'.($hpant1)*(.25).'px;';}  ?> 
                   <?php if ($aso_pant['fsema']!=$lsema){echo 'border-top:dotted 1px;'; $lsema=$aso_pant['fsema']; $gsema++;} ?>
                   <?php if (($gsema % 2)==0){echo 'background-color:#ddd;';} ?>
                   <?php //if (($gsema % 3)==0){echo 'background-color:#eee;';} ?>
                   "
						onmouseover="_filabg(event,'tr_fila','<?php echo '0'; ?>','');"
						onclick="_filabg(event,'tr_fila','<?php echo '0'; ?>','');
                    {if(document.getElementById('detadocu').checked)
										{info_tfe1('PANT2','<?php echo $aso_pant['docu']; ?>','<?php echo $aso_pant['idnum1']; ?>');}}
										<?php if($touchs=='true'){?>
										<?php } ?>
										 "
						>
					<td align="center"><span style="display:none;"><?php echo fillzero($crow,5); ?></span>
					<?php
							$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)                       
										{info_tfe1('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');} ?>
					</td>
					<td align="center" style="<?php if($dispcolu==0){echo'display:none;';}?>"
							title="<?php echo $aso_pant['docu_descri']; ?>">
						<?php echo $aso_pant['docu']; ?>
					</td>
					<td align="center" title="<?php echo $aso_pant['ptonumero']; ?>">
						<?php if($mobile=='true'){echo intval($aso_pant['numero'])	;}else{echo $aso_pant['numero'];} ?>
					</td>
          <?php
              $date1 = new DateTime($aso_pant['fecha1']);
              $date2 = new DateTime($aso_pant['fecha2']);
              $xdiff = $date1->diff($date2);
              $diff = $xdiff->days;
//               $diff=$diff*1;                                                         
//               echo $diff->days . ' days ';
          ?>
					<td align="center" >
						<div style="display:none;"><?php echo $aso_pant['fecha1']; ?></div>
						<?php  echo date('Y - W',strtotime($aso_pant['fecha1'])); ?>
					</td>
					<td align="center" >
						<span style="display:none;"><?php echo $aso_pant['fecha1']; ?></span>
						<?php if($diff!=0){echo date('l',strtotime($aso_pant['fecha1'])).'<br>'.date('d/M/Y',strtotime($aso_pant['fecha1']));} ?>
					</td>
					<td align="center">
						<span style="display:none;"><?php echo $aso_pant['fecha2']; ?></span>
						<?php if($diff!=0){echo date('l',strtotime($aso_pant['fecha2'])).'<br>'.date('d/M/Y',strtotime($aso_pant['fecha2'])). ' ('.$diff.')';} ?>
					</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_descri =$aso_pant['enti_descri'];?>
					<?php if(strlen($enti_descri)>70){$enti_descri=str_replace('-','<br>-',$enti_descri);} ?>
					<?php if(strlen($enti_descri)>70){$enti_descri=substr($enti_descri,0,70);} ?>
					
					<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 $navi_descri= r_fiel('enti',$aso_pant['naviera']);?>
          <td align="left" style="<?php if($mobile!='true' and strlen(trim($navi_descri))>20){echo 'font-size:'.($xfontsize-2).'px;';}else{} ?>"
							title="<?php echo $navi_descri; ?>">
            <?php  //echo 'http://vcrxol.com/tfe1/navi/'.($naviera).'.png';?>
						<?php// if($mobile=='true'){echo substr($navi_descri,0,20);}else{echo $navi_descri;} ?>
            <div style="display:none;"><?php echo $navi_descri;?></div>
							<img src="<?php echo 'http://vcrxol.com/tfe1/navi/'.$aso_pant['naviera'].'.jpg';?>" alt=""
									 title="<?php echo $navi_descri; ?>" style="max-width:100%; max-height:10mm;">		
            
					</td>
          <td>
            <?php
               $sql_marcas='select * from clie12 where idnum2="'.$aso_pant['idnum1'].'"'; 
               $res_marcas=mysql_query($sql_marcas,$link_vcrx);
               while($aso_marcas=mysql_fetch_assoc($res_marcas))
               { 
               echo ' CAJAS:'.number_format($aso_marcas['cant'],0).' ==> MARCA : '. $aso_marcas['item_descri'].'<br>'; 
               }
                                                         
            ?>
          </td>
					<td align="right" style="<?php if($tsubt==0){echo'display:none;';}?>">
						<div style="display:none;"><?php echo fillzero($aso_pant['stsubt'],15); ?></div>
						<?php echo number_format(abs($aso_pant['stsubt']),2); ?>
					</td>	
					<?php if($docuiimp){ ?>
						<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($tdcto==0){echo'display:none;';}?> font-style:italic;">
							<div style="display:none;"><?php echo fillzero($aso_pant['stdcto'],9); ?></div>
							<?php echo number_format(abs($aso_pant['stdcto']),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'],9); ?></div>
							<?php echo number_format(abs($aso_pant['stprop']),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'],9); ?></div>
							<?php echo number_format(abs($aso_pant['stice']),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'],9); ?></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'],9); ?></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:none;';} ?>"> 
							<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:none;';} ?>"> 
							<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 } ?>	
					<td align="right" > 
						<div style="display:none;"><?php echo fillzero($aso_pant['stotal'],15); ?></div>
						<?php echo number_format(abs($aso_pant['stotal']),2); ?>
					</td>
					<td style="<?php if($dispcolu==0 or $mconcepto==''){echo'display:none;';}?>max-width:400px;
										 <?php if(strlen(trim($aso_pant['concepto']))>50){echo 'font-size:'.($xfontsize-2).'px';} ?>"
							title="<?php echo trim($aso_pant['suco_descri']); ?>"
							>
						<?php echo trim($aso_pant['concepto']); ?>
						<?php //if($aso_pant['drtr']!=''){echo ' D:'.r_fiel('enti',$aso_pant['drtr']);}; ?>
					</td>
					<td align="center"><?php echo $aso_pant['status']; ?></td>
					<td align="center" >
					<?php
						if($aso_pant['status']!='O' and $aso_pant['status']!='X'){$tnumero++;}

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

// 						if(!mb_stristr('RX',$aso_pant['status']))
// 						{
// 							$pidtxt='anul'.'tr_fila'.$crow; $pname='itr_fila';
// 							$pidnum=$aso_pant['idnum1'];$pdocu=$aso_pant['docu'];
// 							$psize=$xfontsize;
// 							$ponclick='info_tfe1("PANTX","'.$aso_pant['idnum1'].'")';
// 							include('vrbutton2.php');
// 						}
					?>
						
					<?php if ($aso_pant['autorfec']=="") {?>
					<?php
// 						$pidtxt='btngenx'.$aso_pant['idnum1']; $pcaption='XML'; $psize=8;
// 						$ponclick="{php_func('gen_cexml(".$aso_pant['claveacc'].")')}";
// 						include('vrbutton2.php'); ?>
					<?php } ?>						

					<?php if ($aso_pant['statce']=="FIR" or $aso_pant['statce']=="SRI" and (1==2)){?>
					<?php //$pidtxt='btnrecep'.$aso_pant['idnum1']; $pcaption='Autor'; $psize=8;
						//$ponclick="{php_func('ws_recep(".$aso_pant['claveacc'].")')}";
						//include('vrbutton2.php'); ?>
					<?php } ?>						
						
					</td>
					
					<td style="font-size:80%;" align="left">
					<?php if(mb_stristr('vtas.retp.guia.clie.rolp',$tabla)  and 1==2){?>
						<?php
							if(substr($aso_pant['claveacc'],23,1)=='1'){echo 'PRUEBASX';}
							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($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')
								{
									if(mb_stristr($aso_pant['recepmsj'],'ERROR :CLAVE ACCESO REGISTRADA'))
									{echo '<br><div style="background-color:green;color:white;">'.'RECIBIDA'.'</div>';}
									else
									{echo '<br>'.$aso_pant['recepmsj'];}
								}
							};

// 							if($aso_pant['firmafec']!="" and $aso_pant['status']!='O')
							if(($aso_pant['firmafec']!="" or mb_stristr('PF.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');
							}
						?>

					<?php } ?>
					</td>
				</tr>
				<?php } ?> -->
			</tbody>
		<?php } ?>	
			<?php { // FOOT ?>
			<tfoot style="display:none; <?php if($mobile!='true'){echo 'max-width:'.($screenw-20).'px;';} ?>;background-color:#eee;">
				<tr style="border-top:solid 1px;">
					<th></th>
					<th></th>
					<th></th>
					<th></th>
					<th></th>
					<th></th>
					<th></th>
					<th></th>
					<th align="right">
						<?php echo number_format(abs($total),2); ?>
					</th>
				</tr>
				<tr style="border-top:solid 1px;">
					<th></th>
					<th></th>
					<th></th>
					<th></th>
					<th></th>
					<th></th>
					<th></th>
					<th></th>
					<th align="right">
						<?php echo number_format(abs($total),2); ?>
					</th>
				</tr>
			</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');
	}
	$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 mysql_result($res_tpant,0,'docu_descri'); ?>
					<?php echo '<br>'.'NUM: '.mysql_result($res_tpant,0,'ptonumero'); ?>
					<?php echo '<br>'.'ID : '.mysql_result($res_tpant,0,'idnum1'); ?>
					<?php echo '<br>'.'CA: '.@mysql_result($res_tpant,0,'claveacc'); ?>
				</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>
					<div style="">
					<?php echo '<strong>SUSTENTO:</strong>'.mysql_result($res_tpant,0,'suco_descri'); ?>
					</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
	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';
	}
	else{$sql_pant='select * from '.$tabla.'12 where idnum2="'.$idnum.'" order by iddet';	} 
// 	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($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 } ?>
				<th onclick="sortTable(this,<?php echo $ccol++; ?>);">TOTAL</th>
				<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="letter-spacing:10px;<?php if($dispcolu==0){echo'display:none;';}?>">DETALLE</th>
				<?php if($empr_cont=='1' and $tabla=='comp') {?>
					<th onclick="sortTable(this,<?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($modi_docu==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 ?>
    <?php $lsema=''; ?>
    <?php $gsema=0; ?>
		<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 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 ($aso_pant['fsema']!=$lsema){echo 'border-top:dotted 1px;'; $lsema=$aso_pant['fsema']; $gsema++; } ?>
                   <?php if (($gsema % 2)==0){echo 'background-color:#ddd;';} ?>
                   <?php //if (($gsema % 3)==0){echo 'background-color:#eee;';} ?>
                   <?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 '0'; ?>','');"
						onclick="_filabg(event,'tr_filad','<?php echo '0'; ?>','');";
						>
				<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($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'],9); ?></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'],9); ?></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'],9); ?></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'],9); ?></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'],9); ?></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
						$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'],9); ?></div>
						<?php echo number_format(abs($aso_pant['puni']),$dval).'%'; ?></td>
						<?php $duni=2;$dval=2; ?>
					<?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){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($modi_docu==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($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); ?>
        </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;	?>

		