diff --git a/app/models/venue_management_bill.rb b/app/models/venue_management_bill.rb
index 3414b9e..dd46eea 100644
--- a/app/models/venue_management_bill.rb
+++ b/app/models/venue_management_bill.rb
@@ -19,6 +19,9 @@ class VenueManagementBill
field :note, type: String, default: "", localize: true
belongs_to :venue_management_main
include VenueLinkFile
+ def display_accounting_month
+ return (self.accounting_month.strftime("%Y-%m") rescue "")
+ end
def case_no
return (self.contractor.case_no rescue "")
end
diff --git a/app/models/venue_management_contract.rb b/app/models/venue_management_contract.rb
index c8e2b26..c1b63d5 100644
--- a/app/models/venue_management_contract.rb
+++ b/app/models/venue_management_contract.rb
@@ -89,6 +89,9 @@ class VenueManagementContract
def display_tags
self.venue_management_inviting.tags.map{|t| t.name}.join(" , ") rescue ""
end
+ def display_case_no
+ return (self.case_no.blank? ? I18n.t(:empty) : self.case_no)
+ end
before_save do
org_contract = VenueManagementContract.find(self.id) rescue nil
inviting = VenueManagementInviting.find(self.venue_management_inviting_id) rescue nil
diff --git a/app/models/venue_management_inviting.rb b/app/models/venue_management_inviting.rb
index 4394c29..0842600 100644
--- a/app/models/venue_management_inviting.rb
+++ b/app/models/venue_management_inviting.rb
@@ -30,6 +30,9 @@ class VenueManagementInviting
has_many :venue_management_memorabilias, :class_name => 'VenueManagementMemorabilia', :foreign_key => "venue_management_memorabilia_ids"
belongs_to :venue_management_main
include VenueLinkFile
+ def display_case_no
+ return (self.case_no.blank? ? I18n.t(:empty) : self.case_no)
+ end
before_save do
contracts = self.venue_management_contracts
org_inviting = VenueManagementInviting.find(self.id) rescue nil
diff --git a/app/models/venue_management_main.rb b/app/models/venue_management_main.rb
index 6d3a261..f6822fa 100644
--- a/app/models/venue_management_main.rb
+++ b/app/models/venue_management_main.rb
@@ -118,4 +118,9 @@ class VenueManagementMain
def case_no
''
end
+ def newest_case_no
+ last_contract = self.venue_management_contracts.desc(:id).first
+ newest_case_no = last_contract.venue_management_inviting.case_no rescue ""
+ return ( newest_case_no.blank? ? I18n.t(:empty) : newest_case_no)
+ end
end
diff --git a/app/views/admin/venue_management_bills/_index.html.erb b/app/views/admin/venue_management_bills/_index.html.erb
index cc9f061..c1066cf 100644
--- a/app/views/admin/venue_management_bills/_index.html.erb
+++ b/app/views/admin/venue_management_bills/_index.html.erb
@@ -31,7 +31,7 @@
-
<%= bill.accounting_month.strftime("%Y-%m") %> |
+ <%= bill.display_accounting_month %> |
<%= "#{t("vm_bill.#{bill.bill_typeA}")}/#{t("vm_bill.#{bill.bill_typeB}")}" %>
<% if bill.bill_typeB == 'other' && bill.bill_other.present? %>
-<%=bill.bill_other%>
diff --git a/app/views/admin/venue_managements/_form.html.erb b/app/views/admin/venue_managements/_form.html.erb
index 9ffaaf4..b42a52d 100644
--- a/app/views/admin/venue_managements/_form.html.erb
+++ b/app/views/admin/venue_managements/_form.html.erb
@@ -99,7 +99,7 @@
|
<%= t('vm_contract.case_no') %> |
- <%= @venue_management_contract.venue_management_inviting.case_no %> |
+ <%= @venue_management.newest_case_no %> |
<%= t('vm_inviting.type') %> |
diff --git a/app/views/venue_managements/show_bill.html.erb b/app/views/venue_managements/show_bill.html.erb
index 4780cad..bde759b 100644
--- a/app/views/venue_managements/show_bill.html.erb
+++ b/app/views/venue_managements/show_bill.html.erb
@@ -23,7 +23,7 @@
<%= t('vm_bill.accounting_month') %> |
- <%= @venue_management_bill.accounting_month.strftime("%Y-%m") %> |
+ <%= @venue_management_bill.display_accounting_month %> |
<%= t('vm_bill.bill_type') %> |
<%= "#{t("vm_bill.#{@venue_management_bill.bill_typeA}")}/#{t("vm_bill.#{@venue_management_bill.bill_typeB}")}" %>
diff --git a/app/views/venue_managements/show_contract.html.erb b/app/views/venue_managements/show_contract.html.erb
index e7a7a4d..84c9acb 100644
--- a/app/views/venue_managements/show_contract.html.erb
+++ b/app/views/venue_managements/show_contract.html.erb
@@ -11,8 +11,7 @@
|
<%= t('vm_contract.case_no') %> |
- <% case_no = (@venue_management_contract.case_no.nil? ? t(:empty) : @venue_management_contract.case_no) %>
- <%= case_no %> |
+ <%= @venue_management_contract.display_case_no %> |
<%= t('vm_inviting.type') %> |
diff --git a/app/views/venue_managements/show_data.html.erb b/app/views/venue_managements/show_data.html.erb
index 8c3342a..c416544 100644
--- a/app/views/venue_managements/show_data.html.erb
+++ b/app/views/venue_managements/show_data.html.erb
@@ -90,7 +90,7 @@
<% if !@venue_management_contract.nil? %>
<%= t('vm_contract.case_no') %> |
- <%= @venue_management_contract.venue_management_inviting.case_no %> |
+ <%= @venue_management.newest_case_no rescue "" %> |
<%= t('vm_inviting.type') %> |
@@ -230,7 +230,7 @@
<% @contracts.each do |contract| %>
- <%= link_to contract.case_no, "/#{I18n.locale}"+@params[:url]+"/#{contract.case_no.strip}-#{contract.id}?method=show_contract" , :target => '_blank' %>
+ <%= link_to contract.display_case_no, "/#{I18n.locale}"+@params[:url]+"/#{contract.display_case_no.to_s.strip}-#{contract.id}?method=show_contract" , :target => '_blank' %>
|
<%= contract.display_contractors %> |
<%= "#{contract.contract_start_date} / #{contract.contract_end_date}" %> |
@@ -306,7 +306,7 @@
<% @invitings.each do |inviting| %>
- <%= link_to inviting.case_no, "/#{I18n.locale}"+@params[:url]+"/#{inviting.case_no.strip}-#{inviting.id}?method=show_inviting", :target => '_blank' %>
+ <%= link_to inviting.display_case_no, "/#{I18n.locale}"+@params[:url]+"/#{inviting.display_case_no.strip}-#{inviting.id}?method=show_inviting", :target => '_blank' %>
|
<%= inviting.publish_times %> |
<%= "#{inviting.early_rent} / #{inviting.operation_rent}" %> |
@@ -355,7 +355,7 @@
<% contractors = t(:empty) if contractors.blank? %>
<%= link_to contractors, "/#{I18n.locale}"+@params[:url]+"/#{contractors.to_s.strip}-#{bill.id}?method=show_bill", :target => '_blank' %>
- <%= bill.accounting_month.strftime("%Y-%m") %> |
+ <%= bill.display_accounting_month %> |
<%= "#{t("vm_bill.#{bill.bill_typeA}")}/#{t("vm_bill.#{bill.bill_typeB}")}" %>
<% if bill.bill_typeB == 'other' && bill.bill_other.present? %>
-<%=bill.bill_other%>
diff --git a/app/views/venue_managements/show_inviting.html.erb b/app/views/venue_managements/show_inviting.html.erb
index f7a7b5e..0250b57 100644
--- a/app/views/venue_managements/show_inviting.html.erb
+++ b/app/views/venue_managements/show_inviting.html.erb
@@ -15,7 +15,7 @@
|
<%= t('vm_inviting.case_no') %> |
- <%= @venue_management_inviting.case_no %> |
+ <%= @venue_management_inviting.display_case_no %> |
<%= t('vm_inviting.publish_times') %> |