Fix bugs.

This commit is contained in:
BoHung Chiu 2020-09-14 22:55:39 +08:00
parent 84bdf0c9f1
commit 7a1de22911
10 changed files with 23 additions and 10 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -31,7 +31,7 @@
</ul>
</div>
</td>
<td><%= bill.accounting_month.strftime("%Y-%m") %></td>
<td><%= bill.display_accounting_month %></td>
<td><%= "#{t("vm_bill.#{bill.bill_typeA}")}/#{t("vm_bill.#{bill.bill_typeB}")}" %>
<% if bill.bill_typeB == 'other' && bill.bill_other.present? %>
-<%=bill.bill_other%>

View File

@ -99,7 +99,7 @@
<tbody>
<tr class="control-group">
<th class="venue_managementive-title-field control-label muted"><%= t('vm_contract.case_no') %></th>
<td class="venue_managementive-title-value controls display_infos"><%= @venue_management_contract.venue_management_inviting.case_no %></td>
<td class="venue_managementive-title-value controls display_infos"><%= @venue_management.newest_case_no %></td>
</tr>
<tr class="control-group">
<th class="venue_managementive-title-field control-label muted"><%= t('vm_inviting.type') %></th>

View File

@ -23,7 +23,7 @@
</tr>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_bill.accounting_month') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_bill.accounting_month.strftime("%Y-%m") %></td>
<td class="venue_managementive-title-value"><%= @venue_management_bill.display_accounting_month %></td>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_bill.bill_type') %></th>
<td class="venue_managementive-title-value"><%= "#{t("vm_bill.#{@venue_management_bill.bill_typeA}")}/#{t("vm_bill.#{@venue_management_bill.bill_typeB}")}" %>

View File

@ -11,8 +11,7 @@
<tbody>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_contract.case_no') %></th>
<% case_no = (@venue_management_contract.case_no.nil? ? t(:empty) : @venue_management_contract.case_no) %>
<td class="venue_managementive-title-value"><%= case_no %></td>
<td class="venue_managementive-title-value"><%= @venue_management_contract.display_case_no %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_inviting.type') %></th>

View File

@ -90,7 +90,7 @@
<% if !@venue_management_contract.nil? %>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_contract.case_no') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_contract.venue_management_inviting.case_no %></td>
<td class="venue_managementive-title-value"><%= @venue_management.newest_case_no rescue "" %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_inviting.type') %></th>
@ -230,7 +230,7 @@
<% @contracts.each do |contract| %>
<tr>
<td>
<%= 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' %>
</td>
<td><%= contract.display_contractors %></td>
<td><%= "#{contract.contract_start_date} / #{contract.contract_end_date}" %></td>
@ -306,7 +306,7 @@
<% @invitings.each do |inviting| %>
<tr data-level="2" data-list="pd_datas">
<td>
<%= 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' %>
</td>
<td><%= inviting.publish_times %></td>
<td><%= "#{inviting.early_rent} / #{inviting.operation_rent}" %></td>
@ -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' %>
</td>
<td><%= bill.accounting_month.strftime("%Y-%m") %></td>
<td><%= bill.display_accounting_month %></td>
<td><%= "#{t("vm_bill.#{bill.bill_typeA}")}/#{t("vm_bill.#{bill.bill_typeB}")}" %>
<% if bill.bill_typeB == 'other' && bill.bill_other.present? %>
-<%=bill.bill_other%>

View File

@ -15,7 +15,7 @@
</tr>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_inviting.case_no') %></th>
<td class="venue_managementive-title-value"><%= @venue_management_inviting.case_no %></td>
<td class="venue_managementive-title-value"><%= @venue_management_inviting.display_case_no %></td>
</tr>
<tr>
<th class="venue_managementive-title-field"><%= t('vm_inviting.publish_times') %></th>