Sum of fields of parent doctype and child

Hi all. Is it possible to write a custom script that will sum the field from the parent doctype with the field of the child and write the result to the child doctype ?