<?php
ob_start();
session_start();
include("../inc/config.php");
include("../inc/session.php");


if($_POST['type']=="get_client_details"){
    $conditions ='';
   if($session_client_ids==0){
        $conditions.="";
    }else{
        $conditions.=" and id IN ($session_client_ids)";
    } 
   $branch_id = $_POST['branch_id'];

   error_log("SELECT * FROM `tbl_client_new` WHERE status=1 and branch_id=$branch_id");
    
        $statement = $pdo->prepare("SELECT * FROM `tbl_client_new` WHERE status=1 and branch_id=$branch_id $conditions");
		
		$statement->execute();
		$result = $statement->fetchAll(PDO::FETCH_ASSOC);
		$totalrow = $statement->rowCount();
		
		if($result){
		    $response['data']=$result;
		    $response['error']=false;
		    $response['message']="Client details fetched Successfuly";
		}else{
		    $response['error']=true;
		    $response['message']='failed';
		}
		
		echo json_encode($response);
 
}


?>