(Abridged) The birth environment of the Sun will have influenced the conditions in the pre-solar nebula, including the attainable chemical complexity, important for prebiotic chemistry. The formation and distribution of complex organic molecules (COMs) in a disk around a T Tauri star is investigated for two scenarios: (i) an isolated disk, and (ii) a disk irradiated externally by a nearby massive star. The chemistry is calculated along the accretion flow from the outer disk inwards using a comprehensive network. Two simulations are performed, one beginning with complex ices and one with simple ices only. For the isolated disk, COMs are transported without major alteration into the inner disk where they thermally desorb into the gas reaching an abundance representative of the initial assumed ice abundance. For simple ices, COMs efficiently form on grain surfaces under the conditions in the outer disk. Gas-phase COMs are released into the molecular layer via photodesorption. For the irradiated disk, complex ices are also transported inwards; however, they undergo thermal processing caused by the warmer conditions in the irradiated disk which tends to reduce their abundance along the accretion flow. For simple ices, grain-surface chemistry cannot synthesise COMs in the outer disk because the necessary grain-surface radicals, which tend to be particularly volatile, are not sufficiently abundant on the grain surfaces. Gas-phase COMs are formed in the inner region of the irradiated disk via gas-phase chemistry induced by the desorption of strongly bound molecules such as methanol; hence, the abundances are not representative of the initial molecular abundances injected into the outer disk. These results suggest that the composition of comets formed in isolated disks may differ from those formed in externally irradiated disks with the latter composed of more simple ices.