forked from spen/seminar
71 lines
1.6 KiB
Plaintext
71 lines
1.6 KiB
Plaintext
# encoding: utf-8
|
|
|
|
wb = xlsx_package.workbook
|
|
|
|
wb.add_worksheet(name: (@seminar.title.to_s[0..27]+'...')) do |sheet|
|
|
|
|
row = [t('seminar_signup.signup_time')]
|
|
|
|
row << t('seminar_signup.serial_number')
|
|
|
|
row << t('seminar_signup.name')
|
|
|
|
row << t('seminar_signup.unit')
|
|
|
|
row << t('seminar_signup.tel')
|
|
|
|
row << t('seminar_signup.phone')
|
|
|
|
row << t('seminar_signup.fax')
|
|
|
|
row << t('seminar_signup.address')
|
|
|
|
row << t(:email)
|
|
|
|
row << t('seminar_signup.note')
|
|
|
|
@seminar.seminar_signup_fields.asc(:_id).each do |rf|
|
|
if rf.can_muti_lang_input?
|
|
@site_in_use_locales.each do |l|
|
|
row << rf.title + " (#{t(l.to_s)})"
|
|
end
|
|
else
|
|
row << rf.title
|
|
end
|
|
end
|
|
|
|
sheet.add_row row
|
|
|
|
@seminar_signups.each do |signup|
|
|
types = {}
|
|
row2 = []
|
|
|
|
row2 << "#{signup.created_at} "
|
|
types[1] = :string
|
|
row2 << "#{signup.display_serial_number}"
|
|
row2 << "#{signup[:name]} "
|
|
row2 << "#{signup.unit} "
|
|
row2 << "#{signup[:tel]} "
|
|
row2 << "#{signup[:phone]} "
|
|
row2 << "#{signup[:fax]} "
|
|
row2 << "#{signup.address} "
|
|
row2 << "#{signup[:email]} "
|
|
row2 << "#{signup.note} "
|
|
|
|
@seminar.seminar_signup_fields.asc(:_id).each do |rf|
|
|
if rf.can_muti_lang_input?
|
|
@site_in_use_locales.each do |l|
|
|
row2 << nl2br(show_attribute_value(@seminar.get_attribute_value(rf,signup.id).get_value_by_locale(l))) rescue ' '
|
|
end
|
|
else
|
|
row2 << nl2br(show_attribute_value(@seminar.get_attribute_value(rf,signup.id).get_value_by_locale(I18n.locale))) rescue ' '
|
|
end
|
|
end
|
|
types = (0...row2.count).map{|i| types[i]}
|
|
sheet.add_row row2 , :types => types
|
|
end
|
|
|
|
|
|
end
|
|
|