
808 So.2d 428 (2001)
BUCK'S RUN ENTERPRISES, INC.
v.
MAPP CONSTRUCTION, INC.
No. 1999 CA 3054.
Court of Appeal of Louisiana, First Circuit.
February 16, 2001.
*429 Eric L. Pittman, Denham Springs, Lawrence R. Anderson, Jr., Baton Rouge, for Plaintiff-Appellee Buck's Run Enterprises, Inc.
R. Gray Sexton, Kirsten B. David, Baton Rouge, for Defendant-Appellant Mapp Construction, Inc.
Before: PARRO, FITZSIMMONS, and GUIDRY, JJ.
PARRO, J.
This is an appeal from a judgment in favor of Buck's Run Enterprises, Inc. (Buck's Run), granting its motion for summary judgment and denying a motion for summary judgment filed by MAPP Construction, *430 Inc. (MAPP). We reverse and remand.

FACTUAL AND PROCEDURAL BACKGROUND
Buck's Run was a subcontractor on several construction projects on which MAPP was the general contractor. On March 23, 1999, Buck's Run filed suit against MAPP in the Baton Rouge City Court for $9,323.30 it claimed MAPP owed it for services provided on the University Club subdivision project. MAPP answered and asserted an affirmative defense of setoff. MAPP claimed Buck's Run defaulted on another project, the All Star Ford project in Denham Springs, and that the damages resulting from its default on that project exceeded the amount MAPP owed Buck's Run on the University Club project. Therefore, MAPP claimed it was entitled to a setoff that would defeat the claim of Buck's Run in this suit.
The parties filed cross motions for summary judgment and submitted affidavits and other evidence in support of their motions. Buck's Run argued that setoff was not appropriate, because the amounts claimed by MAPP with regard to the All Star Ford project were not liquidated, but were disputed. In fact, the All Star Ford issues were the subject of another lawsuit Buck's Run had filed against MAPP in Livingston Parish for amounts it claimed were owed to it under the subcontract on that job.[1] MAPP claimed that although some of the damages on the All Star Ford project may have been unliquidated, a portion of those damages could be ascertained by calculation and these amounts exceeded the amount claimed by Buck's Run under the University Club project. MAPP also claimed that a provision in its contract with Buck's Run allowed it to withhold payment on any project if Buck's Run was in default on any other project. MAPP urged the court to deny the motion for summary judgment filed by Buck's Run and grant its motion for summary judgment or determine at trial whether the setoff claim in its affirmative defense was sufficient to defeat the claim of Buck's Run.
After a hearing on the motions, the court denied MAPP's motion and granted summary judgment in favor of Buck's Run, ordering MAPP to pay $9,323.30, plus 25% attorney fees, and all costs. MAPP filed a motion for new trial, which was denied on August 30, 1999. This appeal followed.

ISSUES ON APPEAL
MAPP argues the trial court erred in granting Buck's Run's motion for summary judgment and denying its motion for summary judgment, because a provision in the subcontract agreement between the parties specifically authorized MAPP to withhold an amount sufficient to secure it with respect to any breach or default by Buck's Run under any other agreement. MAPP contends that the amount it is withholding on the University Club project is far exceeded by the amounts it is owed by Buck's Run on the All Star Ford project. MAPP claims the court erred in applying the codal provision requiring liquidated amounts for compensation and setoff by operation of law, when in this case, the *431 contract between the parties is the law between the parties and specifically allows the action taken by MAPP, even if the amount withheld is not liquidated. In the alternative, MAPP argues that the debt it asserts as an offset to what is owed to Buck's Run is liquidated, because it is an amount capable of ascertainment by mere calculation, and is therefore quantifiable.
Buck's Run counters that the amount MAPP claims it is owed on the All Star Ford project is not liquidated, and in fact, the liability of Buck's Run for any debt on that project has not been established and is the subject of the other lawsuit. Therefore setoff is not appropriate as a matter of law. Buck's Run also claims the withholding provision of the subcontract agreement is contrary to the law of compensation/setoff provided by Louisiana statute and jurisprudence and is therefore unenforceable. It further argues that in order for a contractual provision to override clear statutory law, it must expressly indicate that it is intended to derogate from statutory law.

