<?php session_start();?>
<?php ob_start(); ?>
<?php $mobile= $_SESSION['user_mobile'];?>
<?php $touchs= $_SESSION['user_touchs'];?>


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

<?php //if(file_exists('../cfg/res.php')){include('../cfg/res.php');} ?>	

<?php //if(file_exists('../cfg/config.php'))
//{include('../cfg/config.php');}?>	
<?php
//  include('php_gene1.php');
//  include('php_session.php');
?>

<!-- 
1 pantalla
2 impresora
 -->
<?php
// session_start();

		$sql_saycod='describe '.$ptabla.'0';
		$res_saycod=msql_query($sql_saycod,$link_vcrx);
		if(!msql_error($link_vcrx))	
		{
			$plong=msql_result($res_saycod,0,'type');
			$plong=str_replace(')','',$plong);
			$plong=str_replace('varchar(','',$plong);
			$plong=str_replace('char(','',$plong);
			$plong=str_replace('int(','',$plong);
		}
?>
<?php if(empty($pdeci)){$pdeci=0;}?>
<?php if(empty($pdest)){$pdest=1;}?>
<?php if(empty($ptitle) || $pdest==2){$ptitle='';}?>
<?php if(empty($ptitle) || $pdest==2){$ptitle='';}?>
<?php if(empty($ptabla)){$ptabla='empr';}?>
<?php //if(empty($pcodigo)){$pcodigo=$_SESSION['user_vcrx_empr'];}?>
<?php if(empty($pcodigo)){$pcodigo=$cfg_empr;}?>

<?php if(empty($pcaption)){$pcaption=$pcodi;}?>
<?php //if(empty($pcaption) && (mb_stristr('sist.supe',substr($_SESSION['user_vcrx_tipo'],0,4))) ){$pcaption=$ptabla;} ?>
<?php if(empty($pobj)){$pobj=3;}?>
<?php if(!empty($pcolu)){$pobj=2;}?>
<?php if(empty($pcolu)){$pcolu='descri';}?>
<?php if(empty($pcolumn)){$pcolumn=$pcolu;}?>
<?php if(empty($psize)){$psize=12;}?>

<?php
  $xvalor='';
//   $sql_saycod='select * from '.$ptabla.'0 where '.$ptabla.'_codigo="'.$pcodigo.'" order by '.$ptabla.'_codigo';
	if(substr($ptabla,-1,1)!='0' and substr($ptabla,-1,1)!='1' and substr($ptabla,-1,1)!='2')
	{
//     echo '*/*/*'.$ptabla;
		if(exist_table($ptabla.'0')){$ptabla=$ptabla.'0';}
		if(exist_table($ptabla.'1')){$ptabla=$ptabla.'1';}
		if(exist_table($ptabla.'2')){$ptabla=$ptabla.'2';}
	}

	if(substr($ptabla,-1,1)=='0')
  {
    $sql_saycod='select * from '.$ptabla.' where '.substr($ptabla,0,4).'_codigo="'.$pcodigo.'"';
    $res_saycod=msql_query($sql_saycod,$link_vcrx);
    $pcolumn=substr($ptabla,0,4).'_'.$pcolumn;
    if(msql_num_rows($res_saycod)!=0)
    {$xvalor=msql_result($res_saycod,0,$pcolumn);}
//     {$xvalor=msql_result($res_saycod,0,$ptabla.'_'.$pcolumn);}
  }

	if(substr($ptabla,-1,1)=='1')
  {
    $sql_saycod='select * from '.$ptabla.' where idnum1="'.$pcodigo.'"';
    $res_saycod=msql_query($sql_saycod,$link_vcrx);
    if(msql_num_rows($res_saycod)!=0)
    {$xvalor=msql_result($res_saycod,0,$pcolumn);}
  }

// echo $sql_saycod;
// echo msql_error();
?>                         


<?php if($pobj>1){?>
<td valign="middle" >
<input type="button"
				 tabIndex="-1"
         style="
								font-weight:bold;
								border-style:outset;
								border-width:3px;
								border-radius:0px;
								padding:2px;
								margin:0px;
								width:100%;
								max-width:100%;
								font-family:arial;
								font-size:<?php echo $psize;?>px;
								<?php if($pobj==1 ){echo 'display:none;';} ?>
								" 
       value="<?php echo $pcaption ?>">
</input>
</td>
<?php } ?>


<td valign="middle">
<?php if($pobj==2 || $pobj==3){?>
<input type="text"
			 	 disabled='true'
				 tabIndex="-1"
         size="<?php echo $plon;?>"
         style="
								background-color:white;
								font-weight:bold;
								font-family:arial;
								font-size:<?php echo $psize+2;?>px;
								border-style:outset;
								border-width:3px;
								border-radius:0px;
								padding:2px;
								margin:0px;
								width:<?php  if($pobj==2){echo strlen(trim($xvalor))*$psize;}else{echo strlen(trim($pcodigo))*$psize;} ?>px;
                min-width:36px;
								<?php if($pobj==5 ){echo 'display:none;';} ?>
								" 
       title="<?php echo msql_result($res_saycod,0,$pcolumn);?>"
       value="<?php if($pobj==2){echo $xvalor;}else{echo $pcodigo;} ?>"
			 >
</input>
<?php } ?>

<?php if($pobj==3){?>
<!-- <td> -->
<span 
     style="
            font-weight:bold;
            font-family:arial;
						font-size:<?php echo $psize;?>px;
						max-width:100%;
            <?php if($pobj==5){echo 'display:none;';} ?>
            " 
      >
      <?php echo $xvalor; ?>
</span>
<?php } ?>
</td>


<?php $ptabla=''; ?>
<?php $pdefa=''; ?>
<?php $pcaption=''; ?>
<?php $pcodigo=''; ?>
<?php $pcolumn=''; ?>
<?php $pcolu=''; ?>
<?php $pdisab=0; ?>
<?php $pobj=0; ?>

<?php $psize=0; ?>
<?php $pvalor=0; ?>
<?php $pdeci=0; ?>
<?php $pdest=0; ?>
<?php $ptitle=''; ?>

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