<?php

function dashboard_get_inventory_approvals_users($from_date, $to_date, $user_id=0) {
    $sql_material_reqs = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_MATERIAL_REQ);
    $sql_material_issues = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_MATERIAL_ISSUE);
    $sql_material_returns = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_MATERIAL_RETURN);
    $sql_material_transfer_receipts = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_MATERIAL_TRANSFER_RECEIPT);
    $sql_transfer_reqs = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_TRANSFERREQ);
    $sql_req_transfers = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_REQTRANSFER);
    $sql_inventory_receipts = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_INVENTORY_RECEIPT);
    $sql_inventory_issues = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_INVENTORY_ISSUE);
    $sql_inventory_receipt_requests = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_INVENTORY_RECEIPT_REQUEST);
    $sql_inventory_issue_requests = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_INVENTORY_ISSUE_REQUEST);
    
    $sql = $sql_material_reqs 
        ." UNION ".$sql_material_issues 
        ." UNION ".$sql_material_returns 
        ." UNION ".$sql_material_transfer_receipts 
        ." UNION ".$sql_transfer_reqs 
        ." UNION ".$sql_req_transfers 
        ." UNION ".$sql_inventory_receipts
        ." UNION ".$sql_inventory_issues
        ." UNION ".$sql_inventory_receipt_requests
        ." UNION ".$sql_inventory_issue_requests
            ;   
    
        return dashboard_get_approvals_users($sql);
}

?>