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


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


<?php	val_usercodigo(); ?>


<?php
$envio=0;

$verpvp=1;
$docuiimp=1;

	$total_sql ='max(detalle) as mdetalle,';
	$total_sql.='max(item_clor) as mcolor,';
	$total_sql.='max(item_tlla) as mtalla,';
	$total_sql.='sum(case when item_descri like "KIT%" then 1 else 0 end) as itemkit,';
	$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(tice) as stice,';
		$total_sql.='sum(tiva) as stiva,';
		$total_sql.='sum(tirbp) as stirbp,';

		$total_sql.='max(dcto) as pdcto,';
		$total_sql.='max(ice) as pice,';
		$total_sql.='max(iva) as piva,';
		$total_sql.='max(irbp) as pirbp,';
	}
	$total_sql.='sum(total) as stotal ';

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

$sql_carr ='select * from carr12 ';
$sql_carr.=' where puni>0 ';
// $sql_carr.=' and item_carr=1 ';
$sql_carr.=' and docu="'.$docu.'"';
$sql_carr.=' and status!="O"';
$sql_carr.=' and status!="X"';
$sql_carr.=' and iuser="'.$user_codigo.'"';

$sql_carr.=' order by item_lsub,item_descri,item';
$sql_tcarr =str_replace('select *','select *,'.$total_sql,$sql_carr);

$res_tcarr=mysql_query($sql_tcarr,$link_vcrx);
//  echo explain_sql($sql_tcarr);

// $idcarr=mysql_result($res_tcarr,0,'idnum1');
$idcarr=get_carr($docu);

gmny_calc1('CAR1',$idcarr);
gnya_calc1('CAR1',$idcarr);


$res_tcarr=mysql_query($sql_tcarr,$link_vcrx);

    $enticarr=mysql_result($res_tcarr,0,'enti');
    $tcant=mysql_result($res_tcarr,0,'stcant');
    $tsubt=mysql_result($res_tcarr,0,'stsubt');

    $itemkit=mysql_result($res_tcarr,0,'itemkit');
		$mdetalle=mysql_result($res_tcarr,0,'mdetalle');
		$mcolor=mysql_result($res_tcarr,0,'mcolor');
		$mtalla=mysql_result($res_tcarr,0,'mtalla');
          $mcolor='';
          $mtalla='';

		if($docuiimp==1)
		{
			$tsubtiva0=mysql_result($res_tcarr,0,'stsubtiva0');
			$tsubtiva=mysql_result($res_tcarr,0,'stsubtiva');

			
			if(mb_stristr('.gnya',$cfg_empr))
			{
				$dcto0=0;
        $dcto2=0;

				//18/abr/2018
// 				if($tsubt>=20){$dcto2=20;} // removido el 25/abr/19  // reestablecido 17/may/19
// 				if($tsubt>=50 and $itemkit==1){$dcto2=40;}
        
        // 22/nov/2018
// 				if($tsubt>=200 and $itemkit==1){$dcto2=50;}
        
        // 16/jul/2019
//         $dcto2=30;
// 				if($tsubt>=200){$dcto2=40;}
        
        // 29/ago/2019
        // contar cuantos referidos activos
        
// 				if($trefa>=3){$dcto2=35;}
// 				if($tsubt>=50 and $trefa>=5){$dcto2=40;}
// 				if($tsubt>=100){$dcto2=40;}
// 				if($tsubt>=100 and $trefa>=10){$dcto2=50;}
// 				if($tsubt>=200){$dcto2=50;}
        

        // 16/dic/2019
//         $trefa=gmny_refa($enticarr);
//         $dcto2=30;
// // 				if($trefa>=3){$dcto2=35;}
// 				if($tsubt>=20){$dcto2=35;}
// 				if($tsubt>=20 and $trefa>=1){$dcto2=40;}
// 				if($tsubt>=60){$dcto2=40;}
// 				if($tsubt>=40 and $trefa>=2){$dcto2=45;}
// 				if($tsubt>=100){$dcto2=45;}
        
        // 8/mayo/2020
//         $trefa=gmny_refa($enticarr);
//         $dcto2=20;
// 				if($tsubt>=1 and $trefa>=1){$dcto2=25;}
// 				if($tsubt>=1 and $trefa>=2){$dcto2=30;}
        
        // 18/mayo/2020
//         $trefa=gmny_refa($enticarr);
        
//         $dcto2=0;
// 				if($tsubt>=50){$dcto2=10;}
        
        
	
// 				$sql_dcto2='update carr2 set dcto='.$dcto2.' where iva>0 and idnum2='.$idcarr;
// 				$res_dcto2=mysql_query($sql_dcto2,$link_vcrx);

//         $sql_dcto2='update carr2, item0 set dcto='.$dcto0.' where item=item_codigo and item_descri like "KIT%" and idnum2='.$idcarr;
// 				$res_dcto2=mysql_query($sql_dcto2,$link_vcrx);

//         $sql_dcto2='update carr2, item0 set dcto='.$dcto0.' where item=item_codigo and item_descri like "CATALO%" and idnum2='.$idcarr;
// 				$res_dcto2=mysql_query($sql_dcto2,$link_vcrx);
// // 				echo explain_sql($sql_dcto2);
// 				$res_tcarr=mysql_query($sql_tcarr,$link_vcrx);
			}

			$tdcto=mysql_result($res_tcarr,0,'stdcto');
			$tice=mysql_result($res_tcarr,0,'stice');
			$tiva=mysql_result($res_tcarr,0,'stiva');
			$tirbp=mysql_result($res_tcarr,0,'stirbp');
		}


$total=mysql_result($res_tcarr,0,'stotal');


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


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

			$trrta=0;
			$triva=0;
		}


// $user_codigo=637;
$sql_dato='select * from user0 where user_codigo="'.$user_codigo.'"';
$res_dato=mysql_query($sql_dato,$link_vcrx);

// echo '*/*/*/'.$sql_dato;

$user_datosok=1;
$user_nombre=mysql_result($res_dato,0,'user_descri');
$user_cedula=mysql_result($res_dato,0,'user_cedula');
$user_ciudad=mysql_result($res_dato,0,'user_ciudad');
$user_postal=mysql_result($res_dato,0,'user_postal');
// $user_direccion=mysql_result($res_dato,0,'user_direccion');
$user_calle1=mysql_result($res_dato,0,'user_calle1');
$user_calle2=mysql_result($res_dato,0,'user_calle2');
$user_calle3=mysql_result($res_dato,0,'user_calle3');
$user_callen=mysql_result($res_dato,0,'user_callen');
$user_referidox=mysql_result($res_dato,0,'user_referidox');

