
    (52 P.3d 911)
    No. 87,625
    Todd Howarth, Plaintiff/Appellant, v. Simon Olivier, Defendant, Oklahoma City Professional Hockey, Inc., and United States Fidelity & Guaranty Company, Defendants/Appellees, Gulf Insurance Company, Defendant, and Wichita Hockey, Inc., Intervenor.
    
    Opinion filed August 23, 2002.
    
      Ron D. Beal, of Lenexa, and Robert (Rocky) D. Wiechman, Jr., of Wichita, for appellant.
    
      
      Mary T. Malicoat, of Klenda, Mitchell, Austerman & Zuercher, L.L.C., of Wichita, for appellees.
    Before Gernon, P.J., Marquardt and Beier, JJ.
   Marquardt, J.:

Todd Howarth appeals the trial court’s denial of his motion for: (1) an order to enforce the settlement agreement; (2) an order to allow his attorneys, Ron D. Beal and Robert Wiechman, to intervene; and (3) a judgment declaring that Howarth and his attorneys possess no obligation of confidentiality under the terms of a settlemént agreement with Oklahoma City Professional Hockey, Inc. (OCPH) and its insurer, United States Fidelity & Guaranty Company (USF&G) (defendants). We affirm.

Howarth filed a lawsuit against Simon Olivier, OCPH, USF&G, and Gulf Insurance Company to recover damages for injuries he sustained in a hockey game as a player of Wichita Hockey, Inc. On October 21, 2000, Howarth entered into a written settlement agreement with defendants. The agreement read, in pertinent part, as follows:

“1. OCPH and USF&G jointly agree to pay Howarth, and Howarth agrees to accept payment of, the total sum of [amount omitted] by certified check made payable jointly to Todd Howarth and Robert (Rocky) D. Wiechman, Jr., or by wire transfer to the trust account of Mr. Wiechman. Delivery of the certified check shall be made to Mr. Wiechman at 330 N. Main, Wichita, Kansas. Delivery of the certified check or wire transfer funds shall be due, and shall be completed on or before, 5:00 p.m. on November 20, 2000. Time is of the essence.
“6. Subject to receiving payment in the amount, in the manner and by the time specified in paragraph 1, above, Howarth and his attorneys, Robert (Rocky) D. Wiechman, Jr. (“Wiechman”) and Ron D. Beal (“Beal”), agree not to divulge, and to keep confidential, the amount payable under the terms of this setdement agreement."

Through the use of a fax machine, all parties signed the settlement agreement on October 21, 2000. On October 24, 2000, Howarth signed three original settlement agreements and hand delivered them to defendants’ attorney for defendants’ signatures. On November 20, 2000, defendants returned the agreement for Wiechman’s and Beal’s signatures. Wiechman and Beal signed all three original settlement agreements and sent two of them to defendants the following day.

On November 20, 2000, defendants presented a certified check to Howarth which represented a partial payment of the settlement amount. On November 22,2000, the balance of the settlement was transferred to Wiechman’s trust account.

Howarth filed a motion for declaratory judgment with Beal and Wiechman as proposed intervenors, claiming that they were not bound to maintain confidentiality of the settlement due to defendants’ failure to pay the settlement pursuant to the agreement.

Defendants’ attorney, Mary T. Mahcoat, alleged that on November 14, 2000, she attempted to give Howarth an uncertified check which represented USF&G’s portion of the settlement; however, Beal refused to accept an uncertified check. Mahcoat also claimed that USF&G would have wired the funds to Wiechman’s trust account on November 20, 2000, but a USF&G representative informed her on that day that it needed a copy of the settlement agreement signed by all parties faxed to USF&G for authorization purposes. However, Beal refused to sign a faxed copy of the agreement; he insisted on signing only the original agreement.

At the motion hearing, Beal admitted that he refused to accept the uncertified check and did not sign a faxed copy of the settlement agreement as Mahcoat had requested. The trial court denied Howarth’s motion, finding that no justification existed for refusing USF&G’s attempts to pay the settlement proceeds. The trial court held that defendants substantially comphed with the terms of the agreement.

Howarth filed a motion to alter or amend the judgment, arguing that the doctrine of substantial performance does not apply to an express condition in the settlement agreement. Alternatively, Howarth contended that the determination of whether substantial performance exists is a question of fact which requires a trial. Following a hearing, the trial court denied the motion. The trial court found no material facts in dispute and dismissed Howarth’s claims against defendants with prejudice. Howarth appeals.

Howarth claims that he and his attorneys owe no duty to keep the settlement agreement confidential. He contends that the doctrine of substantial performance does not apply to a condition precedent, particularly where time is of the essence.

