<?php

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

$client_id = $db->query("stock", "UPDATE `stock` SET `name`='{$_POST['name']}', `cost`='" . $function->number_to_save(number_format(str_replace(',', '.', $_POST['cost']), 2, '.', '')) . "', `retail`='" . $function->number_to_save(number_format(str_replace(',', '.', $_POST['retail']), 2, '.', '')) . "', `unit_of_measure`='{$_POST['unit_of_measure']}', `status`='{$_POST['status']}', `supplier_id`='{$_POST['supplier_id']}',`code` = '{$_POST['code']}',`contractors` = '" . $function->number_to_save(number_format(str_replace(',', '.', $_POST['contractors']), 2, '.', '')) . "',`shops` =  '" . $function->number_to_save(number_format(str_replace(',', '.', $_POST['shops']), 2, '.', '')) . "',`stock_categories` =  '{$_POST['stock_categories']}' WHERE `record_id`={$_POST['record_id']}");
if ($client_id > 0) {
    header("location: home.php");
}