Hi, can someone help me to write a code to create a vendor credit based on a search?
My search returns multiple lines, each line is a result of one Return Authorisation.
Sometimes I can have more than one Return Authorisation per Vendor.
I would like to get the results from this search and create one Vendor Credit for each supplier, so I have to get an array of these supplier who has more than one Return Authorisation and sum the amount of the transactions and also create a note with each Return number.
Note: Just in case you are wondering how do I know who is the supplier using a customer Return Authorisation, it is because I am looking the Preferred Vendor of the Item returning.
Here is what I could write so far, it is working but I am creating one Credit for each Return and I need to group them when they are the same supplier.