active/app/views/admin/actives/export.xlsx.axlsx

49 lines
884 B
Plaintext

# encoding: utf-8
wb = xlsx_package.workbook
wb.add_worksheet(name: @act.title) do |sheet|
row = [t('act_signup.name')]
row << t('act_signup.idno') if !@act.has_idno.blank?
row << t('act_signup.sex')
row << t('act_signup.birthday')
row << t('act_signup.tel')
row << t('act_signup.phone')
row << t('act_signup.fax')
row << t(:email)
row << t('act.note')
sheet.add_row row
@act.act_signups.each do |signup|
row2 = []
@birtbday = !signup[:birthday].blank? ? signup[:birthday].to_date.to_s : ' '
row2 << "#{signup[:name]} "
row2 << "#{signup[:idno]} " if !@act.has_idno.blank?
row2 << "#{signup[:sex]} "
row2 << "#{@birtbday} "
row2 << "#{signup[:tel]} "
row2 << "#{signup[:phone]} "
row2 << "#{signup[:fax]} "
row2 << "#{signup[:email]} "
row2 << "#{signup[:note]} "
sheet.add_row row2
end
end