<?php

function dashboard_get_purchasing_approvals_users($from_date, $to_date, $user_id=0) {
    $sql_purch_reqs = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_PURCH_REQ);
    $sql_pos = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_PURCHORDER);
    $sql_supp_invoices = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_SUPPINVOICE);
    $sql_supp_credits = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_SUPPCREDIT);
    $sql_supp_payments = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_SUPPAYMENT);
    $sql_supp_receives = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_SUPPRECEIVE);
    $sql_pr_issues = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_PR_ISSUE);
    
    $sql = $sql_purch_reqs 
        ." UNION ".$sql_pos 
        ." UNION ".$sql_supp_invoices 
        ." UNION ".$sql_supp_credits 
        ." UNION ".$sql_supp_payments 
        ." UNION ".$sql_supp_receives
        ." UNION ".$sql_pr_issues
            ;   
    
        return dashboard_get_approvals_users($sql);
}

?>