In construing statutes and determining legislative intent, several provisions of an act or acts, in pari materia , must be construed together with a view of reconciling and bringing them into workable harmony if possible. 12-4106 provides that the municipal judge may commit persons to jail for contempt of court, failure to obey process, being found guilty of violating a city ordinance, or defaulting on a pretrial bond condition. 12-4509 provides that whenever a person is found guilty of a violation of an ordinance, the municipal judge may impose a sentence of fine or imprisonment or both, as authorized by the ordinance violation. When a sentence of imprisonment is pronounced, the municipal judge or the clerk of the municipal court shall prepare and deliver to the chief of police a copy of the entry of judgment, duly certified by the judge or clerk, which provides authority to the chief of police to execute the sentence and confine the accused person to jail. A diversion agreement is the specification of formal terms and conditions which a defendant must fulfill in order to have the charges against such defendant dismissed.
Diversion is, therefore, a means to avoid a judgment of criminal guilt.
See K.S.A. 12-4413. Inasmuch as no judgment of guilt is entered when diversion is granted, the district court was correct in finding that the municipal court judge had no authority to order Petty to a period of jail confinement as a condition of diversion. In declaring the diversion agreement void, the district court relied upon equitable estoppel and the general principle of contract law that a party to an illegal agreement will not be permitted to avail himself or herself of its illegality until he or she restores to the other party all that has been received from such a party as the result of the illegal agreement. So long as he or she continues to enjoy the benefits of the agreement, the party will not be allowed to set up its nullity. The district judge concluded that because the agreement was against public policy, the parties should be restored to their preagreement status.