
    874 P.2d 506
    ERVIN CONSTRUCTION COMPANY, a Montana corporation, Plaintiff, Counterdefendant-Respondent, Jay VAN ORDEN and Shelli Van Orden, husband and wife, Defendants, Counterclaimants-Appellants, v. MASTER LOG HOMES, INC., a Montana corporation, Counterdefendant-Respondent.
    No. 20388.
    Supreme Court of Idaho, Twin Falls
    March 1993 Term.
    Aug. 25, 1993.
    Rehearing Denied March 25, 1994.
    
      Racine, Olson, Nye, Cooper & Budge, Pocatello, for appellants. John A. Bailey, Jr. argued.
    Blaser, Sorensen & Hansen, Blackfoot, for respondent. Murray J. Sorensen argued.
   TROUT, Justice.

Jay and Shelly Van Orden (the Van Or-dens) purchased materials and supplies from Master Log Homes, Inc. (Master Log) for the construction of a log home. They later contracted with Ervin Construction Company (Ervin), to complete construction on that home. Both Ervin and Master Log are closely held Montana corporations owned by Jerry Ervin. After the home was eighty to ninety percent completed, the Van Ordens refused to pay for a portion of the completed work. Ervin thereafter brought a breach of contract action. The Van Ordens denied liability and counterclaimed against Ervin and Master Log, contending that the work was not done in a workmanlike manner. The trial court, sitting without a jury, ruled that Ervin had breached express and implied warranties under the contract. The trial court also ruled that the Van Ordens had breached the contract by refusing to pay certain monthly billings. The Van Ordens appealed from the judgment of the trial court which, in part, awarded damages to Ervin. We assigned this case to the Court of Appeals which vacated the judgment and remanded the case to the trial court for a reeomputation of damages. We subsequently granted both Ervin’s and the Van Ordens’ petitions for review of the Court of Appeals’ decision.

I.

BACKGROUND

During the summer of 1985, Master Log sold logs and other construction materials to the Van Ordens to build a new log home. The original contractor retained by the Van Ordens was fired following completion of the foundation, basement and first floor system. In November of 1985, the Van Ordens contracted with Ervin to finish construction on the home for the sum of $84,500.00. The contract between Ervin and the Van Ordens provided that Ervin would be paid on a monthly basis as work progressed. The contract further provided that the Van Ordens would retain ten percent of the contract amount until final completion and that all work would be completed in a workmanlike manner. The contract did not specify a completion date and provided that the Van Or-dens could terminate the contract at any time by paying the percentage of work completed based on the net contract amount and the value of materials installed.

The Van Ordens paid the first four monthly billings for the work completed from November, 1985, through February, 1986. During this time, the parties agreed to reduce by $2,718.25 the original contract amount. In April of 1986, the Van Ordens began to complain about the workmanship on their home, including gaps in the corners of the log walls, gaps in the horizontal joints, improperly installed beams and improper' finish work. They voiced these concerns at a meeting with Ervin which they followed with a letter enumerating the defects. Ervin responded with a letter on April 28,1986, acknowledging that there were butt joints which were not sealed, cracks in the logs that ran from the inside of the house to the outside which allowed air to flow into the house, unsealed windows, and trim along the edge of the roof decking that was not finished.

On April 29, 1986, Ervin sent the Van Ordens a billing statement for March and April in the amount of $13,151.02. The Van Ordens assured Ervin they would pay this balance on May 15, 1986, and as a result, Ervin continued work at the site. On May 15, the Van Ordens delivered Ervin a check for $13,061.07 which was post-dated to August 15, 1986. Ervin attempted to deposit this check, unaware that it had been postdated. The check was returned for non-sufficient funds on May 21 and Ervin promptly notified the Van Ordens that unless they paid the check and gave assurance that future payments would be timely, Ervin would withdraw from the job site. On May 22, after receiving no assurance from the Van Ordens, Ervin withdrew.

The Van Ordens thereafter hired John Grimmett to complete construction and repair defects in the home. The Van Ordens moved into their new home in the fall of 1986.

When Ervin left the construction site, there was approximately four to six weeks of work remaining to finish the house and Ervin had been paid a total of $19,321.00. Ervin alleged the Van Ordens owed an additional $16,061.07 for work completed. Ervin did not bill the Van Ordens for work that was not completed.

