<?php
$PageSecurity = 11;
 //echo $_SERVER['QUERY_STRING'];exit;
 include('includes/SQL_CommonFunctions.inc');
 include('includes/function_lib.php');
 include('includes/session.inc');
 global $db;
 if($_REQUEST['desig']!=""){
$sql_po= "select b.*,a.id as mainid from hr_job_criteria a ,hr_job_criteria_details b Where a.id=b.masterid and a.branch='".$_REQUEST['branch']."' and a.designation='".$_REQUEST['desig']."' and a.job_type='".$_REQUEST['type']."' and a.companyid='".$_SESSION['ACGCompanyId']."' ";
$data1='<table width="100%" border="1" align="center" cellpadding="3" cellspacing="0">
    <tr><th>Sequence Number</th><th>Parameter Name</th><th>Label Count</th><th>Label Details</th></tr>';
        $result=DB_query($sql_po,$db);
        $i=0;
        while($myrow=DB_fetch_array($result))
        {
              $data1.='<tr class="row1"> <td class="tabledata1"><input type="text" readonly name="" id="" value="'.$myrow['seq_no'].'"> </td>';
         $data1.=' <td class="tabledata1"><input readonly style="width:200px" type="text" value="'.$myrow['parameter'].'" name="" id=""> </td>';
         $data1.='<td class="tabledata1"><input style="width:200px" type="text" value="" name="" id="lablecount_'.$i.'" onkeypress="return isNumberKey(event)" maxlength="2"  onkeyup="javascript:getlablefields(this,'.$i.')"> </td>';
         $data1.='<input type="hidden" value="'.$myrow['mainid'].'" name="" ><input type="hidden" id="detid_'.$i.'" value="'.$myrow['id'].'"><td class="tabledata1" id="labcnt_'.$i.'"> </td>';
      
    $data1.='</tr>';
        $i++;}
echo $data1; 
 }
 
if($_REQUEST['lablecount']!="")
{
     $data1='<table width="50%" border="1" align="center" cellpadding="3" cellspacing="0">';
     for($i=0;$i<$_REQUEST['lablecount'];$i++)
     {
         $k=$i+1;
         $data1.='<tr><td class="tabledata1"><input type="text" placeholder="Label Name" name="lable_name['.$_REQUEST['detid'].']['.$i.']" id="lablename_'.$_REQUEST['detid'].'_'.$i.'" value=""> </td> <td class="tabledata1"><input type="text" name="lablevalue['.$_REQUEST['detid'].']['.$i.']" placeholder="Value Count" maxlength="2" id="lablevalue_'.$_REQUEST['detid'].'_'.$i.'" onkeypress="return isNumberKey(event)"  onkeyup="javascript:getfieldvalue(this)" value=""> </td>';
         $data1.='<input type="hidden" value="'.$_REQUEST['detid'].'" id="detfield_'.$i.'" ><td class="tabledata1" id="fieldcnt_'.$_REQUEST['detid'].'_'.$i.'"></td>';    
$data1.='</tr>';
      }   
      $data1.='</table>' ;  
      echo $data1;
}

 if($_REQUEST['fieldcount']!="")
{
     $data1='<table width="50%" border="1" align="center" cellpadding="3" cellspacing="0"><tr>';
     
     for($i=0;$i<$_REQUEST['fieldcount'];$i++)
     {
         $k=$i+1;
         $data1.='<td class="tabledata1"><input type="text" name=fieldvalue['.$_REQUEST['detid'].']['.$_REQUEST['cntr'].'][] placeholder="Values" name="Value['.$i.']" id="valuename_'.$i.'" value=""> </td>';
      }   
      $data1.='</tr></table>' ;  
      echo $data1;
}
?>
