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

44 lines
1.7 KiB
Plaintext
Raw Permalink Normal View History

2020-10-16 04:03:26 +00:00
# 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?
2020-10-16 04:03:26 +00:00
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')
2020-10-16 04:03:26 +00:00
row << t("link")
2020-10-27 04:44:10 +00:00
row << t("link") + " " + t("url_alt")
2020-10-16 04:03:26 +00:00
row << t("file_")
2020-10-27 04:44:10 +00:00
row << t("file_") + " " + t("description")
row << t("file_") + " " + t("alternative")
2020-10-16 04:03:26 +00:00
sheet.add_row row
@bills.each do |bill|
row2 = []
row2 << bill.venue_management_main.title if @id.blank?
2020-10-16 04:03:26 +00:00
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
2020-10-16 04:03:26 +00:00
row2 << bill.venue_management_links.map{|l| l.url.to_s.strip}.join(";")
2020-10-27 04:44:10 +00:00
row2 << bill.venue_management_links.map{|l| l.title.to_s.strip}.join(";")
2020-10-16 04:03:26 +00:00
row2 << bill.venue_management_files.map{|f| @host + f.file.url rescue nil}.select{|s| !s.nil?}.join(";")
2020-10-27 04:44:10 +00:00
row2 << bill.venue_management_files.map{|f| f.description.to_s.strip}.join(";")
row2 << bill.venue_management_files.map{|f| f.title.to_s.strip}.join(";")
2020-10-16 04:03:26 +00:00
sheet.add_row row2
end
end