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

<?php $pbground='#D4FEF9'; ?>

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

<?php if(empty($pclass)){$pclass="";}?>
<?php if(empty($pobj)){$pobj=3;} ?>
<?php if(empty($plong)){$plong=9;} ?>
<?php if(empty($psize)){$psize=12;} ?>
<?php if(empty($pdefa)){$pdefa='';} ?>
<?php if(empty($ponclick)){$ponclick="";} ?>
<?php if(empty($ponchange)){$ponchange="";} ?>
<?php if(empty($ponenter)){$ponenter=$ponblur;} ?>
<?php if(empty($ptitle)){$ptitle=$pcaption;} ?>
<?php if(empty($plist)){$plist="";}?>
<?php if(empty($preado)){$preado=0;} ?>
<?php if(empty($phide)){$phide=0;} ?>
<?php if(empty($pidtxt)){$pidtxt=$pcaption;} ?>
<?php if(empty($pcaption)){$pcaption=$pidtxt;}?>
<?php if(empty($pphold) and $pobj==1){$pphold=$pcaption;}?>
<?php if(empty($pvalue)){$pvalue=$pdefa;} ?>
<?php $pphold=ucwords(strtolower($pphold));?>
<?php $pwhere=trim($pwhere); ?>
<?php if(substr($pwhere,0,1)=='('){$pwhere=' and'.$pwhere;} ?>
<?php $pstyle1=$pstyle; ?>
<?php $plong1=$plong; ?>



<?php 
	if(!empty($pdocu))
		{
      $sql_gettab='select * from docu0 where docu_status!="X" and docu_codigo like "'.$pdocu.'%" order by docu_codigo';
      $res_gettab=msql_query($sql_gettab,$link_vcrx);
      if(!msql_error($link_vcrx)){$ptabla=@msql_result($res_gettab,0,'docu_tabla').'12';}
		} 
?>
<?php if(!empty($pdocu) or !empty($plist)){$pdldown=2;} ?>
<?php if(empty($ptabla)){$ptabla='';} ?>
<?php if(empty($pcolu)){$pcolu='';} ?>
<?php $plong=$plong+$pdldown;?>
<?php $rdatalist=0; ?>


<?php $ponclick= str_replace('"',"'",$ponclick); ?>
<?php $ponchange= str_replace('"',"'",$ponchange); ?>

<?php $ponclick= str_replace('"',"'",$ponclick); ?>
<?php $ponenter= str_replace('"',"'",$ponenter); ?>
<?php $ponenter.=';'.$ponclick; ?>



<?php
// 	if($mobile=='true')
	if($mobile=='true')
	{
		$ponenter=$ponclick;
// 		$ponclick='';
	}
?>

<?php if($pobj==2){?>
<th id="th_<?php echo $pidtxt; ?>" class="<?php echo $pclass; ?>" width="<?php if(mb_stristr($plong,'%;')){echo $plong;}else{echo $plong.'px;';} ?>" valign="top"  style="<?php if($phide==1){echo 'display:none;';} ?>"  >
<?php } ?>
<?php if($pobj==3){?>
<td valign="top" class="<?php echo $pclass; ?>" style="<?php if($phide==1){echo 'display:none;';} ?>" >
<?php } ?>
<?php if($pobj!=1){ ?>	
<div class="<?php echo $pclass; ?>" <?php if($pobj==2){echo 'align="center"';}?>>
<?php } ?>
	<input type="button" 
         class="getnum_btn"
         id="<?php echo $pidtxt; ?>_btn" 
         onClick="<?php echo $ponclick;?>;_defanum(event,this.id)" 
         title="<?php echo ($ptitle);?>" 
         style="
                <?php echo $pstyle1; ?>
                <?php if($phide==1){echo ';display:none;';} ?>
                font-size:<?php echo $psize;?>px;
								<?php if($pobj==2 || $pobj==3){echo 'display:block;';}else{echo 'display:none;';}?>;
								<?php if($pobj==2)
											{
												if(mb_stristr($plong1,'%')){echo 'width:'.$plong1.';';}
												else
												{
												if(strlen($pcaption)<=$plong){echo 'width:100%;';}
												if(strlen($pcaption)>$plong){echo 'width:'.(strlen($pcaption)*$psize*.7).'px;';}
												}
											}
								?>;
								<?php //if($pobj==2){echo 'width:100%;';}?>;
								<?php if($pobj==3){echo 'width:100%;';}?>;
								padding:2px;
								margin:0px;
								" 
				 tabIndex="-1"
         value="<?php echo strtoupper($pcaption) ?>" 
				 ></input>
<?php if($pobj!=1){ ?>	
</div>
<?php } ?>

