<?php

function dashboard_get_project_approvals_users($from_date, $to_date, $user_id=0) {
    $sql_project_invoices = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_PROJECT_INVOICE);
    $sql_project_credit_notes = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_PROJECT_CREDIT_NOTE);
    $sql_project_payment_apps = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_PROJECT_PAYMENT_APPLICATION);
    $sql_project_cost_adjusts = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_PROJECT_COST_ADJUST);
    $sql_project_alloc_adjusts = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_PROJECT_ALLOC_ADJUST);
    $sql_project_work_dones = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_PROJECT_WORK_DONE);
    $sql_project_boq_items = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_PROJECT_BOQ_ITEM);
    $sql_project_boq_item_detail_edits = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_PROJECT_BOQ_ITEM_DETAIL_EDIT);
    $sql_project_sales_orders = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_PROJECT_SALES_ORDERS);
    $sql_est_project_boq_item_detail_edits = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_EST_PROJECT_BOQ_ITEM_DETAIL_EDIT);
    $sql_project_dispatch_requests = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_PROJECT_DISPATCH_REQUEST);
    $sql_project_float_adjusts = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_PROJECT_FLOAT_ADJ);
    $sql_project_advance_batches = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_PROJECT_ADVANCE_BATCH);
    $sql_miscellaneous_project_costs = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_MISCELLANEOUS_PROJECT_COST);
    $sql_approve_projects = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_APPROVE_PROJECT);
    $sql_approve_est_projects = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_APPROVE_EST_PROJECT);
    $sql_project_advances = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_PROJECT_ADVANCE);
    
    $sql = $sql_project_invoices 
        ." UNION ".$sql_project_credit_notes 
        ." UNION ".$sql_project_payment_apps 
        ." UNION ".$sql_project_cost_adjusts 
        ." UNION ".$sql_project_alloc_adjusts 
        ." UNION ".$sql_project_work_dones 
        ." UNION ".$sql_project_boq_items
        ." UNION ".$sql_project_boq_item_detail_edits
        ." UNION ".$sql_project_sales_orders
        ." UNION ".$sql_est_project_boq_item_detail_edits
        ." UNION ".$sql_project_dispatch_requests
        ." UNION ".$sql_project_float_adjusts
        ." UNION ".$sql_project_advance_batches
        ." UNION ".$sql_miscellaneous_project_costs
        ." UNION ".$sql_approve_projects
        ." UNION ".$sql_approve_est_projects
        ." UNION ".$sql_project_advances
            ;   
    
        return dashboard_get_approvals_users($sql);
}

?>