# encoding: utf-8 wb = xlsx_package.workbook wb.add_worksheet(name: t('restful_actions.venue_management_contracts')) do |sheet| 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.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 wb.add_worksheet(name: t('restful_actions.venue_management_invitings')) do |sheet| row = [] 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.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('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.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