II.

PROCEDURAL HISTORY

Ervin brought a breach of contract action against the Van Ordens to collect the unpaid balance on the contract. The Van Ordens denied liability and counterclaimed against Ervin and Master Log for breach of contract, breach of warranty, negligence and fraud. The court trial included testimony from both parties, both parties’ experts and an on-site inspection of the house by the trial judge.

The trial court held that the Van Ordens breached their contract with Ervin by failing to pay monthly billings for March and April totaling $13,151.02. The trial court also held that Ervin “partially breached” the implied and express warranties of the contract by failing to construct certain parts of the house in a “workmanlike” manner. Specifically, the trial court found that the following conditions existed when Ervin left the construction site:

excessive gaps between certain log courses and butt joints (where the logs meet end to end in the walls); certain logs were used with excessive cracks in them; excessive gaps between the logs in the corners where they are stacked on top of each other; some of the logs used in the walls were of different diameters; improperly placed stairways; improperly hung doors; warped beams; walls that were not perpendicular or straight; improperly installed tongue and groove paneling; improperly installed interior trim; improperly installed exterior trim; use of incorrect bottom course logs in the upper courses of the logs; garage beams that were not properly designed and constructed; deck and roof support system on the rear deck that were not properly constructed or supported; improper construction and sealing of the joint between the top log courses and the roof structure.

The trial court also found that the center beam on the back porch had twisted and was subsequently replaced and that Ervin had miscut a chase in a place where the Van Ordens intended to place a china cabinet.

The trial court held that Ervin was forced off of the construction site by the Van Or-dens’ refusal to pay installments due under the contract and was not allowed the opportunity to remedy the defects or complete the home. The trial court then fashioned what it styled a “reasonable balance” and awarded the Van Ordens $5,174.33. This amount reflected what the trial court calculated to be one-half of all the labor and material costs incurred by Grimmett to complete and repair the Van Orden home. The trial court did not award the Van Ordens any damages for the construction defects which were not repaired. The trial court awarded Ervin $15,506.43 for work completed prior to leaving the job site along with pre-judgment interest accruing from June 10, 1986.

The trial court denied the Van Ordens’ various post-trial motions. These included a motion to alter or amend the judgment under I.R.C.P. 59(e), a motion to alter or amend the findings of fact and conclusions of law under I.R.C.P. 52(b), and a motion for a new trial under I.R.C.P. 59(a). The trial court also found that Ervin “generally” prevailed in the case and awarded Ervin two-thirds of its requested attorney fees and all of its costs of right.

The Van Ordens appealed and raised the following issues which were considered by the Court of Appeals: (1) did the trial court properly find the Van Ordens in breach of the contract; (2) did the trial court employ a correct measure of damages; (3) was the award of pre-judgment interest proper; (4) did the trial court properly find that the Van Ordens failed to prove their negligence claim; and (5) was the award of costs and attorney fees proper. The Court of Appeals vacated the judgment entered and remanded the case back to the trial court for recalculation of damages.

We now consider this appeal pursuant to our grant of each party’s petition for review of the Court of Appeals’ decision. I.A.R. 118.

III.

STANDARD OF REVIEW

The standard by which this Court reviews a decision of the Court of Appeals was set forth in Sato v. Schossberger, 117 Idaho 771, 774-75, 792 P.2d 336, 339-40 (1990):

If we decide to review a decision of the Court of Appeals, we ordinarily consider all of the issues presented to the Court of Appeals. Occasionally, we may decide to address less than all of the issues presented to the Court of Appeals. In that case, we advise the parties of the issues we will address. As to the issues we decide to address, we consider that we are hearing the matter in the first instance, not merely considering the correctness of the decision of the Court of Appeals. If, as in this case, the issues presented to the Court of Appeals concerned a decision of a district court, we consider the correctness of the district court’s decision. While we value the opinion of the Court of Appeals for the insight it gives us in addressing the issues presented on appeal, we do not focus on the opinion of the Court of Appeals, but rather on the decision of the district court.

We will consider each of the issues presented to the Court of Appeals focusing on the decision of the trial court. Our review of the trial court’s decision is governed by the principles of appellate review set forth in Sun Valley Shamrock Resources, Inc. v. Travelers Leasing Corp., 118 Idaho 116, 794 P.2d 1389 (1990). The Court in that case identified the following principles by which we review the decision of a trial court sitting without a jury:

