Fixed Issues related to order generated sales csv and course ware access 

@chrisndodge i have made changes in Order generated sales csv in 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.

- added a fix in the courseware view to let the users visit the courseware if they have enrolled in the course by clicking on the enrollment link