$direccion=$user_calle1.' /'.$user_calle2.' ('.$user_callen.') '.$user_calle3;


if(empty($user_cedula) or empty($user_calle1)){$user_datosok=0;}

// echo '*/*/*'.$user_cedula;
// echo '+--+-'.$user_calle1;

if(mb_stristr('gmny',$cfg_empr))
{if(empty($user_referidox)){$user_datosok=0;}}

$sql_updt ='update carr1,user0 set enti=user_cedula ';
$sql_updt.=' where iuser=user_codigo ';
$sql_updt.=' and (enti="" or enti is null)';
$sql_updt.=' and iuser="'.$user_codigo.'"';
$res_updt=mysql_query($sql_updt,$link_vcrx);

if($empr=='gmny'){$envio=4;}
if($empr=='gnya')
{
  $envio=4;
//   if(mb_stristr($user_ciudad,'GUAYAQ')){$envio=2.50;}
}


?>

<?php ob_start(); ?>
<resultado>
<div style="font-family:arial;">
  
<?php	//val_usercodigo(); ?>
<?php $tdisplay=''; ?>  
<?php //if(substr($pant,0,4)=='PANT'){$tdisplay='display:block;';}?>  

<div width="100%" style="overflow:auto;">
<?php if($mobile=='true'){?>	
<br>
<?php } ?>
	
<?php $classtab='filtro'; ?>
<?php $classcol=$classtab.'_coligua'; ?>
<?php //if($user_datosok==1)
{?>
<table id="tpant0" cellpadding="2" width="99%" border="0"
     style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:snow;">
  <tr>
	<?php $pidtxt='enti'; $pcaption="CEDULA/RUC : "; $ptabla='enti'; $pdefa=$user_cedula; $pvalue=$user_cedula; $psize=$xfontsize;  $pexact=1; include('vrgetcod.php');?>
	</tr>
  <tr>
	<?php $pidtxt='adrs'; $pcaption="DIRECCION: "; $ptabla='adrs'; $pdefa=''; $pvalue=$adrs; $psize=$xfontsize;  
     $pwhere='(adrs_user="'.$user_codigo.'" or adrs_enti like "'.$user_cedula.'%")'; 
     include('vrselopt.php');?>
	</tr>
  <tr>
		<td width="10%" align="right">
		<?php $pidtxt='f_orden';  $pcaption='ORDENAR PEDIDO'; $psize=$xfontsize;
			$ponclick="if(confirm('Ordenar Pedido ?')){php_func('carr2clie(".$idcarr.")');carr_clie();};";
		include('vrbutton.php'); ?>
		</td>
  </tr>
</table>	
<?php } ?>
<?php if($user_datosok==0){?>
<table id="filtro" cellpadding="2" width="100%" border="0" class="<?php echo $classtab?>"
			style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse;  ">
	<tr>
		<td align="right" style="color:red; font-weight:bold; text-decoration:underline; font-size:<?php echo $xfontsize+6;?>;">
			<?php echo 'DEBE COMPLETAR SUS DATOS PARA ORDENAR PEDIDO';?>
		</td>
		<td width="10%" align="right">
		<?php $pidtxt='f_datos';  $pcaption='COMPLETAR DATOS'; $psize=$xfontsize;
			$ponclick="user_dato()";
		include('vrbutton.php'); ?>
		</td>
	</tr>
</table>	
<?php } ?>
<?php if($mobile=='true'){?>	
<br>
<?php  } ?>
</div>
	<?php //echo '**'.$user_tipo;?>
<hr>
<?php $crow=0; ?>
<?php $ccol=0; ?>

<?php $res_carr=mysql_query($sql_carr,$link_vcrx); ?>
<?php //echo explain_sql($sql_carr); ?>	
<?php if(mysql_num_rows($res_carr)==0){?>
<?php  echo 'EL CARRITO ESTA VACIO'; ?>
<?php } ?>
	
<?php

	
	//esto es acumulativo para gmny
	$xdcto=0;
	if($empr=='gnya' and 1==2)
	{
		$xdcto=30;
		$fecha1=date('Y-m-d',strtotime ('-1 month')); 
		$fecha2=$fechaa;
		
		$sql_dcto ='select * from carr12 ';
		$sql_dcto.=' where puni>0 ';
		$sql_dcto.=' and docu="CAR1"';
		$sql_dcto.=' and status!="O"';
		$sql_dcto.=' and status!="X"';
		$sql_dcto.=' and item_descri like "%CATALO%"';
		$sql_dcto.=' and iuser="'.$user_codigo.'"';
		$res_dcto=mysql_query($sql_dcto,$link_vcrx);
		if(mysql_num_rows($res_dcto)!=0){$xdcto=30;}

		if($user_cedula!="")
		{
			$sql_dcto ='select *, sum(case when docu like "NC%" then abs(total)*-1 else abs(total) end) as stotal from vtas12 ';
			$sql_dcto.=' where fecha between "'.$fecha1.'" and "'.$fecha2.'"';
			$sql_dcto.=' and enti like "'.$user_cedula.'%" ';
			$res_dcto=mysql_query($sql_dcto,$link_vcrx);
			$tot_valor=mysql_result($res_dcto,0,'stotal');
			if($tot_valor>=50){$xdcto=30;}
			if($tot_valor>=300){$xdcto=40;}
			if($tot_valor>=500){$xdcto=45;}
		}
		
		$sql_dcto='update carr2 set dcto='.$xdcto.' where iva>0 and idnum2="'.$idcarr.'"';
		$res_dcto=mysql_query($sql_dcto,$link_vcrx);
	}
?>	

