<?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 `Account3Name` WHERE ClientID=6 AND UpdatedDate > '2020-03-25 12:48:40'");
     
 			$stmt = $conn->prepare("SELECT * FROM Account3Name WHERE ClientID = $ClientID AND UpdatedDate > '$MaxDate'");
			$stmt->execute();
			$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
		
		
	   if($result!=null &&  $result>0){
			 $response["Account3Name"] = array();
      foreach($result as $row) { 
            $Account3Name["AcNameID"] = $row["AcNameID"];
            $Account3Name["AcName"] = $row["AcName"];
            $Account3Name["AcGroupID"] = $row["AcGroupID"];
            $Account3Name["AcAddress"] = $row["AcAddress"];
            $Account3Name["AcMobileNo"] = $row["AcMobileNo"];
            $Account3Name["AcContactNo"] = $row["AcContactNo"];
            $Account3Name["AcEmailAddress"] = $row["AcEmailAddress"];
            $Account3Name["AcDebitBal"] = $row["AcDebitBal"];
            $Account3Name["AcCreditBal"] = $row["AcCreditBal"];
            $Account3Name["AcPassward"] = $row["AcPassward"];
            $Account3Name["ClientID"] = $row["ClientID"];
            $Account3Name["ClientUserID"] = $row["ClientUserID"];
            $Account3Name["SysCode"] = $row["SysCode"];
            $Account3Name["NetCode"] = $row["NetCode"];
            $Account3Name["UpdatedDate"] = $row["UpdatedDate"];
            $Account3Name["SerialNo"] = $row["SerialNo"];
            $Account3Name["UserRights"] = $row["UserRights"];
            $Account3Name["SecurityRights"] = $row["SecurityRights"];
            $Account3Name["Salary"] = $row["Salary"];
            $Account3Name["NameOfPerson"] = $row["NameOfPerson"];
            $Account3Name["Remarks"] = $row["Remarks"];
        

        // push single product into final response array
        array_push($response["Account3Name"], $Account3Name);
     }
			 // success
			$response["success"] = 1;
			// echoing JSON response
			echo json_encode($response);
		}
		else{
				
		 // success
			$response["success"] = 0;
			$response["message"] = "No Data Availaible in Account3Name";
		   // 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 Account3Name";
       // echoing JSON response
       echo json_encode($response);
}
  $conn = null;
?>
