<?php
    require_once __DIR__ . '/../DBConnect.php';
if (isset($_POST['ClientID']) && isset($_POST['MaxDate'])) {
	try 
	{
	    $ClientID = $_POST['ClientID'];
     $MaxDate = $_POST['MaxDate'];
// 			$stmt = $conn->prepare("SELECT * FROM Item2Group WHERE ClientID = $ClientID AND UpdatedDate > '$MaxDate'");
			$stmt = $conn->prepare("SELECT * FROM Item2Group");
			$stmt->execute();
			$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
		
		
	   if($result!=null &&  $result>0){
		    $response["Item2Group"] = array();
			foreach($result as $row) { 
					//$Item2Group["ID"] = $row["ID"];          
					$Item2Group["Item2GroupID"] = $row["Item2GroupID"]; 
					$Item2Group["Item1TypeID"] = $row["Item1TypeID"];
					$Item2Group["Item2GroupName"] = $row["Item2GroupName"];
					$Item2Group["ClientID"] = $row["ClientID"];    
					$Item2Group["ClientUserID"] = $row["ClientUserID"];
					$Item2Group["NetCode"] = $row["NetCode"]; 
					$Item2Group["SysCode"] = $row["SysCode"];
					$Item2Group["UpdatedDate"] = $row["UpdatedDate"];
					// push single product into final response array
					array_push($response["Item2Group"], $Item2Group);
					}
				  // success
				  $response["success"] = 1;
				  // echoing JSON response
				  echo json_encode($response);
		}
		else{
				
		 // success
			$response["success"] = 0;
			$response["message"] = "No Data Availaible in Item2Group";
		   // echoing JSON response
			echo json_encode($response);
		}
	}
	catch(PDOException $e){
		
		echo "Error: " . $e->getMessage();
		
	}
	}
	
 else{
    $response["success"] = 0;
      $response["message"] = "Parameters are not set of Item2Group";
      // echoing JSON response
      echo json_encode($response);
}
  $conn = null;
?>