<?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/investment.php';

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

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

$investment->investor_id = $data->investor_id;
$investment->date = $data->date;
$investment->amount = $data->amount;
$investment->entry_by = isset($_SESSION['user']) ? $_SESSION['user'] : "";

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