<?php
/**********************************************************************
***********************************************************************/
$page_security = 'SA_STOCK_STATUS_INQ';
$path_to_root = "../..";

include_once($path_to_root . "/includes/session.inc");

$js = "";
$js .= get_js_open_window(800, 500);
$js .= get_js_date_picker();

if (!@$_GET['popup']) {
    if (isset($_GET['stock_id'])) {
        page(_($help_context = "Inventory Item Status"), true, false, "", $js);
    } else {
        page(_($help_context = "Inventory Item Status"), false, false, "", $js);
    }
}

if (isset($_GET['stock_id'])) {
    $_POST['stock_id'] = $_GET['stock_id'];
}

include_once($path_to_root . "/includes/ui.inc");
include_once($path_to_root . "/inventory/includes/ui/stock_status_ui.inc");
include_once($path_to_root . "/inventory/includes/db/stock_status_db.inc");
include_once($path_to_root . "/inventory/includes/inventory_db.inc"); 
include_once($path_to_root . "/inventory/includes/db/items_locations_db.inc");  

global $Ajax;

if (list_updated('stock_id')) {
    $Ajax->activate('status_tbl');
}

check_db_has_stock_items(_("There are no items defined in the system."));

start_form();

    display_stock_status_selecting_parameters();

    display_stock_status_details($_POST['stock_id'], $_POST['date']);
    
end_form();

end_page(@$_GET['popup'], false, false);

?>