Since you have the related records in a portal, why not let the portal's relationship , work for you so that you do not need a looping script?
If you have this relationship:
ParentTableOccurrence::PrimaryKey = PortalTableOccurrence::ForeignKey //use your names in place of these
Sum ( PortalTableOccurrence::LednetAmount )
Will retun the total of LedNetAmount for all portal records related to that parent record.
If you have a portal filter expression involved and you only want to compute the total of the records shown in the filtered portal, a different approach will need to be used.
Note that a summary field computing the total of LednetAmount, defined in the portal's table can also be used to compute this same total.