
    Bill G. HENDRICKS, dba Deseret Roofing Company, Plaintiff and Respondent, v. INTERSTATE HOMES, INC., Franz C. Stangl III, Elizabeth Ann Stangl, Nebraska Savings and Loan Association, F.A., Empire Land Title, Inc., a Utah Corporation, and John Does I—XX, Defendants and Appellants. Bill G. HENDRICKS, dba Deseret Roofing Company, Third-Party Plaintiff, v. OWENS-CORNING FIBERGLAS CORPORATION, Third-Party Defendant, OWENS-CORNING FIBERGLAS CORPORATION, Plaintiff, v. Bill G. HENDRICKS, dba Deseret Roofing Company, and Stangl Construction Company, a corporation, Defendants..
    No. 860094-CA.
    Court of Appeals of Utah.
    Nov. 9, 1987.
    
      Henry S. Nygaard, Beaslin, Nygaard, Coke & Vincent, Salt Lake City, for Interstate Homes and Franz Stangl.
    Robert A. Burton, Strong and Hanni, Salt Lake City, for Bill Hendricks.
    W. Cullen Battle, Fabian & Clendenin, Salt Lake City, for Bill Hendricks and Des-eret Roofing.
    Alan Kent Shearer, Shearer & Carling, Salt Lake City, for Owens-Coming.
    Before BILLINGS, GARFF and GREENWOOD, JJ.
   GARFF, Judge:

Plaintiff/respondent Bill G. Hendricks (Hendricks), dba Deseret Roofing Company, was awarded summary judgment against defendant/appellant Interstate Homes, Inc., (Interstate), a modular building manufacturer, for $19,500 plus interest, costs, and attorney fees. The court dismissed Interstate’s counterclaim for $50,-000 damages with prejudice. Interstate appeals the dismissal of its counterclaim. We affirm.

Interstate contracted with Franz C. Stangl to manufacture a motel at its plant in Bountiful, Utah, and then to move and assemble it in Price, Utah. On April 3, 1983, Interstate accepted Hendricks’ proposal to furnish and install a roof on the motel. Hendricks’ proposal provided, in part, that he would furnish all roofing materials, including felt and nails. However, Interstate’s personnel were to install the base felt at the Interstate plant, and Hendricks was not to be actively involved in the roof installation until the modular sections of the motel had been assembled in Price. Upon completion of the roofing job in Price, Interstate was to pay Hendricks $19,500.

Hendricks ordered sixty rolls of roofing felt from Owens-Coming Fiberglas Corporation (Owens-Corning). The felt was delivered directly to Interstate’s factory, clearly identified as Type 28 Bondable Base felt. Invoices were delivered directly to Hendricks for payment. Interstate’s employees installed the felt at its plant. Because these sixty rolls were insufficient to finish the modular units, Hendricks ordered another eighteen rolls of felt. He again received the invoice, which reflected that the same type of felt had been shipped directly to Interstate. However, the material actually shipped was not the material shown on the invoice, but an intermediate felt known as Type IV Ultra Ply. These eighteen rolls were clearly marked as such, and the material was porous, lighter, and visibly different from Type 28 Bondable Base felt, but Interstate’s employees did not recognize the difference in the material and installed it on the modular units. Hendricks had no notice that the wrong material had been shipped to Interstate.

The completed modular units were transported to Price, Utah. Around June 8, 1983, immediately after the units arrived, a rainstorm occurred. A substantial amount of water leaked through the felt material causing approximately $52,000 damage to the building interior. Water damage occurred only in the areas where the final eighteen rolls of felt were installed.

Hendricks submitted a claim to his insurance carrier for the water damage, and demanded assurance from Interstate that he would be paid in full upon completion of the roofing contract. In response, Interstate’s agent prepared, signed, and sent a copy of an interoffice memorandum to Hendricks. This memorandum stated, in part, that “payment on this job will not be affected by insurance claim in progress.” Relying upon this memorandum, Hendricks satisfactorily completed the roofing contract.

