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

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

<?php set_lsuborel(); ?>  

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

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


<?php $docu_descri=r_fiel('docu',$docu);  ?>
 
<?php 
// $user_tipo='invi';
// echo '<msgalert>';
// echo '**/*/*'.$docu.'===='.$docu_descri; 
// echo '</msgalert>';
?>
<?php if($docu=='' or $docu_descri==''){$docu='CAR1'; $docu_descri=r_fiel('docu',$docu);} ?>

<?php if(mb_stristr($docu_descri,' ')){$docu_descri=substr($docu_descri,0,strpos($docu_descri,' '));} ?>

<?php 
// echo '<msgalert>';
// echo '**/*/*'.$docu.'===='.$docu_descri; 
// echo '</msgalert>';
?>


<?php if($pant==''){$pant='PANT0';}?>
<?php if(!@mb_stristr('PANT.IMPR.MODI',substr($pant,0,4))){return;} ?>
<?php //if($user_codigo==''){echo ('<msgalert>Usuario desconectado...</msgalert>');}?>
<?php $xmodi=0; if(mb_stristr($pant,'MODI')){$xmodi=1;} ?>


<?php


//   $paraiddet=$iddet;
//   ini_set('memory_limit', '512M');

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

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

$idcarr=get_carr();


$gris1='gainsboro';

$itemxlin=4;

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

$citem=0;


$solo_stock=0;
$solo_ctlg=0;
$bode='';

$tipo_stock=0; //0:s/n 1:unidades
$tipo_stock=1;

$btn_stock=0;
$ver_stock=0;
// $ver_stock=1;

$precio='pvp1';


$ver_precio=1;
$ver_tallas=0;
$ver_color=1;
$add_carr=1;

$fil_lsub=1;
$fil_mrca=1;
$fil_clor=1;
$fil_catg=0;
$fil_orde=0;

$fpobj=3;
if($mobile=='true'){$fpobj=2;}

if($user_codigo==''){$add_carr=0;}
if($cfg_empr=='orel')
{
  $solo_stock=1;
  $ver_precio=1;
  $ver_color=0;
  $fil_clor=0;
  $precio='pvp1';
  if(mb_stristr('sist.admi.supe',$user_tipo)){$precio='pvp3';}  
//   $tipo_stock=2;
}

// if($cfg_empr=='gmny')
if(mb_stristr('gmny.gnya',$cfg_empr))
{
//   $itemxlin=3;
  $fil_lsub=0;
  $fil_mrca=0;
  $fil_clor=0;
  $fil_catg=1;
  
  
  $solo_stock=0;
  $ver_precio=1;
  $ver_color=1;
  $solo_ctlg=1;
  $tipo_stock=0;
  if($cfg_empr=='gmny')
  {$ver_tallas=2;}
  if($cfg_empr=='gnya')
  {$ver_tallas=1;}
}



?>




<?php	

$user_nuev=0;
$user_cons=0;
$user_modi=0;
$user_anul=0;
$user_elim=0;
$user_proc=0;
$user_clon=0;

$cel_stat=0;
$ver_rete=0;
$ver_guia=0;
$ver_apli=0;
$ver_fact=0;
$ver_doco=0;
$ver_cont=0;
$ver_cele=0;
$ver_modi=0;
$ver_abono=0;
$ver_saldo=0;
$ver_valor=1;
$ver_subtot=1;
// $ver_total=1;
$tsaldo=0;

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

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


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



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



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


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

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

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


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


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


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



if($modu!='' and $modu!=undefined){$tabla=strtolower($modu);}  



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


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

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

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

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

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

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

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

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

if(@mb_stristr('dxco.dxpa',$tabla) and substr($docu,0,1)=='A' and $versaldo=='true')
{$ver_saldo=1;}

if($versaldo!='true'){$ver_saldo=0;}

if(@mb_stristr('vtas.inve',$tabla) and mb_stristr('F.E',substr($docu,0,1)) and $empr_guia==1 and $verguia=='true')
{$ver_guia=1;}

if($verguia!='true'){$ver_guia=0;}

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

if($verrete!='true'){$ver_rete=0;}

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

if(@mb_stristr('atvd.plan',$tabla) and $user_cargo=='ASIS')
{$ver_valor=0;}


if(@mb_stristr('comp',$tabla) and $docu!='FP11')
{$ver_cele=0; $cel_stat=0;}

if(@mb_stristr('vtas.comp',$tabla) and mb_stristr('NC.NP',substr($docu,0,2)))
{$ver_apli=1;}

if(@mb_stristr('vtas.comp.caja.bcos.retp.retc.dxco.dxpa.inve.prod.nomi.',$tabla) and $vercont=='true')
{$ver_cont=1;}

if(@mb_stristr('cont',$tabla) and $verdife=='true')
{$ver_dife=1;}

if(@mb_stristr('cont',$tabla) and $verdiar=='true')
{$ver_diar=1;}

if($vermodi=='true')
{$ver_modi=1;}

if(mb_stristr($pant,'IMPR'))
{$ver_modi=0;}

if($ver_modi==1)
{
  $ver_rete=0;
  $ver_guia=0;
  $ver_apli=0;
  $ver_fact=0;
  $ver_doco=0;
  $ver_cont=0;
  $ver_cele=0;
  $ver_abono=0;
  $ver_saldo=0;
  
  $user_anul=0;
  $user_elim=0;
  
  $ver_modi=1;
}
  


