<?php
	header("Access-Control-Allow-Origin: *");
	header("Content-Type: application/json; charset=UTF-8");
	 
	include_once '../config/database.php';
	include_once '../objects/createrole.php';
	 
	$database = new Database();
	$db = $database->getConnection();
	 
	$userrole = new UserRole($db);

	$stmt = $userrole->getAllRows();
	$num = $stmt->rowCount();

	$arr=array();
	$arr["records"]=array();
	if($num>0){


		while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){
			extract($row);
			$item=array(
				"id" => (int)$id,
				"rolename" => $rolename,
				"create_role" => $create_role,
				"employee" => $employee,
				"create_account" => $create_account,
				"change_password" => $change_password,
				"investor" => $investor,
				"room" => $room,
				"agent" => $agent,
				"item" => $item,
				"duty_schedule" => $duty_schedule,
				"attendance" => $attendance,
				"attendance_update" => $attendance_update,
				"reservation" => $reservation,
				"upcoming_arrivals" => $upcoming_arrivals,
				"arrival" => $arrival,
				"occupied_list" => $occupied_list,
				"deleted_reservation_list" => $deleted_reservation_list,
				"sales_service" => $sales_service,
				"stock_in" => $stock_in,
				"stock_out" => $stock_out,
				"stock_in_report" => $stock_in_report,
				"stock_out_report" => $stock_out_report,
				"stock_balance_report" => $stock_balance_report,
				"purchase" => $purchase,
				"purchase_report" => $purchase_report,
				"monthly_report" => $monthly_report,
				"cash_book_report" => $cash_book_report,
				"coa" => $coa,
				"expense" => $expense,
				"income" => $income,
				"expense_report" => $expense_report,
				"income_report" => $income_report,
				"attendance_report" => $attendance_report,
				"guest_report" => $guest_report,
				"arrival_report" => $arrival_report,
				"departure_report" => $departure_report
			);
	 
			array_push($arr["records"], $item);
		}
	 
		
	}
	echo json_encode($arr);
?>