Hendricks’ insurance company refused to pay for the water damage, Interstate refused to pay Hendricks’ $19,500 bill, and Hendricks refused to pay the $9,912.11 owed to Owens-Corning for materials.

In an effort to receive payment, Hendricks filed a mechanics’ lien for the $19,-500 claim; an additional claim for $2,852.14, plus interest, for supplemental work not included in the contract; and attorney fees. He then filed a complaint to enforce the lien. Interstate counterclaimed, seeking recovery for $50,000 of the property damage.

Hendricks moved for summary judgment. On November 13, 1984, the trial court entered summary judgment in favor of Hendricks for $19,500 plus interest, costs of $495.74, and attorney fees of $4,813.80, dismissing Interstate’s counterclaim. Interstate filed this appeal. Subsequently, Interstate withdrew its appeal with respect to the money judgment, so the only issue remaining on appeal is whether the trial court was justified in summarily dismissing Interstate’s $50,000 counterclaim for water damages.

Interstate sets forth two arguments in support of its contention that summary dismissal of its counterclaim was improper: (1) Material issues of fact existed as to whether Hendricks had a contractual duty to ensure that the correct materials were delivered to defendant and whether, in fact, this duty was fulfilled. (2) The counterclaim was non-frivolous, compulsory, and greatly exceeded the amount of relief sought by Hendricks, so, by law, should not have been dismissed.

Summary judgment is proper only where there is no genuine issue of material fact and the moving party is entitled to judgment as a matter of law. Utah R.Civ.P. 56; Frisbee v. K & K Constr. Co., 676 P.2d 387, 389 (Utah 1984); Bowen v. Riverton City, 656 P.2d 434, 436 (Utah 1982). It is used only to determine the existence of any material issues of fact, not to determine what the facts are. Hill v. Grand Central, Inc., 25 Utah 2d 121, 477 P.2d 150, 151 (1970).

In this summary judgment action, the materiality of Interstate’s asserted genuine issues of fact, e.g., whether Hendricks had a contractual duty to ensure that correct materials were delivered to Interstate, and whether this duty was fulfilled, depends upon whether Interstate alleged in its counterclaim that Hendricks actually warranted that correct materials would be delivered, and that he breached this warranty because incorrect materials were delivered.

In its counterclaim, Interstate alleges that “on or about April 13, 1983 the plaintiff and defendant entered into a written contact [sic], including plans and specifications, under the terms of which plaintiff was to provide materials and labor that would insure the construction of a 'water tite’ [sic] roof,” that Hendricks ordered and caused the roofing materials to be delivered, and that “plaintiff’s negligence was the direct and proximate cause of the water damage suffered by defendant.” Thus, Interstate did not, in its counterclaim, explicitly raise a breach of warranty cause of action, but only one of negligence. Hendricks’ answer, likewise, responds only to a negligence cause of action, not to any allegations of breach of warranty. Interstate did, however, discuss a warranty theory in the summary judgment hearing and in its supporting memorandum. Hendricks’ counsel, however, never even impliedly consented to try the case on a warranty theory during the hearing, stating, “the only claim that’s before the Court is negligence. That’s the counterclaim.”

It is well settled that a judgment order must not only be supported by competent evidence, but the pleadings must allege applicable legal theories. In re Marriage of Adams, 92 Ill.App.3d 797, 48 Ill.Dec. 285, 292, 416 N.E.2d 316, 323 (1981); Swartz v. Peterson, 199 Neb. 171, 256 N.W.2d 681, 684 (1977), and that a favorable judgment may not be sustained on an unpleaded cause of action in the absence of trial by consent. Stoner v. Thompson, 578 S.W.2d 679, 682 (Tex.1979); First State Bank of Bedford v. Miller, 563 S.W.2d 572, 576 (Tex.1978). “A party may not plead one theory of recovery and have a judgment based upon another theory not pled.” Crozier v. Home Children Maintenance and Educ. Trust, 597 S.W.2d 418, 421 (Tex.Civ.App.1980). Instead, if a court’s judgment exceeds the nature of the suit and the issues raised by the pleadings, it is void. Andrews v. Andrews, 126 Ariz. 55, 612 P.2d 511, 514 (Ariz.Ct.App.1980).

