| <%= t("views.right_panel.detail.dining") %> | <%= t("views.right_panel.detail.receipt_no") %> | <%= t("views.right_panel.detail.created_by") %> | <%= t("views.right_panel.detail.child") %> | <%= t("views.right_panel.detail.adult") %> | <%= t("views.right_panel.detail.male") %> | <%= t("views.right_panel.detail.female") %> | <%= t("views.right_panel.detail.total") %> <%= t :customer %> | <%= t("views.right_panel.detail.local") %> | <%= t("views.right_panel.detail.foreigner") %> | <% total_child = 0 %> <% total_adult = 0 %> <% total_male = 0 %> <% total_female = 0 %> <% total_local = 0 %> <% total_customer = 0 %> <% total_foreigner = 0 %> <% if !@surveys.nil? %> <% @surveys.each do |survey| %> <% total_child = total_child.to_i + survey.child.to_i %> <% total_adult = total_adult.to_i + survey.adult.to_i %> <% total_male = total_male.to_i + survey.male.to_i %> <% total_female = total_female.to_i + survey.female.to_i %> <% total_local = total_local.to_i + survey.local.to_i %> <% total_customer = total_customer.to_i + survey.total_customer.to_i %>
|---|---|---|---|---|---|---|---|---|---|
| <%= survey.dining_name rescue ' '%> | <%= survey.receipt_no rescue '-'%> | <%= survey.created_by rescue ' '%> | <%= survey.child rescue ' '%> | <%= survey.adult rescue ' '%> | <%= survey.male rescue ' '%> | <%= survey.female rescue ' '%> | <%= survey.total_customer rescue ' '%> | <%= survey.local rescue ' '%> |
<% if !survey.foreigner.nil? %>
<% JSON.parse(survey.foreigner).each do |foreign| %>
<% foreigner_lists = foreign.split(",") %>
<% if !foreigner_lists.empty? %>
<% foreigner_lists.each do |fgn| %>
<% unless fgn.match(/[^[:digit:]]+/)
total_foreigner = total_foreigner.to_i + fgn.to_i
end %>
<% if !fgn.scan(/\D/).empty? %>
<%= fgn %> :<% end %> <%= fgn.to_i unless fgn.match(/[^[:digit:]]+/) %> <% end %> <% end %> <% end %> <% end %> |
| <%= t("views.right_panel.detail.total") %> | <%= total_child %> | <%= total_adult %> | <%= total_male %> | <%= total_female %> | <%= total_customer %> | <%= total_local %> | <%= total_foreigner %> | ||