
<?php
include('./includes/fun-php.php');
include('./includes/fun-HRClass.php');
$modid=$_REQUEST['modid'];
$frmid=$_REQUEST['frmid'];

?>

<link rel="stylesheet" href="css/new_mxerp.css">

<form name="search" action="" method="post">
<div class="body_contain">
<div class="tab_div"> 

<h1>Appointment</h1>

<?php 
$qu=DB_fetch_array(DB_query("SELECT no_of_assignee FROM conf_interview_approval",$db));
$no_assign=$qu['no_of_assignee'];
?>
<form>
<p style="text-align:left;">
<?php  $url='&modid='.$_REQUEST['modid'].'&frmid='.$_REQUEST['frmid'];?>
<a href='index.php?route=HRModule/Master/appointment<?php echo $url; ?>'>
  <input class="search" type="button" value="Pending"></a>
  <a href='index.php?route=HRModule/Master/appointment_offer<?php echo$url; ?>'>
  <input class="search" type="button" value="Offered"></a>
  <!--
  <a href='index.php?route=HRModule/Master/Reference_rejected<?php echo$url; ?>'>
  <input class="search" type="button" value="Rejected"></a>
  
  <a href='index.php?route=HRModule/Master/reference_ackowledge<?php echo$url; ?>'>
  <input class="search" type="button" value="Acknowledged"></a>-->
</p>
</p>
<table width="100%" cellspacing="0" cellpadding="3" border="0" align="center">
  <tbody>
  <tr class="row1">
    <td width="13%"><strong>Department</strong></td>
    <td width="20%"><select id="dept" name="dept" onchange="get_designation(this.value)">
    <option value="0">Select Department</option>
       <?php  $dept1=DB_query("SELECT * FROM `deptmaster` order by deptname",$db);?>
                 <?php   while($DeptRec1=DB_fetch_array($dept1)) { ?>
          <option value="<?php echo $DeptRec1['id']; ?>" <?php if($DeptRec1['id']==$_REQUEST['dept']){ echo "selected" ;}  ?>><?php echo $DeptRec1['deptname']; ?></option>
          <?php } ?>
      </select></td>
    <td width="13%"><strong>Designation</strong></td>
    <td width="20%"> 
      <select id="design" name="design" onchange="get_applicant(this.value)">              
      <option value="0">Select Designation</option>
      <?php  $design1=DB_query("SELECT * FROM `desigmaster` order by designame",$db);?>
              <?php   while($designRec1=DB_fetch_array($design1)) { ?>
          <option value="<?php echo $designRec1['id']; ?>" <?php if($designRec1['id']==$_REQUEST['design']){ echo "selected" ;}  ?>><?php echo $designRec1['designame']; ?></option>
          <?php } ?>        
         </select>
    <td width="13%"><strong>Applicant</strong></td>
    <td> 
      <select id="applicant" name="applicant">              
      <option value="">Select Applicant </option>
         <?php $SQL12=DB_query("SELECT id,first_name,middle_name,last_name FROM hr_applcnt_rgstn ",$db);
                         while($GetRec12=DB_fetch_array($SQL12)) {

        ?>
        <option value="<?php echo $GetRec12['first_name'];?>"><?php echo $GetRec12['first_name']." ".$GetRec12['middle_name']." ".$GetRec12['last_name']; ?></option>
          <?php  } ?>        
         </select>
      </td>
    </tr>

<tr class="row1">
  <td style="text-align:center;" colspan="6"><input type="submit" onclick="return frmvalidate();" value="Search" class="search" name="Search">
  </td>
</tr>
</tbody>
</table>
<br>
<?php
//if(in_array($_SESSION['UserID'],$Explode))
//{

if($_REQUEST['Search']!=''){

  //$filter[]="1=1";
if($_REQUEST['dept']!='0')
  {
  $filter[]="a.department='".$_REQUEST['dept']."'";
  }
  if($_REQUEST['design']!='0' && $_REQUEST['design']!='')
  {
  $filter[]="a.designation='".$_REQUEST['design']."'";
  }
  if($_REQUEST['applicant']!='')
  {
  $filter[]="a.first_name='".$_REQUEST['applicant']."'";
  }
}
if($filter!='')
  {
  
    $filter1 = implode(" and ",$filter);
    
   $SQL=DB_query("SELECT a.*,b.*,a.id as mainid,b.id as aid FROM hr_applcnt_rgstn a inner join hr_applcnt_rgstn_appointment b on b.hr_applcnt_rgstn_id=a.id where  $filter1 and a.status!='off_accept' and a.status!='off_reject'",$db);
    }
else
{
  $SQL=DB_query("SELECT a.*,b.*,a.id as mainid,b.id as aid FROM hr_applcnt_rgstn a inner join hr_applcnt_rgstn_appointment b on b.hr_applcnt_rgstn_id=a.id  WHERE a.status!='off_accept' and a.status!='off_reject'",$db);
}


