Addition calculation in custom script


I have created a costing template, in that I have created a child doctype which consists of 3 different tables.

I want the total of each table seperately and finally display the total of 3 tables in the field Total2

I have edited the custom script as per the previous solution provided in the forum, but still it is not working.

Can anyone please help.

I have attached the screenshots.

Thanks & Regards,