<?php 
if($_REQUEST['action']=='delete'){
   DB_query("delete from hr_job_created  where id='".$_REQUEST['id']."' and post_status='0'",$db);
   DB_query("delete from hr_job_created_details  where parentid='".$_REQUEST['id']."'",$db);     
}
?>
<link rel="stylesheet" href="css/new_mxerp.css">
<div class="body_contain">
<div class="tab_div"> 
<h1>Vacancy Creation </h1>	
<p align="left"><a href="index.php?route=HRModule/Master/vacancy_creation&modid=<?php echo $_REQUEST['modid'] ?>&frmid=<?php echo $_REQUEST['frmid'] ?>"><input type="button" class="search" value="Add New" ></a></p>
<table width="100%" cellpadding="3" cellspacing="0" border="1" style="border:#808080 1px solid; border-collapse:collapse;">
<tr>
    <th rowspan="2" width="5%"><strong>S. No.</strong></th>
    <th rowspan="2"><strong>Branch</strong></th>
    <th rowspan="2" width="15%"><strong>Job Type</strong></th>
    <th rowspan="2" width="15%"><strong>Designation</strong></th>
    <th rowspan="2" width="15%"><strong>Department</strong></th>
    <th rowspan="2" width="12%"><strong>Vacancy Code</strong></th>
	<th rowspan="2" width="10%"><strong>Vacancy Date</strong></th>
    <th colspan="2" style="text-align:center;"><strong>Action</strong></th>
</tr>
<tr>
    <th width="5%" style="text-align:center;"><strong>Edit</strong></th>
    <th width="5%" style="text-align:center;"><strong>Delete</strong></th>
</tr>
<?php $i=0; $SQL=DB_query("SELECT * FROM hr_job_created where companyid='".$_SESSION['ACGCompanyId']."'",$db);
if(DB_num_rows($SQL)>0){
while($GetRec=DB_fetch_array($SQL)) {?>
<tr bgcolor="#fff">
	<td><?php echo $i+1; ?></td>
	<td><?php echo $sitename=$s->GetFieldValue('locations',"loccode='".$GetRec['branch']."'",'locationname'); ?></td>
    <td><?php if($GetRec['job_type']=="p"){ echo "Permanent"; } else if($GetRec['job_type']=="c"){ echo "Contract" ;} ?></td>
   <td><?php echo $s->GetFieldValue('desigmaster',"id='".$s->GetFieldValue('hr_job_created_details',"parentid='".$GetRec['id']."'","designation")."'","designame") ;?> </td> 
   
    <td><?php echo $s->GetFieldValue('deptmaster',"id='".$s->GetFieldValue('desigmaster',"id='".$s->GetFieldValue('hr_job_created_details',"parentid='".$GetRec['id']."'","designation")."'","mst_departmentid")."'","deptname") ;?></td>


    <td><?php echo $GetRec['vacancy_code']; ?></td>
    <td><?php echo ConvertSQLDate($GetRec['vac_date']) ?></td>	
    <td style="text-align:center;"><?php if($GetRec['post_status']==0){ ?>
        <a href="index.php?route=HRModule/Master/vacancy_creation_edit&modid=<?php echo $_REQUEST['modid'] ?>&frmid=<?php echo $_REQUEST['frmid'] ?>&id=<?php echo $GetRec['id']; ?>"><img width="15" height="15" src="images/icon-edit.png" title="Edit Document"></a><?php } else { ?><img width="15" height="15" src="images/icon-edit.png" title="Not Allowed" style="opacity:0.5;" /><?php } ?></td>
    <td style="text-align:center;">
    <?php if($GetRec['post_status']==0){ ?>
        <a href="index.php?route=HRModule/Master/vacancy_creation_index&modid=<?php echo $_REQUEST['modid'] ?>&frmid=<?php echo $_REQUEST['frmid'] ?>&action=delete&id=<?php echo $GetRec['id']; ?>"><img width="15" height="15" src="images/Icon_Delete.png" title="Edit Document"></a>
        <?php } else {?>
       <img width="15" height="15" src="images/Icon_Delete.png" title="Not Allowed" style="opacity:0.5;" /> 
        <?php } ?>
    </td>
</tr>
<?php $i++;} }else{?>
<tr>
    <td colspan="5">No Result Found.</td>
</tr>
<?php } ?>
</table>
</div>
</div>