<?php   
    require "commonincludefiles.php";
	
	$objallowancesMgmt = new allowancesMgmt();
	     
	if ($_SESSION['VedantnrCollegeId']!="" && isset($_SESSION['VedantnrCollegeId'])) {

		$objallowancesMgmt->allowances_id 			  = $_REQUEST["allowances_id"];									   		
		$objallowancesMgmt->allowances_name			  =	$_REQUEST['allowances_name'];
		$objallowancesMgmt->allowances_percentage 	  =	$_REQUEST['allowances_percentage'];	
		$objallowancesMgmt->allowances_value 		  =	$_REQUEST['allowances_value'];
			
		if ($_REQUEST["allowances_id"] > 0 && isset($_REQUEST["allowances_id"])) {  // edit mode 	
			 {
				if ($_REQUEST["mode"] =="delete") {  // delete mode 	
					$objallowancesMgmt->deleteallowances_Id =	 $_REQUEST["allowances_id"];									   
					$objallowancesMgmt -> delete();
				}
				else
				{
					$objallowancesMgmt -> edit();
				}
			  } 
			echo '{"success":"true","msg":""}';
		}			
		else
		{	$objallowancesMgmt->add();
			
			if(	$objallowancesMgmt->allowances_id >0) {
				echo '{"success":"true","msg":""}';			
			} else {
				echo '{"success":"false","msg":""}';	
			}	
		}
   }						 
	else {
		echo '{"success":"false","msg":"session expiry"}';
	}	
 ?>