APPLICABLE LAW

Summary Judgment
An appellate court's review of a summary judgment is a de novo review based on the evidence presented to the trial court, using the same criteria used by the trial court in deciding whether a summary judgment should be granted. Simmons v. Berry, 98-0660 (La.App. 1st Cir.12/22/00), 779 So.2d 910, 913-914. A motion for summary judgment should be granted only if all the pleadings, depositions, answers to interrogatories, admissions, and affidavits submitted to the trial court show that there is no genuine issue of material fact and that the mover is entitled to judgment as a matter of law. LSA-C.C.P. art. 966(B). If the issue before the court on the motion for summary judgment is one on which the party bringing the motion will bear the burden of proof at trial, the burden of showing that there is no genuine issue of material fact is on the party bringing the motion. LSA-C.C.P. art. 966(C)(2).

Affirmative Defense
Louisiana Code of Civil Procedure article 1005 governs the pleading of affirmative defenses, stating, in pertinent part:
The answer shall set forth affirmatively arbitration and award, assumption of risk, contributory negligence, discharge in bankruptcy, division, duress, error or mistake, estoppel, extinguishment of the obligation in any manner, failure of consideration, fraud, illegality, injury by fellow servant, transaction or compromise, and any other matter constituting an affirmative defense.
An affirmative defense raises new matter which, assuming the allegations in the petition to be true, constitutes a defense to the action and will have the effect of defeating the plaintiff's demand on its merits. Hanks v. Wilson, 93-0554 (La.App. 1st Cir.3/11/94), 633 So.2d 1345, 1348. A party claiming setoff as an affirmative defense has the burden of proving his claim. Richard v. Vidrine Auto. Services, Inc., 98-1020 (La.App. 1st Cir.4/1/99), 729 So.2d 1174, 1179.

Compensation or Setoff
Compensation takes place by operation of law when two persons owe to each other sums of money or quantities of fungible things identical in kind, and these sums or quantities are liquidated and presently due. In such a case, compensation extinguishes both obligations to the extent of the lesser amount. LSA-C.C. art. 1893. A claim is liquidated when the debt is for an amount capable of ascertainment by *432 mere calculation in accordance with accepted legal standards. Independent Living Ctr., Inc. v. State, Dept. of Soc. Services, 93-0776 (La.App. 1st Cir.6/24/94), 638 So.2d 1202, 1205.
Compensation of obligations may take place also by agreement of the parties, even though the requirements for compensation by operation of law are not met. LSA-C.C. art. 1901; Echo, Inc. v. Power Equip, Distributors, Inc., 96-1771, 96-1772 (La.App. 1st Cir.8/7/98), 719 So.2d 79, 87, writ denied, 98-2392 (La.11/20/98), 729 So.2d 555.
Judicial compensation takes place when a court decides two parties are mutually indebted to each other and adjusts the amounts owed in fixing the judgment. LSA-C.C. art. 1902; Fidelity & Deposit Co. of Maryland v. Cloy Const. Co., Inc., 463 So.2d 1365, 1369 (La.App. 1st Cir. 1984), writ denied, 465 So.2d 723 (La. 1985).

Contract Principles
Contracts have the effect of law for the parties. LSA-C.C. art. 1983. If the terms are clear, the court will enforce the contract as written, provided the agreement is not contrary to good morals or public policy. First Nat. Bank of Commerce v. City of New Orleans, 555 So.2d 1345, 1348 (La.1990). Parties are free to contract for any object that is lawful, possible, and determined or determinable. LSA-C.C. art. 1971. Parties are free to contract except for those instances where the government places restrictions for reasons of public policy. Louisiana Smoked Products, Inc. v. Savoie's Sausage & Food Products, Inc., 96-1716, 96-1727 (La.7/1/97), 696 So.2d 1373, 1380-81.

