Stock market sees highest fund inflow in three years