Custom Script to create new Sales Invoice

Hello!

How could I create a custom script inside a Clinical Procedure DocType to create a new Sales Invoice automatically after saving a new clinical procedure using the saved clinical procedure as the item?

Thanks in advance