<?php require_once '../../masterpage/webservice_master.php'; 
	
	header("Access-Control-Allow-Origin: *");
	$surveyor_ID=$_POST['surveyor_ID'];
	$cond = "surveyor_ID='".$surveyor_ID."' AND isActive = 1  AND surveyType_ID = 2 AND isDelete = 0 AND  	isCompletedBySurveyor=0";
	$rows = $obj->fetchRowall('lfs_asign_survey',$cond);
	
	$row_arr=array();
	$i=0;


	if($rows){
	foreach ($rows as $rowvalue) {
		$conds = "project_ID='".$rowvalue['project_ID']."' AND isActive = 1 AND isDelete = 0 ";
		$rows = $obj->fetchRowall('lfs_projects',$conds);

		$row_arr[$i]=$rows[0]['client_ID'];
	$i++;	
	}

}

$clientarray=array_unique($row_arr);
//print_r($clientarray);
$clientarraymain=array();
$m=0;
if($clientarray){
foreach ($clientarray as $clientarrayvalue) {
	$cond1 = "client_ID='".$clientarrayvalue."' AND isActive = 1 AND isDelete = 0 ";
	$rowsclient = $obj->fetchRowall('lfs_clients',$cond1);
	$clientarraymain[$m]=$rowsclient[0];
	$m++;
}
}
	if(!empty($clientarraymain)){
		echo json_encode($clientarraymain);
	}
	else
	{
		echo json_encode(0);
	}

?>
