Apply payment to job from a different customer

SOLVED

We had a job with ABC Company and the costs on the job went over the contract amount by $50,000.  We had purchased scaffolding for the job and we were able to sell the scaffolding to XYZ Subcontractor, for the same amount ($50,000).  Is it possible to apply the $50,000 we received from XYZ to the ABC job/contract so that the job does not look like it lost money?  If so, what is suggested?  If I create an invoice against the job/contract for ABC, it will show "bill to ABC".  Can I apply a payment from XYZ to the ABC invoice?

Thanks.