| Current Path : /var/www/html/mmishra/iws8/html/indem/phq/operator/ |
| Current File : /var/www/html/mmishra/iws8/html/indem/phq/operator/leave.php |
<b>Leave Details</b>
<?php
$tbl = "t_leave";
$my_id = $_REQUEST['id'];
if (!$my_id) $my_id = 0;
$pno = $_REQUEST['pno'];
echo " [<a href='$PHP_SELF?url=$url&pno=$pno&id=0'>New...</a>]";
if ($_POST['submit'] == 'SAVE'){
$leave_type = $_REQUEST['leave_type'];
$startdate_of_leave = $_REQUEST['startdate_of_leave'];
$enddate_of_leave = $_REQUEST['enddate_of_leave'];
$leave_period = $_REQUEST['leave_period'];
$granted_by = $_REQUEST['gradted_by'];
$district = $_REQUEST['district'];
$rs = mysql_query("select * from $tbl where id=$my_id", $link);
if (mysql_num_rows($rs)){//update
mysql_query("update $tbl set leave_type='$leave_type',startdate_of_leave='$startdate_of_leave',enddate_of_leave='$enddate_of_leave',leave_period=$leave_period,granted_by='$granted_by',district='$district',date_of_updation=now() where id=$my_id", $link);
}else{//insert
mysql_query("insert into $tbl(id,pno,leave_type,startdate_of_leave,enddate_of_leave,leave_period,granted_by,district,date_of_updation) values(NULL,'$pno','$leave_type','$startdate_of_leave','$enddate_of_leave',$leave_period,'$granted_by','$district',now())", $link);
}
echo "<div align='right'>Record saved...</div>";
}else{
//echo "<div align='right'>Posting details...</div>";
}
$rs = mysql_query("select * from $tbl where pno='$pno'", $link);
while ($o = mysql_fetch_object($rs)){
$id = $o->id;
if ($id == $my_id){
$pno = $o->pno;
$leave_type = $o->leave_type;
$startdate_of_leave = $o->startdate_of_leave;
$enddate_of_leave = $o->enddate_of_leave;
$leave_period = $o->leave_period;
$granted_by = $o->granted_by;
$district = $o->district;
$date_of_updation = $o->date_of_updation;
}
}
?>
<input type='hidden' name='id' value='<?=$my_id?>'>
<table width='100%'>
<tr><td width='20%' nowrap>Leave Type</td><td width='80%'><select id='hindi' name='leave_type'>
<?php
echo enumerated_data('leave',$leave_type,$link);
?>
</select></td></tr>
<tr><td>Start Date of Leave</td><td><input type='text' name='startdate_of_leave' size='10' value='<?=$startdate_of_leave?>'></td></tr>
<tr><td>End Date of Leave</td><td><input type='text' name='enddate_of_leave' size='10' value='<?=$enddate_of_leave?>'></td></tr>
<tr><td>Leave Period</td><td><input type='text' name='leave_period' size='10' value='<?=$leave_period?>'></td></tr>
<tr><td>Granted By</td><td><select id='hindi' name='granted_by'>
<?php
echo enumerated_data('post',$granted_by,$link);
?>
</select></td></tr>
<tr><td>District</td><td><select id='hindi' name='district'>
<?php
echo enumerated_data('district',$district,$link);
?>
</select></td></tr>
</table>
<input type='submit' name='submit' value='SAVE'> <input type='reset' value='RESET'> Last updated: <?=$date_of_updation?>
<table width='100%'>
<tr><th>Leave</th><th>From Date</th><th>To Date</th><th>Period</th><th>Granted By</th><th>District</th></tr>
<?php
$rs = mysql_query("select * from $tbl where pno='$pno'", $link);
while ($o = mysql_fetch_object($rs)){
echo "<tr><td id='hindi'>$o->leave_type</td><td>$o->startdate_of_leave</td><td>$o->enddate_of_leave</td><td>$o->leave_period</td>";
echo "<td id='hindi'><a href='$PHP_SELF?url=$url&pno=$pno&id=$o->id'>$o->granted_by</a></td><td id='hindi'>$o->district</td></tr>";
}
?>
</table>