<?php
$placeholders = implode(',', $branchmid);
$placeholders1 = implode(',', $departmentmid);
if(!in_array('All',$umid))
{
	$umid = $_POST['umid'];
}
else if( in_array('All',$branchmid) && in_array('All',$departmentmid))
	{
		 // $sql23="select umid  from res_user_master where  departmentmid='$departmentmid' and branchmid=$branchmid";
		  $sql23="select umid  from res_user_master where  ustatus = 'Approved'";
			$stmt23= $db7->prepare($sql23);
			
		    $stmt23->execute();
			if ($stmt23->rowCount() > 0)
				{
					$umid = array();
					while($rt23 = $stmt23->fetch(PDO::FETCH_ASSOC))
					{
						  $umid1=$rt23['umid'];
						
						
						array_push($umid,$umid1);
						
						
					}
				}
				
				
			
	}else if( in_array('All',$branchmid) && !in_array('All',$departmentmid)){
		
		// $sql23="select umid  from res_user_master where  departmentmid='$departmentmid' and branchmid=$branchmid";
		  $sql23="select umid  from res_user_master where  ustatus = 'Approved' and departmentmid in ('$placeholders1')";
			$stmt23= $db7->prepare($sql23);
			
		    $stmt23->execute();
			if ($stmt23->rowCount() > 0)
				{
					$umid = array();
					while($rt23 = $stmt23->fetch(PDO::FETCH_ASSOC))
					{
						  $umid1=$rt23['umid'];
						
						
						array_push($umid,$umid1);
						
						
					}
				}
	}else if( !in_array('All',$branchmid) && !in_array('All',$departmentmid)){
		
		// $sql23="select umid  from res_user_master where  departmentmid='$departmentmid' and branchmid=$branchmid";
		  $sql23="select umid  from res_user_master where  ustatus = 'Approved' and departmentmid in ($placeholders1) and branchmid in ($placeholders)";
			$stmt23= $db7->prepare($sql23);
			
		    $stmt23->execute();
			if ($stmt23->rowCount() > 0)
				{
					$umid = array();
					while($rt23 = $stmt23->fetch(PDO::FETCH_ASSOC))
					{
						  $umid1=$rt23['umid'];
						
						
						array_push($umid,$umid1);
						
						
					}
				}
	}else if( !in_array('All',$branchmid) && in_array('All',$departmentmid)){
		
		// $sql23="select umid  from res_user_master where  departmentmid='$departmentmid' and branchmid=$branchmid";
		  $sql23="select umid  from res_user_master where  ustatus = 'Approved' and branchmid in ($placeholders)";
			$stmt23= $db7->prepare($sql23);
			
		    $stmt23->execute();
			if ($stmt23->rowCount() > 0)
				{
					$umid = array();
					while($rt23 = $stmt23->fetch(PDO::FETCH_ASSOC))
					{
						  $umid1=$rt23['umid'];
						
						
						array_push($umid,$umid1);
						
						
					}
				}
	}

?>