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

include_once($path_to_root . "/includes/session.inc");
include_once($path_to_root . "/includes/ui.inc");
include_once($path_to_root . "/includes/date_functions.inc");
include_once($path_to_root . "/inventory/includes/ui/item_transactions_inquiry_ui.inc"); 
include_once($path_to_root . "/inventory/includes/db/item_transactions_inquiry_db.inc"); 
include_once($path_to_root . "/inventory/includes/db/movement_types_db.inc");  
include_once($path_to_root . "/includes/db/group_companies_db.inc");  

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

page(_($help_context = "Item Transactions Inquiry"), false, false, "", $js);

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

start_form();

    $Ajax->activate('itm_trns');
    
    div_start('itm_trns');
    
        display_item_transactions_inquiry_selecting_parameters();

        if (isset($_POST['SearchItemTrans'])) {
            display_item_transactions_inquiry_details($_POST['stock_id'], $_POST['StockLocation'], $_POST['BeforeDate'], $_POST['AfterDate'], 
                                                      $_POST['project_id'], $_POST['type'], $_POST['movement_type_id'], $_POST['linked_field'], 
                                                      $_POST['linked_field_id'], $_POST['filtering_item_description']);
        } else {
            display_note('Select filters then click search button.', 2, 2);
        }
    
    div_end();

end_form(2);

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

?>