<?php require_once('../Connections/oprmConn.php'); $sdt = date("Y-m-d",strtotime($_REQUEST['start_date']));



$edt = date("Y-m-d",strtotime($_REQUEST['end_date']));



$ld = $_REQUEST['leave_duration1'];


$leave_type_id = $_REQUEST['leave_type_id'];
$st = $_REQUEST['status'];



$details = $_REQUEST['text'];



$leave_duration = ((strtotime($edt)- strtotime($sdt))/24/3600)+1;



 



$d = date("Y-m-d");



//$q = "UPDATE weby_leave SET   (`start_date`, `end_date`, `leave_duration`, `status`, `updated_by`) WHERE weby_leave.leave_id = $row_postLeave[leave_id] VALUES ('$sdt', '$edt', '$leave_duration', 'P/A/C/R', '$_SESSION[user_id]')";







$p = "UPDATE weby_leave SET `start_date` = '$sdt', `end_date` = '$edt', `leave_reason` = '$details', `leave_duration` = '$ld', `leave_type_id` = '$leave_type_id', `status` = '$st', `updated_by` = '$_SESSION[user_id]' WHERE leave_id = '$_REQUEST[leave_id]'";



mysql_select_db($database_oprmConn, $oprmConn);



$query_getProj = $p;



$getProj = mysql_query($query_getProj, $oprmConn) or die(mysql_error());

















//mysql_select_db($database_oprmConn, $oprmConn);



//$query_getProf1 = "update weby_leave set status = '$_REQUEST[status]' where leave_id = '$_REQUEST[leaveid]'";



//$getProf1 = mysql_query($query_getProf1, $oprmConn) or die(mysql_error());







$l = "leave-view.php?leaveid=".$lid;



$iid = $_REQUEST['leave_id'];







$q = "SELECT DISTINCT weby_users.email_address, weby_profiles.full_name, weby_leave.leave_id, weby_leave.start_date, weby_leave.end_date, weby_leave.leave_duration, weby_leave.leave_reason, weby_leave.status FROM weby_users, weby_profiles, weby_leave WHERE weby_profiles.user_id = weby_leave.user_id and weby_leave.user_id = weby_users.user_id and weby_leave.leave_id = '$iid'";



mysql_select_db($database_oprmConn, $oprmConn);



$query_getLeave = $q;



$getLeave = mysql_query($query_getLeave, $oprmConn) or die(mysql_error());



$row_getLeave = mysql_fetch_assoc($getLeave);



$totalRows_getLeave = mysql_num_rows($getLeave);







mysql_select_db($database_oprmConn, $oprmConn);



$query_getProj22 = "select email_address FROM weby_users where user_role = 1";



$getProj22 = mysql_query($query_getProj22, $oprmConn) or die(mysql_error());



$row_getProj22 = mysql_fetch_assoc($getProj22);



$totalRows_getProj22 = mysql_num_rows($getProj22);











$sda = date("d-m-Y",strtotime($row_getLeave[start_date]));



if($row_getLeave[leave_duration]>1)



{



$eda = date("d-m-Y",strtotime($row_getLeave[end_date]));



}



else



{



	$eda = $sda;



}















$s = "InActive";



	   if($_REQUEST['status']=="A")



	   $s = "Approved";



	   if($_REQUEST['status']=="P")



	   $s = "Pending";



	    if($_REQUEST['status']=="C")



	   $s = "Cancled";



	    if($_REQUEST['status']=="R")



	   $s = "Rejected";



		if($_REQUEST['status']=="D")



	   $s = "Deleted";

		





