Tailoring Terahertz Propagation by Phase and Amplitude Control in Metasurfaces