In any action by an employee, his personal representative or other person against any person other than the employer, the court shall, after reasonable notice to the parties and the employer, ascertain the amount of compensation paid and expenses for medical, surgical and hospital attention and supplies, and funeral expenses incurred by the employer under the provisions of this title and deduct therefrom a proportionate share of such amounts as are paid by the plaintiff for reasonable expenses and attorney's fees as provided in § 65.2-311; and, in event of judgment against such person other than the employer, the court shall in its order require that the judgment debtor pay such compensation and expenses of the employer, less said share of expenses and attorney's fees, so ascertained by the court out of the amount of the judgment, so far as sufficient, and the balance, if any, to the judgment creditor.
Va. Code § 65.2-310