
    NATIONAL TEA CO., Plaintiff-Appellant, v. CONFECTION SPECIALTIES, INC., Defendant-Appellee.
    Third District
    No. 76-403
    Opinion filed May 11, 1977.
    
      Tim Swain II, of Swain, Johnson & Card, of Peoria, for appellant.
    Wayne L. Hanold, of Westervelt, Johnson, Nicoll & Keller, of Peoria, for appellee.
   Mr. JUSTICE BARRY

delivered the opinion of the court:

This appeal is brought by the plaintiff, National Tea Co., from a dismissal of the underlying action by the Circuit Court of Peoria County. The plaintiff initiated a breach of contract action against Confection Specialties, Inc., for failing to maintain insurance protecting the interest of the plaintiff, as was required by their agreement allowing the defendant to place vending machines in the plaintiff’s stores, and as a result, the plaintiff claims damages of *11,000 by reason of payment of the settlement of a suit by Cheryl and Brent Fetters against Del Farm Store, Division of National Food Stores.

That earlier case was a negligence action for the injuries incurred by Cheryl Fetters when she slipped on a plastic container and fell as she was entering the store. The plastic container was of the type used to encase items dispensed by the defendant’s vending machines. In the earlier case, National Tea filed a third-party complaint against Confection Specialties seeking indemnity. The three theories presented in that third-party complaint were: First, indemnity based on an active-passive negligence theory (count I); secondly, contractual indemnity based on a letter from Confection Specialties dated March 31, 1971 (count II); and lastly, implied contractual indemnity (count III). The trial court dismissed counts II and III, and after hearing arguments and reviewing all exhibits, granted Confection Specialties’ motion for summary judgment in count I. No appeal was filed, and National Tea settled with the Fetters.

The letter upon which count II of the third-party complaint was based states:

“Gentlemen:
Please be advised that in connection with the installation of our vending machines in various of your stores throughout the country, we agree, at our own expense, to defend and save National Tea Company harmless from and against any claims, suits, or causes of action that may be instituted or asserted against National Tea Co. by reason of or arising out of such installation and operation of any of our vending machines or component parts thereof while located in a store or other establishment belonging to National Tea Co.
If we should fail to comply with the provision of the above paragraph with reasonable promptness after receipt of a demand from you, National Tea Company shall have the right to defend itself against such claims, suits or actions; and we shall, forthwith upon demand, reimburse National Tea Company for all judgments, attorneys’ fees, costs and other damages and expenses whatsoever in connection therewith.
We further hereby agree to hold National Tea Company free and harmless from any claim based upon damage to one of our vending machines while located in one of your stores or other establishments, occasioned through no fault of your company.
We have already delivered to you certificates evidencing our insurance coverage; but this letter will also evidence our agreement to maintain in full force and effect, and to pay the premiums upon general liability insurance protecting the interests of this company and National Tea Company the limits of coverage applicable to the responsibility to be not less than [sic] *100/300,000. for death and bodily injury.” (Emphasis added.)

This same letter is the basis for the contract action underlying this appeal. For this reason, the defendant moved to dismiss this case. The trial court granted the motion to dismiss after finding that the letter of March 31, 1971, “guarantees the maintenance of general liability insurance for the matters contained in paragraph I of the said letter and not for all purposes,” that the second law suit involved the same parties and issues as the third party complaint and that the doctrine of res judicata applied. The plaintiff appeals from this order. We affirm.

The limitations imposed by the doctrine of res judicata are summarized in Prochotsky v. Union Central Life Insurance Co. (1st Dist. 1971), 2 Ill. App. 3d 354, 356, 276 N.E.2d 388, 390.

“The law requires that both in law and in equity a plaintiff must present all grounds of recovery he may have. He cannot preserve the right to bring a second action after loss of the first merely by limiting the theories of recovery opened by the pleadings in the first action. [Citations.] In Phelps [(1928), 331 Ill. 80, 85, 162 N.E. 119, 122], the court said 0 °
‘The rule of res judicata embraces not only what actually was determined in the former case between the same parties or their privies, but it extends to any other matters properly involved which might have been raised and determined.’ (Emphasis added.)
In Freeman, (1st Dist. 1947), 332 Ill. App. 637, 76 N.E.2d 514], the court explicitly clarified the doctrine set down in Phelps and held that where a demand or right of action is in its nature entire and indivisible, it cannot be split up into several causes of action and sued piecemeal or made the basis of many separate suits. The court said [332 Ill. App. 637, 645, 76 N.E.2d 514, 517]:
‘[A] judgment on the merits as to one part will bar a subsequent action for the whole, the residue, or another part. It is immaterial that the form of the second action is different from the first. [Wjhether or not a judgment is a bar to a subsequent action under the rule against splitting causes of action depends on whether the entire amount claimed to be due plaintiff arises out of one and the same act or contract, or whether the several parts arise from distinct acts or contracts.’ ”

The doctrine itself may be simply stated. Once a court of competent jurisdiction has determined a cause of action on the merits, except for a direct attack on appeal, that judgment is a bar to any subsequent cause of action between the same parties, or their privies, which was or might have been litigated in the earlier proceeding. (Charles E. Harding Co. v. Harding (1933), 352 Ill. 417, 186 N.E. 152.) The application of the rule, therefore, is limited to situations in which the second cause involves the same parties, subject matter and issues as the first. (Renner v. Greathouse (4th Dist. 1957), 12 Ill. App. 2d 338, 139 N.E.2d 825.) There is no question that the parties involved in the action at bar are the same as those involved in the previous third-party action. When comparing the two cases, the relevant test is whether there are facts essential to the maintenance of both cases or whether the same evidence would sustain both. Renner v. Greathouse (4th Dist. 1957), 12 Ill. App. 2d 338, 139 N.E.2d 825; 30A Am. Jur. Judgments § 365 (1958); 46 Am. Jur. 2d Judgments § 410 (1969).

The action underlying this appeal is based on the same letter as was the basis of count II of the third-party complaint. In the third-party action, National Tea sought indemnity because Confection Specialties agreed in the letter to indemnify National Tea from all actions arising out of the installation or operation of the vending machines. In the case at bar, National Tea seeks indemnification from the very same liability by enforcing that paragraph of the letter in which Confection Specialties agrees to provide insurance to hold National Tea harmless for any injury or death arising out of the installation or operation of the vending machines. Since, to dismiss count II of the third-party complaint the court must have determined that the injury was not a result of the installation and operation of the vending machines and, therefore, National Tea was not entitled to indemnification, National Tea is barred from now seeking indemnity by reason of the promise to provide insurance. That issue could have, and should have, been raised in the earlier case.

The plaintiff argues that it could not raise an issue involving insurance in a case based on personal injury because it would prejudice their case with the jury. Where there may be prejudice, the trial court has. the discretion of deferring a hearing on the third-party action. Gertz v. Campbell (1973), 55 Ill. 2d 84, 302 N.E.2d 40; Ill. Rev. Stat. 1975, ch. 110, par. 44(2), as amended by P.A. 79-1366, § 16, effective October 1, 1976.

Accordingly, the judgment of the Circuit Court of Peoria County is affirmed.

Affirmed.

STENGEL, P. J., and SCOTT, J., concur.  