venue_management/app/views/admin/venue_management_bills/export.xlsx.axlsx

62 lines
2.4 KiB
Plaintext

# encoding: utf-8
wb = xlsx_package.workbook
wb.add_worksheet(name: t('restful_actions.venue_management_bills')) do |sheet|
row = []
row << t('venue_management.contractor')
row << t('vm_bill.accounting_month')
row << t('vm_bill.bill_type')
row << t('vm_bill.caculation_basis')
@site_in_use_locales.each do |locale|
row << t('vm_bill.reason') + " - " + t(locale)
end
@site_in_use_locales.each do |locale|
row << t('vm_bill.pay_method') + " - " + t(locale)
end
@site_in_use_locales.each do |locale|
row << t('vm_bill.note') + " - " + t(locale)
end
row << t("link")
@site_in_use_locales.each do |locale|
row << t("link") + " " + t("url_alt") + " - " + t(locale)
end
row << t("file_")
@site_in_use_locales.each do |locale|
row << t("file_") + " " + t("description") + " - " + t(locale)
end
@site_in_use_locales.each do |locale|
row << t("file_") + " " + t("alternative") + " - " + t(locale)
end
sheet.add_row row
@bills.each do |bill|
row2 = []
row2 << (bill.contractor.display_contractors rescue "")
row2 << bill.display_accounting_month
row2 << "#{t("vm_bill.#{bill.bill_typeA}")}/#{t("vm_bill.#{bill.bill_typeB}")}"
row2 << bill.display_caculation_basis
@site_in_use_locales.each do |locale|
row2 << bill.reason_translations[locale]
end
@site_in_use_locales.each do |locale|
row2 << bill.pay_method_translations[locale]
end
@site_in_use_locales.each do |locale|
row2 << bill.note_translations[locale]
end
row2 << bill.venue_management_links.map{|l| l.url.to_s.strip}.join(";")
@site_in_use_locales.each do |locale|
row2 << bill.venue_management_links.map{|l| l.title_translations[locale].to_s.strip}.join(";")
end
row2 << bill.venue_management_files.map{|f| @host + f.file.url rescue nil}.select{|s| !s.nil?}.join(";")
@site_in_use_locales.each do |locale|
row2 << bill.venue_management_files.map{|f| f.description_translations[locale].to_s.strip}.join(";")
end
@site_in_use_locales.each do |locale|
row2 << bill.venue_management_files.map{|f| f.title_translations[locale].to_s.strip}.join(";")
end
sheet.add_row row2
end
end