<?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'];
	}

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

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

	if(sizeof($deleteOperator_Id)<1){
		echo '0';
	} else{
		$operator_id = implode(",",$deleteOperator_Id);
		
		$sql = "SELECT 
					operator_photo 
				FROM 
					lms_operator
				WHERE 
					operator_id in($operator_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_operator
				where 
					operator_id in ($operator_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';
	}        
?> 