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

$page_security = 'SA_ASSET_QUANTITY_ADJUSTMENT_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_quantity_adjustment_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 Quantity Adjustment Requests Inquiry", false, false, "", $js);
//---------------------------------------------------------------------------------------------

simple_page_mode(true);

global $Ajax;

function _id($row){
    return get_asset_trans_view_str(ST_ASSET_QUANTITY_ADJUSTMENT_REQUEST, $row['id']);
}
function _reference($row){
    return $row['reference'];     
}
function _comment($row){
    return $row['comment'];     
}
function _project_description($row){
    return $row['project_description'];   
}
function _location_name($row){
    return $row['location_name'];
}
function _total($row){
    return $row['total'];
}
function _is_deduction($row){
    return get_yes_no_name($row['is_deduction']);
}
function _approval_status($row){
    global $approval_statuses;
    return $approval_statuses[$row["approval_status"]];
}
function _edit_link($row){
    $modify = "AQARNo";   
    return pager_link(_("Edit"), "/assets/asset_quantity_adjustment_requests.php?$modify=". $row['id'], ICON_EDIT);   
}

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

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

$cols = array(
            _("ID")=> array('fun' => '_id', 'align' => 'center'),
            _("Reference")=> array('fun' => '_reference'),                         
            _("Project Name")=>array('fun' => '_project_description'),                              
            _("Asset Location")=>array('fun' => '_location_name'), 
            _("Is Deduction")=>array('fun' => '_is_deduction', 'align' => 'center'),
            _("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();
}	

?>