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

56 lines
2.2 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.title') if @id.blank?
row << t('venue_management.contractor')
row << t('vm_bill.accounting_month')
row << t('vm_bill.bill_type')
row << t('vm_bill.caculation_basis')
row << t('vm_bill.total_amount')
row << t('vm_bill.pay_date')
row << t('vm_bill.reason')
row << t('vm_bill.pay_method')
row << t('vm_bill.note')
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.venue_management_main.title if @id.blank?
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
row2 << bill.total_amount
row2 << bill.pay_date
row2 << bill.reason
row2 << bill.pay_method
row2 << bill.note
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