
583 P.2d 521 (1978)
AMERICAN PETROFINA COMPANY OF TEXAS, a Corporation, Appellant-Cross-Respondent,
v.
D & L OIL SUPPLY, Inc., a Corporation, and Theodore Kightlinger and Mildred Kightlinger, Husband and Wife, Respondents-Cross-Appellants.
TC 78638; SC 25059.
Supreme Court of Oregon, Department 1.
Argued and Submitted January 12, 1978.
Decided August 1, 1978.
*523 David A. Rhoten, Salem, argued the cause for appellant-cross-respondent. With him on the brief were Rhoten, Rhoten & Speerstra and Don A. Dickey, Salem.
Thomas B. Brand, Salem, argued the cause for respondents-cross-appellants. With him on the brief were Brand, Lee, Ferris & Embick, Richard D. Lee and D. Erik Larson, Salem.
Before DENECKE, C.J., HOWELL and LENT, JJ., and GILLETTE, J. Pro Tem.
LENT, Justice.
This is an action at law arising out of a series of disputes between a supplier of petroleum products, American Petrofina Company ("Fina"), and a regional distributor, D & L Oil Supply, Inc. ("D & L"), which has its place of business in Salem. The case was tried to the court without a jury. The major problem on appeal involves Fina's obligations to D & L under a price support agreement. Fina's appeal challenges the sufficiency of the evidence to support the trial court's judgment for D & L in this and other particulars.[1] We view the evidence in the light most favorable to D & L, and must affirm the trial court's judgment unless we can say there was no evidence to support it. See Hendrix v. McKee, note 1 supra, 281 Or. 123, 126, 575 P.2d 134.
In March of 1971 the parties entered into a written agreement, entitled a "Distributor Sales Contract," under which Fina agreed to sell and D & L agreed to buy gasoline and other petroleum products. The price support dispute concerns the sale of gasoline only. Although the contract did not specify a price per gallon, it is undisputed that throughout the period involved in this case the base price to be paid by D & L was $0.1465 per gallon for regular gasoline and three cents more per gallon for premium.
The written contract does not refer to price support, but at the time it was executed the parties orally agreed that Fina would, under certain circumstances, furnish price support. They are now in sharp disagreement about the terms of that oral agreement. Fina did furnish some price support, but not the amount to which D & L claims it was entitled. Further background information will help to clarify the parties' contentions.
D & L, from its Salem location, supplied a number of independent retail service stations in the Willamette Valley and on the coast. In order to remain competitive as independent service stations, these retail dealers had to sell gasoline to the public at a price lower than that being charged by the major brand service stations in their trading areas. In order to supply gasoline to these stations at a price which would permit them to maintain their competitive status as independent stations, D & L looked to the price support to be furnished by Fina.
For pricing purposes, Fina and D & L divided the area served by D & L into a number of zones. The price support furnished by Fina on a particular purchase of gasoline depended on the price situation in the zone to which that gasoline was to be delivered and where it was to be sold by a given retail station. The rate of price support furnished during a given period for a particular price zone was tied to the retail price of major brand gasoline. Fina, shortly after the initial agreement, provided D & L with a schedule for price support (which Fina calls a "Competitive Price Allowance" or "CPA") from which the following figures are excerpted:


*524
Major Retail     CPA     Net Jobber Price
   .369          -0-          .1465
   .359         .0025         .1440
   .349         .0075         .1390
   .339         .0125         .1340
   .329         .0175         .1290
   .319         .0225         .1240
   .309         .0275         .1190
   .299         .0325         .1140
   .289         .0375         .1090
   .279         .0475         .0990