<?php if(1==2){ ?>  
	
<pant11>
	<div style="font-size:<?php echo $xfontsize; ?>px;">
		<table border="0" width="<?php if($orient=='V'){echo '200%';}else{echo '100%';} ?>" cellpadding="2" width="100%"
						style="font-size:<?php if($mobile=='true'){echo $xfontsize-12;}else{echo $xfontsize;} ?>px;
										max-height:<?php echo $hpant11-15; ?>px; display:none;
										border-collapse:collapse; background-color:#eee;">
			<tr valign="top" >
				<td style="display:none;">
					<?php
// 							$pcaption='Imprimir: '.mysql_result($res_tcarr,0,'docu').'-'.mysql_result($res_tcarr,0,'numero'); $pabrev='I';
// 							$pidnum=mysql_result($res_tcarr,0,'idnum1');
// 							$psize=$xfontsize;
// 							$ponclick='{window.open("print1.php?docu='.mysql_result($res_tcarr,0,'docu').'&idnum='.mysql_result($res_tcarr,0,'idnum1').'","_blank")}';
//  							include('vrbutton.php');
					?>
				</td>
				<td style="font-weight:bold; font-size:80%" width="10%">
					<?php echo mysql_result($res_tcarr,0,'docu_descri').'<br>'.mysql_result($res_tcarr,0,'ptonumero'); ?><br>
					<?php echo 'ID: '.mysql_result($res_tcarr,0,'idnum1'); ?>
				</td>
				<td>
					<div style="font-weight:bold;">
					<?php echo substr(mysql_result($res_carr,0,'enti_descri'),0,200); ?>
					</div>
					<div style="font-size:<?php if($mobile=='true' and strlen(mysql_result($res_tcarr,0,'concepto')>100)){echo $xfontsize-16;}?>px" ;>
					<?php echo substr(mysql_result($res_tcarr,0,'concepto'),0,200); ?>
					</div>
				</td>
			</tr>
		</table>
	</div>

	
	</pant11>

<?php } ?>  
  
<br>	
	
	
	
<?php $res_carr=mysql_query($sql_carr,$link_vcrx); ?>
<?php //echo $sql_carr;?>
<?php $numrows=mysql_num_rows($res_carr); ?>
  
  
	<table id="tpant2" class="pant2" border="0" cellpadding="3" width="100%" align="left"
				 style="font-size:<?php if($mobile=='true'){echo $xfontsize-12;}else{echo $xfontsize+6;} ?>px;
								overflow-x:hidden;
								border-collapse:collapse; "
						 >
		<?php { // THEAD ?>
		<thead style="<?php echo $tdisplay; ?>">
			<tr style="border-bottom:solid 1px;background-color:#eee;">
				<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" title="Linea">L</th>
				<th style="<?php if($dispcolu==0){echo 'display:none;';} ?><?php echo $ccol++; ?>"></th>	
				<?php if($docuiimp==1){ ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Cantidad" width="10%">Img</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Código" style="">Código</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($mcolor==''){echo'display:none;';}?>" title="Color">Color</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($mtalla==''){echo'display:none;';}?>" title="Talla">Talla</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" title="Descripción">Descripción</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" title="Cantidad">Cant</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" title="Prec.Unitario">P.Uni</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" style="<?php if($tsubt==0){echo'display:none;';}?>">Sub-Tot</th>			
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" style="<?php if($tdcto==0){echo'display:none;';}?>">Dcto</th>	
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" style="<?php if($tice==0){echo'display:none;';}?>">ICE</th>	
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" style="<?php if($tiva==0){echo'display:none;';}?>">IVA</th>	
					<th onclick="sortTable(this,<?php echo $ccol++; ?>,'N');" style="<?php if($tirbp==0){echo'display:none;';}?>">IRBP</th>
	<!-- 				<th onclick="sortTable(this,3);" title="Precio Unitario">PVP</th> -->
				<?php } ?>
				<th onclick="sortTable(this,<?php echo $ccol++; ?>);">TOTAL</th>
				<th width="10%" align="right">
					<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('Vaciar Carrito ?')){php_func('del_carr(".$idcarr.")');carr_clie();};";
