<?php
/**********************************************************************
***********************************************************************/
$page_security = 'SA_PROJECT_JOB_COST_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 . "/manufacturing/includes/ui/job_cost_inquiry_ui.inc"); 
include_once($path_to_root . "/manufacturing/includes/db/job_cost_inquiry_db.inc"); 
include_once($path_to_root . "/projects/includes/db/project_sites_db.inc"); 
include_once($path_to_root . "/assets/includes/db/daily_tool_issue_db.inc"); 

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

page(_($help_context = "Job Cost Inquiry"), false, false, "", $js);

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

start_form();

    $Ajax->activate('job_cost');
    
    div_start('job_cost');
    
        display_job_cost_inquiry_selecting_parameters();

        if (isset($_POST['SearchItemTrans']) && $_POST['project_id'] > 0 && $_POST['job_id'] > 0) {
            display_job_cost_inquiry_details($_POST['project_id'], $_POST['job_id'], $_POST['type'], $_POST['stock_id'], $_POST['location']);
        } else {
            display_note('Select a project and a job then click search button.', 2, 2, "style=color:red");
        }
    
    div_end();

end_form(3);

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

?>