diff --git a/app/controllers/admin/venue_management_bills_controller.rb b/app/controllers/admin/venue_management_bills_controller.rb index be5efab..f875f9d 100644 --- a/app/controllers/admin/venue_management_bills_controller.rb +++ b/app/controllers/admin/venue_management_bills_controller.rb @@ -64,19 +64,22 @@ class Admin::VenueManagementBillsController < Admin::VenueAdminController end accounting_month_start = DateTime.parse(params[:filters]["accounting_month_start"]) rescue 0 accounting_month_end = DateTime.parse(params[:filters]["accounting_month_end"]) rescue 0 + if(accounting_month_end != 0) + accounting_month_end = accounting_month_end + 1.month - 1.day + end if @bills.nil? if accounting_month_start != 0 && accounting_month_end != 0 - @bills = VenueManagementBill.where(:accounting_month.gt=>accounting_month_start,:accounting_month.lte=>accounting_month_end).page(params[:page]).per(10) + @bills = VenueManagementBill.where(:accounting_month.gte=>accounting_month_start,:accounting_month.lte=>accounting_month_end).page(params[:page]).per(10) elsif accounting_month_start != 0 - @bills = VenueManagementBill.where(:accounting_month.gt=>accounting_month_start).page(params[:page]).per(10) + @bills = VenueManagementBill.where(:accounting_month.gte=>accounting_month_start).page(params[:page]).per(10) elsif accounting_month_end != 0 @bills = VenueManagementBill.where(:accounting_month.lte=>accounting_month_end).page(params[:page]).per(10) end else if accounting_month_start != 0 && accounting_month_end != 0 - @bills = @bills.where(:accounting_month.gt=>accounting_month_start,:accounting_month.lte=>accounting_month_end).page(params[:page]).per(10) + @bills = @bills.where(:accounting_month.gte=>accounting_month_start,:accounting_month.lte=>accounting_month_end).page(params[:page]).per(10) elsif accounting_month_start != 0 - @bills = @bills.where(:accounting_month.gt=>accounting_month_start).page(params[:page]).per(10) + @bills = @bills.where(:accounting_month.gte=>accounting_month_start).page(params[:page]).per(10) elsif accounting_month_end != 0 @bills = @bills.where(:accounting_month.lte=>accounting_month_end).page(params[:page]).per(10) end @@ -151,7 +154,7 @@ class Admin::VenueManagementBillsController < Admin::VenueAdminController filter_tags = params[:filters]["type"].to_a rescue [] @main_ids = nil if !filter_tags.blank? - filename += (I18n.t("vm_bill.type") + ": #{Tag.where(:id.in=>filter_tags).map{|t| t.name}.join(',')}") + filename += (I18n.t("vm_inviting.type") + ": #{Tag.where(:id.in=>filter_tags).map{|t| t.name}.join(',')}") @main_ids = VenueManagementInviting.with_tags(filter_tags).pluck(:venue_management_main_id) if !filters("category").blank? @main_ids = VenueManagementMain.where(:id.in=>@main_ids).with_categories(filters("category")).pluck(:id) @@ -165,13 +168,16 @@ class Admin::VenueManagementBillsController < Admin::VenueAdminController end accounting_month_start = DateTime.parse(params[:filters]["accounting_month_start"]) rescue 0 accounting_month_end = DateTime.parse(params[:filters]["accounting_month_end"]) rescue 0 + if(accounting_month_end != 0) + accounting_month_end = accounting_month_end + 1.month - 1.day + end if @bills.nil? if accounting_month_start != 0 && accounting_month_end != 0 filename += (I18n.t("vm_bill.accounting_month") + ": #{accounting_month_start}~#{accounting_month_end}") if filename.blank? - @bills = VenueManagementBill.where(:accounting_month.gt=>accounting_month_start,:accounting_month.lte=>accounting_month_end).page(params[:page]).per(10) + @bills = VenueManagementBill.where(:accounting_month.gte=>accounting_month_start,:accounting_month.lte=>accounting_month_end).page(params[:page]).per(10) elsif accounting_month_start != 0 filename += (I18n.t("vm_bill.accounting_month") + ": #{accounting_month_start}~") if filename.blank? - @bills = VenueManagementBill.where(:accounting_month.gt=>accounting_month_start).page(params[:page]).per(10) + @bills = VenueManagementBill.where(:accounting_month.gte=>accounting_month_start).page(params[:page]).per(10) elsif accounting_month_end != 0 filename += (I18n.t("vm_bill.accounting_month") + ": ~#{accounting_month_end}") if filename.blank? @bills = VenueManagementBill.where(:accounting_month.lte=>accounting_month_end).page(params[:page]).per(10) @@ -199,6 +205,8 @@ class Admin::VenueManagementBillsController < Admin::VenueAdminController @bills = VenueManagementBill.all.page(params[:page]).per(10) elsif @bills.nil? @bills = VenueManagementBill.where(:venue_management_main_id=>params[:id]) + else + @bills = @bills.where(:venue_management_main_id=>params[:id]) end @bills = @bills.page(1).per(@bills.count) @protocol = (request.referer.blank? ? "http" : URI(request.referer).scheme) @@ -206,6 +214,7 @@ class Admin::VenueManagementBillsController < Admin::VenueAdminController @site_in_use_locales = Site.first.in_use_locales filename = "export_bills" if filename.blank? filename = filename + "_export.xlsx" + @id = params[:id] respond_to do |format| format.xlsx { response.headers['Content-Transfer-Encoding'] = 'binary' diff --git a/app/controllers/admin/venue_management_contracts_controller.rb b/app/controllers/admin/venue_management_contracts_controller.rb index 599b428..dfdb931 100644 --- a/app/controllers/admin/venue_management_contracts_controller.rb +++ b/app/controllers/admin/venue_management_contracts_controller.rb @@ -5,6 +5,11 @@ class Admin::VenueManagementContractsController < Admin::VenueAdminController before_action ->(module_app = @app_title) { set_variables module_app } before_action :set_venue_management_contract, only: [:edit, :update, :destroy] + def filter_fields(categories) + { + :category=>categories.map{|c| {:title=>(c.title.blank? ? " " : c.title), :id=>c.id}} + } + end def initialize super @app_title = 'venue_management' @@ -29,13 +34,69 @@ class Admin::VenueManagementContractsController < Admin::VenueAdminController 'vm_inviting.rents', 'vm_inviting.royalty', 'vm_contract.start_end', + 'vm_contract.deposit_amount_type_exp_date', 'vm_contract.renewal_permission', - 'vm_contract.note', + 'vm_contract.other_commitment', + 'vm_contract.note' ] - @contracts = VenueManagementContract.order(updated_at: :desc).page(params[:page]).per(10) + @filter_fields = filter_fields(@categories) + @tags = @module_app.tags + @filter_fields['vm_inviting.type'] = @tags.map{|t| {:title => t.name,:id => t.id} } + @filter_fields['vm_contract.start_end'] = ('
') + filter_tags = params[:filters]["type"].to_a rescue [] + @main_ids = nil + @inviting_ids = nil + if !filter_tags.blank? + @inviting_ids = VenueManagementInviting.with_tags(filter_tags).pluck(:id) + end + if !filters("category").blank? + @main_ids = VenueManagementMain.all.with_categories(filters("category")).pluck(:id) + end + contract_start_date = DateTime.parse(params[:filters]["contract_start_date"]) rescue 0 + contract_end_date = DateTime.parse(params[:filters]["contract_end_date"]) rescue 0 + if @contracts.nil? + if contract_start_date != 0 && contract_end_date != 0 + @contracts = VenueManagementContract.where(:contract_start_date.gte=>contract_start_date,:contract_end_date.lte=>contract_end_date).page(params[:page]).per(10) + elsif contract_start_date != 0 + @contracts = VenueManagementContract.where(:contract_start_date.gte=>contract_start_date).page(params[:page]).per(10) + elsif contract_end_date != 0 + @contracts = VenueManagementContract.where(:contract_end_date.lte=>contract_end_date).page(params[:page]).per(10) + end + else + if contract_start_date != 0 && contract_end_date != 0 + @contracts = @contracts.where(:contract_start_date.gte=>contract_start_date,:contract_end_date.lte=>contract_end_date).page(params[:page]).per(10) + elsif contract_start_date != 0 + @contracts = @contracts.where(:contract_start_date.gte=>contract_start_date).page(params[:page]).per(10) + elsif contract_end_date != 0 + @contracts = @contracts.where(:contract_end_date.lte=>contract_end_date).page(params[:page]).per(10) + end + end + if !@main_ids.nil? + if @contracts.nil? + @contracts = VenueManagementContract.where(:venue_management_main_id.in=>@main_ids).page(params[:page]).per(10) + else + @contracts = @contracts.where(:venue_management_main_id.in=>@main_ids).page(params[:page]).per(10) + end + end + if @contracts.nil? + @contracts = VenueManagementContract.all.page(params[:page]).per(10) + end + if !@inviting_ids.nil? + @contracts = @contracts.where(:venue_management_inviting_id.in=>@inviting_ids) + end + @contracts = @contracts.order(updated_at: :desc).page(params[:page]).per(10) @venue_management_page_url = Page.where(:module =>"venue_management").last.url rescue "" end + def render_html(code,pass_variables={}) + render_to_string(:inline=>code,:locals=>pass_variables) + end + def new @venue_management = VenueManagementMain.find(params[:id]) @venue_management_contract = @venue_management.venue_management_contracts.build @@ -65,7 +126,77 @@ class Admin::VenueManagementContractsController < Admin::VenueAdminController redirect_to venue_management_contracts_admin_venue_management_path(@venue_management_main_id) end - + def export + filename = "" + filter_tags = params[:filters]["type"].to_a rescue [] + @main_ids = nil + @inviting_ids = nil + if !filter_tags.blank? + filename += (I18n.t("vm_bill.type") + ": #{Tag.where(:id.in=>filter_tags).map{|t| t.name}.join(',')}") + @inviting_ids = VenueManagementInviting.with_tags(filter_tags).pluck(:id) + end + if !filters("category").blank? + filename += (I18n.t(:category) + ": #{Category.where(:id.in=>filters("category")).map{|t| t.title}.join(',')}") if filename.blank? + @main_ids = VenueManagementMain.all.with_categories(filters("category")).pluck(:id) + end + contract_start_date = DateTime.parse(params[:filters]["contract_start_date"]) rescue 0 + contract_end_date = DateTime.parse(params[:filters]["contract_end_date"]) rescue 0 + if @contracts.nil? + if contract_start_date != 0 && contract_end_date != 0 + filename += (I18n.t("vm_bill.accounting_month") + ": #{contract_start_date}~#{contract_end_date}") if filename.blank? + @contracts = VenueManagementContract.where(:contract_start_date.gte=>contract_start_date,:contract_end_date.lte=>contract_end_date).page(params[:page]).per(10) + elsif contract_start_date != 0 + filename += (I18n.t("vm_bill.accounting_month") + ": #{contract_start_date}~") if filename.blank? + @contracts = VenueManagementContract.where(:contract_start_date.gte=>contract_start_date).page(params[:page]).per(10) + elsif contract_end_date != 0 + filename += (I18n.t("vm_bill.accounting_month") + ": ~#{contract_end_date}") if filename.blank? + @contracts = VenueManagementContract.where(:contract_end_date.lte=>contract_end_date).page(params[:page]).per(10) + end + else + if contract_start_date != 0 && contract_end_date != 0 + filename += (I18n.t("vm_bill.accounting_month") + ": #{contract_start_date}~#{contract_end_date}") if filename.blank? + @contracts = @contracts.where(:contract_start_date.gte=>contract_start_date,:contract_end_date.lte=>contract_end_date).page(params[:page]).per(10) + elsif contract_start_date != 0 + filename += (I18n.t("vm_bill.accounting_month") + ": #{contract_start_date}~") if filename.blank? + @contracts = @contracts.where(:contract_start_date.gte=>contract_start_date).page(params[:page]).per(10) + elsif contract_end_date != 0 + filename += (I18n.t("vm_bill.accounting_month") + ": ~#{contract_end_date}") if filename.blank? + @contracts = @contracts.where(:contract_end_date.lte=>contract_end_date).page(params[:page]).per(10) + end + end + if !@main_ids.nil? + if @contracts.nil? + @contracts = VenueManagementContract.where(:venue_management_main_id.in=>@main_ids).page(params[:page]).per(10) + else + @contracts = @contracts.where(:venue_management_main_id.in=>@main_ids).page(params[:page]).per(10) + end + end + if @contracts.nil? + @contracts = VenueManagementContract.all.page(params[:page]).per(10) + end + if !@inviting_ids.nil? + @contracts = @contracts.where(:venue_management_inviting_id.in=>@inviting_ids) + end + if params[:id].present? + filename = "#{VenueManagementMain.find(params[:id]).title rescue ''}_export_invitings" if filename.blank? + @contracts = @contracts.and(:venue_management_main_id=>params[:id]) + end + @contracts = @contracts.order(updated_at: :desc).page(1).per(@contracts.count) + @protocol = (request.referer.blank? ? "http" : URI(request.referer).scheme) + @host = "#{@protocol}://#{request.host_with_port}" + @site_in_use_locales = Site.first.in_use_locales + filename = "export_contracts" if filename.blank? + filename = filename + "_export.xlsx" + @id = params[:id] + respond_to do |format| + format.xlsx { + response.headers['Content-Transfer-Encoding'] = 'binary' + response.headers['Content-Type'] = 'binary/octet-stream' + response.headers['Content-Disposition'] = 'attachment; filename="' + filename + '"' + } + end + render :layout => false + end private def set_venue_management_contract diff --git a/app/controllers/admin/venue_management_invitings_controller.rb b/app/controllers/admin/venue_management_invitings_controller.rb index db9bc69..8e694ea 100644 --- a/app/controllers/admin/venue_management_invitings_controller.rb +++ b/app/controllers/admin/venue_management_invitings_controller.rb @@ -22,12 +22,38 @@ class Admin::VenueManagementInvitingsController < Admin::VenueAdminController 'vm_inviting.house_land_tax_payer', 'vm_inviting.contractor_manager', 'vm_inviting.bid_result', + 'vm_inviting.details' ] @tags = @module_app.tags @filter_fields = {} @filter_fields['vm_inviting.type'] = @tags.map{|t| {:title => t.name,:id => t.id} } + @filter_fields['vm_inviting.start_end'] = ('') filter_tags = params[:filters]["type"].to_a rescue [] + start_date = DateTime.parse(params[:filters]["start_date"]) rescue 0 + end_date = DateTime.parse(params[:filters]["end_date"]) rescue 0 @invitings = VenueManagementInviting.with_tags(filter_tags).order(updated_at: :desc).page(params[:page]).per(10) + if @invitings.nil? + if start_date != 0 && end_date != 0 + @invitings = VenueManagementInviting.where(:start_date.gte=>start_date,:end_date.lte=>end_date).page(params[:page]).per(10) + elsif start_date != 0 + @invitings = VenueManagementInviting.where(:start_date.gte=>start_date).page(params[:page]).per(10) + elsif end_date != 0 + @invitings = VenueManagementInviting.where(:end_date.lte=>end_date).page(params[:page]).per(10) + end + else + if start_date != 0 && end_date != 0 + @invitings = @invitings.where(:start_date.gte=>start_date,:end_date.lte=>end_date).page(params[:page]).per(10) + elsif start_date != 0 + @invitings = @invitings.where(:start_date.gte=>start_date).page(params[:page]).per(10) + elsif end_date != 0 + @invitings = @invitings.where(:end_date.lte=>end_date).page(params[:page]).per(10) + end + end @venue_management_page_url = Page.where(:module =>"venue_management").last.url rescue "" if request.xhr? render :partial => 'index' @@ -62,7 +88,46 @@ class Admin::VenueManagementInvitingsController < Admin::VenueAdminController redirect_to venue_management_invitings_admin_venue_management_path(@venue_management_main_id) end - + def render_html(code,pass_variables={}) + render_to_string(:inline=>code,:locals=>pass_variables) + end + def export + filename = "" + filter_tags = params[:filters]["type"].to_a rescue [] + start_date = DateTime.parse(params[:filters]["start_date"]) rescue 0 + end_date = DateTime.parse(params[:filters]["end_date"]) rescue 0 + @invitings = VenueManagementInviting.with_tags(filter_tags).order(updated_at: :desc).page(params[:page]).per(10) + filename += (I18n.t("vm_inviting.type") + ": #{Tag.where(:id.in=>filter_tags).map{|t| t.name}.join(',')}") if !filter_tags.blank? + if start_date != 0 && end_date != 0 + filename += (I18n.t("vm_inviting.start_end") + ": #{start_date}~#{end_date}") if filename.blank? + @invitings = @invitings.where(:start_date.gte=>start_date,:end_date.lte=>end_date).page(params[:page]).per(10) + elsif start_date != 0 + filename += (I18n.t("vm_inviting.start_end") + ": #{start_date}~") if filename.blank? + @invitings = @invitings.where(:start_date.gte=>start_date).page(params[:page]).per(10) + elsif end_date != 0 + filename += (I18n.t("vm_inviting.start_end") + ": ~#{end_date}") if filename.blank? + @invitings = @invitings.where(:end_date.lte=>end_date).page(params[:page]).per(10) + end + if params[:id].present? + filename = "#{VenueManagementMain.find(params[:id]).title rescue ''}_export_invitings" if filename.blank? + @invitings = @invitings.where(:venue_management_main_id=>params[:id]) + end + @invitings = @invitings.page(1).per(@invitings.count) + @protocol = (request.referer.blank? ? "http" : URI(request.referer).scheme) + @host = "#{@protocol}://#{request.host_with_port}" + @site_in_use_locales = Site.first.in_use_locales + filename = "export_invitings" if filename.blank? + filename = filename + "_export.xlsx" + @id = params[:id] + respond_to do |format| + format.xlsx { + response.headers['Content-Transfer-Encoding'] = 'binary' + response.headers['Content-Type'] = 'binary/octet-stream' + response.headers['Content-Disposition'] = 'attachment; filename="' + filename + '"' + } + end + render :layout => false + end private def set_venue_management_inviting diff --git a/app/controllers/admin/venue_managements_controller.rb b/app/controllers/admin/venue_managements_controller.rb index b93fa50..afb5b62 100644 --- a/app/controllers/admin/venue_managements_controller.rb +++ b/app/controllers/admin/venue_managements_controller.rb @@ -312,12 +312,38 @@ class Admin::VenueManagementsController < Admin::VenueAdminController 'vm_inviting.house_land_tax_payer', 'vm_inviting.contractor_manager', 'vm_inviting.bid_result', + 'vm_inviting.details' ] filter_tags = params[:filters]["type"].to_a rescue [] @invitings = @venue_management.venue_management_invitings.with_tags(filter_tags).page(params[:page]).per(10) @tags = @module_app.tags @filter_fields = {} @filter_fields['vm_inviting.type'] = @tags.map{|t| {:title => t.name,:id => t.id} } + @filter_fields['vm_inviting.start_end'] = ('') + start_date = DateTime.parse(params[:filters]["start_date"]) rescue 0 + end_date = DateTime.parse(params[:filters]["end_date"]) rescue 0 + if @invitings.nil? + if start_date != 0 && end_date != 0 + @invitings = VenueManagementInviting.where(:start_date.gte=>start_date,:end_date.lte=>end_date).page(params[:page]).per(10) + elsif start_date != 0 + @invitings = VenueManagementInviting.where(:start_date.gte=>start_date).page(params[:page]).per(10) + elsif end_date != 0 + @invitings = VenueManagementInviting.where(:end_date.lte=>end_date).page(params[:page]).per(10) + end + else + if start_date != 0 && end_date != 0 + @invitings = @invitings.where(:start_date.gte=>start_date,:end_date.lte=>end_date).page(params[:page]).per(10) + elsif start_date != 0 + @invitings = @invitings.where(:start_date.gte=>start_date).page(params[:page]).per(10) + elsif end_date != 0 + @invitings = @invitings.where(:end_date.lte=>end_date).page(params[:page]).per(10) + end + end @venue_management_page_url = Page.where(:module =>"venue_management").last.url rescue "" if request.xhr? render :partial => 'admin/venue_management_invitings/index' @@ -381,10 +407,13 @@ class Admin::VenueManagementsController < Admin::VenueAdminController end accounting_month_start = DateTime.parse(params[:filters]["accounting_month_start"]) rescue 0 accounting_month_end = DateTime.parse(params[:filters]["accounting_month_end"]) rescue 0 + if(accounting_month_end != 0) + accounting_month_end = accounting_month_end + 1.month - 1.day + end if accounting_month_start != 0 && accounting_month_end != 0 - @bills = @bills.where(:accounting_month.gt=>accounting_month_start,:accounting_month.lte=>accounting_month_end).page(params[:page]).per(10) + @bills = @bills.where(:accounting_month.gte=>accounting_month_start,:accounting_month.lte=>accounting_month_end).page(params[:page]).per(10) elsif accounting_month_start != 0 - @bills = @bills.where(:accounting_month.gt=>accounting_month_start).page(params[:page]).per(10) + @bills = @bills.where(:accounting_month.gte=>accounting_month_start).page(params[:page]).per(10) elsif accounting_month_end != 0 @bills = @bills.where(:accounting_month.lte=>accounting_month_end).page(params[:page]).per(10) end @@ -404,10 +433,64 @@ class Admin::VenueManagementsController < Admin::VenueAdminController 'vm_inviting.rents', 'vm_inviting.royalty', 'vm_contract.start_end', + 'vm_contract.deposit_amount_type_exp_date', 'vm_contract.renewal_permission', - 'vm_contract.note', + 'vm_contract.other_commitment', + 'vm_contract.note' ] + @filter_fields = filter_fields(@categories) + @tags = @module_app.tags + @filter_fields['vm_inviting.type'] = @tags.map{|t| {:title => t.name,:id => t.id} } + @filter_fields['vm_contract.start_end'] = ('') + filter_tags = params[:filters]["type"].to_a rescue [] + @main_ids = nil + @inviting_ids = nil @contracts = @venue_management.venue_management_contracts.page(params[:page]).per(10) + if !filter_tags.blank? + @inviting_ids = VenueManagementInviting.with_tags(filter_tags).pluck(:id) + end + if !filters("category").blank? + @main_ids = VenueManagementMain.all.with_categories(filters("category")).pluck(:id) + end + contract_start_date = DateTime.parse(params[:filters]["contract_start_date"]) rescue 0 + contract_end_date = DateTime.parse(params[:filters]["contract_end_date"]) rescue 0 + if @contracts.nil? + if contract_start_date != 0 && contract_end_date != 0 + @contracts = VenueManagementContract.where(:contract_start_date.gte=>contract_start_date,:contract_end_date.lte=>contract_end_date).page(params[:page]).per(10) + elsif contract_start_date != 0 + @contracts = VenueManagementContract.where(:contract_start_date.gte=>contract_start_date).page(params[:page]).per(10) + elsif contract_end_date != 0 + @contracts = VenueManagementContract.where(:contract_end_date.lte=>contract_end_date).page(params[:page]).per(10) + end + else + if contract_start_date != 0 && contract_end_date != 0 + @contracts = @contracts.where(:contract_start_date.gte=>contract_start_date,:contract_end_date.lte=>contract_end_date).page(params[:page]).per(10) + elsif contract_start_date != 0 + @contracts = @contracts.where(:contract_start_date.gte=>contract_start_date).page(params[:page]).per(10) + elsif contract_end_date != 0 + @contracts = @contracts.where(:contract_end_date.lte=>contract_end_date).page(params[:page]).per(10) + end + end + if !@main_ids.nil? + if @contracts.nil? + @contracts = VenueManagementContract.where(:venue_management_main_id.in=>@main_ids).page(params[:page]).per(10) + else + @contracts = @contracts.and(:venue_management_main_id.in=>@main_ids).page(params[:page]).per(10) + end + end + if @contracts.nil? + @contracts = VenueManagementContract.all.page(params[:page]).per(10) + end + if !@inviting_ids.nil? + @contracts = @contracts.where(:venue_management_inviting_id.in=>@inviting_ids) + end + @contracts = @contracts.order(updated_at: :desc) + @venue_management_page_url = Page.where(:module =>"venue_management").last.url rescue "" end def render_html(code,pass_variables={}) diff --git a/app/models/venue_management_bill.rb b/app/models/venue_management_bill.rb index 6f0e283..68b9741 100644 --- a/app/models/venue_management_bill.rb +++ b/app/models/venue_management_bill.rb @@ -181,6 +181,10 @@ class VenueManagementBill # venue_management_main.update(venue_management_main.venue_management_bill_ids.push(record.id)) # end # end + def display_note + html = self.note.to_s.split("\r\n").select{|s| !s.blank?}.first + return Nokogiri::HTML(html).css("body").text + end def display_caculation_basis caculation_basis_val = eval("#{self.class::CACULATIONBASIS[self.caculation_basis_type]}") return "#{I18n.t("vm_bill.#{self.class::CACULATIONBASIS[self.caculation_basis_type]}")}: #{caculation_basis_val}" diff --git a/app/models/venue_management_contract.rb b/app/models/venue_management_contract.rb index beaa164..b7e888d 100644 --- a/app/models/venue_management_contract.rb +++ b/app/models/venue_management_contract.rb @@ -62,6 +62,17 @@ class VenueManagementContract belongs_to :venue_management_main belongs_to :venue_management_inviting include VenueLinkFile + def deposit_amount_type_exp_date + return "#{self.deposit_amount}/#{self.deposit_type}/#{self.deposit_exp_date}" + end + def display_note + html = self.note.to_s.split("\r\n").select{|s| !s.blank?}.first + return Nokogiri::HTML(html).css("body").text + end + def display_other_commitment + html = self.other_commitment.to_s.split("\r\n").select{|s| !s.blank?}.first + return Nokogiri::HTML(html).css("body").text + end def display_royalty self.royalty.to_s.gsub("\r\n","