// send email to new user along with registration details.



	/*$user_email = $row_getLeave['email_address'];



    $headers = 'MIME-Version: 1.0' . "\r\n";



       $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";



       $headers .= "From: Jiwani Consultancy <admin@Jiwani Consultancyservices.co.uk>" . "\r\n" ;



	   $s = "InActive";



	   if($_REQUEST['status']=="A")



	   $s = "Active";



	   if($_REQUEST['status']=="P")



	   $s = "Pending";*/



	



	   



	/*$subject = "Jiwani Consultancy - Leave Status Changed to $s .";



	$body = "Hi $row_getLeave[full_name],<br>This is to inform you that your Leave Request status has been changed to below status. <br>



	==================================================================<br>



	Resource Name: $row_getLeave[full_name]<br>



	Status: $s<br>



	==================================================================<br>



	<table width='100%' border='1' cellpadding='5' cellspacing='0'>



<th height='30' align='left' valign='top' bgcolor='#FFCC99'><strong>Leave id



</strong>



<td height='30' align='left' valign='top' bgcolor='#FFCC99'><strong>From Date</strong></td>



<td height='30' align='left' valign='top' bgcolor='#FFCC99'><strong>To Date</strong></td>



<td height='30' align='left' valign='top' bgcolor='#FFCC99'><strong>Reason</strong></td>



<td height='30' align='left' valign='top' bgcolor='#FFCC99'><strong>Status</strong></td>



</th>



<tr align='left' valign='top'>



<td height='30'>$row_getLeave[leave_id]</td>



<td height='30'>$sde</td>



<td height='30'>$ede</td>



<td height='30'>$row_getLeave[leave_reason]</td>



<td height='30'>$s</td>



</tr>



</table>



	If you have any queries, please contact admin.



	<br>";//upload now and test



	



	



	



	$user_email = $row_getLeave['email_address'];



	$headers = 'MIME-Version: 1.0' . "\r\n";



    $headers .= "From: Jiwani Consultancy <donotreply@Jiwani Consultancyservices.co.uk>" . "\r\n" ;



	$subject = "Jiwani Consultancy - $row_getLeave[full_name]: Leave Application Status has been submitted"; 



	$body = "Hi $row_getLeave[full_name],<";



	$t = "br>This is to inform you that your Leave Request status has been changed to below status. <br>



	==================================================================<br>



	Resource Name: $row_getLeave[full_name]<br>



	Status: $s<br>



	==================================================================<br>



	If you have any queries, please contact admin.



	<br>



	Thanks,<br>



	Jiwani Consultancy.";



	



	$body .= $t;



	mail($user_email, $subject, $body, $headers);*/































// send email to user about leave application details.



	$user_email = $row_getLeave['email_address'];



	$user_email1 = $row_getProj22['email_address'];



    $headers = 'MIME-Version: 1.0' . "\r\n";



       $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";



       //$headers .= "From: Jiwani Consultancy <donotreply@Jiwani Consultancyservices.co.uk>" . "\r\n" ;



	   $headers .= "From: $SERVER_EMAIL" . "\r\n" ;



	$subject = "SS WEB TECHNOLOGIES -  $row_getLeave[full_name]: Leave ApplicationStatus submitted";



	$subject1 = "SS WEB TECHNOLOGIES. - $row_getLeave[full_name]: Leave ApplicationStatus submitted."; 



	$body1 = "Hi admin,<";



	$body = "Hi $row_getLeave[full_name],<";



	$t = "br>This is to inform you that your Leave Request status has been changed to below status. <br>



	==================================================================<br>



	Resource Name: $row_getLeave[full_name]<br>



	Status: $s<br>



	==================================================================<br>



	



	<table width='100%' border='1' cellpadding='5' cellspacing='0'>



	<th height='30' align='left' valign='top' bgcolor='#FFCC99'><strong>Leave id



	</strong>



	<td height='30' align='left' valign='top' bgcolor='#FFCC99'><strong>From Date</strong></td>



	<td height='30' align='left' valign='top' bgcolor='#FFCC99'><strong>To Date</strong></td>



	<td height='30' align='left' valign='top' bgcolor='#FFCC99'><strong>Duration</strong></td>



	<td height='30' align='left' valign='top' bgcolor='#FFCC99'><strong>Reason</strong></td>



	<td height='30' align='left' valign='top' bgcolor='#FFCC99'><strong>Status</strong></td>



	</th>



	<tr align='left' valign='top'>



	<td height='30'>$row_getLeave[leave_id]</td>



	<td height='30'>$sda</td>



	<td height='30'>$eda</td>



	<td height='30'>$row_getLeave[leave_duration]</td>



	<td height='30'>$row_getLeave[leave_reason]</td>



	<td height='30'>$s</td>



	</tr>



	</table>











	<br>



	If you have any queries, please contact admin.



	<br>



	Thanks,<br>



	SS WEB TECHNOLOGIES.";



	



	$body .= $t;



	$body1 .= $t;



	mail($user_email, $subject, $body, $headers);



	mail($user_email1, $subject1, $body1, $headers);







$url="leave-list.php";



header("Location: leave-list.php");







 ?>







<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



<html xmlns="http://www.w3.org/1999/xhtml">



<head>



<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />



<title>Untitled Document</title>



</head>







<body>



</body>



</html>



