Theory of optoelectronic quantum devices