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

224 lines
10 KiB
Plaintext
Raw Permalink Normal View History

2020-05-07 15:26:34 +00:00
# encoding: utf-8
wb = xlsx_package.workbook
2020-11-12 13:51:31 +00:00
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
@venue_management.venue_management_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(";")
2020-05-07 15:26:34 +00:00
end
2020-11-12 13:51:31 +00:00
sheet.add_row row2
2020-05-07 15:26:34 +00:00
end
end
2020-11-12 13:51:31 +00:00
wb.add_worksheet(name: t('restful_actions.venue_management_invitings')) do |sheet|
row = []
row << t('venue_management.title') if @id.blank?
row << t('vm_inviting.type')
row << t('vm_inviting.case_no')
row << t('vm_inviting.publish_times')
row << t('vm_inviting.rents')
row << t('vm_inviting.royalty')
row << t('vm_inviting.house_land_tax_payer')
row << t('vm_inviting.contractor_manager')
row << t('vm_inviting.bid_result')
@site_in_use_locales.each do |locale|
row << t('vm_inviting.details') + "-" + 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
@venue_management.venue_management_invitings.each do |inviting|
row2 = []
row2 << inviting.venue_management_main.title if @id.blank?
row2 << inviting.tags.map{|t| t.name}.join(" , ")
row2 << inviting.case_no
row2 << inviting.publish_times
row2 << "#{inviting.early_rent} / #{inviting.operation_rent}"
row2 << inviting.royalty
row2 << t("vm_inviting.enums.#{inviting.house_tax_payer}")+"/"+t("vm_inviting.enums.#{inviting.land_tax_payer}")
row2 << inviting.contractor_manager
row2 << t("vm_inviting.enums.bid_result.#{inviting.bid_result}")
@site_in_use_locales.each do |locale|
row2 << Nokogiri::HTML(inviting.details_translations[locale].to_s).css("body").text
end
row2 << inviting.venue_management_links.map{|l| l.url.to_s.strip}.join(";")
@site_in_use_locales.each do |locale|
row2 << inviting.venue_management_links.map{|l| l.title_translations[locale].to_s.strip}.join(";")
end
row2 << inviting.venue_management_files.map{|f| @host + f.file.url rescue nil}.select{|s| !s.nil?}.join(";")
@site_in_use_locales.each do |locale|
row2 << inviting.venue_management_files.map{|f| f.description_translations[locale].to_s.strip}.join(";")
end
@site_in_use_locales.each do |locale|
row2 << inviting.venue_management_files.map{|f| f.title_translations[locale].to_s.strip}.join(";")
end
sheet.add_row row2
end
end
wb.add_worksheet(name: t('restful_actions.venue_management_memorabilias')) do |sheet|
row = []
row << t('venue_management.title') if @id.blank?
row << t('vm_memorabilia.case_no')
row << t('vm_memorabilia.event_date')
@site_in_use_locales.each do |locale|
row << t('vm_memorabilia.details') + "-" + 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
@venue_management.venue_management_memorabilias.each do |memorabilia|
row2 = []
row2 << memorabilia.venue_management_main.title if @id.blank?
row2 << memorabilia.case_no
row2 << memorabilia.event_date
@site_in_use_locales.each do |locale|
row2 << Nokogiri::HTML(memorabilia.details_translations[locale].to_s).css("body").text
end
row2 << memorabilia.venue_management_links.map{|l| l.url.to_s.strip}.join(";")
@site_in_use_locales.each do |locale|
row2 << memorabilia.venue_management_links.map{|l| l.title_translations[locale].to_s.strip}.join(";")
end
row2 << memorabilia.venue_management_files.map{|f| @host + f.file.url rescue nil}.select{|s| !s.nil?}.join(";")
@site_in_use_locales.each do |locale|
row2 << memorabilia.venue_management_files.map{|f| f.description_translations[locale].to_s.strip}.join(";")
end
@site_in_use_locales.each do |locale|
row2 << memorabilia.venue_management_files.map{|f| f.title_translations[locale].to_s.strip}.join(";")
end
sheet.add_row row2
end
end
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
@venue_management.venue_management_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
2020-05-07 15:26:34 +00:00
2020-11-12 13:51:31 +00:00
end