At the trial level the trier of fact, in this case the district court judge, is the arbiter of conflicting evidence. It is the province of the trier of fact to weigh conflicting evidence and testimony and to judge the credibility of witnesses. In view of this role, the trial court’s findings of fact will be liberally construed in favor of the judgment entered. Trial court’s findings and conclusions which are based on substantial although conflicting evidence will not be disturbed on appeal. The credibility and weight to be given evidence is in the province of the trier of fact, and the findings made by the trial judge will not be set aside unless clearly erroneous.

118 Idaho at 118, 794 P.2d at 1391 (citations omitted).

IV.

THE TRIAL COURT PROPERLY FOUND THAT THE VAN ORDENS WERE IN BREACH OF THE CONTRACT

The Van Ordens argue that the trial court erred in finding that they were in breach of their contract with Ervin because their performance under the contract was excused by Ervin’s breach. The Van Ordens argue, in effect, that their obligation under the contract was rescinded by Ervin’s breach. We disagree.

The construction contract between Ervin and the Van Ordens expressly provided that “all work shall be done in a workmanlike manner.” In addition to this express provision, an implied warranty of fitness was also implied in the construction contract. Bethlahmy v. Bechtel, 91 Idaho 55, 67, 415 P.2d 698, 710 (1966). “[T]he vendor of a house under construction impliedly warrants that it will be completed in a workmanlike manner, and reasonably fit for occupancy as a place of abode.” Id., citing Jones v. Gatewood, 381 P.2d 158 (Okla.1963). However, as noted in Bethlahmy, the implied warranty of fitness does not require a builder to build a perfect house free from any defects:

The implied warranty of fitness does not impose upon the builder an obligation to deliver a perfect house. No house is built without defects, and defects susceptible of remedy ordinarily would not warrant rescission. But major defects which render the house unfit for habitation, and which are not readily remediable, entitle the buyer to rescission and restitution. The builder-vendor’s legitimate interests are protected by the rule which casts the burden upon the purchaser to establish the facts which give rise to the implied warranty of fitness, and its breach.

91 Idaho at 68, 415 P.2d at 711.

The trial judge, after personally viewing the Van Ordens’ residence and considering all of the evidence presented at trial, determined Ervin “partially breached” the express and implied warranties of its contract with the Van Ordens by failing to construct certain parts of the house in a workmanlike manner. However, the trial court held that this breach was not substantial. The court also found that the Van Ordens breached the contract by failing to pay the installments due under the contract which forced Ervin off the construction site and denied Ervin the opportunity to cure the defects in the home. The trial court rejected the Van Ordens’ argument that their obligation under the contract was excused by Ervin’s partial breach.

We are not persuaded that the findings and conclusions of the trial court on ' this issue should be set aside. A substantial or material breach of contract is one which touches the fundamental purpose of the contract and defeats the object of the parties in entering into the contract. Enterprise, Inc. v. Nampa City, 96 Idaho 734, 740, 536 P.2d 729, 735 (1975); see also Mountain Restaurant Corp. v. Parkcenter Mall Assocs., 122 Idaho 261, 265, 833 P.2d 119, 123 (Ct.App.1992). Rescission of a contract is available only when one of the parties has committed a material breach which destroys the entire purpose of entering into the contract. Crowley v. Lafayette Life Ins. Co., 106 Idaho 818, 821, 683 P.2d 854, 857 (1984). Rescission is not available, however, where the breach of contract is only incidental and subordinate to the main purpose of the contract. Huggins v. Green Top Dairy Farms, 75 Idaho 436, 447, 273 P.2d 399, 405 (1954); Mountain Restaurant Corp., 122 Idaho at 265, 833 P.2d at 123. Whether a breach of contract is material is a factual question. See Enterprise, Inc., 96 Idaho at 740, 536 P.2d at 735; Mountain Restaurant Corp., 122 Idaho at 265, 833 P.2d at 123.

