<?php

function view_dashboard_project_expenses_details($expense_type_id, $from_date, $to_date, $project_id) {
    
    $sql = "SELECT ex.*,
                    en.value_name expense_type_name  
            FROM ".TB_PREF."i_owe_you_expenses ex  
                JOIN ".TB_PREF."i_owe_you_batches b  
                    ON ex.iou_batch_no = b.batch_no  
                JOIN ".TB_PREF."list_values en  
                    ON en.id = ex.expense_type_id  
            WHERE b.tran_date >= ".db_escape($from_date)." 
                AND b.tran_date <= ".db_escape($to_date)." 
                AND b.project_id = ".db_escape($project_id)." 
                AND ex.expense_type_id = ".db_escape($expense_type_id)." 
            ORDER BY ex.expence_date ";
    
                
        return db_query($sql, "view_dashboard_project_expenses_details"); 
     
}
