Fixed Issues related to order generated sales csv

@chrisndodge  i have made the changes related to the order generated Sales CSV in Sales Section of Instructor Dashboard. The total_registration_codes and total_used_codes  were not correctly stored in the csv file.

- The total_registration_codes were not filtered with course_id.
- The total_used_codes that a user had redeemed were not correctly included in the CSV.