Substantial and competent evidence supports the trial court’s conclusion that Ervin’s breach of the contract was not substantial, i.e., the breach did not destroy the entire purpose of the contract. At the time Ervin left the construction site in May of 1986, only four to six weeks of work was required to complete the project. Ervin had billed the Van Ordens for approximately $35,000.00 in materials and labor since commencing work in November of 1985. The total contract amount was approximately $82,000.00, of which approximately $41,000.00 was to be paid to Ervin. Thus, only $6,000.00 additional dollars would have been paid to Ervin under the terms of the contract if Ervin remained through completion.

Two months after Ervin left the site, the Van Ordens hired another contractor, John Grimmett, to perform what Jay Van Orden testified was finish work on the interior of the house. The trial court found Grimmett incurred $10,348.66 in material and labor expenses completing and repairing the Van Or-dens’ home. Caulking and sealing work which presumably would have been completed by Ervin was instead performed by Jay Van Orden himself. There is no evidence of any expenses incurred in connection with this task or in connection with any additional work which was scheduled to be completed by Ervin. Approximately two months after hiring Grimmett, the Van Ordens were able to move into their new home.

The trial court observed that a log home is rustic in nature and some gaps, cracks, warping, and rough finish in the logs and beams are expected and permissible. The trial court held, however, that there were excessive gaps, cracks, warping and rough finish. Clearly, defects existed in the log home during the course of construction. Milton L. Werner, a builder of log homes and an engineer hired by Ervin as an expert in this ease, testified about the rustic makeup of log homes and imperfections which exist in materials used in building log homes. Werner believed that many of the alleged defects in the Van Orden house were attributable to the rustic nature of the home. In addition, Werner also testified that the Van Ordens’ home was. unfinished when Ervin left the construction site but that the house at that point was structurally sound. Werner opined that many of the defects which existed in the unfinished structure were correctable. As we noted in Bethlahmy, “[n]o house is built without defects, and defects susceptible of remedy ordinarily would not warrant rescission.” 91 Idaho at 68, 415 P.2d at 711.

We agree with the trial court’s conclusion that Ervin was not permitted the opportunity to correct defects in the house because of the Van Orden’s failure to make payments in accordance with the terms of the contract. Of the approximately $41,000.00 to be paid to Ervin pursuant to the contract, Ervin had billed the Van Ordens for approximately $85,000.00 of that amount. The evidence supports the trial court’s conclusion that Ervin was ready, willing and able to complete the balance of the work required under the contract. This work would have included mostly finish work and repairing defects which existed in the construction. It was unreasonable for the Van Ordens to withhold all of the money owed on the presumption that Ervin would be unable to cure any of the defects which existed at this stage of construction. The Van Ordens’ failure to pay the installments due was, in effect, a constructive eviction of Ervin from the premises and a material breach of the contract. See Huggins v. Green Top Dairy Farms, 75 Idaho at 448, 273 P.2d at 406 (one cannot declare a forfeiture of a contract where he himself is materially in default); see also Associated Developers Co. v. Infanger, 85 Idaho 158, 165, 376 P.2d 496, 500 (1962).

Given the extent of Ervin’s work on the house, the work remaining on the construction contract, the time and labor spent repairing the defects, the trial court’s unique opportunity to inspect the premises and considering all of the evidence presented at trial, albeit some of it conflicting, we find substantial and competent evidence supports the trial court’s finding that Ervin’s breach was not substantial. For the reasons stated above, we also reject the Van Orden’s argument that the contract was unenforceable because of a failure of consideration. Cf. Worldwide Lease, Inc. v. Woodworth, 111 Idaho 880, 728 P.2d 769 (Ct.App.1986).

V.

THE TRIAL COURT’S AWARD OF DAMAGES IS REVERSED AND REMANDED FOR RECALCULATION

The Van Ordens argue that the trial court did not employ a correct measure of damages. The Van Ordens raise four issues in this regard: (1) whether the trial court erred in arbitrarily reducing by one-half their recovery for expenses incurred repairing defects which existed when Ervin left the construction site; (2) whether the trial court failed to award damages for the diminution in value of the home caused by existing defects; (3) whether the trial court erred in entering separate judgments with respect to both Ervin and the Van Ordens rather than entering a single judgment; and (4) whether the trial court erred in awarding Ervin prejudgment interest. We will address each of these issues in turn.

We first address whether the trial court erred by reducing the damages awarded to the Van Ordens by one-half. The trial court entered the following conclusion of law:

