<?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 //$lsub=$_POST['lsub']; ?>
<?php //$item=$_POST['item']; ?>
<?php //$stat=$_POST['stat']; ?>
<?php $fecha1=$_POST['fecha1']; ?>
<?php $fecha2=$_POST['fecha2']; ?>

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

<?php $fecha1=date('Y-m-01',strtotime ('-1 year')); ?>


<?php foreach($_POST as $campo => $valor){${$campo}=$valor;} ?>
<?php if(empty($pant)){$pant='PANT0';}?>

<?php


$sql_puni='update item0 set item_puni=item_pvp1/(1+(item_iva/100)) where item_ctlg=1 and item_pvp1>0 and item_pvp1 is not null and (item_puni=0 or item_puni is null) ';
$res_puni=msql_query($sql_puni,$link_vcrx);


$sql_updt='update item0 set item_raiz=left(item_codigo,10) where length(trim(item_codigo))=10 or length(trim(item_codigo))=13';
$res_updt=msql_query($sql_updt,$link_vcrx);

$sql_updt='update item0 set item_raiz=left(item_codigo,6) where length(trim(item_codigo))=6 or length(trim(item_codigo))=8';
$res_updt=msql_query($sql_updt,$link_vcrx);

$sql_raiz='update item0 set item_raiz=substring(item_codigo,1,10) where item_codigo like "2010%" ';
$res_raiz=msql_query($sql_raiz,$link_vcrx);



// $sql_updt='update item0 set item_raiz=left(item_codigo,6) where length(trim(item_codigo))=6 or length(trim(item_codigo))=8';
// $res_updt=msql_query($sql_updt,$link_vcrx);
// echo $sql_updt;
// echo $res_updt;


$total_sql ='max(item_mrca) as tmrca,';
$total_sql ='max(item_nctlg) as tnctlg,';
$total_sql ='max(item_pctlg) as tpctlg,';
$total_sql.='max(item_modelo) as tmodelo,';
$total_sql.='max(item_tlla) as ttlla,';
$total_sql.='max(item_ice) as tice,';
$total_sql.='max(item_iva) as tiva,';
$total_sql.='max(item_irbp) as tirbp';


$xfontsize=12;
if($mobile=='true' and $orient=='V'){$xfontsize=40;}
if($mobile=='true' and $orient=='H'){$xfontsize=12;}
if($oswin==0 and $screenr>=75){$xfontsize=20;}


// echo '*/*/*'.$mobile.$screenr;
$hpant1 =ceil($screenh*0.30);
$hpant11=ceil($screenh*0.10);
$hpant2 =ceil($screenh*0.30);

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

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

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

?>

<?php ob_start(); ?>
<resultado>
	