This schedule refers to prices for regular gasoline. The price to be paid by D & L for premium gasoline was three cents per gallon more than it paid for regular under the same circumstances. Although regular and premium were accounted for separately, the same amount of price support was to be furnished for premium gasoline as was furnished for regular at a given time in a given zone.
As can be seen from the schedule, when the "major retail" price for regular gasoline dropped below $0.369 per gallon, Fina was to furnish price support. The net price to D & L can be determined at any given "major retail" price by determining the agreed amount of price support per gallon ("CPA") from the schedule and subtracting that figure from D & L's base price of $0.1465. The result of this calculation is shown in the schedule as the "Net Jobber Price."
The dispute concerns the meaning of the term "Major Retail" in this schedule and how it was to be determined. Fina's position is that the existence and amount of price support for gasoline furnished for sale in a particular zone was to be determined with reference to the "protected price" at two or more major oil company service stations within that zone. "Protected price" apparently means a retail price at which the major oil company would provide its dealers with price support sufficient to permit them to maintain their customary profit margin.[2] Fina personnel testified that company policy was to provide price support based only on the protected price of two or more major companies with stations in the pricing zone. They did not explain how the amount of price support would be determined if two or more major companies were supporting their dealers but at different prices.
D & L's version of the oral agreement was that price supports were to be based, according to the above schedule, on the lowest retail price actually charged for regular gasoline by any major brand station within the price zone. The trial court accepted D & L's position, and there was evidence to support it. Mr. Kightlinger, the owner of D & L, testified that the oral agreement was that price support would be furnished with reference to the lowest price charged by a major station within the zone, and that he and Fina's representative had never discussed any requirement that the major retail price which would trigger the price support had to be a "protected" price. D & L personnel regularly surveyed the retail prices charged at other stations in the various zones and reported this information to Fina when requesting additional price support. There was, of course, evidence which contradicted Mr. Kightlinger's version of the agreement. However, the trial court as finder of fact was entitled to believe Mr. Kightlinger. We may not reweigh the conflicting evidence. Hendrix v. McKee, supra at 125-26, 575 P.2d 134.
Fina also contends that there is no evidence to support the trial court's determination of the amount of damages to which D & L was entitled as a result of Fina's failure to credit D & L's account with price support in the agreed amounts. We conclude that, although there was evidence of damage, the evidence does not support the method of calculation adopted by the trial court; therefore, the case must *525 be remanded for a proper determination of damage.
The method of calculation proposed by D & L, and adopted by the trial court, was to determine, on a day-by-day basis, the amount of price support per gallon which Fina should have provided for each price zone, and to multiply that figure by the number of gallons of gasoline sold by stations in that zone while that level of price support should have been in effect. In that way the total amount of price support which D & L contended that Fina should have paid was calculated, and from the total thus obtained the amount of support actually paid during the contract period was subtracted.
There is evidence to support D & L's figures as to the amount of support per gallon which Fina should have provided according to D & L's version of the agreement, and there is no dispute about the amount actually paid. The difficulty involves the determination of the number of gallons to which the price support figure, which varied considerably over time and also among the various zones, was to be applied.
All of the oral and documentary evidence establishes that between April 1971, when deliveries under the contract began, until November 30, 1971, when a change in accounting methods was made, the price support program was implemented by reducing the invoice price of each truckload of gasoline purchased by D & L according to the destination shown for that load on the bill of lading. The evidence also establishes that during this period D & L did not provide Fina with gallonage sales figures for the various stations which it supplied. Frequently the destination indicated on the bill of lading was Salem, where D & L maintained its storage facilities, but some or all of that gasoline was later delivered by D & L to retail stations in other price zones where a different level of price support might be in effect.
Prior to December 1, 1971, there was never any attempt by the parties to account for the amount of gasoline sold in each price zone by any means other than the designation of destination of each load on the bill of lading. The only reasonable inference is that the parties agreed that those designations would be the basis for the price support calculations.
After December 1, 1971, Fina required, and D & L furnished, meter readings from the various stations supplied by D & L, and price support amounts were determined with reference to the gasoline actually sold in each price zone during a given period. The evidence does not, however, support a damages calculation based on the assumption that this same method of accounting was in effect prior to that date.
All of the data necessary for making a correct computation for the period prior to December 1, 1971, appears to be in the record. However, that computation has not been made, and we cannot determine, without complete recalculations of the daily transactions for that entire period, the extent of the difference a recalculation would make in the amount of damages, or whether the difference would be favorable to Fina or to D & L. D & L has not appealed and cannot, therefore, claim any advantage to it which might result from the recalculation.[3] Fina, however, should have the opportunity to determine whether an appropriate recalculation would reduce the damages award and, if so, to demonstrate that fact and the amount involved to the trial court.
On remand, therefore, the trial court will allow Fina a reasonable time in which to make the recalculation. If, within the time allowed, Fina satisfies the trial court that the damages award should be reduced, the judgment is to be modified accordingly. If it does not do so, the judgment will be affirmed, except for two items which must be disallowed, as we discuss below.
*526 To avoid misunderstanding, we emphasize that the data upon which the damages recalculation is to be made is that already in the record. The calculation should be made as follows: for the period to and including November 30, 1971, the rate of support that should have been paid for each price zone on each date is the amount determined by ascertaining the lowest price charged by a major retail station in that zone and finding the appropriate level of price support on the CPA schedule. That figure should be multiplied by the number of gallons purchased by D & L and designated for delivery in that zone during the time that level of price support should have been in effect. The amount thus determined is to be added to the amount of price support which should have been paid after December 1, 1971, according to the computations furnished by D & L. From that total, the amount of price support actually paid, $137,813.20, should be subtracted. If the resulting figure is less than $38,623.29, the amount of additional price support allowed by the trial court, the judgment should be reduced by the amount of the difference.
Fina also objects on several grounds to the inclusion in the judgment of price support for gasoline sold by certain stations the so-called "unbranded accounts." Insofar as those objections relate to the calculation of the amount of subsidy due, they are, with one exception, disposed of by what we have held above. The exception is the "Archie Miller" account. D & L claimed, and was awarded, $1,638.11 in price support on account of gasoline sold there after December 1, 1971. Fina contends that this amount should not have been allowed, because it was not properly substantiated by D & L by furnishing Fina with meter readings in accordance with the parties' agreement as modified by the December 1, 1971, change in accounting methods. D & L has not responded to this argument, and we have not been directed to anything in the record to indicate that D & L ever supplied Fina with the necessary information. Fina was not obliged to furnish price support after December 1, 1971, measured by gasoline sales of which it was not notified. The evidence does not support this portion of the damages award, and the judgment must be reduced by this amount.
Fina also contends that in any event it was not obliged to pay price support for gasoline which D & L supplied to stations which did not display the Fina trademark. It relies on the following language in the written contract:
"* * * unless FINA consents otherwise in writing, the products purchased hereunder will be sold to the public under the respective applicable brand names of FINA; and Buyer shall display the same on all containers in which such products are handled and in all advertisements thereof and at all stations and other places of distribution from which sales or deliveries may be made by Buyer."
The contract also provides that a breach of any of its provisions by D & L shall be grounds for termination by Fina. There is no evidence of any agreement that Fina could elect not to terminate the contract after a breach and yet be relieved of its obligation to furnish price support. Mr. Kightlinger testified that the Fina representative with whom he dealt was aware, at the time the contract was executed, of the circumstances in which D & L would be supplying gasoline to Davis Oil Company, the account upon which all but about $40 of the unbranded gasoline dispute is based. The trial court could properly find that Fina had been aware of the unbranded sales, that it had elected not to exercise any right of termination which it might have under the contract, and that there was nothing in the parties' oral agreement which would relieve Fina of its obligation to pay price support under those circumstances. We find no grounds upon which to disturb this portion of the judgment.
Fina also assigns as error the trial court's judgment for D & L in the amount of $864.44, representing damages resulting from Fina's failure to supply gasoline for a four-day period during February of 1972. Fina admits that it failed to supply gasoline during that period and does not dispute the *527 amount of damages suffered by D & L. Fina contends, however, that under the terms of the parties' contract it is not liable for these damages.
The evidence discloses that all gasoline furnished by Fina to its Oregon distributors was obtained by it from Union Oil Company. Witnesses explained that this arrangement was pursuant to an exchange agreement by which Union Oil Company products were furnished to Fina in some parts of the country while Fina products were furnished to Union in other areas. During the period at issue here, Union had failed to deliver gasoline to the terminal in Portland from which Fina's customers obtained their supplies. As a result, D & L had to obtain its gasoline on the open market.
The contract between Fina and D & L provides:
"It is agreed that FINA shall not be liable for delays or for non-deliveries caused by fire, flood, strike, war, acts of God, insufficient receipts of raw materials, or other causes beyond FINA's control, including inability of FINA to secure crude oil or other supplies necessary for the conduct of its business."
The issue is the proper construction of this language in the agreement.
Fina contends that because it received no gasoline from Union during the period in question, it could not supply any to its customers. This nonperformance was excused, it contends, because it was caused by Fina's inability to secure supplies and was beyond its control. This argument appears to concede that the contract, properly construed, excuses Fina's nonperformance only if Fina was unable to secure gasoline for delivery under the contract. We agree that this is the correct construction.
The contract provides that if lack of raw materials results in nondelivery Fina will not be liable if its receipt of raw materials is, for whatever reason, insufficient. However, the lack of raw materials did not cause the problem in this case. Nondelivery under the circumstances of this case, to be excused, must be caused by Fina's actual inability to secure "necessary supplies."
The evidence was uncontradicted that when Fina failed to supply gasoline D & L obtained it elsewhere. There was no evidence that Fina could not have done so. The trial court could properly infer that if D & L could obtain gasoline Fina would also have been able to do so. The trial court did not err in finding that Fina's nondelivery was not caused by its inability to secure gasoline and in giving judgment for the resulting damages.
The next area of dispute concerns an agreement, memorialized in separate written contracts, that Fina would provide paint and labor to repaint, in Fina's colors, most of the service stations supplied by D & L. By the terms of the agreement, the paint and labor were to be furnished and paid for by Fina at an agreed price. If, however, D & L discontinued handling Fina petroleum products within three years after the painting was completed, D & L would reimburse Fina for the painting at the agreed price less 3% for each month which had elapsed under the supply contract. When the parties' disagreements over the petroleum supply contract resulted in its termination, Fina billed D & L for $13,608.66 for reimbursement for painting. D & L refused to pay. There is no dispute about the proper computation of the percentage for which D & L owes reimbursement under the above terms of the contract. D & L alleged, however, that the painting work was so defective as to be valueless and prayed that Fina recover nothing on account of the painting. The trial court held, after hearing evidence that the work was defective, that Fina was entitled to reimbursement only in the amount of $6,804.33, half of the amount claimed. Fina assigns this portion of the judgment as error.
Fina's claim was pleaded in two counts: one on the contract and one for the unpaid portion of the reasonable value of the services performed. Fina was entitled to recover on the contract only if it proved that it substantially performed its obligations thereunder. One of the obligations in *528 a contract for the furnishing of services  an obligation which is implied by law if it is not expressed between the parties  is that the work is to be performed in a workmanlike manner. Amer. Recip. Insurers v. Bessonette, 241 Or. 500, 506, 405 P.2d 529 (1965); Brown v. Eakins, 220 Or. 122, 124, 348 P.2d 1116 (1960); Newlee v. Heyting, 167 Or. 288, 292, 117 P.2d 829 (1941). There was evidence in this case from which the trier of fact could find that the paint work was so defective that Fina's obligation had not been substantially performed. Whether there has been substantial performance is a question of fact. Turner v. Jackson, 139 Or. 539, 556, 4 P.2d 925, 11 P.2d 1048 (1932); Edmunds v. Welling, 57 Or. 103, 106, 110 P. 533 (1910).
Our prior cases discussing the problem of substantial performance have involved construction contracts. In that context we have said:
"* * * The substantial performance of a contract like the one in question permits only such omissions and deviations as are inadvertent and unintentional, are not due to bad faith, do not impair the structure as a whole, can be conveniently remedied, and may, without injustice, be paid for by deductions from the contract price." Pippy v. Winslow, 62 Or. 219, 222, 125 P. 298, 299 (1912), quoted in Turner v. Jackson, supra at 556, 4 P.2d 925.
Defective painting does not, of course, "impair the structure as a whole." In both Pippy and Turner the contract obligation was to construct an entire building. In the present case, where the obligation was to perform painting work only, the trial court could properly consider the defects in relation to the paint job as a whole.
The trial court could find, upon the evidence before it, that the defects involved here were not inadvertent and could not have been "conveniently remedied." There was evidence that on a number of the stations the old color showed through and that on a few the paint peeled badly. As to the former, the trial court could infer that a complete second coat of paint was necessary; as to those stations where the paint peeled, it could have found that remedying the situation would have required removal of the old paint, or significant portions of it, and substantial repainting. It could properly conclude that Fina did not substantially perform its obligations under the painting agreement.
If Fina did not substantially perform those obligations, it could not recover on the contract but only for the reasonable value of the services it furnished. Turner v. Jackson, supra at 548, 4 P.2d 925. The burden was on Fina to prove what that reasonable value was. Considering D & L's evidence of the defective nature of much of the work, the trial court did not err in finding that Fina had failed to prove that the value exceeded the amount reflected in the judgment.
The trial court also held that D & L was entitled to attorney fees in connection with the resolution of the painting dispute. Fina assigns this holding as error, and we agree that the award of attorney fees cannot be sustained. To explain this portion of the case, it is necessary to describe some complications of pleading and procedure which we have been able, so far, to ignore.
This case began as an action by Fina to recover moneys alleged to be due from D & L for products and services, including the reimbursement claimed by Fina under the painting agreement. Fina prayed for attorney fees as provided in the painting contracts. In its answer D & L raised a number of defenses by way of counter-claims. In response to the claim for reimbursement for painting, D & L alleged that the painting done by Fina was worthless and prayed that Fina take nothing. D & L also prayed for attorney fees under ORS 20.096.[4]
*529 After the case was at issue, but before the trial, the gasoline shortage of 1973 resulted in intervention by the federal government in the problem of allocation of petroleum products. D & L was entitled, under relevant federal directives, to receive supplies from Fina during the period of the shortage except for the fact that on Fina's books D & L owed over $70,000. In order to obtain supplies from Fina under the federal allocation program, D & L paid Fina the entire amount Fina claimed to be due, under a stipulation which was recited to the court at trial as follows:
"* * * [A] $72,000 check was sent by D & L to American Petrofina for reasons which I will go into in a minute. The understanding between both parties was that this would not be prejudicial to either party, or prejudice to either party  that it was a requirement that was imposed upon D & L by the federal government * * *
"* * * The requirement imposed by an agency of the federal government, since Fina contended that there was an obligation due from D & L in the sum of approximately $72,000  the federal government, after a great deal of thrashing around, concluded that it would require D & L to make payment of the $72,000 before requiring Fina to deliver gasoline  so under this kind of club, the $72,000 was paid.
"There were no agreements particularly, and so far as I know, no stipulations except that the payment would not be binding upon either the plaintiff or upon the defendant."
No supplemental pleadings reflecting the effect of the payment were filed. D & L assumed the burden of going forward with the evidence to support its counterclaims, and the eventual judgment was entered for D & L in a total amount less than the approximately $72,000 which it had paid to Fina. In other words, although the pleadings framed an action in which Fina was attempting to recover approximately $72,000 and D & L claimed various sums by way of a series of counter-claims, at the time of trial D & L was attempting to recover from Fina, on various theories, portions of the $72,000 it had already paid.[5]
As to most of D & L's counter-claims, this informality of procedure has posed no particular problem, because D & L alleged that specific amounts were owed to it for various reasons. With respect to the painting agreement, however, there is a problem. The Second Amended Answer, upon which the case was tried, does not include a claim that anything is due from Fina in connection with the painting dispute except the attorney fees. Because there was no allegation that Fina's claim under the contract had been paid, there was also no allegation that anything was due D & L, but only that Fina was not entitled to recover anything.
Fina has argued, as a consequence, that there is no pleading foundation for the judgment for D & L in the amount of $6,804.33. D & L contends that the understanding under which the case was tried excuses that omission. The stipulation, as recited to the court, does not include any agreement respecting the pleadings. We conclude, nevertheless, that D & L is entitled to its judgment for reimbursement in connection with the painting contracts. Although there was no express stipulation about the effect of the $72,000 payment on the procedure to be employed, the proceedings as a whole demonstrate a tacit agreement that the trial would proceed, in effect, as though no payment had been made, with one necessary exception: the payment would be taken into account when final judgment was rendered, so that any reduction in the amount of Fina's original claim *530 would result in a money judgment for D & L.
D & L has argued that, for purposes of an award of attorney fees under the statute, it was the prevailing party, because it was "the party in whose favor final judgment * * * is rendered." ORS 20.096(3). Because of the sequence of events which we have described, however, we do not attach the usual importance to the fact that the final money judgment on the painting claim was rendered in favor of D & L. We view the case, in accordance with the parties' tacit agreement as to procedure, as one in which Fina was partially successful in its claim for reimbursement for painting services.
As we have pointed out above, however, the trial court's determination on this issue is not based on the contract, but on Fina's claim for recovery in quantum meruit. Strictly speaking, the trial court must have held for D & L on the contract count and for Fina on the quantum meruit count. Under a strict analysis, then, D & L "prevailed" on the contract count and could argue (although it has not done so) that it is entitled to attorney fees on that basis. We believe, however, that such an approach would make the application of ORS 20.096 unworkable.
In Dean v. Exotic Veneers, Inc., 271 Or. 188, 194-95, 531 P.2d 266 (1975), we held that for res judicata purposes a contract claim and a quasi-contract claim based on the same transaction constitute a single cause of action. As a consequence, it will be necessary for many plaintiffs to plead such a cause of action in two alternative counts as was done in this case. Although it is possible to determine the theory upon which the trial court allowed recovery in this case, that will not always be possible without special findings or special interrogatories to the jury.
The better alternative is to consider the plaintiff who recovers in such a case to be the prevailing party under the statute and to consider the defendant to be the prevailing party only when the plaintiff takes nothing on account of the transaction. This interpretation of the statute is consistent with the language of subsection (3), which provides that the prevailing party is the one "in whose favor final judgment or decree is rendered." We believe it will also come closer to giving effect to the probable intent of the parties who have provided in a contract for recovery of attorney fees in the event of litigation.
Therefore, as we construe the statute, D & L is not the "prevailing party" in this case, because Fina was held entitled to recover upon the cause of action pleaded alternatively in contract and in quasi-contract.[6] The award of attorney fees to D & L was not proper.
In summary, then, we hold that the judgment for D & L must be modified in the following particulars: (1) the award for additional price support will be reduced by $1,638.11, the amount claimed on account of sales by the "Archie Miller" station after December 1, 1971; (2) that award will also be reduced by the amount, if any, the trial court finds to be required by appropriate recalculations of the price support due for D & L's purchases prior to December 1, 1971; (3) the award of $2,500 attorney fees in connection with the painting dispute will be deleted. As modified, the judgment of the trial court is affirmed.
NOTES
[1]  No rulings during the trial itself are assigned as error. As we pointed out in Hendrix v. McKee, 281 Or. 123, 125 at note 2, 575 P.2d 134 (1978), an appropriate motion at trial would give the trial court, sitting without a jury, an opportunity to pass on the sufficiency of the evidence, serving the same purpose as a motion for nonsuit or for a directed verdict in a jury trial. No such motion was made in this case, but D & L has not raised the issue.
[2]  Whether a given major oil company is protecting its dealers at any particular time, and if so at what price, is confidential information. However, a Fina employee testified that he could make an informed judgment about the protected price by observing the retail prices at certain "benchmark" major oil company service stations and by inquiring of acquaintances within the industry who had access to that confidential information. He reported the information to Fina's home office, where price support changes were authorized.
[3]  D & L did file a cross-appeal from the trial court's judgment, but that cross-appeal has been abandoned.
[4]  ORS 20.096 provides:

"(1) In any action or suit on a contract, where such contract specifically provides that attorney fees and costs incurred to enforce the provisions of the contract shall be awarded to one of the parties, the prevailing party, whether he is the party specified in the contract or not, at trial or on appeal, shall be entitled to reasonable attorney fees in addition to costs and necessary disbursements.
"* * *
"(3) As used in this section and ORS 20.097 `prevailing party' means the party in whose favor final judgment or decree is rendered."
[5]  In fact, D & L's counter-claims totaled considerably more than $72,000; however, the trial court held that it was entitled to somewhat less than that amount.
[6]  Although Fina, under this interpretation of the statute, is the prevailing party, it has not challenged on appeal the trial court's failure to award attorney fees as prayed for in its complaint.
