<?php

function get_summary_employee_work_departmet_total($month_id, $department_id)
{
    $sql = "SELECT SUM(spw.days * spw.rate) total 
            FROM ".TB_PREF."monthly_summary_project_work spw
                JOIN ".TB_PREF."projects_master pm  
                    ON spw.project_id = pm.project_id 
            WHERE spw.month_id = ". db_escape($month_id)."  
                AND pm.department_id = ".db_escape($department_id);
    
    $result = db_query($sql);
    return db_result_value($result, 'total', 0);
}


function get_summary_employee_work_project_total($month_id, $project_id)
{
    $sql = "SELECT SUM(spw.days * spw.rate) total 
            FROM ".TB_PREF."monthly_summary_project_work spw  
            WHERE spw.month_id = ". db_escape($month_id)."  
                AND spw.project_id = ".db_escape($project_id);
    
    $result = db_query($sql);
    return db_result_value($result, 'total', 0);
}


















