<?php   
    require "commonincludefiles.php";
	
	$objWorkMgmt = new WorkMgmt();
	
	     
	if ($_SESSION['cCompany_id']!="" && isset($_SESSION['cCompany_id'])) {
	
		$objWorkMgmt->work_id 	=	$_REQUEST["work_id"];
		$objWorkMgmt->work_details 	=	$_REQUEST['work_details'];	
		$objWorkMgmt->hours 	=	$_REQUEST['hours'];	
				
		if($_REQUEST["work_id"] > 0 && isset($_REQUEST["work_id"])){
			if($_REQUEST["mode"] =="delete"){
				$objWorkMgmt -> delete();
				
			} else{
				$objWorkMgmt -> edit();
			}
			echo '{"success":"true","msg":""}';
		} else{	
			$objWorkMgmt->add();
			if(	$objWorkMgmt->work_id	>0) {
				echo '{"success":"true","msg":""}';			
			} else{
				echo '{"success":"false","msg":""}';	
			}
		}
   	} else {
		echo '{"success":"false","msg":"session expiry"}';
	}	
 ?>