<%-# Fedena #Copyright 2010 Foradian Technologies Private Limited # #This product includes software developed at #Project Fedena - http://www.projectfedena.org/ # #Licensed under the Apache License, Version 2.0 (the "License"); #you may not use this file except in compliance with the License. #You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # #Unless required by applicable law or agreed to in writing, #software distributed under the License is distributed on an #"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY #KIND, either express or implied. See the License for the #specific language governing permissions and limitations #under the License. -%>

<%= t('transcript_of_academic_record') %>

<%= t('name') %> : <%= @student.full_name %>

<%= t('adm_no') %> : <%= @student.admission_no.present? ? @student.admission_no : "-" %>

<%= t('course_text') %> : <%= @student.batch.course.course_name %>

<% reports = GroupedExamReport.find_all_by_student_id_and_score_type(@student.id,'c') %> <% if reports.empty? %>

<%= t('grouped_exam_reports_not_generated') %>

<% else %> <% grades = [] %> <% grade_type = "normal" %> <% grade_type = "GPA" if @student.batch.gpa_enabled? %> <% grade_type = "CWA" if @student.batch.cwa_enabled? %> <% @batches.each do|batch| %> <% st_mark = GroupedExamReport.find_by_batch_id_and_student_id_and_score_type(batch.id,@student.id,"c") %> <% unless st_mark.nil? %> <% general_subjects = Subject.find_all_by_batch_id(batch.id, :conditions=>"elective_group_id IS NULL AND is_deleted=false") %> <% student_electives = StudentsSubject.find_all_by_student_id(@student.id,:conditions=>"batch_id = #{batch.id}") %> <% elective_subjects = [] %> <% student_electives.each do |elect| %> <% elective_subjects.push Subject.find(elect.subject_id) %> <% end %> <% @subjects = general_subjects + elective_subjects %> <% unless @subjects.empty? %>

<%= batch.full_name %>

<% total_credits=0 %> <% c= 'even' %> <% if grade_type=="GPA" or grade_type=="CWA" %> <% else %> <% end %> <% @subjects.each do |s| %> <% subject_average = GroupedExamReport.find_by_student_id_and_subject_id_and_score_type(@student.id,s.id,"s") %> <% unless subject_average.nil? %> "> <% if @student.has_retaken_exam(s.id) %> <% else %> <% end %> <% if grade_type=="GPA" or grade_type=="CWA" %> <% total_credits = total_credits + s.credit_hours.to_f %> <% end %> <% end %> <% end %> <% if grade_type=="GPA" or grade_type=="CWA" %> <% end %>
<%= t('subject_code') %> <%= t('subject_title') %><%= t('credit') %> <%= t('marks') %><%= t('percentage') %>(%)
<%= s.code %> - <%= s.code %> <%= s.name %><%= s.credit_hours %><%= subject_average.present? ? subject_average.marks : "-" %>
<%= t('total') %> <%= total_credits %> -
<% unless st_mark.nil? %> <% mark = st_mark.marks || 0 %> <% else %> <% mark=0 %> <% end %> <% grades << mark %> <% if grade_type=="CWA" %>
<%= t('combined_weighted_average') %> = <%= mark==0 ? "-" : mark %>
<% elsif grade_type=="GPA" %>
<%= t('batch_wise_cumulative_grade_point_average') %> = <%= mark==0 ? "-" : mark %>
<% else %>
<%= t('combined_percentage') %> = <%= mark==0 ? "-" : mark %>
<% end %> <% end %> <% end %> <% end %>
<% unless grades.count.to_f == 0 %> <% cgpa = (grades.sum.to_f)/(grades.count.to_f) %> <% else %> <% cgpa = 0 %> <% end %> <% if grade_type=="GPA" %> <% designations = ClassDesignation.find(:all,:conditions=>["cgpa <= ? AND course_id = ?",cgpa,@student.batch.course_id],:order=>"cgpa DESC") %>
<%= t('course_wise_cumulative_grade_point') %> = <%= "%.2f" %(cgpa) %>
<% else %> <% designations = ClassDesignation.find(:all,:conditions=>["marks <= ? AND course_id = ?",cgpa,@student.batch.course_id],:order=>"marks DESC") %> <% if grade_type=="CWA" %>
<%= t('course_wise_combined_weighted_average') %> = <%= "%.2f" %(cgpa) %>
<% else %>
<%= t('course_wise_combined_percentage') %> = <%= "%.2f" %(cgpa) %>
<% end %> <% end %>
<%= t('class_designations_text') %> : <%= designations.empty? ? "-" : designations.first.name %>
<% end %>