It all depends what the contract says. If the contract allows a right to set off monies from one contract against another, then this is lawful. However, in the absence of a contractual right to set off, you cannot set off claims under one contract against monies due under another contract. “Claims” in this context means monies which require to be proved and are not capable of calculation by mere arithmetic.