if($formato==2){$tabla='cont';}


// if(@mb_stristr('FP03.FP11',$docu)){$cel_stat=1;}
// if(@mb_stristr('FP03.FP11',$docu) and $vercele=='true'){$ver_cele=1;}

// if($docu=='RBCO'){$ver_apli=0;}

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





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

if(substr($pant,0,4)=='IMPR')
{
  $user_anul=0;
  $user_elim=0;
  $user_clon=0;
  $ver_cele=0;
  $ver_rete=0;
  $ver_doco=0;
  $ver_cont=0;
//   $ver_guia=0;
}


$xfontsize=12;
if($mobile=='true' and $orient=='V'){$xfontsize=24;}
// if($mobile=='true' and $orient=='H'){$xfontsize=12;}
// if($orient=='V'){$xfontsize=40;}
// if($orient=='H'){$xfontsize=12;}

$hpant1 =ceil($screenh*0.30);
$hpant11=ceil($screenh*0.10);
// $hpant2 =ceil($screenh*0.30);
$hpant2 =ceil($screenh*0.50);
// $vpant2 =ceil($screenv*0.30);

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

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

	if(@mb_stristr('vtas.comp.clie.prov.carr.inve.prod.guia',$tabla)){$docuitem=1;}
	if(@mb_stristr('vtas.comp.clie.prov.carr',$tabla)){$docuiimp=1;}
