The district attorney and the offender may enter into an agreement as a part of the PTIP of an offender that the offender be admitted to a drug or alcohol program on an inpatient or outpatient basis or receive other treatment alternatives for substance abuse. The district attorney may require the offender to submit to periodic or random drug testing as a part of the PTIP of the offender and other terms and conditions related to substance abuse as the district attorney may direct. The offender shall pay the costs of all such services unless otherwise agreed.