:auto call {MATCH (c:Company)-[r:INVOICE]->(t:Company)
WHERE r.invoiceState='PAID'
with c, t, count(r) as numero,sum(r.amountGross) as dovuto
MERGE (c)-[s:summaryInvoice]->(t)
set s.numInvoice=numero, s.amountDue=dovuto
} in transactions of 1000 rows
this will create or update the summary relationship between every pair of company nodes with an invoice relationship. Is this what you want? You can add constraints if you want a subset instead. I enclosed it in a call subquery so the updates are done in batches. This is helpful if you have a large number of updates.