// 				if(mb_stristr('inve.prod.guia',$tabla)){$docuinve=1;}
// 	if(@mb_stristr('caja.bcos.retc.retp.rete',$tabla)){$docudocu=1;}
	if(@mb_stristr('caja.bcos.dxco.dxpa',$tabla)){$docudocu=1;}
	if(@mb_stristr('comi',$tabla)){$docuitem=1;}
	if(@mb_stristr('retc.retp.rete',$tabla)){$docurete=1;}
	if(@mb_stristr('cont',$tabla)){$docuctas=1;}
  
    if(@mb_stristr('inve.prod',$tabla) and 1==2)
    {
        $docuacce='COST';
        include('php_useracce.php');
        $user_cons=0;
        $xipuni=$user_cons;
        $tsubt=$user_cons;

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

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

?>



<?php ob_start(); ?>
<resultado>
<?php	//val_usercodigo(); ?>
  
  
<?php $tdisplay=''; ?>  
<?php if(substr($pant,0,4)=='PANT'){$tdisplay='display:block;';}?>  
  
  
  
<?php if(mb_stristr('PANT0',$pant)){ ?>
  
<?php //$ptabla='item'; include('vrsetlist.php'); ?>
<?php $pidtxt='dl_enti'; $ptabla='enti'; $plimit=200; $pwhere='(enti_descri not like "%***%")'; include('vrsetlist.php'); ?>
  
  <?php
// echo '<msgalert>';
// echo '**/*/*'.$docu.'===='.$docu_descri; 
// echo '</msgalert>';

  
  ?>

<?php if(@mb_stristr('invi.clie.prov',$user_tipo) or $user_tipo=='') {}else{?>
<?php } ?>
<?php if($fecha1==''){ ?>
  <?php $fecha1=date('Y-m-01',strtotime ('-5 days')); ?>
  <?php if(mb_stristr('amay.',$cfg_empr)){$fecha1=date('Y-m-d',strtotime ('-1 day'));} ?>
  <?php if(@mb_stristr('PLA.ATV',substr($docu,0,3))){$fecha1=date('Y-m-01',strtotime ('-180 day'));} ?>
<?php  } ?>
<?php $fecha2=date('Y-m-01',strtotime ('today')); ?>
<?php $fecha2=date('Y-m-d',strtotime ('today')); ?>

		<div id="pant0" style="border:solid 2px; overflow:auto; width:99%;">
      <div align="center" style="align:center; text-transform:uppercase; font-weight:bold; font-family:arial;
                  font-size:<?php echo $xfontsize*1.2; ?>;
                  <?php if($mobile=='false'){echo 'display:none;';} ?>
                  ">
      <titulo style="font-size:<?php echo $xfontsize*2; ?>px;" >Catálogo de Productos</titulo>
      </div>
      
   <?php { ?>
      <table id="tpant0" cellpadding="2" width="99%" border="0"
					 style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:snow;">
				<tr>
          <td valign="top">
            

        <table id="tpant0" cellpadding="2" width="99%" border="0"
             style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:snow;">
            <tr>

            <?php if($mobile=='true'){?>        
            </tr>
            <tr>
            <?php } ?>
            <?php $pidtxt='enti'; $psize=$xfontsize*1.2; $ptabla='enti'; $pcaption='CLIENTE'; $pdefa=$enti; 
              $pexact=1; $phide=1; $pobj=3;
               $plist='dl_enti';
               if($user_tipo!=''){$pdefa='';}
               if(@mb_stristr('sist.admi.supe',$user_tipo)){$pexact=0;}
               if(@mb_stristr('sist.admi.supe',$user_tipo) and $user_tipo!=''){$phide=0;}
               include('vrgetcod.php'); ?>
              
            <?php if($mobile=='true'){ ?>        
            </tr>
            <tr>
            <?php } ?>
              
                <?php $pidtxt='email'; $pcaption='E-Mail'; $plong=15; $psize=$xfontsize*1.2; $pobj=$xobj; $phide=1; $pobj=2;
                    if($mobile=='true'){$pobj=3;}
                   if(@mb_stristr('sist.admi.supe',$user_tipo) and $user_tipo!=''){$phide=0;}
                   include('vrgettxt.php'); ?>
              
            <?php if($mobile=='true'){ ?>        
            </tr>
            <tr>
            <?php } ?>
              
                <?php $pidtxt='wsapp'; $pcaption='WhatsApp'; $plong=13; $psize=$xfontsize*1.2; $pobj=$xobj; $phide=1; $pobj=2;
                    if($mobile=='true'){$pobj=3;}
                   if(@mb_stristr('sist.admi.supe',$user_tipo) and $user_tipo!=''){$phide=0;}
                   include('vrgetnum.php'); ?>
              
            <?php if($mobile=='true'){ ?>        
            </tr>
            <tr>
            <?php } ?>
              
                  <?php
                     $pidtxt='ptoe'; $pcaption='ptoe'; $ptabla='ptov';  $psize=$xfontsize; $pdefa=$ptov;  $pobj=3;
                     $phide=1;$preado=1; 
                     include('vrgetcod.php');
                  ?>     

            <?php if($mobile=='true'){?>        
            </tr>
            <tr>
            <?php } ?>
                  <?php
                     $pidtxt='numero'; $pcaption='numero';  $psize=$xfontsize; $pdefa=$numero;  $pobj=3;
                     $phide=1;$preado=1; 
//                      if(@mb_stristr('sist.admi.supe',$user_tipo) and $user_tipo!=''){$phide=0;}
                     include('vrgetnum.php');
                  ?>     

              
            <?php if($mobile=='true'){?>        
    </td>
    </tr>
    </table>
      
<hr>

    <table width="99%" cellpadding="2" border="0"
          style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:snow;">
    <tr><td width="10%"></td></tr>
    <tr>
<!--     <td valign="top"> -->
            <?php } ?>
              
                  <?php
                     $pidtxt='docu'; $pcaption='docu'; $ptabla='docu';  $psize=$xfontsize*1.2; $pdefa=$docu;  $pobj=2;  $pnotob=0; 
                      $pvalue=$docu;
//                      $pwhere='(docu_tabla in("carr","clie"))';  
                     $pwhere='(substring(docu_codigo,1,2) in("CA","PC","PF"))';  
                     $phide=1;
//                      $preado=1; 
                     if(@mb_stristr('sist.admi.supe',$user_tipo) and $user_tipo!=''){$phide=0;}
                     include('vrgetcod.php');
                  ?>     

            <?php if($mobile=='true'){ ?>        
<!--             </tr>
            <tr> -->
            <?php } ?>
              
                  <?php
                     $pidtxt='unidades'; $pcaption='UNIDADES';  $psize=$xfontsize*1.2; $pvalue=$unidades; $pobj=2;
                     $phide=0;$preado=1; 
                     if($user_tipo==''){$phide=1;}
                     include('vrgetval.php');
                  ?>     
              
              <?php if($ver_precio==1){ ?>
                  <?php
                     $pidtxt='total'; $pcaption='TOTAL';  $psize=$xfontsize*1.2; $pvalue=$total; $pobj=2;
                     $phide=0;$preado=1; 
                     if($user_tipo==''){$phide=1;}
                     include('vrgetval.php');
                  ?>     
              <?php } ?>

            <?php if($mobile=='true'){?>        
<!--             </tr>
            <tr> -->
            <?php } ?>
              
            <td align="center" valign="top">
              <?php $pidtxt='shopcart'; $pcaption='Carrito';
                  $pcaption='VER '.$docu_descri;
                     if($user_tipo==''){$phide=1;}
//                   $ponclick ='location.href=\'?scri=shop_cart\'';
//                   $ponclick.='+\'&docu=\'+document.getElementById("docu").value.trim();';
//                   $ponclick.=';';
//                   $ponclick ='window.open(\'?scri=shop_cart\'';
                  $ponclick ='window.open(\'?scri=carr_clie\'';
                  $ponclick.='+\'&docu=\'+document.getElementById("docu").value.trim()';
                  $ponclick.='+\'\',\'_blank\')';
       
// window.open('?scri=shop_cart'+'&docu='+document.getElementById('docu').value.trim()+','_blank');

                  $ponclick.=';';
                  $psize=$xfontsize*1.2; include('vrbutton.php'); ?>
              </td>
              
            <?php if($mobile=='true'){?>  
<!--             <td width="90%"></td> -->
            </tr>
            <tr>
            <?php } ?>
								<?php  $pidtxt='idnum1'; $pcaption='ID-NUM'; $psize=12; $pobj=3;  $psize=$xfontsize; $preado=1; if($peditar==1){$pdefa=$idnum1;};
                  $ponclick='gath_idnum();';
                  $phide=1;
                  include('vrgetnum.php');?>

          </tr>
        </table>

            
            
   <?php if($mobile!='true'){ ?>        
    </td>
    </tr>
    </table>

    <table width="99%" cellpadding="2" border="0"
          style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:snow;">
    <tr><td width="10%"></td></tr>
    <tr>
    <td valign="top">
   <?php } ?>

<?php if(@mb_stristr('sist.admi.supe',$user_tipo) and $user_tipo!=''){echo '<hr>';} ?>
      
      
        <table id="tpant0" cellpadding="2" width="99%" border="0"
             style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:snow;">
            <tr>

            <?php if($mobile=='true'){?>        
<!--             </tr>
            <tr> -->
            <?php } ?>
            <?php $pidtxt='lsub'; $psize=$xfontsize*1.2; $ptabla='lsub'; $pcaption='LINEA'; $pdefa=$lsub; $pobj=$fpobj;
            $ptodos=1; if($fil_lsub==0){$phide=1;}
            include('vrselopt.php'); ?>

            <?php if($mobile=='true'){?>        
<!--           </tr>
          <tr> -->
          <?php } ?>
            <?php $pidtxt='mrca'; $psize=$xfontsize*1.2; $ptabla='mrca'; $pcaption='MARCA'; $pdefa=$mrca;  $pobj=$fpobj;;
              $ptodos=1; if($fil_mrca==0){$phide=1;}
              $pwhere='(mrca_codigo in(select distinct item_mrca from item0 where item_codigo like "20%" or item_codigo like "17%"))';
              include('vrselopt.php'); ?>

            <?php if($mobile=='true'){?>        
<!--           </tr>
          <tr> -->
          <?php } ?>
            <?php            
              $pidtxt='clor'; $pcaption='Color'; $ptabla='clor';  $pdefa=$clor; $psize=$xfontsize*1.2;  $pobj=$fpobj;;
              $ptodos=1;
              $pwhere='((clor_hexa!="" or clor_codigo="00")and(clor_codigo in(select distinct item_clor from item0)))';
              if($fil_clor==0){$phide=1;}
              include('vrselopt.php'); 
            ?>            

              
            <?php if($mobile=='true'){?>        
            <th width="90%" colspan="3"></th>
            </tr>
            <tr>
            <?php } ?>
              
              
            <?php if(mb_stristr('gmny.gnya',$cfg_empr)) { ?>
            <?php
            $pidtxt='catg'; $psize=$xfontsize*1.2;  $pcaption='Categoria'; $ptodos=1; $pdefa=$catg; $phide=0; $pobj=$fpobj;;
            $poptions='';
            $poptions.='blus,Blusas;fald,Faldas;enteri,Enterizos;short,Shorts;vestido,Vestidos;leggi,Leggins;camisa,Camisas;camiseta,Camisetas;pantalo,Pantalones;pijam,Pijamas;conjunt,Conjuntos;niñ,Niños;';
//             $ponchange='shop_item();';
            include('vrselopt.php');
            ?>
            <?php } ?>

            <?php if(mb_stristr('gmny.gnya',$cfg_empr)) { ?>
            <?php 
              $arra_catg=',';
              $arra_catg.='Blusas,';
              $arra_catg.='Faldas,';
              $arra_catg.='Enterizos,';
              $arra_catg.='Shorts,';
              $arra_catg.='Vestidos,';
              $arra_catg.='Leggins,';
              $arra_catg.='Camisas,';
              $arra_catg.='Camisetas,';
              $arra_catg.='Pantalones,';
              $arra_catg.='Pijamas,';
              $arra_catg.='Niños,';
              $arra_catg.='Todo';
                
              $arra_catg='';

              $arra_catg=explode(',',$arra_catg);
            ?>
              <?php for($xidx=1; $xidx<count($arra_catg); $xidx++){ ?>
              <td align="center" valign="top">
                
                <?php 
                    $pidtxt=$arra_catg[$xidx]; $pcaption=$arra_catg[$xidx]; $psize=$xfontsize;  
                    $ponclick ='document.getElementById(\'buscar\').value=\''.substr(strtolower($arra_catg[$xidx]),0,strlen($arra_catg[$xidx])-2).'\';shop_item();';
                    include('vrbutton.php'); ?>
              </td>
              <?php if($mobile=='true' and $xidx % 5==0){?>        
              </tr><tr>
              <?php } ?>
            
              <?php } ?>
            <?php } ?>
            
            <?php $pidtxt='orde'; $psize=$xfontsize*1.2;  $pcaption='ORDEN'; $pdefa='DESCRIPCION'; $pobj=2;
            if($fil_orde==0){$phide=1;}
//             $ponchange='shop_item();';
            $poptions='Descripcion;Menor Precio;Mayor Precio;Nuevos;'; include('vrselopt.php'); ?>

            <?php if($mobile=='true'){?>        
<!--             </tr>
            <tr> -->
            <?php } ?>
          
            <?php if($mobile=='true'){?>        
            <th width="90%" colspan="3"></th>
            <?php }else{ ?>
            <td width="90%"></td>
            <?php } ?>
          
          </tr>
        </table>


        </td>

				</tr>	
			</table>
      
      
    <table width="99%" cellpadding="2" border="0"
          style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:snow;">
    <tr><td width="10%"></td></tr>
    <tr>
    <td valign="top">
   <?php } ?>

            
          <table width="99%" cellpadding="2" border="0" caption=""
                 style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:snow;">
              <tr>
               <?php if($mobile!='true'){?>        
                  <td width="10%"></td>
               <?php } ?>
              </tr>
              <tr>
              <?php $pidtxt='item'; $ptabla='item'; $psize=$xfontsize; $pcaption='ITEM'; $pobj=1; $phide=1; include('vrgetcod.php'); ?>
              </tr>

              
              <tr>
              <?php $pidtxt='buscar'; $psize=$xfontsize*1.5; $pcaption='BUSCAR'; $plong='100%'; $pobj=1; $pvalue=$buscar; 
              $ptabla='item'; $pcolu='descri';
              $ponclick="{document.getElementById('buscaok').onclick();}";
              include('vrgettxt.php'); ?>
                
            <td align="center" valign="top" width="1%">
              <?php $pidtxt='buscaok'; $pcaption='Buscar '; 
                  $ponclick='shop_item();';
                  $psize=$xfontsize*1.5; include('vrbutton.php'); ?>
             </td>
                
              </tr>
         </table>

   <?php if($mobile!='true'){ ?>        
    </td>
    </tr>
    </table>
      
      
		<?php } ?>
		</div>	


		<div id="pant1" style="border:solid 1px; overflow:auto; font-family:arial;">
    <?php
      $buscar=trim($buscar);
      if(substr($buscar,-1)=='S'){$buscar=substr($buscar,0,-1);}
      if(substr($buscar,-1)=='s'){$buscar=substr($buscar,0,-1);}
      $buscar.=' '.$catg;
      if(substr($buscar,-1)=='S'){$buscar=substr($buscar,0,-1);}
      if(substr($buscar,-1)=='s'){$buscar=substr($buscar,0,-1);}
                                 
                                 
      $sql_ctlg ='select *,';
      $sql_ctlg.=' count(item_tlla) as item_ctalla ';
      $sql_ctlg.=' from item0';
         $sql_ctlg.=' left join lsub0 on item_lsub=lsub_codigo ';
         $sql_ctlg.=' left join mrca0 on item_mrca=mrca_codigo ';
         $sql_ctlg.=' left join clor0 on item_clor=clor_codigo ';
         $sql_ctlg.=' left join tlla0 on item_tlla=tlla_codigo ';
         $sql_ctlg.=' left join kldd0 on item_kldd=kldd_codigo ';
      $sql_ctlg.=' where item_status!="I" ';
      $sql_ctlg.=' and item_status!="X" ';
      $sql_ctlg.=' and item_descri!="" ';
      $sql_ctlg.=' and item_codigo not like "99%" ';
      $sql_ctlg.=' and item_'.$precio.'>0 ';
      if($buscar!='')
      {
        $buscar=alltrim($buscar);
        $buscararray=explode(' ',$buscar);
        for($cbus=0; $cbus<count($buscararray); $cbus++)
        {$sql_ctlg.=' and (item_descri like "%'.$buscararray[$cbus].'%" or item_codigo like "%'.$buscararray[$cbus].'%" or item_codigov like "%'.$buscararray[$cbus].'%") ';}
      }
//       if(strlen($lsub))
      if($lsub!='')
      {$sql_ctlg.=' and (item_lsub like "'.$lsub.'%")';}
      if($mrca!='')
      {$sql_ctlg.=' and (item_mrca = "'.$mrca.'")';}
      if($item!='')
      {$sql_ctlg.=' and (item_codigo like "'.$item.'%")';}
      if($mdlo!='')
      {$sql_ctlg.=' and (item_mdlo like "'.$mdlo.'%")';}
      if($clor!='')
      {
        $clor_tipo=r_fiel('clor',$clor,'tipo');
        $sql_ctlg.=' and (clor_tipo like "'.$clor_tipo.'%")';
      }
//       if(mb_stristr('gnya.gmny',$cfg_empr))
      if($solo_ctlg==1)
      {$sql_ctlg.=' and item_ctlg=1 ';}
      
// echo '<msgalert>';                                 
// echo  '*/*/*'.$sql_ctlg;                                 
// echo '</msgalert>';
// die();                                 
                                 

      if(mb_stristr('gnya.gmny',$cfg_empr))
      {$sql_ctlg.=' and item_codigo!=item_rfer ';}
                                 
      if(empty($buscar) and empty($lsub) and empty($mrca) and empty($clor))                                 
      {$sql_ctlg.='and item_codigo in(select imgi_item from imgi0 where imgi_status!="X") ';}
      
      $xgroupby='group by item_codigo ';
      $xorderby='order by item_descri,item_codigo ';                                 
                                 
      if(mb_stristr('gnya.gmny',$cfg_empr)){$xgroupby=' group by item_mdlo,item_raiz ';}
      if(mb_stristr('gnya.gmny',$cfg_empr)){$xorderby='order by item_codigo ';}
                                 
      $sql_ctlg.=$xgroupby;                                 
      $sql_ctlg.=$xorderby;

      if(empty($lsub) and empty($mrca) and empty($clor))                                 
      {$sql_ctlg.=' desc ';}
                                 
      $xlimit=100;                                 
      $xlimit=1000;                                 

      $sql_ctlg.=' limit '.$xlimit;
//       if($orde=='')
                                 
      $res_ctlg=msql_query($sql_ctlg,$link_vcrx);
//        explain_sql($sql_ctlg,1);
//        echo $sql_ctlg;
                                 
      $item_lcodigo='';            
    ?>  

    <table id="tpant0" cellpadding="2" width="99%" border="0"
       style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:snow;">
      
    <tr>

    <?php
        if(msql_num_rows($res_ctlg)==0)
        {
          echo '<td>';
          echo 'NO SE ENCONTRARON RESULTADOS';
          echo '</td>';
        }
    ?>  
      
    <?php while($aso_ctlg=msql_fetch_assoc($res_ctlg)){ ?>
      <?php $item_codigo=$aso_ctlg['item_codigo']; ?>
      <?php $item_descri=$aso_ctlg['item_descri']; ?>
      <?php $item_descri2=$aso_ctlg['item_descri2']; ?>
      <?php $item_codigov=$aso_ctlg['item_codigov']; ?>
      <?php $item_duni=$aso_ctlg['item_duni']; ?>
      <?php $item_rfer=$aso_ctlg['item_rfer']; ?>
      <?php $item_mdlo=$aso_ctlg['item_mdlo']; ?>
      <?php $item_clor=$aso_ctlg['item_clor']; ?>
      <?php $item_tlla=$aso_ctlg['item_tlla']; ?>
      
      <?php $mrca_descri=$aso_ctlg['mrca_descri']; ?>
      <?php $kldd_descri=$aso_ctlg['kldd_descri']; ?>
      <?php $kldd_descri=$aso_ctlg['kldd_descri'].' /'.$aso_ctlg['item_composi']; ?>
      <?php $item_ctalla=$aso_ctlg['item_ctalla']; ?>
      <?php //$item_precio=$aso_ctlg['item_puniimp']; ?>
      <?php $item_precio=$aso_ctlg['item_'.$precio]; ?>
      <?php $item_dpuni=$aso_ctlg['item_dpuni']; ?>
      <?php $clor_descri=$aso_ctlg['clor_descri']; ?>
      <?php $clor_hexa=$aso_ctlg['clor_hexa']; ?>
      
      <?php if(empty($item_rfer)){$item_rfer=$item_mdlo;} ?>
      <?php if(empty($item_rfer)){$item_rfer=$item_codigo;} ?>
      <?php if($item_dpuni==0){$item_dpuni=2;} ?>
      
      <?php //if($cfg_empr=='gmny' and $user_codigo==''){$item_precio=get_puniempr($item_rfer,'gnya','puniimp');} ?>
      <?php if($cfg_empr=='gmny' and $user_codigo==''){$item_precio=get_puniempr($item_rfer,'gnya',$precio);} ?>
      <?php if($cfg_empr=='orel'){$item_precio=$aso_ctlg['item_'.$precio]; } ?>
      <?php
        $tllas_array='';
        if($item_ctalla==1){$tllas_array='00,UNICA;';}
        if($item_ctalla>=1 and strlen($item_mdlo)>2)
        {
//           $sql_tllas ='select distinct tlla_codigo,tlla_descri from item0 ';
          $sql_tllas ='select distinct item_rfer,tlla_codigo,tlla_descri from item0 ';
          $sql_tllas.=' left join tlla0 on item_tlla=tlla_codigo ';
          $sql_tllas.=' where item_codigo like "'.$item_rfer.'%" ';
          $sql_tllas.=' and item_tlla!="00"';
          if($solo_ctlg)
          {$sql_tllas.=' and item_ctlg="1" ';}
          $sql_tllas.=' order by tlla_codigo';
          $res_tllas=msql_query($sql_tllas,$link_vcrx);
          $tllas_codigo='';
          $tllas_descri='';
          $tllas_array='';
//           echo '*/*/*/*'.explain_sql($sql_tllas);
          while($aso_tllas=msql_fetch_assoc($res_tllas))
          {
            $tllas_codigo.=$aso_tllas['tlla_codigo'].' ';
            $tllas_descri.=$aso_tllas['tlla_descri'].' ';
            $tllas_array.=$aso_tllas['tlla_codigo'].','.$aso_tllas['tlla_descri'].';';
//             $tllas_array.=$tlla_codigo.','.$tlla_descri.';';
          }
        }
      ?>
      
      <?php $xcodigov=$item_codigov; ?>
      <?php if(empty($xcodigov)){$xcodigov=$item_codigo;}?>
      <?php if(mb_stristr('gnya.gmny',$cfg_empr)){$xcodigov=$item_rfer;} ?>
      <?php if(mb_stristr('gnya.gmny',$cfg_empr)){$xcodigov=substr($item_codigo,0,8);} ?>
      <?php if(mb_stristr('gmny.gnya',$cfg_empr))
          {
//           if($item_lcodigo!=substr($item_codigo,0,8)){echo '</tr><tr>';$citem=0;}
//           $item_lcodigo=substr($item_codigo,0,8);
          }
      ?>
      <?php $detaok=1; ?>
      <?php 
        $sal_item=sal_item($item_codigo,'','',$bode);
        $item_saldo=$sal_item[4];                                             
        if($solo_stock==1)
        {if($item_saldo<=0){$detaok=0;}}
      ?>
      
      <?php if($detaok==1){ ?>
      <?php if($citem%$itemxlin==0){echo '</tr><tr>';}?>
      <?php $citem++; ?>
      <td valign="top" width="<?php echo round(100/$itemxlin,2); ?>%" >
        
          <hr size="3" noshade  >
          <table id="tb<?php echo $item_codigo;?>" align="center" cellpadding="2" border="0" 
                 style="font-size:<?php echo $xfontsize; ?>px;
                        max-width:<?php if($itemxlin==1){echo $screenw*2;}else{echo $screenw/$itemxlin;} ?>px;
                        border-collapse:collapse; " >
            <tr>
              <td align="center" valign="top">
                  <div style="font-weight:bold;">
                    

                  <a href="?scri=shop_item&buscar=<?php echo trim($xcodigov);?>" target="_blank">
                  <?php echo 'CODIGO : '.$xcodigov; ?>
                  </a>  
                  </div>
                <?php $pidtxt=$item_rfer; $ptabla='imgi'; $pcodigo=$item_rfer; include('vrsayimgs.php');?>
                <?php //$pid=$item_rfer; $ptabla='item'; $pcodigo=$item_rfer; include('vrimage.php');?>
<!--               </td> -->
              
              <?php if($orient=='V'){ ?>
<!--               </tr> -->
<!--               <tr> -->
              <?php } ?>

                <div bold italic>
                <?php echo $mrca_descri; ?>
                </div>
                <div style="font-size:<?php echo $xfontsize; ?>;">
                <?php echo $item_descri; ?>
                </div>
                <div italic>
                <?php echo $kldd_descri; ?>
                </div>
                
                <?php if($ver_color==1 and $clor_descri!='') { ?>
                  <div style="font-size:80%; border:solid 1px; background-color:<?php echo $clor_hexa; ?>;">
                  <?php echo 'COLOR : '.$clor_descri; ?>
                  </div>
                <?php } ?>
                
                <?php if($ver_tallas>=1 and $tllas_descri!='') { ?>
                  <div style="font-size:80%;">
                  <?php echo 'TALLAS : '.$tllas_descri; ?>
                  </div>
                <?php } ?>
                
                <?php if($ver_precio==1 and $item_precio>0) { ?>
                  <div style="font-weight:bold;">
                  <?php echo 'PVP : $ '.number_format($item_precio,$item_dpuni); ?>
                  </div>
                <?php } ?>

                <?php //if($ver_precio==1 and $add_carr==1) { ?>
                <?php if($add_carr==1) { ?>
                  <div>
                    <table id="t_<?php echo $item_codigo;?>" cellpadding="2" width="" border="0"
                         style="font-size:<?php echo $xfontsize; ?>px;border-collapse:collapse; background-color:snow;">
                      <tr>
                        
                        
                      <?php if($ver_tallas==1 and $tllas_descri!='') { ?>
                      <td>
                      <?php
                        $pidtxt='tlla'.$item_rfer; $pcaption='TALLA';
                        $pobj=1; $psize=$xfontsize;
                        $poptions=$tllas_array;
//                           $ponchange='alert(this.value);';
                        $ponchange="document.getElementsByName('".$item_rfer."')[0].id='cant'+document.getElementsByName('".$item_rfer."')[0].name+this.value;";
                        include('vrselopt.php');
                      ?>
                      </td>
                      <?php } ?>

                        <?php if($ver_tallas<2 ) { ?>
<!--                         <td> -->
                        <?php
                          $pidtxt='cant'.$item_codigo; 
                          $pname=$item_codigo; 
                          if($ver_tallas==1 and $tllas_descri!='')
                          {
                            $pidtxt='cant'.$item_rfer.substr($tllas_array,0,2);
                            $pname=$item_rfer;
                          }
                          $pcaption='CANT.';
                          $plong=5; $pdefa=1; $pobj=1; $psize=$xfontsize; 
                          include('vrgetval.php');
                        ?>
<!--                         </td> -->
                        <?php } ?>
                        
                      <?php if($ver_tallas==2 and $tllas_descri!=''){ ?>
                        <?php
                          $idxct=0;
                          msql_data_seek($res_tllas,0);
                          while($aso_tllas=msql_fetch_assoc($res_tllas))
                          {
                            $tlla_codigo=$aso_tllas['tlla_codigo'];
                            $tlla_descri=$aso_tllas['tlla_descri'];
//                             $tllas_array.=$aso_tllas['tlla_codigo'].','.$aso_tllas['tlla_descri'].';';
                            if(!empty($tlla_descri))
                            {
                             if(($idxct % 3)==0 and $orient=='H'){echo '</tr><tr>';}
                              $idxct++;
//                              $pidtxt='cant'.$item_mdlo.$item_clor.$tlla_codigo ; 
                             $pidtxt='cant'.$item_rfer.$tlla_codigo ; 
                             $pname=$item_mdlo.$item_clor; 
                             $pcaption=trim(substr($tlla_descri,0,6)); 
                             if($orient=='V')
                             {$pcaption=trim(substr($tlla_descri,0,3));}
                             $pobj=2; $psize=$xfontsize; 
                              $plong=5;
                             include('vrgetval.php');
                            }
                            
                          }
                        ?>
                        <?php if($orient=='V' and 1==2){ ?>
                        </tr><tr>
                        <?php } ?>
                      <?php } ?>
                        
                        <td valign="middle">
                        <?php 
                          $pidtxt='a_'.$item_codigo;  $psize=$xfontsize;
                          $pcaption='Agregar';
                          if($user_tipo=='invi')
                          {$pcaption='Cotizar';}
                                     
//                           $ponclick="add_carr2('docu','".$item_codigo."','cant".$item_codigo."','','enti')";
                          $ponclick="add_carr2('docu','".$item_codigo."','cant".$item_codigo."','docu','enti')";
                                     
//                           {$ponclick="add_carr2('docu',document.getElementsByName('".$item_rfer."')[0].id.substring(4),document.getElementsByName('".$item_rfer."')[0].id,'','enti')";}
                          if($ver_tallas==1)
                          {$ponclick="add_carr2('docu',document.getElementsByName('".$item_rfer."')[0].id.substring(4),document.getElementsByName('".$item_rfer."')[0].id,'docu','enti')";}
                                     
                          if($ver_tallas==2)
                          {
                            $ponclick='';
                            msql_data_seek($res_tllas,0);
                            while($aso_tllas=msql_fetch_assoc($res_tllas))
                            {
                              $tlla_codigo=$aso_tllas['tlla_codigo'];
                              $tlla_descri=$aso_tllas['tlla_descri'];
  //                             $tllas_array.=$aso_tllas['tlla_codigo'].','.$aso_tllas['tlla_descri'].';';
                              if(!empty($tlla_descri))
                              {
//                                $pidtxt='cant'.$item_mdlo.$item_clor.$tlla_codigo ; 
//                                 $ponclick.="add_carr2('docu','".$item_mdlo.$item_clor.$tlla_codigo."','cant".$item_mdlo.$item_clor.$tlla_codigo."','','enti');";
//                                 $ponclick.="add_carr2('docu','".$item_mdlo.$item_clor.$tlla_codigo."','cant".$item_mdlo.$item_clor.$tlla_codigo."','docu','enti');";
                                $ponclick.="add_carr2('docu','".$item_rfer.$tlla_codigo."','cant".$item_rfer.$tlla_codigo."','docu','enti');";
                              }

                            }
                          }
                          include('vrbutton.php');
                        ?>
                        </td>
                      </tr>
                      
                      <tr>
                        <?php if($ver_tallas<2 ) { ?>
                        <td align="left" valign="top">
                          <?php
                            if($solo_ctlg==0)
                            {
                              $pidtxt='bs'.$citem; $psize=$xfontsize; $pclass='onoff';
                              $pcaption='STOCK'; 
                              if($solo_stock==0){$pcaption='DISP.';}
                              if($item_saldo<=0){$pcaption='NO DISP.';}
                              if($item_saldo>0 and $tipo_stock>=1)
                              {$ponclick='if(document.getElementById("ss'.$citem.'").style.display=="none"){document.getElementById("ss'.$citem.'").style.display="";}else{document.getElementById("ss'.$citem.'").style.display="none";}';}
                              include('vrbutton.php');
                            }
                          ?>
                        </td>
                        <td valign="top">
                          <?php if($tipo_stock>=1 and $item_saldo>0){ ?>
                           <span id="ss<?php echo $citem;?>" style="display:none;font:weight:bold;font-size:<?php echo $xfontsize*1.5;?>;">
                             <?php if($tipo_stock==1){echo '='.number_format($item_saldo,$item_duni);} ?>
                             <?php
                                if($tipo_stock>1)
                                {
                                  if($item_saldo>100){echo '+100';}
                                  elseif($item_saldo>50){echo '+50';}
                                  elseif($item_saldo>10){echo '+10';}
                                  else{echo '<10';}
                                }
                             ?>
                           </span>
                          <?php } ?>
                        </td>
                        <?php } ?>
                      </tr>
                      
                    </table>
                    
                      <?php if(!empty($item_descri2)){ ?>
                    <table id="ti_<?php echo $item_codigo;?>" cellpadding="0" width="100%" border="0"
                         style="border-collapse:collapse; background-color:snow;">
                      <tr>
                        <td align="left" valign="top" colspan="2">
                          <?php
                              $pidtxt='bi'.$citem; $psize=$xfontsize; $pclass='onoff';
                              $pcaption='INFO'; 
                              {$ponclick='if(document.getElementById("si'.$citem.'").style.display=="none"){document.getElementById("si'.$citem.'").style.display="";}else{document.getElementById("si'.$citem.'").style.display="none";}';}
                              include('vrbutton.php');
                          ?>
                           <span id="si<?php echo $citem;?>" style="display:none;font:weight:bold;font-size:<?php echo $xfontsize*0.8;?>;">
                             <?php echo $item_descri2; ?>
                           </span>
                        </td>
                        <td>
                        </td>
                      </tr>
                    </table>
                      <?php } ?>
                    
                  </div>
                <?php } ?>
                
              </td>
            </tr>
          </table>
          <hr size="2" noshade  >

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


</resultado>

<?php $obstart = ob_get_clean(); ?>
<?php //$obstart = alltrim($obstart) ?>
<?php $obstart = limpiahtml($obstart) ?>
<?php $obstart = str_replace('border="0"','',$obstart); ?>
<?php //$obstart = str_replace('> ','>',$obstart); ?>
<?php //$obstart = str_replace(' <','<',$obstart); ?>

<?php //$obstart = str_replace('" ','"',$obstart); ?>
<?php //$obstart = str_replace(' "','"',$obstart); ?>
<?php //$obstart = str_replace('<div></div>','',$obstart); ?>
<?php $obstart = str_replace('align="left"','',$obstart); ?>
<?php $obstart = str_replace('title=""','',$obstart); ?>
<?php $obstart = str_replace('position:;','',$obstart); ?>
<?php $obstart = str_replace('" "','""',$obstart); ?>
<?php $obstart = str_replace(';;',';',$obstart); ?>
<?php //$obstart = str_replace('" ','"',$obstart); ?>
<?php //$obstart = str_replace(' "','"',$obstart); ?>
<?php $obstart = str_replace('onclick=""','',$obstart); ?>
<?php if(mb_stristr('IMPR1.IMPR3',$pant)){ ?>
  <?php //$obstart = str_replace('display:block','',$obstart); ?>
  <?php $obstart = str_replace('tfoot','tfoot1',$obstart); ?>
  <?php $obstart=remove_href($obstart); ?>
<?php } ?>

<?php echo $obstart;	?>
  
  
  