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


function get_tool_usage_entry_header($pi_no)
{
    $sql = "SELECT ai.*,
                    pm.description project_description
                   
            FROM ".TB_PREF."tool_issues ai 
                    LEFT JOIN ".TB_PREF."projects_master pm ON 
                            ai.project_id = pm.project_id 
                  
            WHERE ai.id=".db_escape($pi_no);
    
    $result = db_query($sql, "Could not get_asset_issue_header.");
    return db_fetch($result);   
    
}

function get_tool_usage_entry_details($ar_no)
{
    $sql = "SELECT aid.*,
                    am.description asset_description,
                    am.asset_code,
                    am.asset_id,
                    ar.description rate_description,
                    pt.description task_description,
                    ps.description site_description
        
            FROM ".TB_PREF."tool_issue_details aid 
                LEFT JOIN ".TB_PREF."asset_master am ON
                    aid.asset_id = am.asset_id 
                    
                LEFT JOIN ".TB_PREF."tool_rates ar ON
                    aid.rate_category_id = ar.id
                    
                LEFT JOIN ".TB_PREF."project_tasks pt ON
                    aid.task_id = pt.task_id
                    
                LEFT JOIN ".TB_PREF."project_sites ps ON
                    aid.site_id = ps.id
                   
                   
            WHERE aid.ai_id=".db_escape($ar_no);
    
    return db_query($sql, "Could not get_tool_request_details");
    
}
