<?php

function get_summary_company_month_range_value($from_month_display_order, $to_month_display_order, $value_types_in){
    
    $sql = "SELECT SUM(s.value) total 
            FROM ".TB_PREF."monthly_summary_company s 
                JOIN ".TB_PREF."months m 
                    ON s.month_id = m.id                                
            WHERE m.display_order >= ". db_escape($from_month_display_order)."  
                AND m.display_order <= ". db_escape($to_month_display_order)."  
                AND s.value_type IN (".$value_types_in.") ";
    
    $result = db_query($sql);
    return db_result_value($result, 'total', 0);
}
