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

44 lines
1.7 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")
row << t("link") + " " + t("url_alt")
row << t("file_")
row << t("file_") + " " + t("description")
row << t("file_") + " " + t("alternative")
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(";")
row2 << bill.venue_management_links.map{|l| l.title.to_s.strip}.join(";")
row2 << bill.venue_management_files.map{|f| @host + f.file.url rescue nil}.select{|s| !s.nil?}.join(";")
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(";")
sheet.add_row row2
end
end