<?php

function dashboard_get_petty_cash_approvals_users($from_date, $to_date, $user_id=0) {
    $sql_petty_cash_expenses = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_PETTY_CASH);
    $sql_ious = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_I_OWE_YOU);
    $sql_iou_batches = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_I_OWE_YOU_BATCH);
    $sql_iou_payments = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_I_OWE_YOU_PAYMENT);
    $sql_petty_cash_payments = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_PETTY_CASH_PAYMENT);
    $sql_bank_payments = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_IOU_BANKPAYMENT);
    $sql_bank_returns = dashboard_get_sql_for_approvals($from_date, $to_date, $user_id, ST_IOU_BANKPAYMENT_RETURN);
    
    $sql = $sql_petty_cash_expenses 
        ." UNION ".$sql_ious 
        ." UNION ".$sql_iou_batches 
        ." UNION ".$sql_iou_payments 
        ." UNION ".$sql_petty_cash_payments 
        ." UNION ".$sql_bank_payments 
        ." UNION ".$sql_bank_returns
            ;   
    
        return dashboard_get_approvals_users($sql);
}

?>