Because of the issues stated above [that some of Ervin’s work was substandard and defective and that Ervin left the job before the work was completed because they had not been paid], the Court concludes that since there were defects in the workmanship and since the Ervins were forced off the job site before they could attempt to remedy these defects, a reasonable balance must be found in this ease. Therefore, the Court will award to the Van Ordens one-half of all the labor and material costs incurred by Mr. Grimmett to complete and repair the Van Orden home. There was work that Mr. Grimmett performed on the home that was in addition to what the Ervins were contracted to complete. The Court found it difficult to determine from the evidence which costs were for the additional work. However, the Court believes that the total labor costs incurred by Mr. Grimmett of $5,840.33, and the materials he purchased totaling $4,508.33 did not include any of the additional work done by Mr. Grimmett. Therefore, the sum of these figures is $10,348.66 and half of that figure is $5,174.33 which is the total damages that will be awarded to the Van Or-dens.

We can find no basis in the record to substantiate what the trial court called a “reasonable balance” in reducing the damages awarded the Van Ordens by one-half. While the trial court may have been grappling with the sufficiency of the proof to establish the costs to repair the defects (as opposed to the costs to complete the home, for which Ervin was not responsible), it was nevertheless clearly erroneous for the trial court to create a damage figure which it deemed reasonable. We therefore reverse the trial court on this issue and for the reasons stated hereafter, remand this case back to the trial court for a recalculation of the Van Ordens’ damages consistent with the evidence presented.

The Van Ordens next challenge the trial court’s measure of damages arguing they should have been awarded damages for diminution in value, rather than simply the cost to repair. The general rule in Idaho is a contractor may recover the contract price of a structure which substantially conforms to the terms of the contract, less the cost of repairing minor defects in the structure. Eldred v. C.L. Folkman Co., 93 Idaho 131, 133, 456 P.2d 775, 777 (1969). The question of whether the contractor’s performance is “substantial” and whether the defect is “minor” is one of degree, “turning upon circumstances such as the particular structure involved, its intended purposes, and the nature and relative expense of the repairs, as well as equitable considerations.” Id. Whether a contractor has substantially performed a contract is a question of fact. See Puget Sound National Bank of Tacoma v. C.B. Lauch Construction Co., 73 Idaho 68, 75-76, 245 P.2d 800, 804-05 (1952).

The Court has previously endorsed the following definition of substantial performance:

* * * There is a substantial performance of a contract to construct a building where the variations from the specifications or contract are inadvertent and unimportant and may be remedied at a relatively small expense and without material change of the building; but where it is necessary, in order to make the building comply with the contract, that the structure, in the whole or in material part, must be changed, or there will be damage to parts of the building, or the expense of such repair will be great, then it cannot be said that there has been a substantial performance of the contract.

White v. Mitchell, 123 Wash. 630, 213 P. 10, 13 (1923), cited with approval in Nelson v. Hazel, 89 Idaho 480, 488, 406 P.2d 138, 143 (1965); cf. Bott v. Idaho State Bldg. Auth., 122 Idaho 471, 476-77, 835 P.2d 1282, 1287-88 (1992) (instruction on substantial performance which measured whether the obligee under the contract received the important essential benefits for which it contracted up until the time of termination accurately stated the law of substantiual performance).

In Hafer v. Horn, 95 Idaho 621, 515 P.2d 1013 (1973), a building contractor who had completed construction on a house sued the owners of the house after they withheld a portion of the contract price for alleged defects in the construction of the home. The owner counterclaimed for breach of the implied warranty of fitness. The trial court found a number of defects or deficiencies in the residence and awarded damages based on the cost of repair. Although the Court remanded the case back to the trial court for a recomputation of damages because of ambiguities in the trial court’s calculation of damages, the Court upheld the trial court’s use of repair costs as a measure of damages. In doing so, the Court endorsed the following measure of damages discussed in Restatement of Contracts § 346:

§ 346. Damages for Breach of a Construction Contract.
(1) For a breach by one who has contracted to construct a specified product, the other party can get judgment for compensátory damages for all unavoidable harm that the builder had reason to foresee when the contract was made, less such part of the contract price as has not been paid and is not still payable, determined as follows:
(a) For defective or unfinished construction he can get judgement for either
(i) the reasonable cost of construction and completion in accordance with the contract, if this is possible and does not involve unreasonable economic waste; or
(ii) the difference between the value that the product contracted for would have had and the value of the performance that has been received by the [buyer], if construction and completion in accordance with the contract would involve unreasonable economic waste.