<?php if($pobj==1){?>
<td valign="top" class="<?php echo $pclass; ?>" style="<?php if($phide==1){echo 'display:none;';} ?>" >
<?php } ?>
<?php if($pobj==3){?>
</td> 
<td valign="top" class="<?php echo $pclass; ?>" style="<?php if($phide==1){echo 'display:none;';} ?>">
<?php } ?>
<?php if($pobj!=1){ ?>	
	<div class="<?php echo $pclass; ?>" <?php if($pobj==2){echo 'align="center"';}?>>
<?php } ?>
  <input 
         value="<?php echo $pvalue;?>" 
				 type="<?php 
               if ($mobile=='false' or $plong>15)
               {if($plist==''){echo 'text';}else{echo 'search';}}
               else
               {echo 'number';}
               ?>"
         
         class="getnum_txt"
         onchange="<?php echo $ponchange;?>" 
				 accesskey="<?php echo substr($pcaption,0,1)?>"
         id="<?php echo $pidtxt; ?>"  
         name="<?php echo $pidtxt; ?>"  
				 maxlength="<?php echo $plong-$pdldown ?>"
				 onfocus="<?php if ($mobile=='true' and $pobj==2){echo '{document.getElementById('.$pidtxt.').scrollInto View()}';} ?>{this.style.background='<?php echo $pbground;?>';}"
         onblur ="_valpad(this.id);<?php echo $ponblur;?>;{this.style.background='white';}" 
				 <?php if($preado==1){echo ' readonly ';}else{ ?>
 				 onKeyUp="_okupnum(event,this.id,'<?php echo $pdefa ?>','');"
         onKeyDown ="_okdnnum(event,this.id,'<?php echo $pdefa ?>','');
                     <?php if($ponenter!=''){ ?>
                     {if(event.keyCode==13){<?php echo $ponenter; ?>}}; 
                     <?php } ?>
                     "
         pattern="[0-9]"				 
         <?php } ?>
         style="
                <?php if($plong>10){echo 'align:left !important;';} ?>
                <?php //if($phide==1){echo 'display:none;';} ?>
								<?php if($pobj>1){echo 'font-weight:bold;';} ?>
								font-size:<?php echo $psize+2;?>px;
								width:<?php if(mb_stristr($plong,'%')){echo $plong.'';}else{echo (($plong+1)*$psize*.7).'px;';}?>;
								" 
         <?php if($pphold!=""){echo 'placeholder="'.$pphold.'"';}?>
				 title="<?php echo ($ptitle);?>" 
				 defa="<?php echo $pdefa;?>" 
         longi="<?php echo $plong-$pdldown; ?>" 
				 list="<?php if($plist!=''){echo $plist;}else{echo 'dl'.$pidtxt;} ?>"
				 <?php //if($plist!=''){echo 'list="'.$plist.'"';} ?>
				 ></input>
	<span id="<?php echo $pidtxt; ?>_error" class="txt_error" style="color:red;"></span>
<?php if($pobj!=1){ ?>	
</div>
<?php } ?>

<?php if($mobile=='true' and $preado==0){ ?><div class="" style="height:50px;"></div><?php } ?>
<?php if($mobile=='true' and $preado==1){ ?><div class="" style="height:25px;"></div><?php } ?>


<?php if($pobj==1){?>
</td>
<?php } ?>
<?php if($pobj==2){?>
</th>
<?php } ?>
<?php if($pobj==3){?>
</td>
<?php } ?>

<span>
<datalist id="dl<?php echo $pidtxt; ?>" style="display:none;">
<?php
	if(!empty($ptabla) and !empty($pcolu) and $plist=='')
	{
    $sql_list='select distinct ';
    $sql_list.= $pcolu.' as datalist ';
    $sql_list.=' from '.$ptabla;
    $sql_list.=' where status!="X" ';
      if($cfg_tipo=='cong')
      {if($pdocu!='DPU2'){$sql_list.=' and cong="'.$_SESSION['cong_codigo'].'" ';}}
      $sql_list.=' and status!="O" ';
    if(!empty($pdocu))
    {$sql_list.=' and docu like "'.$pdocu.'%" ';}
    if($pwhere!=""){$sql_list.=' '.$pwhere.' ';}
    $sql_list.=' order by '.$pcolu;
    $res_list=msql_query($sql_list,$link_vcrx);
//     echo $sql_list;echo msql_error($link_vcrx);
//     $countdl=msql_num_rows($res_list);
    while($aso_list=msql_fetch_assoc($res_list))
    {
      echo '<option value="'.$aso_list['datalist'].'">';
    }
	}
?>	
</datalist>
</span>


<?php $pcaption='';?>
<?php $pidtxt='';?>
<?php $pphold='';?>
<?php $ptitle='';?>
<?php $ptabla='';?>
<?php $pidtxt='';?>
<?php $plong='';?>
<?php $pobj='';?>
<?php $pdefa='';?>
<?php $ponblur='';?>
<?php $ponclick='';?>
<?php $psize=0;?>
<?php $preado=0;?>
<?php $pclass='';?>
<?php $plist='';?>
<?php $phide=0;?>
<?php $pstyle=''; ?>
<?php $pstyle1=''; ?>
<?php $pstyle2=''; ?>
<?php $pstyle3=''; ?>
<?php $pvalue='';?>


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