// 					$ponclick="if(confirm('Vaciar Carrito ?')){del_carr('".$idcarr."');carr_clie();};";
// 					$ponclick='';
					include('vrbutton.php'); ?>
				</th>
				
			</tr>
		</thead>
		<?php } ?>
		<?php// $res_carr=mysql_query($sql_carr,$link_vcrx); ?>
		<?php { // TBODY ?>
		<tbody id="bodypant2" style="overflow-y:auto;  border-bottom:solid 1px; <?php echo $tdisplay; ?>
					<?php if($orient=='V'){echo'min-height:'.($hpant2-75).'px;';}else{echo'min-height:'.($hpant2-75).'px;';}  ?> 
					<?php if($orient=='V'){echo'height:'.($hpant2-75).'px;';}else{echo'height:'.($hpant2-75).'px;';}  ?> ">
			<?php while($aso_carr=mysql_fetch_assoc($res_carr)){ ?>
			<?php $crow++; ?>
			<?php $item_codigo=$aso_carr['item']; ?>
			<?php $xcodigov=$aso_carr['item_codigov']; ?>
			<?php //$xcodigov=$aso_carr['item_codigov']; ?>
      
      <?php //if(mb_stristr('gnya.gmny',$cfg_empr)){$xcodigov=substr($item_codigo,0,8);} ?>
      
			<?php $duni=$aso_carr['item_duni']; ?>
			<?php $dval=$aso_carr['item_dval']; ?>
			<?php if($dval==0){$dval=2;} ?>
			<?php //if(ceil($aso_carr['cant'])!=floor($aso_carr['cant']) and $duni==0){$duni=2;} ?>
			<tr id="tr_filad<?php echo $crow;?>" class="tr_filad" valign="middle"
						style="<?php if ($crow%5==0){echo 'border-bottom:dotted 1px;'; } ?><?php if ($crow==$numrows){echo 'border-bottom:solid 2px;'; } ?>
									 font-size:<?php if($mobile=='true'){echo $xfontsize-6;}else{echo $xfontsize+6;}?>"
						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 $crow; ?>
				</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
						$sql_imgi='select * from imgi0 where imgi_item like "'.$aso_carr['item_raiz'].'%" order by imgi_defa desc, imgi_file';
						$res_imgi=mysql_query($sql_imgi,$link_vcrx);
						?>
						<?php if(mysql_num_rows($res_imgi)>0){?>
							<?php $pidtxt=$item_raiz; $ptabla='imgi'; $pcodigo=$aso_carr['item_raiz']; $pobj=1; $psize=48; include('vrsayimgs.php');?>
						<?php } ?>
					</td>
					<td align="left" style="" title="<?php echo $aso_carr['itemce']; ?>">
						<a href="/?scri=shop_item&buscar=<?php echo substr($aso_carr['item'],0,10);?>">
						<?php echo $xcodigov; ?>
						</a>
					</td>
					<td align="center" style="font-size:70%; <?php if($mcolor==''){echo 'display:none;';} ?>" title="">
						<span style="display:none;"><?php echo $aso_carr['item_clor']; ?></span>
						<?php echo r_fiel('clor',$aso_carr['item_clor']); ?>
					</td>
					<td align="center" style="font-size:70%; <?php if($mtalla==''){echo 'display:none;';} ?>" title="">
						<span style="display:none;"><?php echo $aso_carr['item_tlla']; ?></span>
						<?php //echo substr($aso_carr['item_codigov'],6,3) ; ?>
						<?php echo substr(r_fiel('tlla',$aso_carr['item_tlla']),0,5); ?>
					</td>
					<td align="left" title="<?php echo $aso_carr['itemce']; ?>"
								style="<?php if(strlen(trim($aso_carr['item_descri']))>20){echo 'font-size:80%';} ?>">
						<?php echo $aso_carr['item_descri']; ?>
					</td>
					<td align="center" 
							ondblclick="{window.open('?ctlgi=1&item=<?php echo $aso_carr['item_raiz'];?>','_parent')}";
							>
						<?php echo number_format(abs($aso_carr['cant']),$duni); ?>
					</td>
					<td align="right">
						<div style="display:none;"><?php echo fillzero($aso_carr['puni'],15); ?></div>
						<?php echo number_format(abs($aso_carr['puni']),$dval); ?>
					</td>
					<td align="right" style="<?php if($tsubt==0){echo'display:none;';} ?>" >
						<div style="display:none;"><?php echo fillzero($aso_carr['tsubt'],15); ?></div>
						<?php echo number_format(abs($aso_carr['tsubt']),$dval); ?>
					</td>
					<td align="right" style="<?php if($tdcto==0){echo'display:none;';} ?>font-style:italic;" title="<?php echo number_format(abs($aso_carr['dcto']),$dval).'%'; ?>">
						<div style="display:none;"><?php echo fillzero($aso_carr['tdcto'],9); ?></div>
						<?php echo number_format(abs($aso_carr['tdcto']),$dval); ?>
					</td>
					<td align="right" style="<?php if($tice==0){echo'display:none;';} ?>font-style:italic;" title="<?php echo number_format(abs($aso_carr['ice']),$dval).'%'; ?>">
						<div style="display:none;"><?php echo fillzero($aso_carr['tice'],9); ?></div>
						<?php echo number_format(abs($aso_carr['tice']),$dval); ?>
					</td>
					<td align="right" style="<?php if($tiva==0){echo'display:none;';} ?>font-style:italic;" title="<?php echo number_format(abs($aso_carr['iva']),$dval).'%'; ?>">
						<div style="display:none;"><?php echo fillzero($aso_carr['tiva'],9); ?></div>
						<?php echo number_format(abs($aso_carr['tiva']),$dval); ?>
					</td>
					<td align="right" style="<?php if($tirbp==0){echo'display:none;';} ?>font-style:italic;" title="<?php echo number_format(abs($aso_carr['irbp']),$dval); ?>">
						<div style="display:none;"><?php echo fillzero($aso_carr['tirbp'],9); ?></div>
						<?php echo number_format(abs($aso_carr['tirbp']),$dval); ?>
					</td>
				<?php } ?>
					
						<td align="right" style="<?php if($total==0){echo'display:none;';} ?>">
								<div style="display:none;"><?php echo fillzero($aso_carr['total'],15); ?></div>
								<?php echo number_format(abs($aso_carr['total']),$dval); ?>
						</td>
						
						<td align="right" style="">
							<?php $pidtxt='del_'.$aso_carr['iddet'].$aso_carr['iddet'];
							$pcaption='X';
							$ptitle='Eliminar'.$aso_carr['item_codigov'];
							$pabrev='X'; $psize=$xfontsize+3;
              $item_descri=$aso_carr['item_descri'];
              $item_descri=str_replace('"','\"',$item_descri);                                                       
              $item_descri=str_replace("'","\'",$item_descri);                                                       
							$ponclick="if(confirm('Eliminar Código : ".$aso_carr['item_codigov']."-".$item_descri." ?')){php_func('del_carr(".$aso_carr['idnum1'].",".$aso_carr['iddet'].")');carr_clie();};";
							include('vrbutton.php'); ?>
						</td>

				</tr>

			<?php } ?>
			</tbody>	
		<?php } ?>
		<?php { // TFOOT ?>
			<tfoot id="detafoot" style="<?php echo $tdisplay; ?>">
				<tr style="border-top:solid 1px;background-color:#eee;"><?php echo str_repeat('<th></th>',$ccol-1); ?></tr>
			</tfoot>
		<?php } ?>
	</table>	
	<hr>
  