Regardless of the construction given a written contract by the trial court, an appellate court may construe a written contract and determine its legal effect. The interpretation and legal effect of written agreements are matters of law, and an appellate court exercises unlimited review. City of Topeka v. Watertower Place Dev. Group, 265 Kan. 148, 152-53, 959 P.2d 894 (1998).

Contracting parties may agree to terms in a contract and impose conditions so long as the conditions are not illegal or contrary to public policy. See Wills v. Southwestern Bell Tel. Co., 219 Kan. 755, 757, 549 P.2d 903 (1976); Barbara Oil Co. v. Patrick Petroleum Co., 1 Kan. App. 2d 437, Syl. ¶ 1, 566 P.2d 389, rev. denied 222 Kan. 749 (1977).

“ A condition precedent is something that it is agreed must happen or be performed before a right can accrue to enforce the main contract. It is one without the performance of which the contract, although in form executed and delivered by the parties, cannot be enforced. A condition precedent requires the performance of some act or the happening of some event after the terms of the contract, including the condition precedent, have been agreed on before the contract shall take effect. [Citations omitted.]’ ” Barbara Oil, 1 Kan. App. 2d at 439-40.

Under the written agreement in the present case, Howarth claims that his promise to keep the settlement amount confidential was subject to the defendants’ payment by a specific time and date and in a specified manner. R is undisputed that the full payment was not made on the date specified in the agreement.

The rule of “substantial performance” is recognized and applied in the field of contract law. Almena State Bank v. Enfield, 24 Kan. App. 2d 834, 838, 954 P.2d 724 (1998). Substantial performance is shown when the following circumstances are established by the evidence: (1) The party made an honest endeavor in good faith to perform its part of the contract; (2) the results of the endeavor are beneficial to the other party; and (3) such benefits are retained by the other party. Substantial performance is a relative term, and whether it exists is a question to be determined in each case with reference to the existing facts and circumstances. 24 Kan. App. 2d at 839.

Howarth argues that the trial court denied him due process by ruling on the issue of substantial performance without a hearing. Howarth raised this issue with the trial court in his motion and extensive brief in support of his argument. Howarth had due process; this issue has no merit.

The trial court stated: “Defendant USF&G on two separate occasions attempted to comply with the Settlement Agreement, with no appropriate justification from plaintiff s counsel for refusing the attempts.”

American Jurisprudence discusses substantial performance in contracts:

“[T]he law looks to the spirit of a contract and not the letter of it ... . Where one party to a contract has received and retained the benefits of a substantial partial performance of the agreement by the other party who has not fully performed all his contractual promises, the first party cannot retain the benefits and repudiate the burdens of the contract, but he is bound to perform his part of the agreement, and his remedy for tire breach is limited to compensation in damages.” 17A Am. Jur. 2d, Contracts § 631, p. 640-41.

Under the doctrine of substantial performance, the parties are presumed to have impliedly agreed to do what was reasonable, under all the circumstances, with reference to the matter of performance. 17A Am. Jur. 2d, Contracts § 632, p. 642.

Here, defendants argue that they attempted to pay Howarth by the November 20,2000, deadline but Howarth hindered their ability to complete the wire transfer on November 20, 2000. Defendants allege that Howarth is responsible for the confusion and mistakes in obtaining all of the required signatures on the settlement agreement and providing the information so USF&G could effectuate payment.

Howarth admits that he refused the uncertified check and also refused to send a faxed signature to USF&G. We find that defendants acted reasonably in attempting to make a timely payment of the settlement amount. If Howarth had not frustrated timely performance by defendants, this issue could not have been raised. Howarth created the problem and now asks this court to reward him for his unreasonable behavior.

A party who demands compliance with a condition precedent cannot hinder, delay, or prevent its happening for the purpose of avoiding performance of the contract. Wallerius v. Hare, 194 Kan. 408, 412, 399 P.2d 543 (1965). A refusal to perform must be genuine and grounded in good faith. See Barbara Oil, 1 Kan. App. 2d at 440. Here, the trial court did not err in its ruling, and Howarth and his attorneys are not excused from the confidentiality provision of the settlement agreement.

Defendants do not concede that the trial court erred in overruling HowartlTs motion for declaratory judgment; however, they argue that the trial court’s ruling should be affirmed based on principles of equity rather than the doctrine of substantial performance. Defendants contend that their late payment of the settlement to Howarth should be excused on the grounds of forfeiture, waiver, or prevention because Howarth retained the proceeds.

We agree that Howarth prevented defendants’ performance. If a trial court reaches the right result, its decision will be upheld even though the trial court relied upon the wrong ground or assigned erroneous reasons for its decision. See Bergstrom v. Noah, 266 Kan. 847, 875-76, 974 P.2d 531 (1999).

Affirmed.  