?>
<h3>Offered</h3>
<div style="width:100%; overflow:auto; margin:0 auto;">
 <table width="100%" cellpadding="3" cellspacing="0" border="1" style="border:#808080 1px solid; border-collapse:collapse;">
<tr>
  <th rowspan="2" width="3%"><strong>S. No.</strong></th>
  <th rowspan="2"><strong>Applicant Name</strong></th>
  <th rowspan="2" width="8%"><strong>Contact No.</strong></th>
  <th rowspan="2" width="18%"><strong>Email</strong></th>
  <!--<th width="6%"><strong>Department</strong></th>-->
  <th rowspan="2" width="12%"><strong>Designation</strong></th>
  <!--<th width="8%"><strong>Job Type</strong></th>-->

 <!-- <th width="8%"><strong>No. of Ref.</strong></th>->
  <th width="160"><strong>Reference Name</strong></th>
  <th width="160"><strong>Reference Mail</strong></th>-->
  <th rowspan="2" width="8%"><strong>Offer No.</strong></th>
  <th rowspan="2" width="6%"><strong>Offer Date</strong></th>
  <th rowspan="2" width="10%"><strong>Appointment No.</strong></th>
  <th rowspan="2" width="6%"><strong>Appointment Date</strong></th>
 <!-- <th rowspan="2" width="10%"><strong>Location</strong></th>
  <th rowspan="2" width="6%"><strong>Joining Date</strong></th>-->
  <th colspan="2" style="text-align:center;"><strong>Action</strong></th>
</tr>
<tr>
  <th width="3%" style="text-align:center;"><strong>Print</strong></th>
  <th width="3%" style="text-align:center;"><strong>Edit</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'];

    // $applicantid=$GetRec['hr_applcnt_rgstn_id'];
 
  $rurl_view="appointment_letter_pdf.php?modid=".$modid."&frmid=".$frmid."";
 // $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 $GetRec['first_name']." ".$GetRec['middle_name']." ".$GetRec['last_name']; ?></td>
        <td><?php echo $GetRec['mobile1']; ?></td>
        <td><?php echo $GetRec['email1']; ?></td>       
        <!--<td><?php echo $s->GetFieldValue("deptmaster","id='".$GetRec['department']."'","deptname") ;?></td>-->
        <td><?php echo $s->GetFieldValue("desigmaster","id='".$GetRec['designation']."'","designame") ;?></td>
       <!-- <td><?php $jobtype= $s->GetFieldValue("hr_job_created","id='".$GetRec['hr_job_created_id']."'","job_type") ;
            if($jobtype=='p'){
              echo "Permanent";
              $emp_type='Permanent';
            }
            if($jobtype=='c'){
              echo "Contract ";
              $emp_type='Contract';
            }

        ?></td>-->
      <!--  <td><?php echo $qt; ?></td>
        <td><a href='index.php?route=HRModule/Master/create_offer<?php echo$url.'&id='.$GetRec['id'].'&action='.'offer'; ?>'>
          <input class="search" type="button" value="Offer" name="offer"> </a></td>-->
          <td><?php echo $s->GetFieldValue("hr_applcnt_rgstn_offer","hr_applcnt_rgstn_id='".$GetRec['mainid']."'","offer_no") ; ?></td>
          <td><?php echo convertsqldate($s->GetFieldValue("hr_applcnt_rgstn_offer","hr_applcnt_rgstn_id='".$GetRec['mainid']."'","offer_date")); ?></td>
          <td><?php echo $s->GetFieldValue("hr_applcnt_rgstn_appointment","hr_applcnt_rgstn_id='".$GetRec['mainid']."'","appointment_no") ;?></td>
          <td><?php echo convertsqldate($s->GetFieldValue("hr_applcnt_rgstn_appointment","hr_applcnt_rgstn_id='".$GetRec['mainid']."'","appointment_date"));?></td>
         <!-- <td><?php echo $GetRec['location']; ?></td>
          <td><?php echo convertsqldate($s->GetFieldValue("hr_applcnt_rgstn_offer","hr_applcnt_rgstn_id='".$GetRec['mainid']."'","joining_date")); ?></td>-->
         <!--  <td style="text-align:center;"><a href="appoint_print.php?apponid=<?php echo $GetRec['aid']; ?>&id=<?php echo $GetRec['mainid']; ?> " target="_blank"><img width="18" height="18" src="images/icon_print.jpg" title="Print Document"></a></td>  -->
 <td> <a href="<?php echo $rurl_view.'&app_id='.$applicantid ;?>" target="_blank"><img src="images/icon_print.jpg" width="18" height="18" title="Print" <?php echo $printview;?> /></a>   
                  
          <td style="text-align:center;"><a href='index.php?route=HRModule/Master/appoint_edit<?php echo $url; ?>&apponid=<?php echo $GetRec['aid']; ?>&action=<?php echo 'edit'; ?>&id=<?php echo $GetRec['mainid']; ?>'><img width="15" height="15" title="Edit Document" src="images/icon-edit.png"></a></td>
        </tr>
        <?php $i++; }// } ?>
</table>
</div>
</div>
</div>
</form>