95 Idaho at 623, 515 P.2d at 1015.

Thus, if the court determined that Ervin substantially performed under the contract, Hafer afforded the trial court two alternative measures of damages. In order for Ervin to have substantially performed, the court had to find that any variations from the contract were inadvertent and unimportant and could be remedied at relatively little expense. The trial court then could have awarded the Van Ordens the cost to repair the defects in their home if repair were possible and would not involve economic waste. In the alternative, if the trial court found that the cost to repair would involve unreasonable economic waste, the correct measure of damages would be the difference between the value of the house as contracted and the value of the performance received.

In Nelson we held that a construction contract that is “not performed in a workmanlike manner” is not substantially performed and it is error to so hold. 89 Idaho at 489, 406 P.2d at 144. The trial court in this case found that only certain parts of the construction on the home were not performed in a workmanlike manner, rather than the contract as a whole. Thus this case does not come within the rule announced in Nelson and we decline in this instance to follow the broad pronouncement stated there. In certain instances, such as the case at bar, there can be components of the construction which are not performed in a workmanlike manner, but such a finding does not mean that the project as a whole was not completed in a workmanlike and timely manner. If the defective portions of the construction are not such as to destroy the important essential benefits for which the parties contracted, then there still may be substantial performance. See Bott, 122 Idaho at 476-77, 835 P.2d at 1287-88.

In this instance, the trial court personally observed the home and heard the testimony from the parties and their witnesses about the construction. As such the trial court was in the best position to determine the credibility of the witnesses and the condition of the home. The trial court found that there was no evidence presented to indicate that Ervin could not have repaired the defects had they been given the opportunity to do so. Implicit in that conclusion is a finding that there is no reason to believe the defects were so pervasive that they could not be repaired. While the trial court’s findings of fact and conclusions of law do not use the specific phrase “substantial performance,” this finding is inherent from the trial court’s other findings and use of “cost to repair” as a measure of the Van Ordens’ damages. Both parties acknowledged at oral argument and in their briefing that the trial court had found substantial performance and we agree.

Because repairs were made without unreasonable economic waste, and evidence to this effect was offered, the cost to repair was a reasonable method of damage calculation. As to the remaining alleged defects which have not been repaired, the trial court implicitly found that these defects were curable. Since there was no evidence presented detailing cost to repair these defects, the trial court was correct in awarding no damages for those additional repairs.

Although we find that the trial court utilized the proper method of calculating damages, ie., the cost to repair, we find the actual award of damages deficient in several respects. First, the Van Ordens were not entitled to damages for the cost to complete the house under the terms of the contract. The trial court’s award of damages included expenses incurred by Grimmett to both complete and repair the home. Second, as specified in Footnote 1, supra, the figures used by the trial court in calculating the Van Ordens’ damage award are not supported by the evidence. Third, the trial court erred in arbitrarily reducing by one-half the damage award. Thus, we remand this case back to the trial court for a recalculation of the Van Ordens’ damages which is consistent with the foregoing.

The Van Ordens also argue that the trial court incorrectly entered separate judgments for both Ervin and the Van Ordens. They argue the damages awarded each party should be offset against each other and one judgment entered. We agree. I.R.C.P. 54(b) provides that:

If any parties to an action are entitled to judgments against each other such as on a claim and counterclaim, or upon cross-claims, such judgments shall be offset against each other and a single judgment for the difference between the entitlements shall be entered in favor of the party entitled to the larger judgment.

Based on the clear and unambiguous language of the foregoing, the trial court should enter a single judgment on remand.

We next consider, the trial court’s award of prejudgment interest. I.C. § 28-22-104 provides for the award of prejudgment interest of 12% for “money due by express contract.” A trial court may award prejudgment interest from the date of the breach of contract when the amount upon which the interest is to be based is mathematically and definitely ascertainable. Barber v. Honorof, 116 Idaho 767, 770, 780 P.2d 89, 92 (1989). Prejudgment interest is warranted only when the principal amount of liability is liquidated or ascertainable by mere mathematical process. Id.; see also Stoor’s Inc. v. Idaho Dep’t of Parks & Recreation, 119 Idaho 83, 86, 803 P.2d 989, 992 (1990).

