Multifunction valve for flow injection analysis