<?php

include $_SERVER['DOCUMENT_ROOT'] . "/classes/autoload.php";

$amount = round((float) $_POST['amount'], 2);
$client_id = $db->query("stock", "INSERT INTO `payments`(`invoice_id`, `amount`, `date_time`, `user_id`, `pyament_type`) VALUES ('" . $_POST['invoice_id'] . "','" . $amount . "','" . $_POST['date'] . "','" . $_SESSION['user_id'] . "','" . $_POST['pyament_type'] . "')", true);
if ($client_id > 0) {
    header("location: home.php");
}