<?php
/**********************************************************************
***********************************************************************/



function get_sql_for_project_float_inquiry($from_date,$to_date, $project_id)
{  
	$sql= "SELECT 
                pft.id,
                pft.tran_type,
                pft.type_no,
                pm.description project_description,
                pft.employee_code,
                pft.tran_date,
                pft.amount,    
                pft.balance,
                pft.company_code 
                
            FROM " .TB_PREF."project_float_trans pft
                JOIN ".TB_PREF."projects_master pm ON
                    pft.project_id = pm.project_id 
            WHERE pft.tran_date >=".db_escape(date2sql($from_date))." AND 
                    pft.tran_date <=".db_escape(date2sql($to_date))." AND 
                    pft.project_id = ". db_escape($project_id);
    
	$sql .=" ORDER BY pm.description";
        
	return $sql;
}



function view_project_float_adjustment($id)
{
        $sql= "SELECT fa.*,
                    pm.description project_description,
                    u.real_name user_name
               FROM ".TB_PREF."project_float_adjustments fa
                    INNER JOIN ".TB_PREF."project_floats pf ON
                            pf.project_id = fa.project_id 
                    INNER JOIN ".TB_PREF."projects_master pm ON 
                    		pf.project_id = pm. project_id 
                    INNER JOIN ".TB_PREF."users u ON
                            u.id = fa.created_by
               WHERE fa.id=".db_escape($id);             
        

                
                
        $result = db_query($sql,"Could not view project float adjustments");	
        return db_fetch($result);    
}



?>