Section 39F. (1) Every contract awarded pursuant to sections forty-four A to L, inclusive, of chapter one hundred and forty-nine shall contain the following subparagraphs (a) through (i) and every contract awarded pursuant to section thirty-nine M of chapter thirty shall contain the following subparagraphs (a) through (h) and in each case those subparagraphs shall be binding between the general contractor and each subcontractor.
(a) Forthwith after the general contractor receives payment on account of a periodic estimate, the general contractor shall pay to each subcontractor the amount paid for the labor performed and the materials furnished by that subcontractor, less any amount specified in any court proceedings barring such payment and also less any amount claimed due from the subcontractor by the general contractor.
(b) Not later than the sixty-fifth day after each subcontractor substantially completes his work in accordance with the plans and specifications, the entire balance due under the subcontract less amounts retained by the awarding authority as the estimated cost of completing the incomplete and unsatisfactory items of work, shall be due the subcontractor; and the awarding authority shall pay that amount to the general contractor. The general contractor shall forthwith pay to the subcontractor the full amount received from the awarding authority less any amount specified in any court proceedings barring such payment and also less any amount claimed due from the subcontractor by the general contractor.
(c) Each payment made by the awarding authority to the general contractor pursuant to subparagraphs (a) and (b) of this paragraph for the labor performed and the materials furnished by a subcontractor shall be made to the general contractor for the account of that subcontractor; and the awarding authority shall take reasonable steps to compel the general contractor to make each such payment to each such subcontractor. If the awarding authority has received a demand for direct payment from a subcontractor for any amount which has already been included in a payment to the general contractor or which is to be included in a payment to the general contractor for payment to the subcontractor as provided in subparagraphs (a) and (b), the awarding authority shall act upon the demand as provided in this section.
(d) If, within seventy days after the subcontractor has substantially completed the subcontract work, the subcontractor has not received from the general contractor the balance due under the subcontract including any amount due for extra labor and materials furnished to the general contractor, less any amount retained by the awarding authority as the estimated cost of completing the incomplete and unsatisfactory items of work, the subcontractor may demand direct payment of that balance from the awarding authority. The demand shall be by a sworn statement delivered to or sent by certified mail to the awarding authority, and a copy shall be delivered to or sent by certified mail to the general contractor at the same time. The demand shall contain a detailed breakdown of the balance due under the subcontract and also a statement of the status of completion of the subcontract work. Any demand made after substantial completion of the subcontract work shall be valid even if delivered or mailed prior to the seventieth day after the subcontractor has substantially completed the subcontract work. Within ten days after the subcontractor has delivered or so mailed the demand to the awarding authority and delivered or so mailed a copy to the general contractor, the general contractor may reply to the demand. The reply shall be by a sworn statement delivered to or sent by certified mail to the awarding authority and a copy shall be delivered to or sent by certified mail to the subcontractor at the same time. The reply shall contain a detailed breakdown of the balance due under the subcontract including any amount due for extra labor and materials furnished to the general contractor and of the amount due for each claim made by the general contractor against the subcontractor.
(e) Within fifteen days after receipt of the demand by the awarding authority, but in no event prior to the seventieth day after substantial completion of the subcontract work, the awarding authority shall make direct payment to the subcontractor of the balance due under the subcontract including any amount due for extra labor and materials furnished to the general contractor, less any amount (i) retained by the awarding authority as the estimated cost of completing the incomplete or unsatisfactory items of work, (ii) specified in any court proceedings barring such payment, or (iii) disputed by the general contractor in the sworn reply; provided, that the awarding authority shall not deduct from a direct payment any amount as provided in part (iii) if the reply is not sworn to, or for which the sworn reply does not contain the detailed breakdown required by subparagraph (d). The awarding authority shall make further direct payments to the subcontractor forthwith after the removal of the basis for deductions from direct payments made as provided in parts (i) and (ii) of this subparagraph.
(f) The awarding authority shall forthwith deposit the amount deducted from a direct payment as provided in part (iii) of subparagraph (e) in an interest-bearing joint account in the names of the general contractor and the subcontractor in a bank in Massachusetts selected by the awarding authority or agreed upon by the general contractor and the subcontractor and shall notify the general contractor and the subcontractor of the date of the deposit and the bank receiving the deposit. The bank shall pay the amount in the account, including accrued interest, as provided in an agreement between the general contractor and the subcontractor or as determined by decree of a court of competent jurisdiction.
(g) All direct payments and all deductions from demands for direct payments deposited in an interest-bearing account or accounts in a bank pursuant to subparagraph (f) shall be made out of amounts payable to the general contractor at the time of receipt of a demand for direct payment from a subcontractor and out of amounts which later become payable to the general contractor and in the order of receipt of such demands from subcontractors. All direct payments shall discharge the obligation of the awarding authority to the general contractor to the extent of such payment.
(h) The awarding authority shall deduct from payments to a general contractor amounts which, together with the deposits in interest-bearing accounts pursuant to subparagraph (f), are sufficient to satisfy all unpaid balances of demands for direct payment received from subcontractors. All such amounts shall be earmarked for such direct payments, and the subcontractors shall have a right in such deductions prior to any claims against such amounts by creditors of the general contractor.
(i) If the subcontractor does not receive payment as provided in subparagraph (a) or if the general contractor does not submit a periodic estimate for the value of the labor or materials performed or furnished by the subcontractor and the subcontractor does not receive payment for same when due less the deductions provided for in subparagraph (a), the subcontractor may demand direct payment by following the procedure in subparagraph (d) and the general contractor may file a sworn reply as provided in that same subparagraph. A demand made after the first day of the month following that for which the subcontractor performed or furnished the labor and materials for which the subcontractor seeks payment shall be valid even if delivered or mailed prior to the time payment was due on a periodic estimate from the general contractor. Thereafter the awarding authority shall proceed as provided in subparagraph (e), (f), (g) and (h).
(2) Any assignment by a subcontractor of the rights under this section to a surety company furnishing a bond under the provisions of section twenty-nine of chapter one hundred forty-nine shall be invalid. The assignment and subrogation rights of the surety to amounts included in a demand for direct payment which are in the possession of the awarding authority or which are on deposit pursuant to subparagraph (f) of paragraph (1) shall be subordinate to the rights of all subcontractors who are entitled to be paid under this section and who have not been paid in full.
(3) ''Subcontractor'' as used in this section (i) for contracts awarded as provided in sections forty-four A to forty-four H, inclusive, of chapter one hundred forty-nine shall mean a person who files a sub-bid and receives a subcontract as a result of that filed sub-bid or who is approved by the awarding authority in writing as a person performing labor or both performing labor and furnishing materials pursuant to a contract with the general contractor, (ii) for contracts awarded as provided in paragraph (a) of section thirty-nine M of chapter thirty shall mean a person approved by the awarding authority in writing as a person performing labor or both performing labor and furnishing materials pursuant to a contract with the general contractor, and (iii) for contracts with the commonwealth not awarded as provided in forty-four A to forty-four H, inclusive, of chapter one hundred forty-nine shall also mean a person contracting with the general contractor to supply materials used or employed in a public works project for a price in excess of five thousand dollars.
(4) A general contractor or a subcontractor shall enforce a claim to any portion of the amount of a demand for direct payment deposited as provided in subparagraph (f) of paragraph 1 by a petition in equity in the superior court against the other and the bank shall not be a necessary party. A subcontractor shall enforce a claim for direct payment or a right to require a deposit as provided in subparagraph (f) of paragraph 1 by a petition in equity in the superior court against the awarding authority and the general contractor shall not be a necessary party. Upon motion of any party the court shall advance for speedy trial any petition filed as provided in this paragraph. Sections fifty-nine and fifty-nine B of chapter two hundred thirty-one shall apply to such petitions. The court shall enter an interlocutory decree upon which execution shall issue for any part of a claim found due pursuant to sections fifty-nine and fifty-nine B and, upon motion of any party, shall advance for speedy trial the petition to collect the remainder of the claim. Any party aggrieved by such interlocutory decree shall have the right to appeal therefrom as from a final decree. The court shall not consolidate for trial the petition of any subcontractor with the petition of one or more subcontractors or the same general contract unless the court finds that a substantial portion of the evidence of the same events during the course of construction (other than the fact that the claims sought to be consolidated arise under the same general contract) is applicable to the petitions sought to be consolidated and that such consolidation will prevent unnecessary duplication of evidence. A decree in any such proceeding shall not include interest on the disputed amount deposited in excess of the interest earned for the period of any such deposit. No person except a subcontractor filing a demand for direct payment for which no funds due the general contractor are available for direct payment shall have a right to file a petition in court of equity against the awarding authority claiming a demand for direct payment is premature and such subcontractor must file the petition before the awarding authority has made a direct payment to the subcontractor and has made a deposit of the disputed portion as provided in part (iii) of subparagraph (e) and in subparagraph (f) of paragraph (1).
(5) In any petition to collect any claim for which a subcontractor has filed a demand for direct payment the court shall, upon motion of the general contractor, reduce by the amount of any deposit of a disputed amount by the awarding authority as provided in part (iii) of subparagraph (e) and in subparagraph (f) of paragraph (1) any amount held under a trustee writ or pursuant to a restraining order or injunction.