Get sum of net rate in sales invoice

In sales invoice there is sales invoice item table i need to get sum of total net rate … in custom script i cant write script for child table … any one have idea?

Thank you

This is my code.

@GhadaEbrahim Doctype you selected is Collection Invoice and code you are writing is on Sales Invoice, seems weird.

It should be Collection Invoice

The doctype is sales invoice i just rename it to collection invoice

@GhadaEbrahim Ok,

Try with after_save method

I tried it but not working …
both field type (rate and total rate) are currency , it should be float ??