<?php
		header("Access-Control-Allow-Origin: *");
		header("Access-Control-Allow-Headers: access");
		header("Access-Control-Allow-Methods: GET");
		header("Access-Control-Allow-Credentials: true");
		header("Content-Type: application/json; charset=UTF-8");

		include_once '../Database.php';
		include_once 'cliente.php';

		$database = new DataBase();
		$db = $database->getConnection();

		$cliente = new CLIENTE($db);
		$cliente->id = isset($_GET['id'])?$_GET['id']:die();
		try{
			$stmt = $cliente->select("select * from detallepago where estado=true and usuario=".$cliente->id);
		$num = $stmt->rowCount();

		if($num>0){
		    $cliente=array();
			while($row =$stmt->fetch(PDO::FETCH_ASSOC)){
				extract($row);
				$add_item=array(
					"id"=>$id,
					"modulo"=>$modulo,
				);
				array_push($cliente,$add_item);
			}
			echo json_encode($cliente);
		}
		else {
			echo json_encode(array("Mensaje"=>"No se han encontrado registros"));
		}
	}catch(Exeption $e){
		echo json_encode(array("Error"=>"Error ".$e));
	}
	
		
?>