<?php
/**
 * This is general file which contains
 * connection file, common function file, etc.,
 *
 * PHP version 5
 *
 * @category Admin_Tool
 * @package  Admin_Tool
 * @author   Aum Infosys <admin@auminfosys.com>
 * @license  ACE
 * @version  CVS:1.0.1
 * @link     http://auminfosys.com/
 * @filesource
 */
 
/**
 * This is general file which contains
 * connection file, common function file, etc.,
 *
 */
	require "../commonincludefiles.php";

	$task = '';
	if(isset($_POST['task'])){
		$task = $_POST['task'];
	}

	$Employee_Ids = $_POST['ids']; // Get our array back and translate it :
	$deleteEmployee_Id = 0;

	if(version_compare(PHP_VERSION,"5.2","<")){    
   		require_once("./JSON.php"); 
		$json = new Services_JSON();
		$deleteEmployee_Id = $json->decode(stripslashes($Employee_Ids));
	} else{
	   	$deleteEmployee_Id = json_decode(stripslashes($Employee_Ids));
	}

	if(sizeof($deleteEmployee_Id)<1){
		echo '0';
	} else{
		$employee_id = implode(",",$deleteEmployee_Id);
		
		$sql = "SELECT 
					employee_photo 
				FROM 
					lms_employeemaster 
				WHERE 
					employee_id in($employee_id)
					And company_id='".$_SESSION["cCompany_id"]."'";
					
		$result = dbQuery($sql);			
		
		if(dbRows($result)){
			while($record = dbArray($result)){
				$remove = "../".$EmployeeImagePath.$record['employee_photo'];
				unlink($remove);
			}
		}
		
		$qry1 = "delete from
					lms_employeemaster 
				where 
					employee_id in ($employee_id)
					And company_id='".$_SESSION["cCompany_id"]."'";
				 
	  	/*$qry2 = "delete from
	 				sms_employeesalary  
				where 
				 	employee_id in ($employee_id)
				 	And company_id='".$_SESSION["cCompany_id"]."'";*/
					
		/*$qry3 = "delete from
	 				sms_gpf 
				where 
					employee_id in ($employee_id)
					And company_id='".$_SESSION["cCompany_id"]."'";*/
		
		dbQuery($qry1);	
		//dbQuery($qry2);
		//dbQuery($qry3);
		
		echo '1';
	}        
?> 