On certain self-orthogonal AG codes with applications to Quantum error-correcting codes