<?php
// required headers
header("Access-Control-Allow-Origin: *");
// header("Content-Type: application/json; charset=UTF-8");
header("Access-Control-Allow-Methods: POST");
header("Access-Control-Max-Age: 3600");
header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With");

include_once '../config/database.php';
include_once '../objects/deposit.php';

// date_default_timezone_set('Asia/Rangoon');
session_start();

$database = new Database();
$db = $database->getConnection();
 
$deposit = new Deposit($db);
$data = json_decode(file_get_contents("php://input"));

$deposit->checkin_id = 0;
$deposit->reservation_no = $data->reservation_no;
$deposit->room_no = $data->room_no;
$deposit->deposit_status = 'reservation';
$deposit->deposit_date = $data->deposit_date;
$deposit->deposit_type = $data->deposit_type;
$deposit->deposit_amount = $data->deposit_amount;
$deposit->entry_by = isset($_SESSION['userid']) ? $_SESSION['userid'] : "";

if($deposit->create()){
	echo 'created';
}else{
    echo 'error';
}
?>