<%= wicked_pdf_stylesheet_link_tag "application" %> <%@top_aps_usage = top_aps_usage%> <%@top_clients_usage = top_clients_usage %> <%@usage_per_ssid = usage_per_ssid%> <%@report_obj = report_obj %> <%@no_of_clients_per_ssids = no_of_clients_per_ssids %> <%@aps_in_network = aps_in_network %> <%@ap_versions = ap_versions %> <%@ap_geo_loc = ap_geo_loc %> <%@no_of_clients = no_of_clients %> <%@aps_down_time = aps_down_time %> <%@all_aps_uplinks_usage = aps_uplinks_usage %> <%@uplinks_type_count = uplinks_type_count %> <%@ri_name_mac = ri_name_mac %> <%@network = network%>

PCC Report

<%= wicked_pdf_image_tag 'logo.png' %>
Report Name : <%= @report_obj.title%>
Network Name : <%= @report_obj.location_network.network_name %>
Time Range : <%= @report_obj.from_time.strftime("%b %d %Y")+" to "+ @report_obj.to_time.strftime("%b %d %Y") %>
Created Time : <%= Time.zone.parse(@report_obj.created_at.to_s).in_time_zone(@report_obj.location_network.timezone).strftime("%b %d %Y %H:%M:%S")%>(Network Time Zone)
<% unless @all_aps_uplinks_usage.blank? %> <%@tot = {}%> <% if @network.id.to_s == '814'%> <% end %> <%(@uplinks_type_count || []).each do |i|%> <% end %> <%(@uplinks_type_count || []).each do |i|%> <% end %> <% (@all_aps_uplinks_usage || []).each do |key,val| %> <% if @network.id.to_s == '814'%> <% end %> <%(@uplinks_type_count || []).each do |i|%> <% if val[i.to_s].present? %> <% if @tot[i].blank? @tot[i] = {} @tot[i]['tx'] = 0 @tot[i]['rx'] = 0 @tot[i]['tot'] = 0 end @tot[i]['tx'] += val[i.to_s]['tx'] @tot[i]['rx'] += val[i.to_s]['rx'] @tot[i]['tot'] += val[i.to_s]['total'] %> <% else %> <% end %> <% end %> <% end %> <%if network.id.to_s == '814'%><% end %> <%(@uplinks_type_count || []).each do |i|%> <% end %>
AP MACSSIDUplink Type <%= RouterInventory::UPLINK_TYPE[i.to_s]%>
Up Down Total
<%= @ri_name_mac[key].blank? ? key : "#{@ri_name_mac[key]} (#{key.last(8)})" %> <%= val['ssid']%><%= number_to_human_size(val[i.to_s]['tx'])%> <%= number_to_human_size(val[i.to_s]['rx'])%> <%= number_to_human_size(val[i.to_s]['total'])%>- - -
TOTAL<%= number_to_human_size(@tot[i]['tx']) %> <%= number_to_human_size(@tot[i]['rx'])%> <%= number_to_human_size(@tot[i]['tot'])%>
<% end %> <% unless @top_aps_usage.blank? %>
Top 5 APs by Usage
<%legend = [];data=[];url=""%> <% (@top_aps_usage || []).each do |x| %> <% data.push(x["total"]) legend.push(x["_id"]) %> <% end %>
AP MAC Down Stream Up Stream Total Usage
<%= @ri_name_mac[x["_id"]].blank? ? x["_id"] : "#{@ri_name_mac[x["_id"]]} (#{x["_id"].last(8)})" %> <%= number_to_human_size(x["rx"])%> <%= number_to_human_size(x["tx"])%> <%= number_to_human_size(x["total"])%>
<% url = Gchart.pie_3d(:title=>"", :legend => legend, :data => data, :size => '220x220') %>
<%= image_tag(url) unless url.blank? %>
<% end %>
<% unless @top_clients_usage.blank? %>
Top 5 Clients by Usage
<%legend = [];data=[];url=""%> <% (@top_clients_usage || []).each do |x| %> <% data.push(x["total"]) legend.push(x["_id"])%> <% end %>
AP MAC Down Stream Up Stream Total Usage
<%= @ri_name_mac[x["_id"]].blank? ? x["_id"] : "#{@ri_name_mac[x["_id"]]} (#{x["_id"].last(8)})" %> <%= number_to_human_size(x["rx"])%> <%= number_to_human_size(x["tx"])%> <%= number_to_human_size(x["total"])%>
<%url = Gchart.pie_3d(:title=>"", :legend => legend, :data => data, :size => '220x220') %>
<%= image_tag(url) unless url.blank? %>
<% end %> <% unless @usage_per_ssid.blank? %>
Usage per SSID
<%legend = [];data=[];url=""%> <% (@usage_per_ssid || []).each do |x| %> <% data.push(x["total"]) legend.push(x["name"])%> <% end %>
SSID Name Down Stream Up Stream Total Usage
<%= x["name"]%> <%= number_to_human_size(x["rx"])%> <%= number_to_human_size(x["tx"])%> <%= number_to_human_size(x["total"])%>
<%url = Gchart.pie_3d(:title=>"", :legend => legend, :data => data,:axis_range => [nil, [2,17,5]]) %>
<%= image_tag(url) unless url.blank? %>
<%end%> <% unless @no_of_clients.blank? %> NOTE:Clients count in below table has unique connected clients
Number of connected Clients
<%legend = [];data=[];url=""%> <% (@no_of_clients || []).each do |x| %> <% date = x["_id"]["d"].strftime("%Y-%m-%d") -%> <% data.push(x["count"]) legend.push(date) %> <% end %>
Date Clients
<%= date %> <%= x["count"]%>
<%url = Gchart.bar(:data => data,:axis_with_labels => ['x', 'y'],:axis_labels => [legend], :encoding => 'text', :max_value =>:auto, :bar_width_and_spacing => '55,6') %>
<%= image_tag(url) unless url.blank? %>
<%end%> <% unless @no_of_clients_per_ssids.blank? %> NOTE:Clients count in below table has unique connected clients
Number of connected Clients per SSID
<% sum = 0%> <% (@no_of_clients_per_ssids || []).each do |x| sum += x["count"] end %> <%legend = [];data=[];url=""%> <% (@no_of_clients_per_ssids || []).each do |x| %> <% name = NetworkSsid.find_by_id(x["_id"]).try(:ssid_name) -%> <% count = x["count"] %> <% data.push(count) legend.push(name)%> <% end %>
SSID NAME Clients Percentage
<%= name %><%= count %> <%= ((count * 100)/sum).round(1) %> %
<%url = Gchart.pie_3d(:title=>"", :legend => legend, :data => data, :size => '220x220') %>
<%= image_tag(url) unless url.blank? %>
<%end%> <%unless @aps_in_network.blank?%> <% (@aps_in_network || {}).each do |k, v| %> <% end %>
AP List
AP MAC Version
<%= @ri_name_mac[k].blank? ? k : "#{@ri_name_mac[k]} (#{k.last(8)})" %> <%= v["version"].gsub('"',"") unless v["version"].blank? %>
<%end%> <%unless @ap_versions.blank?%> <% (@ap_versions || []).each do |x| %> <% end %>
AP List by Version
AP MAC Version
<%= @ri_name_mac[x["_id"]["ap_mac"]].blank? ? x["_id"]["ap_mac"] : "#{@ri_name_mac[x["_id"]["ap_mac"]]} (#{x["_id"]["ap_mac"].last(8)})" %> <%= x["version"].last.gsub('"',"") unless x["version"].blank? %>
<%end%> <%unless @ap_geo_loc.blank?%> <% (@ap_geo_loc || []).each do |x| %> <% ri = RouterInventory.where(mac_id: x["_id"]["ap_mac"]).last %> <% end %>
AP List by Geo Location
AP MAC Address
<%= @ri_name_mac[x["_id"]["ap_mac"]].blank? ? x["_id"]["ap_mac"] : "#{@ri_name_mac[x["_id"]["ap_mac"]]} (#{x["_id"]["ap_mac"].last(8)})" %><%= ri.city %>,<%= ri.country %>
<%end%> <%unless @aps_down_time.blank?%> <% @tot_downtime = @non_func_aps = 0 %>
AP Down time
Total Number of Aps:<%= @aps_down_time.count%>
<% @aps_down_time.select{ |a| a["down_time"].select {|x| @non_func_aps += x['entire_period'] || 0}} %> Number of Non-Functional Aps:<%= @non_func_aps%> <% @aps_down_time.each do |x| @tot_downtime = 0 if !x['down_time'].blank? %> <% end %> <% end %>
AP MAC Tags Downtime Period Total Downtime
<%= @ri_name_mac[x["mac"]].blank? ? x["mac"] : "#{@ri_name_mac[x["mac"]]} (#{x["mac"].last(8)})" %> <%= x["tags"].join(', ') %> <% (x["down_time"] || []).each do |list| %> <% unless list['down_secs'].to_i == 0 %> <%= Time.zone.parse(list['est'].to_s).in_time_zone(x['timezone']).strftime('%Y-%m-%d %H:%M:%S') %> to <%= Time.zone.parse(list['eet'].to_s).in_time_zone(x['timezone']).strftime('%Y-%m-%d %H:%M:%S') %>
<% @tot_downtime += list['down_secs'].to_i %> <% end %> <% end %>
<%= ApplicationController.helpers.time_converter(@tot_downtime) %>
<%end%>