<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-6;}else{echo $xfontsize+6;} ?>px;
										border-collapse:collapse; background-color:#eee;">
			<tr>
				<?php if($tcant!=0){ ?><th align="center">UNIDS:</th><?php }?>
				<?php if($tsubt!=0){ ?><th align="center">SUBT:</th><?php }?>
				<?php if($tdcto!=0){ ?><th align="center">DCTO:</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($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($total!=0 and mb_stristr('gmny.gnya',$empr)){ ?><th align="center">ENVIO:</th><?php }?>
				<?php if($total!=0){ ?><th align="center">TOTAL:</th><?php }?>
				</tr>
			<tr>
					<?php //if(ceil($tcant)==floor($tcant)){$duni=0;}else{$duni=2;} ?>
					<?php if($tcant!=0){ ?><td align="center"><?php echo number_format(abs($tcant),$duni); ?></td><?php }?>
					<?php if($tsubt!=0){ ?><td align="center"><?php echo number_format(abs($tsubt),2); ?></td><?php }?>
					<?php if($tdcto!=0){ ?><td align="center"><?php echo number_format($tdcto,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($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($total!=0 and mb_stristr('gmny.gnya',$empr)){ $total=$total+$envio; ?><td align="center"><?php echo number_format($envio,2); ?></td><?php } ?>
					<?php if($total!=0){ ?><td align="center"><?php echo number_format(abs($total),2); ?></td><?php }?>
	<?php if($user_datosok==1){?>
	<td width="10%" align="left">
		<?php $pidtxt='f_orden';  $pcaption='ORDENAR PEDIDO'; $psize=$xfontsize;
			$ponclick="if(confirm('Ordenar Pedido ?')){php_func('carr2clie(".$idcarr.")');carr_clie();};";
		include('vrbutton.php'); ?>
	</td>
	<?php } ?>
			</tr>
		</table>
	</div>
	
	
	
<!-- 	
<table id="tpant1" class="pant1" border="0"
			 onclick="resizeTab('<?php echo "tpant1"?>','');"
			 align="center" border="0" cellpadding="3" width="100%"
			 style="font-size:<?php if($mobile=='true'){echo $xfontsize-8;}else{echo $xfontsize;} ?>px;
							 border-collapse:collapse; "
				 >

	<?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">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++; ?>);"><?php if($mobile=='true'){echo 'NUM.';}else{echo 'NUMERO';} ?></th>
			<th onclick="sortTable(this,<?php echo $ccol++; ?>);">LINEA</th>
			<th onclick="sortTable(this,<?php echo $ccol++; ?>);">CODIGO</th>
			<th onclick="sortTable(this,<?php echo $ccol++; ?>);">DESCRIPCION</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; "><?php echo $entilabel; ?></th>
			<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($tsubt==0){echo'display:none;';}?> <?php echo 'font-size:'.($xfontsize*0.8).';' ?> ">SUB-TOT</th>			
			<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;';}?>">CONCEPTO</th>
			<th onclick="sortTable(this,<?php echo $ccol++; ?>);">ST</th>
			<th>OX</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 while($aso_carr=mysql_fetch_assoc($res_carr)){ ?>
		<?php $crow++; ?> 
		<?php //$struc=$aso_carr['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;'; } ?> "
				onclick="_filabg(event,'tr_fila','<?php echo $crow; ?>','');
								<?php if($touchs=='true'){?>
								info_docu('PANT2','<?php echo $aso_carr['item_codigo']; ?>','<?php echo $aso_carr['idnum1']; ?>');
								<?php } ?>
								 "
				ondblclick="{document.getElementById('detadocu').checked='true';document.getElementById('detadocu').onchange();this.onclick();}"
				>
			<td align="center"><span style="display:none;"><?php echo fillzero($crow,5); ?></span>
			<?php
				echo $aso_carr['item_codigo'];
				echo '<br>';
				echo $aso_carr['item_descri'];
				echo '<br>';
				echo $aso_carr['item_puni'];
			?>
			</td>
		</tr>
		<?php } ?>
	</tbody>
<?php } ?>	
	<?php { // FOOT ?>
	<tfoot style="display:block; <?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>
		</tr>
	</tfoot>
	<?php } ?>	
</table>
	
	 -->
<?php $pant='X';?>
	
<?php if(mb_stristr('PANT0',$pant)) { ?>
<?php $fecha1=date('Y-m-01',strtotime ('today')); ?>
<?php $fecha2=$fechaa; ?>
		<div id="pant0" style="border:solid 2px; overflow:auto;font-family:arial;">
		<?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><?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; ">
				<tr>
					<td align="center" width="50%">
					<?php $pidtxt='consul'; $pcaption='Consultar '.$docu; $ponclick='info_docu("PANT1","'.$docu.'")'; $psize=$xfontsize; include('vrbutton.php'); ?>
					</td>
					<td align="center">
					<?php $pidtxt='nueva'; $pcaption='Nueva'; $ponclick='info_docu("PANT1")'; $psize=$xfontsize; include('vrbutton.php'); ?>
					</td>
					<td align="center">
					<?php $pidtxt='detadocu'; $pcaption='Detalle'; $ponclick='info_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; ">
				<tr>
					<td>
						<table width="100%" cellpadding="2" width="100%" border="0"
									style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; ">
							<tr>
								<td>
									<table width="100%" cellpadding="2" width="100%" border="0"
												 style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse;">
										<tr>
											<td><?php $pidtxt='fecha1'; $pcaption='Desde'; $pdefa=$fecha1; $psize=$xfontsize; include('vrgetfec.php'); ?></td>
										</tr>
										<tr>
											<td><?php $pidtxt='fecha2'; $pcaption='Hasta'; $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; ">
										<tr>
											<td><?php $pidtxt='enti'; $ptabla='enti'; $pnotob="1"; $psize=$xfontsize; $pcaption=$entilabel; include('vrgetcod.php'); ?></td>
										</tr>
										<tr>
											<td><?php $pidtxt='stat'; $pcaption='Status'; $ptabla='stat'; $pnotob="1"; $psize=$xfontsize; include('vrgetcod.php'); ?></td>
										</tr>
									</table>
								</td>
								<td><?php $pidtxt='consul'; $pcaption='Consultar '.$docu; $ponclick='info_docu("PANT1","'.$docu.'")'; $psize=$xfontsize; include('vrbutton.php'); ?></td>
								<td><?php $pidtxt='nueva'; $pcaption='Nueva'; $ponclick='info_docu("PANT1");'; $psize=$xfontsize; include('vrbutton.php'); ?></td>
								<td><?php $pidtxt='detadocu'; $pcaption='Detalle'; $ponclick='info_docu("DETA");'; $psize=$xfontsize; $pdefa=0; include('vrchkbox.php'); ?></td>
							</tr>
						</table>
					</td>	
				</tr>	
			</table>
		<?php } ?>
		</div>	
		<div id="pant1" style="border:solid 1px; overflow:auto; font-family:arial;"></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;"></div>
		<div id="pant9"></div>
<?php } ?>			
	
<?php if(mb_stristr('PANT1',$pant)) { ?>
	<?php { 
		$sql_pant='select * from '.$tabla.'12 ';
		$sql_pant.=' where (fecha between "'.$fecha1.'" and "'.$fecha2.'")';
		$sql_pant.=' and docu like "'.$docu.'%"';
		if($enti!=""){$sql_pant.=' and (enti like "'.$enti.'%" or enti_descri like "%'.$enti.'%")';}
		if($stat!=""){$sql_pant.=' and (status="'.$stat.'")';}

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

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

		$sql_pant.=' order by fecha desc,ptoe,numero desc';

		$res_carr=mysql_query($sql_pant,$link_vcrx);
		$res_tcarr=mysql_query($sql_tcarr,$link_vcrx);

		$tcant=mysql_result($res_tcarr,0,'stcant');
		$tsubt=mysql_result($res_tcarr,0,'stsubt');
		if($docuiimp==1)
		{
			$tsubtiva0=mysql_result($res_tcarr,0,'stsubtiva0');
			$tsubtiva=mysql_result($res_tcarr,0,'stsubtiva');
			$tdcto=mysql_result($res_tcarr,0,'stdcto');
			$tice=mysql_result($res_tcarr,0,'stice');
			$tiva=mysql_result($res_tcarr,0,'stiva');
			$tirbp=mysql_result($res_tcarr,0,'stirbp');
		}

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

		if(mb_stristr('retc.retp',$tabla))
		{
			$tbrta=mysql_result($res_tcarr,0,'sbrta');
			$tbiva=mysql_result($res_tcarr,0,'sbiva');
			$tprta=mysql_result($res_tcarr,0,'sprta');
			$tpiva=mysql_result($res_tcarr,0,'spiva');
			$trrta=mysql_result($res_tcarr,0,'srrta');
			$triva=mysql_result($res_tcarr,0,'sriva');
		}

		$total=mysql_result($res_tcarr,0,'stotal');

		if($dispcolu=='true')
		{
			$tsubt=0;
			$tsubtiva=0;	
			$tsubtiva0=0;
			$tdcto=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>
		<table id="tpant1" class="pant1" border="0"
					 onclick="resizeTab('<?php echo "tpant1"?>','');"
					 align="center" border="0" cellpadding="3" width="100%"
					 style="font-size:<?php if($mobile=='true'){echo $xfontsize-8;}else{echo $xfontsize;} ?>px;
									 border-collapse:collapse; "
						 >
			<?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">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++; ?>);"><?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; "><?php echo $entilabel; ?></th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($tsubt==0){echo'display:none;';}?> <?php echo 'font-size:'.($xfontsize*0.8).';' ?> ">SUB-TOT</th>			
					<?php if($docuiimp==1){?>
						<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($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($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',$tabla)){?>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>">Base RTA</th>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>">%Ret.</th>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>">Ret.RTA</th>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>">Base IVA</th>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>">%Ret.</th>
						<th onclick="sortTable(this,<?php echo $ccol++; ?>);" style="<?php if($dispcolu==0){echo'display:none;';} ?>" >Ret.IVA</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;';}?>">CONCEPTO</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">ST</th>
					<th>OX</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 while($aso_carr=mysql_fetch_assoc($res_carr)){ ?>
				<?php $crow++; ?> 
				<?php $tipoid=$aso_carr['enti_tipoid']; ?>
				<?php $tiporuc=$aso_carr['enti_tiporuc']; ?>
				<?php $struc=$aso_carr['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;'; } ?> "
						onclick="_filabg(event,'tr_fila','<?php echo $crow; ?>','');
										<?php if($touchs=='true'){?>
										info_docu('PANT2','<?php echo $aso_carr['docu']; ?>','<?php echo $aso_carr['idnum1']; ?>');
										<?php } ?>
										 "
						ondblclick="{document.getElementById('detadocu').checked='true';document.getElementById('detadocu').onchange();this.onclick();}"
						>
					<td align="center"><span style="display:none;"><?php echo fillzero($crow,5); ?></span>
					<?php ?>
					</td>
					<td align="center" style="<?php if($dispcolu==0){echo'display:none;';}?>" title="<?php echo 'ID:'.$aso_carr['idnum1'];?>"
							onclick="
										<?php if($touchs=='false'){?>
										info_docu('PANT2','<?php echo $aso_carr['docu']; ?>','<?php echo $aso_carr['idnum1']; ?>');
										<?php } ?>
										 ">
						<?php if($mobile!='true'){$pidtxt='radio'.'tr_fila'.$crow; $pname='rtr_fila'; $pcaption=''; $psize=$xfontsize; include('vrradio.php');} ?>
					</td>
					<td align="center" title="<?php echo $aso_carr['docu'].'-'.$aso_carr['ptonumero']; ?>">
						<?php if($mobile=='true'){echo intval($aso_carr['numero'])	;}else{echo $aso_carr['numero'];} ?>
					</td>
					<td align="center">
						<div style="display:none;"><?php echo $aso_carr['fecha']; ?></div>
						<?php echo $aso_carr['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_carr['enti'],0,10); ?>
					</td>
					<td align="left" style="<?php if($mobile!='true' and strlen(trim($aso_carr['enti_descri']))>20){echo 'font-size:'.($xfontsize-2).'px;';}else{} ?>"
							title="<?php echo ' /RS: '.$aso_carr['enti_razsoc']; ?>">
						<?php if($mobile=='true'){echo substr($aso_carr['enti_descri'],0,20);}else{echo $aso_carr['enti_descri'];} ?>
					</td>
					<td align="right" style="<?php if($tsubt==0){echo'display:none;';}?>">
						<div style="display:none;"><?php echo fillzero($aso_carr['stsubt'],15); ?></div>
						<?php echo number_format(abs($aso_carr['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_carr['stsubtiva0'],15); ?></div>
							<?php echo number_format(abs($aso_carr['stsubtiva0']),2); ?>
						</td>	
						<td align="right" style="<?php if($tsubtiva==0){echo'display:none;';}?>">
							<div style="display:none;"><?php echo fillzero($aso_carr['stsubtiva'],15); ?></div>
							<?php echo number_format(abs($aso_carr['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_carr['stdcto'],9); ?></div>
							<?php echo number_format(abs($aso_carr['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_carr['stice'],9); ?></div>
							<?php echo number_format(abs($aso_carr['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_carr['stiva'],9); ?></div>
							<?php echo number_format(abs($aso_carr['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_carr['stirbp'],9); ?></div>
							<?php echo number_format(abs($aso_carr['stirbp']),2); ?>
						</td>	
				<?php } ?>
					<?php if(mb_stristr('retc.retp',$tabla)){?>
						<td align="right" style="<?php if($dispcolu==0){echo'display:none;';} ?>"> 
							<div style="display:none;"><?php echo fillzero($aso_carr['sbrta'],15); ?></div>
							<?php echo number_format(abs($aso_carr['sbrta']),2); ?>
						</td>
						<?php if(ceil($aso_carr['sprta'])==floor($aso_carr['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_carr['sprta'],7); ?></div>
							<?php echo number_format(abs($aso_carr['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_carr['srrta'],15); ?></div>
							<?php echo number_format(abs($aso_carr['srrta']),2); ?>
						</td>
						<td align="right" style="<?php if($dispcolu==0){echo'display:none;';} ?>"> 
							<div style="display:none;"><?php echo fillzero($aso_carr['sbiva'],15); ?></div>
							<?php echo number_format(abs($aso_carr['sbiva']),2); ?>
						</td>
						<?php if(ceil($aso_carr['spiva'])==floor($aso_carr['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_carr['spiva'],7); ?></div>
							<?php echo number_format(abs($aso_carr['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_carr['sriva'],15); ?></div>
							<?php echo number_format(abs($aso_carr['sriva']),2); ?>
						</td>
					<?php } ?>	
					<td align="right" > 
						<div style="display:none;"><?php echo fillzero($aso_carr['stotal'],15); ?></div>
						<?php echo number_format(abs($aso_carr['stotal']),2); ?>
					</td>
					<td style="<?php if($dispcolu==0){echo'display:none;';}?>
										 <?php if(strlen(trim($aso_carr['concepto']))>50){echo 'font-size:'.($xfontsize-2).'px';} ?>"
							title="<?php echo trim($aso_carr['suco_descri']); ?>"
							>
						<?php echo trim($aso_carr['concepto']); ?>
					</td>
					<td align="center"><?php echo $aso_carr['status']; ?></td>
					<td align="center" >
					<?php
						if($aso_carr['status']!='O' and $aso_carr['status']!='X'){$tnumero++;}
						if($aso_carr['status']=='O')
						{$pcaption='Eliminar: '.$aso_carr['docu'].'-'.$aso_carr['numero']; $pabrev='X';}
						if(!mb_stristr('ROX',$aso_carr['status']))
						{$pcaption='Anular: '.$aso_carr['docu'].'-'.$aso_carr['numero']; $pabrev='O';}
						if(!mb_stristr('RX',$aso_carr['status']))
						{
							$pidtxt='anul'.'tr_fila'.$crow; $pname='itr_fila';
							$pidnum=$aso_carr['idnum1'];$pdocu=$aso_carr['docu'];
							$psize=$xfontsize;
							$ponclick='info_docu("PANTX","'.$aso_carr['idnum1'].'")';
							include('vrbutton.php');
						}
					?>
					</td>
				</tr>
				<?php } ?>
			</tbody>
		<?php } ?>	
			<?php { // FOOT ?>
			<tfoot style="display:block; <?php if($mobile!='true'){echo 'max-width:'.($screenw-20).'px;';} ?>;background-color:#eee;">
				<tr style="border-top:solid 1px;">
					<th></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:250px;letter-spacing:10px; "><?php if(1==1){echo 'TOTALES';} ?></th>
					<th align="right" style="<?php if($tsubt==0){echo'display:none;';}?>">
						<?php echo number_format(abs($tsubt),2); ?>
					</th>	
					<?php if($docuiimp==1){ ?>
						<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($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($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',$tabla)){ ?>
						<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>
				</tr>
				<?phpif($tnumero>0){?>
				<tr style="border-top:solid 1px;">
					<th></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){echo'display:none;';}?>">
						<?php echo number_format(abs($tsubt/$tnumero),2); ?>
					</th>
					<?php if($docuiimp==1){ ?>
						<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($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($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',$tabla)){?>
						<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>
				</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',$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_tcarr =str_replace('select *','select *,'.$total_sql,$sql_pant);

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

	$res_carr=mysql_query($sql_pant,$link_vcrx); 

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

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

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

	if(mb_stristr('retc.retp',$tabla))
	{
		$trrta=mysql_result($res_tcarr,0,'srrta');
		$triva=mysql_result($res_tcarr,0,'sriva');
	}
}
// explain_sql($sql_pant);
}	?>
<pant11>
	<div style="font-size:<?php echo $xfontsize; ?>px;">
		<table border="0" width="<?php if($orient=='V'){echo '200%';}else{echo '100%';} ?>" cellpadding="2" width="100%"
						style="font-size:<?php if($mobile=='true'){echo $xfontsize-12;}else{echo $xfontsize;} ?>px;
										max-height:<?php echo $hpant11-15; ?>px;
										border-collapse:collapse; background-color:#eee;">
			<tr valign="top" >
				<td>
					<?php
							$pcaption='Imprimir: '.mysql_result($res_tcarr,0,'docu').'-'.mysql_result($res_tcarr,0,'numero'); $pabrev='I';
							$pidnum=mysql_result($res_tcarr,0,'idnum1');
							$psize=$xfontsize;
// 							$ponclick='print_docu("'.mysql_result($res_tcarr,0,'docu').'","'.mysql_result($res_tcarr,0,'idnum1').'")';
							$ponclick='{window.open("print1.php?docu='.mysql_result($res_tcarr,0,'docu').'&idnum='.mysql_result($res_tcarr,0,'idnum1').'&enti='.$enti_cedula.'","_blank")}';
 							include('vrbutton.php');
					?>
				</td>
				<td style="font-weight:bold; font-size:80%" width="10%">
					<?php echo mysql_result($res_tcarr,0,'docu_descri').'<br>'.mysql_result($res_tcarr,0,'ptonumero'); ?><br>
					<?php echo 'ID: '.mysql_result($res_tcarr,0,'idnum1'); ?>
				</td>
				<td>
					<div style="font-weight:bold;">
					<?php echo substr(mysql_result($res_carr,0,'enti_descri'),0,200); ?>
					</div>
					<div style="font-size:<?php if($mobile=='true' and strlen(mysql_result($res_tcarr,0,'concepto')>100)){echo $xfontsize-16;}?>px" ;>
					<?php echo substr(mysql_result($res_tcarr,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_tcarr,0,'suco_descri'); ?>
					</div>
				</td>
				<td align="right">
					<div style="">
					<?php echo '<strong>Ret.RTA.: </strong>'.number_format(mysql_result($res_tcarr,0,'strrta'),2); ?>
					</div>
					<div style="">
					<?php echo '<strong>Ret.IVA.: </strong>'.number_format(mysql_result($res_tcarr,0,'striva'),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($tdcto!=0){ ?><th align="center">DCTO:</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($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 and mb_stristr('gmny.gnya',$empr)){ ?><th>ENVIO:</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($tdcto!=0){ ?><td align="center"><?php echo number_format($tdcto,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($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 and mb_stristr('gmny.',$empr)){ $total+=4;?><td align="center">4.00</td><?php }?>
					<?php if($total!=0){ ?><td align="center"><?php echo number_format(abs($total),2); ?></td><?php }?>
			</tr>
		</table>
	</div>
	<?php } ?>
</pant11>
	

<pant2>
<?php $crow=0; ?>
<?php $ccol=0; ?>
<?php
	if(mb_stristr('retc.retp',$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';	} 
	$res_carr=mysql_query($sql_pant,$link_vcrx);	
?>
<?php $numrows=mysql_num_rows($res_carr); ?>
	<table id="tpant2" class="pant2" align="left" border="0" cellpadding="3" width="100%"
				 style="font-size:<?php if($mobile=='true'){echo $xfontsize-8;}else{echo $xfontsize;} ?>px;
								overflow-x:hidden;
								border-collapse:collapse; "
						 >
		<?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($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 } ?>
			</tr>
		</thead>
		<?php } ?>
		<?php { // TBODY ?>
		<tbody 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-75).'px;';}  ?> 
					<?php if($orient=='V'){echo'height:'.($hpant2-75).'px;';}else{echo'height:'.($hpant2-75).'px;';}  ?> ">
			<?php while($aso_carr=mysql_fetch_assoc($res_carr)){ ?>
			<?php $crow++; ?>
			<?php $duni=$aso_carr['item_duni']; ?>
			<?php $dval=$aso_carr['item_dval']; ?>
			<?php if($dval==0){$dval=2;} ?>
			<?php //if(ceil($aso_carr['cant'])!=floor($aso_carr['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($mobile=='true'){echo $xfontsize-8;}else{echo $xfontsize;}?>"
						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_carr['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_carr['cant']),$duni); ?></td>
					<td align="left" style="<?php if($dispcolu==09){echo'display:none;';}?>" title="<?php echo $aso_carr['itemce']; ?>">
						<?php echo $aso_carr['item']; ?>
					</td>
					<td align="left" title="<?php echo $aso_carr['itemce']; ?>"
								style="<?php if(strlen(trim($aso_carr['item_descri']))>20){echo 'font-size:80%';} ?>">
						<?php echo $aso_carr['item_descri']; ?>
					</td>
					<td align="right">
						<div style="display:none;"><?php echo fillzero($aso_carr['puni'],15); ?></div>
						<?php echo number_format(abs($aso_carr['puni']),$dval); ?>
					</td>
					<td align="right">
						<div style="display:none;"><?php echo fillzero($aso_carr['tsubt'],15); ?></div>
						<?php echo number_format(abs($aso_carr['tsubt']),$dval); ?>
					</td>
					<td align="right" style="<?php if($tdcto==0){echo'display:none;';} ?>font-style:italic;" title="<?php echo number_format(abs($aso_carr['dcto']),$dval).'%'; ?>">
						<div style="display:none;"><?php echo fillzero($aso_carr['tdcto'],9); ?></div>
						<?php echo number_format(abs($aso_carr['tdcto']),$dval); ?>
					</td>
					<td align="right" style="<?php if($tice==0){echo'display:none;';} ?>font-style:italic;" title="<?php echo number_format(abs($aso_carr['ice']),$dval).'%'; ?>">
						<div style="display:none;"><?php echo fillzero($aso_carr['tice'],9); ?></div>
						<?php echo number_format(abs($aso_carr['tice']),$dval); ?>
					</td>
					<td align="right" style="<?php if($tiva==0){echo'display:none;';} ?>font-style:italic;" title="<?php echo number_format(abs($aso_carr['iva']),$dval).'%'; ?>">
						<div style="display:none;"><?php echo fillzero($aso_carr['tiva'],9); ?></div>
						<?php echo number_format(abs($aso_carr['tiva']),$dval); ?>
					</td>
					<td align="right" style="<?php if($tirbp==0){echo'display:none;';} ?>font-style:italic;" title="<?php echo number_format(abs($aso_carr['irbp']),$dval); ?>">
						<div style="display:none;"><?php echo fillzero($aso_carr['tirbp'],9); ?></div>
						<?php echo number_format(abs($aso_carr['tirbp']),$dval); ?>
					</td>
				<?php } ?>
				<?php if($docudocu==1){ ?>
				<?php //$duni=2;
           $dval=2; ?>
				<?php if($dispcolu==0){$docum=$aso_carr['docum'];}else{$docum=$aso_carr['docum_descri'];} ?>
					<td align="center" style=""><?php echo $docum; ?></td>
					<?php if($dispcolu==0){$numer=$aso_carr['numer'];}else{$numer=$aso_carr['ptonumer'];} ?>
					<td align="center" style="" ><?php echo $numer; ?></td>
					<td align="center"><?php echo number_format(abs($aso_carr['cant']),$duni); ?></td>
					<?php if($aso_carr['puni']>=30 and $aso_carr['cair']==0){$cair='IVA';$cair_descri='';}
						else{$cair='('.$aso_carr['cair'].')';$cair_descri=$aso_carr['cair_descri'];}?>
					<?php if($dispcolu==0){$cair_descri='';} ?>
					<td align="center" ><?php echo $cair_descri.' '.$cair; ?></td>
					<?php if(ceil($aso_carr['puni'])==floor($aso_carr['puni'])){$dval=0;}else{$dval=2;}?>
					<td align="right"><div style="display:none;"><?php echo fillzero($aso_carr['puni'],9); ?></div>
						<?php echo number_format(abs($aso_carr['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_carr['total'],15); ?></div>
								<?php echo number_format(abs($aso_carr['total']),$dval); ?>
						</td>
						<td align="left" style="<?php if($dispcolu==0){echo'display:none;';} ?>
																		<?php if(strlen(trim($aso_carr['detalle']))>20){echo 'font-size:80%';} ?>">
							<?php echo $aso_carr['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_carr['ctas']; ?>
						</td>
						<td align="left" style="<?php if($dispcolu==0){echo'display:none;';} ?>">
							<?php echo $aso_carr['ctas_descri']; ?>
						</td>
						<td align="center" title="<?php echo $aso_carr['cair_descri']; ?>">
							<?php echo $aso_carr['cair']; ?>
						</td>
						<td align="right" style="<?php if($dispcolu==0){echo'display:none;';} ?>" 
								title="<?php echo number_format($aso_carr['rrta'],2).'%'; ?>">
							<?php echo number_format($aso_carr['rrta'],2).''; ?>
						</td>
						<td align="right" style="<?php if($dispcolu==0){echo'display:none;';} ?>"
								title="<?php echo number_format($aso_carr['riva'],2).'%'; ?>">
							<?php echo number_format($aso_carr['riva'],2).''; ?>
						</td>
						<?php } ?>
				</tr>

			<?php } ?>
			</tbody>	
		<?php } ?>
		<?php { // TFOOT ?>
			<tfoot style="display:block;">
				<tr style="border-top:solid 1px;background-color:#eee;"><?php echo str_repeat('<th></th>',$ccol); ?></tr>
			</tfoot>
		<?php } ?>
	</table>
</pant2>
		
<?php } ?>			
    
  </div>
    
    
</resultado>

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

		