<?php

function dashboard_view_item_purchase_price_variance_details($item, $from_date, $to_date) {
    
    $sql = "SELECT pod.*,
                    u.name unit_name,
                    po.project_id, po.supplier_id  
            FROM ".TB_PREF."purch_order_details pod 
                JOIN ".TB_PREF."purch_orders po 
                    ON po.order_no = pod.order_no   
                JOIN ".TB_PREF."item_units u    
                    ON u.abbr = pod.order_unit     
            WHERE pod.delivery_date >= ".db_escape($from_date)." 
                AND pod.delivery_date <= ".db_escape($to_date)." 
                AND pod.item_code = ".db_escape($item)." 
            ORDER BY pod.delivery_date ";
    
                
        return db_query($sql, "dashboard_view_item_purchase_price_variance_details");  
}
