Influence of carrier-carrier and carrier-phonon correlations on optical absorption and gain in quantum-dot systems