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

87 lines
4.0 KiB
Plaintext

# encoding: utf-8
wb = xlsx_package.workbook
wb.add_worksheet(name: t('restful_actions.venue_management_contracts')) do |sheet|
row = []
row << t('venue_management.title') if @id.blank?
row << t('vm_contract.case_no')
row << t('vm_inviting.type')
row << t('venue_management.contractor')
row << t('vm_inviting.rents')
row << t('vm_inviting.royalty')
row << t('vm_inviting.house_land_tax_payer')
row << t('vm_contract.renewal_permission')
row << t('vm_contract.start_end')
row << t('vm_contract.construction_start_end')
row << t('vm_contract.operation_start_end')
row << t('vm_contract.free_period_start_end')
row << t('vm_contract.sign_date')
row << t('vm_contract.handover_date')
row << t('vm_contract.deposit_payment_date')
row << t('vm_contract.deposit_type')
row << t('vm_contract.deposit_exp_date')
row << t('vm_contract.insurance_type')
row << t('vm_contract.insurance_payment_deadline')
row << t('vm_contract.insurance_payment_date')
@site_in_use_locales.each do |locale|
row << t('vm_contract.other_commitment') + " - " + t(locale)
end
@site_in_use_locales.each do |locale|
row << t('vm_contract.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
@contracts.each do |contract|
row2 = []
row2 << contract.venue_management_main.title if @id.blank?
row2 << contract.case_no
row2 << contract.display_tags
row2 << contract.display_contractors
row2 << "#{contract.early_rent} / #{contract.operation_rent}"
row2 << contract.royalty
row2 << t("vm_inviting.enums.#{contract.house_tax_payer}")+"/"+t("vm_inviting.enums.#{contract.land_tax_payer}")
row2 << contract.renewal_permission.present? ? t("vm_contract.renewal.#{contract.renewal_permission}") : t("vm_contract.renewal.false")
row2 << "#{contract.contract_start_date} ~ #{contract.contract_end_date}"
row2 << "#{contract.construction_start_date} ~ #{contract.construction_end_date}"
row2 << "#{contract.operation_start_date} ~ #{contract.operation_end_date}"
row2 << "#{contract.free_period_start_date} ~ #{contract.free_period_end_date}"
row2 << contract.sign_date
row2 << contract.handover_date
row2 << contract.deposit_payment_date
row2 << contract.deposit_type
row2 << contract.deposit_exp_date
row2 << contract.insurance_type
row2 << contract.insurance_payment_deadline
row2 << contract.insurance_payment_date
@site_in_use_locales.each do |locale|
row2 << Nokogiri::HTML(contract.other_commitment_translations[locale].to_s).css("body").text
end
@site_in_use_locales.each do |locale|
row2 << Nokogiri::HTML(contract.note_translations[locale].to_s).css("body").text
end
row2 << contract.venue_management_links.map{|l| l.url.to_s.strip}.join(";")
@site_in_use_locales.each do |locale|
row2 << contract.venue_management_links.map{|l| l.title_translations[locale].to_s.strip}.join(";")
end
row2 << contract.venue_management_files.map{|f| @host + f.file.url rescue nil}.select{|s| !s.nil?}.join(";")
@site_in_use_locales.each do |locale|
row2 << contract.venue_management_files.map{|f| f.description_translations[locale].to_s.strip}.join(";")
end
@site_in_use_locales.each do |locale|
row2 << contract.venue_management_files.map{|f| f.title_translations[locale].to_s.strip}.join(";")
end
sheet.add_row row2
end
end