<?php if(mb_stristr('PANT0',$pant)) { ?>
<?php $fecha1=date('Y-m-01',strtotime ('-1 year')); ?>
<?php $fecha2=$fechaa; ?>
		<div id="pant0" style="border:solid 2px; overflow:auto;">
      <?php  //echo '*/*/*/'.$mobile.$orient;?>
		<?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;">
        
      <?php if($mobile=='true'){ ?>
        <tr>
          <div style="height:80px;">
            
          </div>
        </tr>
      <?php } ?>
        
				<tr><?php $pidtxt='lsub';  $ptabla='lsub'; $ptodos=1; $psize=$xfontsize; $pcaption='LINEAS'; $pdefa='ELECTRONICA'; if($cfg_empr=='orel'){$pdefa='ELECTRONICA';}
                                             include('vrselopt.php'); ?></tr>
				<tr><?php $pidtxt='item';  $ptabla='item'; $pnotob="1"; $psize=$xfontsize; $pcaption='ITEM'; include('vrgetcod.php'); ?></tr>
        <tr>
        <?php $pidtxt='buscar'; $psize=$xfontsize; $pcaption='BUSCAR'; $plong='100%'; $pobj=1; $pvalue=$buscar; include('vrgettxt.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='mant_ctlg("PANT1","'.$docu.'")'; $psize=$xfontsize; include('vrbutton.php'); ?>
					</td>
					<td align="center">
					<?php $pidtxt='nueva'; $pcaption='Nuevo'; $ponclick='mant_ctlg("PANT1")'; $psize=$xfontsize; include('vrbutton.php'); ?>
					</td>
					<td align="center">
					<?php $pidtxt='detadocu'; $pcaption='Detalle'; $ponclick='mant_ctlg("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='lsub'; $ptabla='lsub'; $ptodos="1"; $psize=$xfontsize; $pcaption='LINEA'; include('vrselopt.php'); ?></td>
										</tr>
										<tr>
											<td><?php// $pidtxt='lsub'; $ptabla='lsub'; $pnotob="1"; $psize=$xfontsize; $pcaption='LINEA'; include('vrgetcod.php'); ?></td>
										</tr>
										<tr>
											<td><?php $pidtxt='item'; $ptabla='item'; $pnotob="1"; $psize=$xfontsize; $pcaption='ITEM'; include('vrgetcod.php'); ?></td>
										</tr>
                    <td>
                    <?php $pidtxt='buscar'; $psize=$xfontsize; $pcaption='BUSCAR'; $plong='50'; $pvalue=$buscar; include('vrgettxt.php'); ?>
                    </td>
										<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='mant_ctlg("PANT1","'.$docu.'")'; $psize=$xfontsize; include('vrbutton.php'); ?></td>
								<td><?php $pidtxt='nuevo'; $pcaption='Nuevo'; $ponclick='mant_ctlg("PANT1");'; $psize=$xfontsize; include('vrbutton.php'); ?></td>
								<td><?php $pidtxt='detadocu'; $pcaption='Detalle'; $ponclick='mant_ctlg("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 item00 ';
		$sql_pant.=' where item_codigo*1>100000 ';
		$sql_pant.=' and item_status!="X" ';
// 		$sql_pant.=' and item_lused>="'.$fecha1.'"';
		if(trim($lsub)!=""){$sql_pant.=' and (item_lsub like "'.$lsub.'%" or lsub_descri like "%'.$lsub.'%")';}
		if($item!=""){$sql_pant.=' and (item_codigo like "'.$item.'%" or item_descri like "%'.$item.'%")';}
		if($stat!=""){$sql_pant.=' and (item_status="'.$stat.'")';}
		if($buscar!=""){$sql_pant.=' and (item_codigo like "%'.$buscar.'%" or item_codigov like "%'.$buscar.'%" or item_descri like "%'.$buscar.'%")';}
   
   
      if($cfg_empr=='orel')
      {
         $sql_pant.=' and item_codigo in(select item from inve2) ';
      }

		$sql_tpant=str_replace('select *','select *,'.$total_sql,$sql_pant);
// 		$sql_pant=str_replace('select *','select *,'.$total_sql,$sql_pant);
// 		$sql_tpant=$sql_pant;
	
// 		{$sql_pant.=' group by item_raiz';}	

// 		$sql_pant.=' order by lsub_descri, item_descri, item_codigo';
		$sql_pant.=' order by lsub_descri, item_codigo ';

  
    if(empty($item) and empty($buscar))
    {
//       $sql_pant.=' limit 300 ';
      $sql_pant.=' limit 1500 ';
    }
  
  
		$res_pant=msql_query($sql_pant,$link_vcrx);
		$res_tpant=msql_query($sql_tpant,$link_vcrx);
  

	
		$tmarca=msql_result($res_tpant,0,'tmarca');
		$tmodelo=msql_result($res_tpant,0,'tmodelo');
		$ttlla=msql_result($res_tpant,0,'ttlla');
// 		$tsubt=msql_result($res_tpant,0,'stsubt');
// 		if($docuiimp==1)
// 		{
// 			$tsubtiva0=msql_result($res_tpant,0,'stsubtiva0');
// 			$tsubtiva=msql_result($res_tpant,0,'stsubtiva');
// 			$tdcto=msql_result($res_tpant,0,'stdcto');
// 			$tice=msql_result($res_tpant,0,'stice');
// 			$tiva=msql_result($res_tpant,0,'stiva');
// 			$tirbp=msql_result($res_tpant,0,'stirbp');
// 		}

	
// 		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>
						<?php //explain_sql($sql_pant); die();?>

		<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++; ?>);">LINEA</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">CODIGO</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">DESCRIPCION</th>
					<?php if($tmarca!=""){?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">MARCA</th>
					<?php } ?>
					<?php if($tmodelo!=""){?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">MODELO</th>
					<?php } ?>
					<?php {?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">COLOR</th>
					<?php } ?>
					<?php if($ttlla!=""){?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">TALLA</th>
					<?php } ?>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">STOCK</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">PVP</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">ONLINE</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">HOJA</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">ST</th>
					<th <?php$ccol++;?> >OX</th>
					<th onclick="sortTable(this,<?php echo $ccol++; ?>);">FOTO</th>
               
          <th style="font-size:<?php echo $xfontsize*.5;?>px;" title="Descargar XLS">
            <a href="#" id="downxls1" onClick="javascript:fnExcelReport('tpant1',this,'<?php echo $cfg_empr.'_'.$modu.'_'.date('Ymd_His');?>');">XLS</a>
          </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 if(@msql_num_rows($res_pant)==0){?>
          <tr><td style="font-weight:bold;">
            <?php echo 'NO HAY DATOS'; ?>  
            <?php echo '<br>==>'.date('H:i:s'); ?>
            <?php //echo '<br>'.$docu.' /'.$enti; ?>
          </td></tr>
        <?php }?>
        
				<?php while($aso_pant=msql_fetch_assoc($res_pant)){ ?>
				<?php $crow++; ?> 
				<?php $pvp1=$aso_pant['item_puni']; ?>
				<?php $duni=$aso_pant['item_duni']; ?>
				<?php //$item_codigo=str_replace(trim($aso_pant['item_tlla']),'',$aso_pant['item_codigo']); ?>
				<?php $item_codigo=$aso_pant['item_codigo'];?>
				<?php $item_codigo_show=$item_codigo;?>
        <?php if($cfg_empr=='orel'){$item_codigo_show=$aso_pant['item_codigov']; }?>
        
				<?php $item_raiz=$aso_pant['item_raiz'];?>
				<?php $item_descri=str_replace(trim($aso_pant['tlla_descri']),'',$aso_pant['item_descri']); ?>
				<?php $item_modelo=substr($aso_pant['item_modelo'],0,6);?>
        <?php $xsalitem=sal_item($aso_pant['item_codigo']); ?>
				<?php if($item_raiz==""){$item_raiz=$item_codigo;} ?>
				<?php //$struc=$aso_pant['enti_struc']; ?>
				<tr id="tr_fila<?php echo $crow;?>" class="tr_fila" valign="top" height="<?php //if($mobile=='true'){echo '55px';};?>"
						style="<?php if ($crow%5==0){echo 'border-bottom:dotted 1px;'; } ?> "
						onclick="_filabg(event,'tr_fila','<?php echo $crow; ?>','');
										mant_ctlg('PANT2','<?php echo $item_codigo; ?>');
										 "
						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:'.$item_codigo;?>"
							onclick="
										<?php if($touchs=='false'){?>
										mant_ctlg('PANT2','<?php echo $item_codigo; ?>');
										<?php } ?>
										 ">
						<?php //if($mobile!='true'){$pidtxt='radio'.'tr_fila'.$crow; $pname='rtr_fila'; $pcaption=''; $psize=$xfontsize; include('vrradio.php');} ?>
					</td>
					<td align="center">
						<div style="display:none;"><?php echo $aso_pant['lsub_descri']; ?></div>
						<?php echo $aso_pant['lsub_descri']; ?>
					</td>
					<td align="left">
						<div style="display:none;"><?php echo $aso_pant['item_raiz']; ?></div>
            <?php echo $item_codigo_show; ?>
          </td>
					<td align="left"><?php echo $item_descri; ?></td>
					<?php if($tmarca!=""){?>
					<td align="center"><?php echo $aso_pant['mrca_descri']; ?></td>
					<?php } ?>
					<?php if($tmodelo!=""){?>
					<td align="left"><?php echo $aso_pant['item_modelo']; ?></td>
					<?php } ?>
					<td align="center" style="background-color:<?php echo $aso_pant['clor_hexa']; ?>;"><?php echo $aso_pant['clor_descri']; ?></td>
					<?php if($ttlla!=""){?>
					<td align="center"><div style="display:none;"><?php echo $aso_pant['item_tlla']; ?></div>
						<?php echo $aso_pant['tlla_descri']; ?>
					</td>
					<?php } ?>
          
					<td align="center">
            <div class="hidden">
            <?php echo fillzero($xsalitem,9); ?>
            </div>
            <?php echo number_format($xsalitem,$duni); ?>
          </td>
					<td align="right" style="">
						<div style="display:none;"><?php echo fillzero($aso_pant['item_pvp0'],15); ?></div>
						<?php echo number_format(abs($aso_pant['item_pvp0']),2); ?>
					</td>	
					<td align="center">
						<?php $pidtxt='chkctlg'.$aso_pant['item_codigo'];  $pdefa=$aso_pant['item_ctlg']; $ptabla='item'; $pline=$aso_pant['item_codigo']; $pcolu='ctlg'; include('vrchkbox.php'); ?>
					</td>
					<td align="center">
						<?php $pidtxt='chkhoja'.$aso_pant['item_codigo'];  $pdefa=$aso_pant['item_hoja']; $ptabla='item'; $pline=$aso_pant['item_codigo']; $pcolu='hoja'; include('vrchkbox.php'); ?>
					</td>
<!-- 					<td valign="top"> -->
<!-- 							<?php
							$sql_imgi='select * from imgi0 ';
							$sql_imgi.='where imgi_item like "'.$item_modelo.'%" ';
							$sql_imgi.='and imgi_file is not null ';
							$sql_imgi.='and imgi_status!="O" ';
							$sql_imgi.='and imgi_status!="X" ';
							$sql_imgi.='order by imgi_defa desc, imgi_file ';
							$sql_imgi.='limit 1';
							$res_imgi=msql_query($sql_imgi,$link_vcrx);
						?>
						<?php if(msql_num_rows($res_imgi)>0){?>
						<?php
							$sql_defa='update imgi0 set imgi_defa=1 where imgi_codigo="'.msql_result($res_imgi,0,'imgi_codigo').'"';
							$res_defa=msql_query($sql_defa,$link_vcrx);
							$res_imgi=msql_query($sql_imgi,$link_vcrx);
						?>
								<?php while($aso_imgi=msql_fetch_assoc($res_imgi))	{ ?>
								<?php $imgfile=$aso_imgi['imgi_file'];?>
								<?php if(file_exists('../imgi/'.$imgfile)){ ?>
									<img id="img_<?php echo $imgfile;?>"
											 src="../imgi/<?php echo $imgfile;?>" 
											 width="50px" 
											 onclick="_clickimg('img_<?php echo $imgfile;?>');" 
											 onmouseover="" 
											 title="<?php echo $imgfile;?>"
											 >
									<div id="imgs_<?php echo $imgfile;?>" style="display:none;">
									</div>
								<?php } ?>
								<?php } ?>
						<?php } ?>

										 -->
<!-- 									</td> -->
					<td align="center"><?php echo $aso_pant['item_status']; ?></td>
					<td align="center" >
					<?php
						if($aso_pant['item_status']!='O' and $aso_pant['item_status']!='X'){$tnumero++;}
						if($aso_pant['item_status']=='O')
						{$pcaption='Eliminar: '.$aso_pant['docu'].'-'.$aso_pant['codigo']; $pabrev='X';}
						if(!mb_stristr('ROX',$aso_pant['item_status']))
						{$pcaption='Anular: '.$aso_pant['docu'].'-'.$aso_pant['codigo']; $pabrev='O';}
						if(!mb_stristr('RX',$aso_pant['item_status']))
						{
							$pidtxt='anul'.'tr_fila'.$crow; $pname='itr_fila';
							$pcodigo=$aso_pant['item_codigo'];$pdocu=$aso_pant['docu'];
							$psize=$xfontsize;
							$ponclick='mant_ctlg("PANTX","'.$aso_pant['item_codigo'].'")';
							include('vrbutton.php');
						}
					?>
					</td>
					<td valign="top">
                  <?php 
                     $sql_foto='select * from imgi0 where imgi_item like "'.$item_raiz.'%" and imgi_status not in("O","X")';
                     $res_foto=msql_query($sql_foto,$link_vcrx);
                     $xfotos=msql_num_rows($res_foto);
                  ?>
                  <?php echo $xfotos; ?>
						<?php $pidtxt=$item_raiz; $ptabla='imgi'; $pcodigo=$item_raiz; $pobj=1; $plimit=1; include('vrsayimgs.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 <?php$ccol--; ?>></th>
          <th <?php$ccol--; ?>></th>
          <th <?php$ccol--; ?>></th>
          <th <?php$ccol--; ?>> <?php echo $crow; ?></th>
					<?php echo str_repeat('<th></th>',$ccol);?>
				</tr>
			</tfoot>
			<?php } ?>	
		</table>
	<pant1>
	<?php //echo '***'.date('H:i:s') .'<br>';?>
				
<?php } ?>			
			
<?php if(mb_stristr('PANT2',$pant)) { ?>

<?php {
	$sql_pant ='select * from item00 where item_codigo="'.$item.'"';

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

	$res_pant=msql_query($sql_pant,$link_vcrx); 
	$item_codigo=msql_result($res_pant,0,'item_codigo');
	$item_descri=msql_result($res_pant,0,'item_descri');
	$item_raiz=msql_result($res_pant,0,'item_raiz');
{
// 	$res_tpant=msql_query($sql_tpant,$link_vcrx); 
// 	$tsubt=msql_result($res_tpant,0,'stsubt');
// 	$tcant=msql_result($res_tpant,0,'stcant');

}
// explain_sql($sql_pant);
}	?>

<pant11>
<?php //echo explain_sql($sql_pant); ?>
	<div style="font-size:<?php echo $xfontsize; ?>px;">
		<table border="0" width="<?php if($orient=='V'){echo '100%';}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 width="3%">
					<?php
							$pcaption='Imprimir: '.$item_codigo.'-'.$item_descri; $pabrev='I';
							$pcodigo=$item_codigo;
							$psize=$xfontsize;
// 							$ponclick='print_docu("'.msql_result($res_tpant,0,'docu').'","'.msql_result($res_tpant,0,'item_codigo').'")';
							$ponclick='{window.open("print1.php?item='.$item_codigo.'&idnum='.$item_codigo.'","_blank")}';
 							include('vrbutton.php');
					?>
				</td>
				<td style="font-weight:bold; font-size:80%" width="">
					<?php echo $item_descri; ?>
					<?php echo '<br>'.'CODIGO: '.$item_codigo; ?>
					<?php if($item_codigo!=$item_raiz){ ?>
					<?php echo '<br>'.'RAIZ  : '.$item_raiz; ?>
					<?php } ?>
				</td>
				<td>
				</td>
				<?php $crow=0; ?>
				<?php $ccol=0; ?>
				<?php
					$sql_imgi='select * from imgi0 ';
					$sql_imgi.='where imgi_item like "'.$item_raiz.'%" ';
					$sql_imgi.='and imgi_file is not null ';
					$sql_imgi.='and imgi_status!="O" ';
					$sql_imgi.='and imgi_status!="X" ';
					$sql_imgi.='order by imgi_defa desc, imgi_file ';
					$res_imgi=msql_query($sql_imgi,$link_vcrx);	
// 					echo explain_sql($sql_imgi);
				?>
				<?php $numrows=msql_num_rows($res_pant); ?>
						<?php if(msql_num_rows($res_imgi)>0){?>
								<?php while($aso_imgi=msql_fetch_assoc($res_imgi))	{ ?>
								<?php $imgfile=$aso_imgi['imgi_file'];?>
								<?php if(file_exists('../imgi/'.$imgfile)){?>
				<td id="imgi<?php echo $aso_imgi['imgi_codigo'];?>"; align="center" valign="center" style="">
					<?php //echo 'DF '.$aso_imgi['imgi_defa'];?>
				<?php
            $pidtxt='radio'.'tr_imgi'.$crow; $pname='rtr_imgi'; $pcaption='';
						$ponclick="{php_func('imgi_defa(".$aso_imgi['imgi_codigo'].")')}";
						$pdefa=$aso_imgi['imgi_defa'] ;$psize=$xfontsize; include('vrradio.php'); 
          ?>
<!-- 					<br><br> -->
									<img id="img_<?php echo $imgfile;?>"
											 src="../imgi/<?php echo $imgfile;?>" 
											 width="50px" 
											 onclick="_clickimg('img_<?php echo $imgfile;?>');" 
											 onmouseover="" 
											 title="<?php echo $imgfile;?>"
											 >
<!-- 					<br><br> -->
				<?php $pidtxt='elim'.$aso_imgi['imgi_codigo']; $pcaption='Eliminar '; $psize=$xfontsize; $pabrev="X";
						$ponclick="{if(confirm('Eliminar : '+'".$aso_imgi['imgi_file']."'))
								{
								document.getElementById('imgi".$aso_imgi['imgi_codigo']."').style.display='none';
								php_func('imgi_dele(".$aso_imgi['imgi_codigo'].")');
								}}"; 
						include('vrbutton.php'); ?>
					
				</td>
								<?php } ?>
								<?php } ?>
						<?php } ?>
			</tr>
		</table>
<!-- 		."mant_ctlg('PANT2','".$item_raiz."','".$item_raiz."')"; -->
		<table border="0" width="<?php if($orient=='V'){echo '100%';}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>
				<td>
          <?php //echo '*/*/'.$mobile; ?>
					<?php $pcaption='SUBIR FOTOS'; $pidtxt='imgi'; $paccept=".JPG"; $pobj=3; $psize=$xfontsize;
								$ponclick="upl_imgi('".$pidtxt."','".$item_codigo."');";
								include('vrgetfil.php'); ?>
				</td>
      <?php if($mobile=='true'){ ?>
        </tr>
        <tr>
      <?php } ?>
				<td align="right">
					<?php $pcaption='SUBIR PDF'; $pidtxt='pdfi'; $paccept=".PDF"; $pobj=3; $pmulti=1; $psize=$xfontsize;
								$ponclick="upl_pdfi('".$pidtxt."','".$item_codigo."');";
								include('vrgetfil.php'); ?>
				</td>
			</tr>
		</table>
	</div>
</pant11>
	
<pant2>
</pant2>
		
<?php } ?>			

<?php if(mb_stristr('IMGS2',$pant)) { ?>

<?php {
	$sql_imgi = 'select * from imgi0 where imgi_status!="O" and imig_status!="X" and imgi_item="'.$item.'" order by imgi_defa desc, imgi_file';
	$res_imgi=msql_query($sql_imgi,$link_vcrx); 
	// explain_sql($sql_pant);
}	?>

<?php if (msql_num_rows($res_imgi)>0){?>
	<?php while($aso_imgi=msql_fetch_assoc($res_imgi))	{ ?>
	<?php $imgfile=$aso_imgi['imgi_file'];?>
	<?php if(file_exists('../imgi/'.$imgfile)){?>
		<img id="img_<?php echo $imgfile;?>"
				 src="../imgi/<?php echo $imgfile;?>" 
				 width="50px" 
				 onclick="_clickimg('img_<?php echo $imgfile;?>');" 
				 onmouseover="" 
				 title="<?php echo $imgfile;?>"
				 >
	<?php } ?>
	<?php } ?>
		
<?php } ?>
		
<?php } ?>			
		
		
</resultado>

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

		