<?php


function view_dashboard_inventory_item_consumption($project_id, $item_code, $from_date, $to_date, $linked_field_type_id, $linked_field_id) {
    
    $sql = dashboard_get_sql_for_inventory_item_consuption_items($from_date, $to_date, $project_id, $item_code, $linked_field_type_id, $linked_field_id);
    
    $sql = " SELECT tmp.*, m.name movement_type_name,
                    u.name tran_unit_name
                FROM ($sql) tmp 
                    LEFT JOIN ".TB_PREF."movement_types m     
                        ON m.id = tmp.movement_type_id  
                    LEFT JOIN ".TB_PREF."item_units u     
                        ON u.abbr = tmp.tran_unit   
                ORDER BY tmp.tran_date, trans_type, trans_no ";

    return db_query($sql, "dashboard_get_period_inventory_item_consuption_total"); 

    
}
