1) On thing for sure is you should group by invoice number and vendor id.
2) Pass the entry in Dynamics GP directly and review the entries created by dynamics GP in company table Pm10100 (distribution) and PM10000 (header) and compare with the source file.
3) refer to pmtransctiontype msdn.microsoft.com/.../ff623798.aspx for more info...
Cheers!
Sanjay