ANALYSIS
With these principles in mind, we review the trial court's judgment in this case. Buck's Run supported its motion with the affidavit of its president, Leslie Wagner, who stated that its work on the University Club project was complete and was performed in a timely and workmanlike manner, for which MAPP owed it $9,323.30. We note first that by asserting the affirmative defense of setoff, MAPP judicially admitted that it owes Buck's Run the $9,323.30 claimed for work on the University Club project. One seeking compensation necessarily admits the debt sued on. Tolbird v. Cooper, 243 La. 306, 143 So.2d 80, 85 n. 3 (1962). In fact, by definition, an affirmative defense asserts a claim that will defeat the plaintiff's claim, even assuming that claim is valid. Therefore, the only issue before the trial court on the cross motions for summary judgment was whether the evidence before it created a genuine issue of material fact as to whether MAPP's setoff claim would defeat the Buck's Run claim.
The evidence before the court included copies of the subcontracts between MAPP and Buck's Run on the University Club project and the All Star Ford project. Both of these contracts included the following language:
Contractor reserves the right to withhold, as an additional reserve and without limiting its other rights and remedies, an amount sufficient ... (e) to secure Contractor with respect to any breach or default by Subcontractor or its affiliates, parent company and subsidiaries under any other agreement.
MAPP also submitted the affidavit of its project manager on the All Star Ford project, Drew Scott, who stated that Buck's Run had failed to complete the work it was supposed to perform on the All Star Ford project, resulting in certain costs to complete the work. According to that affidavit, a partial list of those costs, which did *433 not include delay damages, totaled $20,316.54.[2]
The court did not provide any oral or written reasons for its decision. However, because the matter before it was a motion for summary judgment, it could not reject the credibility of MAPP's affiant. See Independent Fire Ins. Co. v. Sunbeam Corp., 99-2181, 99-2257 (La.2/29/00), 755 So.2d 226, 236. The record also contained copies of pleadings in the other lawsuit between the parties concerning the All Star Ford project. This evidence created an issue of material fact concerning the existence of an obligation on the All Star Ford project that might defeat the Buck's Run claim for the amounts MAPP owed it on the University Club project. This evidence also presented the possibility that, even if the setoff amounts MAPP claimed from the All Star Ford project were not presently liquidated, the contractual agreement between the parties might allow MAPP to withhold payment to Buck's Run for its work on the University Club project. Although that evidence may not have been sufficient for the court to grant MAPP's motion for summary judgment under either Article 1893 or 1901 of the Louisiana Civil Code, or to judicially determine the setoff under Article 1902, it certainly was sufficient to create doubt about whether Buck's Run was entitled to collect on its claim. Based on the evidence before the trial court, it is not possible to determine that Buck's Run is entitled to judgment as a matter of law. Therefore, its motion for summary judgment should have been denied.

CONCLUSION
Based on the foregoing, the judgment of the trial court in favor of Buck's Run is reversed and this matter is remanded for further proceedings. All costs of this appeal are assessed against Buck's Run.
REVERSED AND REMANDED.
NOTES
[1]  On December 16, 1998, several months before this suit was filed, Buck's Run filed suit against MAPP in the Twenty-First Judicial District Court for amounts it claimed were due for its services on the All Star Ford project. MAPP answered and filed a reconventional demand in that suit, alleging breach of contract. Buck's Run answered, denying all liability under the reconventional demand and asserting an affirmative defense. The issues in that suit were pending and unresolved when the instant suit was filed, but neither party had filed an exception of lis pendens in this suit.
[2]  See, e.g., Powerhouse Wholesale Elec. Supply, Inc. v. Spartan Bldg. Corp., 525 So.2d 1216, 1221-22 (La.App. 1st Cir.1988), in which this court allowed a contractor to setoff the amounts paid for completion of a separate subcontract breached by the subcontractor, but did not allow a setoff of delay damages, finding the contractor had not established that the delays were solely the fault of the subcontractor.
