PO Receipt Detail Script to match QtyInv to QtyRec

I'm trying to get the QuantityInvoiced to change to whatever the QuantityReceived is for each line item on Receipt Of Invoice Entry. 

Probably a button script. I have plenty of scripts in place, but I've never written one to cycle through each line. Any tips on how to accomplish this?