In the present case, even though Interstate stated some supporting facts, it failed to allege a breach of warranty cause of action in its counterclaim. Although its asserted issues of fact would be litigated in a warranty cause of action, they are irrelevant to finding a prima facie case of negligence. Therefore, because its alleged material issues of fact are not relevant to its pleaded negligence action, but are only relevant to an unpleaded warranty cause of action, there are no genuine issues of material fact, and summary judgment is appropriate. Consequently, we do not reach the issue of whether or not these issues of fact are genuine.

Interstate further argues that its counterclaim should not have been summarily dismissed because it was non-frivolous, compulsory, and greatly exceeded the amount of relief sought by Hendricks.

The general rule regarding such counterclaims is well-settled:

It is a general rule that the presence of a counterclaim which is shown to be sham, frivolous, or without merit is not in itself a bar to relief under summary judgment statutes and rules. On the other hand, the presence of a counterclaim predicated upon a good and substantial cause justifying a trial may bar a plaintiff’s motion for summary judgment on his complaint or may preclude the court from ordering execution of the judgment pending the determination of the counterclaim. As a general thing, a claim predicated upon a good and substantial cause justifying trial is an insuperable objection to summary judgment where it is in excess of the amount demanded in the complaint....

73 Am.Jur.2d Summary Judgment § 31 (1974). See also Kirkpatrick v. First State Bank of DeQueen, 265 Ark. 285, 578 S.W.2d 28, 29-30 (1979); Ivey Contracting Co. v. Elliott, 151 Ga.App. 361, 259 S.E.2d 658, 661 (1979); Galaxy Int'l, Inc. v. Magnum-Royal Publications, 54 A.D.2d 875, 388 N.Y.S.2d 583, 584 (1976); Chisholm Ryder Co. v. Munro Games, Inc., 58 A.D.2d 972, 397 N.Y.S.2d 253, 254 (1970); Bennion v. Amoss, 28 Utah 2d 216, 500 P.2d 512, 516 (1972).

Summary judgment on a complaint is not precluded by the existence of a counterclaim, no matter how large, if it is shown to be “sham, frivolous, or without merit.” Bennion v. Amoss, 500 P.2d at 516. In the present case, Interstate has alleged a counterclaim greatly in excess of Hendricks’ claim: $50,000 as compared with $19,500. However, as shown above, this counterclaim is without merit, having been properly dismissed due to a lack of any genuine issue of material fact, so Interstate’s reliance on this argument to preclude summary judgment is also without merit.

The judgment of the trial court is affirmed. Costs to plaintiff.

BILLINGS and GREENWOOD, JJ., concur. 
      
      . Summary judgment was based on the pleadings, affidavits, depositions and exhibits, pursuant to Utah R.Civ.P. 56(c): "The judgment sought shall be rendered forthwith if the pleadings, depositions, answers to interrogatories, and admissions on file, together with the affidavits, if any, show that there is no genuine issue as to any material fact and that the moving party is entitled to judgment as a matter of law...
     
      
      . Nevertheless, judgments based upon pleadings which are merely lacking in allegations of sufficient facts to fully state the cause of action are not void, so long as the pleading states the nature of the cause of action determined by the judgment and is of a class over which the court has potential jurisdiction. Couch Mortgage Co. v. Roberts, 544 S.W.2d 944, 947 (Tex.Civ.App.1976).
     
      
      . Although the court does not reach the issue of the genuineness of Interstate's asserted issues of fact, examination of the contractual materials submitted by the parties reveals no duty on the part of Hendricks to provide a water-tight roof during the construction phase of the project.
     