<link rel="stylesheet" href="css/new_mxerp.css">
<form name="search" action="" method="post">
<div class="body_contain">
<div class="tab_div"> 
<div id="PickedItems" style="display:none"></div>
<h1>Declaration Document Updating</h1>
<p style="text-align:left;">
<?php  $url='&modid='.$_REQUEST['modid'].'&frmid='.$_REQUEST['frmid'];
$emp_id  =  $s->GetFieldValue("www_users","id='".$_SESSION['UserID']."' ","empid");

?>

<form action="" method="post" name="myform" >
  <table width="100%" border="0" cellpadding="3" cellspacing="0">
  <tr class="row1">
  <td width="13%"><strong>Employee</strong></td>
  <td width="35%">
    <?php //print_r($_SESSION); ?>
    <select name="emp" >
    <option value="">---Select---</option>
  <?php 
     
     if($_SESSION['UserType']=='SuperAdmin'){
      $Sitesql="select * from empmaster  order by emp_name ASC";
    }
    else{
      $Sitesql="select * from empmaster  where id='".$emp_id."' order by emp_name ASC";
    }
  $SiteRes=DB_query($Sitesql,$db);
  while($SiteRow=DB_fetch_array($SiteRes)){?>
            <option value="<?php  echo $SiteRow['id'];?>" <?php  echo $_REQUEST['emp']==$SiteRow['id']?'selected':''?> >
            <?php  echo $SiteRow['emp_name'];?>
            </option>
<?php }?>
          </select>
  </td>
  <td width="13%"><strong>Finincial Year</strong></td>
  <td><select name="fin_year" >
    <option value="">---Select---</option>
  <?php $finyearsql="SELECT * FROM `company_financial_years` order by id desc";
      $finyearsqlRes=DB_query($finyearsql,$db);
      while($finyeaRow=DB_fetch_array($finyearsqlRes)){?>
            <option value="<?php  echo $finyeaRow['id'];?>" <?php  echo $_REQUEST['fin_year']==$finyeaRow['id']?'selected':''?> >
            <?php  echo date('Y',strtotime($finyeaRow['year_start']))."-TO- ".date('Y',strtotime($finyeaRow['year_end']));?>
            </option>
<?php }?>
          </select>
  </td>
</tr>
<tr class="row1">
  <td colspan="4" style="text-align:center;"><strong> <input name="Search" type="submit" class="search" value="Search"/></strong></td>  
</tr>
  </table>
  </form>

<br>
<?php
//if(in_array($_SESSION['UserID'],$Explode))
//{



if($_REQUEST['Search']){
$filter='1=1';
    
  

  if($_REQUEST['fin_year']!='' ) 
   {
     $filter.=" and fin_year='".$_REQUEST['fin_year']."' ";
   }
   if($_REQUEST['emp']!='' ) 
   {
     $filter.=" and emp_id='".$_REQUEST['emp']."' ";
   }

  if($_SESSION['UserType']=='SuperAdmin'){

     $SQL=DB_query("SELECT * FROM `hr_declaration_head` where $filter ",$db);
  }
  else{
     $SQL=DB_query("SELECT * FROM `hr_declaration_head` where $filter and emp_id='".$emp_id."'",$db);
  }

}
else{
  if($_SESSION['UserType']=='SuperAdmin'){

     $SQL=DB_query("SELECT * FROM `hr_declaration_head`",$db);
  }
  else{
     $SQL=DB_query("SELECT * FROM `hr_declaration_head` where emp_id='".$emp_id."'",$db);
  }

} 



?>

 <table width="100%" cellpadding="3" cellspacing="0" border="1" style="border:#808080 1px solid; border-collapse:collapse;">
 
<tr>
  <th width="3%"><strong>S. No.</strong></th>
  <th><strong>Employe Name</strong></th>
  <th width="10%"><strong>Finincial Year</strong></th>
  <th width="5%"><strong>View</strong></th>
   <!-- <th width="8%"><strong>Location</strong></th>
  <th width="6%"><strong>Joining Date</strong></th>-->
  <th width="7%" style="text-align:center;"><strong>Action</strong></th>
</tr>
<?php 
$i=1;
//$SQL=DB_query("SELECT * FROM hr_applcnt_rgstn where $filter1 and status='accept' and conf_int_app_details_seq ='".$oldseq."'"


while($GetRec=DB_fetch_array($SQL)) {
  $applicantid=$GetRec['id'];
 // $qt=DB_num_rows(DB_query("SELECT * FROM hr_applcnt_rgstn_ref where hr_applcnt_rgstn_id='".$GetRec['mainid']."' and akk_status='ok'",$db));
//if($qt>=2){
  ?>
  <tr bgcolor="#fff">
        <td><?php echo $i; ?></td>         
        <td><?php echo $s->GetFieldValue("empmaster","id='".$GetRec['emp_id']."'","emp_name") ;?></td>
        <td><?php echo $s->GetFieldValue("company_financial_years","id='".$GetRec['fin_year']."'","year(year_start)")."-".$s->GetFieldValue("company_financial_years","id='".$GetRec['fin_year']."'","year(year_end)");?></td>
        <td><input class="search" type="button" name="view" value="View" onclick="pop1(<?php echo $GetRec['id']; ?>,<?php echo $_REQUEST['frmid']; ?>,<?php echo $_REQUEST['modid']; ?>)"></td>            
        <td><input class="search" type="button" value="Uploads" onclick="pop(<?php echo $GetRec['id']; ?>,<?php echo $_REQUEST['frmid']; ?>,<?php echo $_REQUEST['modid']; ?>)"></td>
        </tr>
        <?php $i++; }// } ?>
</table>
</div>
</div>
</form>

<?php

?>
<script type="text/javascript" language="javascript">
//$.noConflict();
function pop(id,frmid,modid){
 // alert(id);
  //alert(str);
  $("#PickedItems").dialog({
                title:'Document Uploading',
                modal: true,
                resizable: false,
                width:900,
                height:400,
                closeText: 'fechar',
                draggable: true,
                show: 'fade',
                hide: 'fade',
                dialogClass: 'main-dialog-class',
                buttons: {
                        Exit: function()
                        {
                                $(this).dialog("close");
                        }
                }

            });
   Getemployeelist(id,frmid,modid);
}

    
function Getemployeelist(id,frmid,modid)
{ 
  var xmlhttp;
    if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp=new XMLHttpRequest();
    }
    else
    {// code for IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function()
    {
    if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
       // alert(xmlhttp.responseText);
    document.getElementById("PickedItems").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("POST",'ajax_invest_doc_updating.php?id='+id+'&modid='+modid+'&frmid='+frmid,true);
xmlhttp.send();
}

function pop1(id,frmid,modid){

  $("#PickedItems").dialog({
                title:'Document Uploading View',
                modal: true,
                resizable: false,
                width:900,
                height:400,
                closeText: 'fechar',
                draggable: true,
                show: 'fade',
                hide: 'fade',
                dialogClass: 'main-dialog-class',
                buttons: {
                        Exit: function()
                        {
                                $(this).dialog("close");
                        }
                }

            });
   Getemployeelist1(id,frmid,modid);
}
    
function Getemployeelist1(id,frmid,modid)
{ 
  var xmlhttp;
    if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp=new XMLHttpRequest();
    }
    else
    {// code for IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function()
    {
    if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
       // alert(xmlhttp.responseText);
    document.getElementById("PickedItems").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("POST",'ajax_invest_doc_updating_view.php?id='+id+'&modid='+modid+'&frmid='+frmid,true);
xmlhttp.send();
}


</script>
