Honestly it's too much to read through and figure out at the moment. If it only works on the first row, you know you have messed up the association between rows. In this case you always refer to your backups, which I realize you may not have.
I would download a fresh copy of 4.2.2, if it is not available in your helpdesk, request it from QT. Then start over with a renewed respect for the template's structure. Hope that helps, best I could muster.