Value of a repeating row input equal another input

I have an invoice page that allows my users to setup a payment schedule to split up the grand total of the invoice into multiple payments. I have the multiple payments in a table. What I’m trying to figure out is when the user presses send invoice it verifies that the payments amount equals the grand total and If doesn’t it prevents them from moving forward with the send invoice button.