The construction contract in the instant case provided that the Van Ordens could terminate the contract at any time by paying Ervin “an appropriate percentage of work completed based on net contract amount and value of materials installed.” At the time of the Van Ordens’ breach of the contract, the net contract amount was readily ascertainable but the value of materials installed was not. The trial court found that numerous defects existed not only in the construction of the home, but in some of the material used. These defects would affect the value of the installed materials. We therefore find that the principal amount of liability at the time of the Van Ordens’ breach was not mathematically and definitely ascertainable. We reverse the trial court’s award of prejudgment interest.

VI.

THE VAN ORDENS’ NEGLIGENCE CLAIM IS AN ALTERNATIVE THEORY OF RECOVERY

The Van Ordens argue that the trial court should have found liability under their negligence claim. The trial court, however, found liability under the Van Ordens’ breach of warranty claim. The negligence claim was merely an alternative theory of recovery for the same economic loss. We refuse to consider this issue on appeal since it would in no way affect the result.

VII.

THE AWARD OF COSTS AND ATTORNEY FEES IS REMANDED FOR RECONSIDERATION

The Van Ordens argue the trial court erred in awarding Ervin two-thirds of its requested attorney fees and all of its costs of right. The trial court noted that it was required to look at the entire case to determine the prevailing party. The court then stated it had made a careful analysis of this case and concluded that Ervin did not prevail one-hundred percent but had “generally prevailed.”

A prevailing party is entitled to costs as a matter of right. I.R.C.P. 54(d)(1). The trial court is vested with broad discretion to determine the prevailing party in a multiple claim action. I.R.C.P. 54(d)(1)(B); International Eng’g Co. v. Daum Indus., Inc., 102 Idaho 363, 366, 630 P.2d 155, 158 (1981). A court may also award reasonable attorney fees to the prevailing party in any civil action when provided for by statute or contract. I.R.C.P. 54(e)(1). Idaho Code § 12-120(3) requires the award of reasonable attorney fees to the prevailing party of a “commercial transaction.” However, a court is not required to award reasonable attorney fees every time a commercial transaction is connected with a ease. Brower v. E.I. DuPont De Nemours & Co., 117 Idaho 780, 784, 792 P.2d 345, 349 (1990). The critical test is whether the commercial transaction comprises the gravamen of the lawsuit; the commercial transaction must be integral to the claim and constitute the basis upon which the party is attempting to recover. Id.

In the present case, the gravamen of this lawsuit was a commercial transaction; the alleged breach of a construction contract between Ervin and the Van Ordens. The trial court was required to award costs and attorney fees if, in its sound discretion, it determined a particular party prevailed. While we will not ordinarily overturn a valid exercise of discretion by our district courts, in light of our holding today, we are reversing the trial court’s award of costs and attorney fees and remanding this issue back to the trial court for its consideration along with its recalculation of the Van Ordens’ damages. In doing so, we are expressing no opinion as to a prevailing party or an appropriate award of costs and attorney fees.

VIII.

CONCLUSION

Based on the foregoing, the judgment of the trial court is affirmed in part, reversed in part and remanded for a recalculation of damages consistent with this opinion.

No costs or attorney fees are awarded on appeal.

MeDEVITT, C.J., BISTLINE and JOHNSON, JJ., and WOODLAND, District Judge (Pro Tern.), concur. . 
      
      . The evidence indicates Grimmett performed additional work on the Van Orden home beyond what Ervin was obligated to complete. The trial court held, however, that the $10,348.66 figure did not include any of the additional work performed by Grimmett. We note that the trial court used a figure of $4,508.33 for materials and a figure of $5,840.33 for labor in calculating the total of $10,348.66. The invoice submitted by Grimmett actually discloses a figure of $4,580.33 for materials. The testimony of Grimmett and the invoice disclose a total labor cost of $7,930.00 which included an initial charge of $6,670.00 followed by an additional charge of $ 1,260.00. We find no basis in the record for the $5,840.33 figure used by the trial court. While the foregoing is not significant to our discussion of whether Ervin materially breached the contract, we nevertheless point these figures out for purposes of an accurate recalculation of damages on remand.
     