<?php
/**********************************************************************
***********************************************************************/

$page_security = 'SA_ASSET_TRANSFER_REQUEST_INQ';
if (!@$_GET['popup'])
	$path_to_root = "../..";
else	
	$path_to_root = "..";
include_once($path_to_root . "/includes/db_pager.inc");
include_once($path_to_root . "/includes/session.inc");
include_once($path_to_root . "/includes/date_functions.inc");
include_once($path_to_root . "/includes/ui.inc");
include_once($path_to_root . "/includes/inventory.inc");
include_once($path_to_root . "/includes/data_checks.inc");
include_once($path_to_root . "/assets/includes/db/asset_transfer_requests_inquiry_db.inc");
include_once($path_to_root . "/includes/ui/ui_lists_group_companies.inc");
include_once($path_to_root . "/includes/db/group_companies_db.inc");

$js = '';

if($use_popup_windows){
    $js .= get_js_open_window(1000, 500);
}
if($use_date_picker){
    $js .= get_js_date_picker();
}

page($help_context = "Approve Asset Transfer Requests Inquiry", false, false, "", $js);
//---------------------------------------------------------------------------------------------

simple_page_mode(true);

global $Ajax;

function _id($row){
    return get_asset_trans_view_str(ST_ASSET_TRANSFER_REQUEST, $row['id']);
}
function _reference($row){
    return $row['reference'];     
}
function _comment($row){
    return $row['comment'];     
}
function _from_project_description($row){
    return $row['from_project_description'];   
}
function _to_project_description($row){
    return $row['to_project_description'];   
}
function _from_location_name($row){
    return $row['from_location_name'];
}
function _to_location_name($row){
    return $row['to_location_name'];
}
function _total($row){
    return $row['total'];
}
function _approval_status($row){
    global $approval_statuses;
    return $approval_statuses[$row["approval_status"]];
}
function _edit_link($row){
    $modify = "ATRNo";   
    return pager_link(_("Edit"), "/assets/asset_transfer_requests.php?$modify=". $row['id'], ICON_EDIT);   
}

//---------------------------------------------------------------------------------------------

$sql = get_sql_for_approve_asset_transfer_request_inquiry($_SESSION['wa_current_user']->user);    

$cols = array(
            _("ID")=> array('fun' => '_id', 'align' => 'center'),
            _("Reference")=> array('fun' => '_reference'),                         
            _("From Project Name")=>array('fun' => '_from_project_description'),                
            _("To Project Name")=>array('fun' => '_to_project_description'),                
            _("From Asset Location")=>array('fun' => '_from_location_name'), 
            _("To Asset Location")=>array('fun' => '_to_location_name'), 
            _("Total")=>array('fun' => '_total'),
            _("Comment")=> array('fun' => '_comment'),
            _("Status")=> array('fun' => '_approval_status', 'align' => 'center'));

    array_append($cols, array( array('insert' => true, 'fun' => '_edit_link', 'align' => 'center')));

$table =& new_db_pager('orders_tbl', $sql, $cols, null, null);
$table->width = "98%";
display_db_pager($table);

br();

if(!@$_GET['popup']){
    end_form();
    end_page();
}	

?>