<% s = @stats %> <% money = ->(v) { whole, frac = ('%.2f' % v).split('.'); "#{whole.reverse.scan(/\d{1,3}/).join(',').reverse.sub(/\A,/, '')}.#{frac}" } %> <% gel = ->(v) { "₾ #{money.(v)}" } %> <%== erb :'admin/_nav', layout: false %>

Invoice statistics

← invoices

<%= gel.(s.gel(s.live)) %>invoiced
<%= gel.(s.gel(s.paid)) %>received
<%= gel.(s.gel(s.unpaid)) %>outstanding
<%= s.overdue.size %>overdue
<%= s.avg_days_to_pay ? "#{s.avg_days_to_pay} d" : '—' %>avg. time to pay
<%= s.live.size %><% if s.cancelled.any? %> +<%= s.cancelled.size %> cancelled<% end %>invoices

GEL at each invoice's captured rate. Cancelled invoices are excluded from all amounts.

<% rows = s.monthly %> <% if rows.any? %>

Received per month (₾, by payment date)

<% peak = rows.map(&:last).max %> <% peak = BigDecimal('1') if peak.nil? || peak.zero? %>

By month

<% rows.reverse_each do |m, n, inv, rec| %> <% next if n.zero? && rec.zero? %> <% end %>
MonthIssuedInvoiced ₾Received ₾
<%= m.strftime('%Y-%m') %><%= n %><%= money.(inv) %><%= money.(rec) %>
<% end %>

By currency

<% s.by_currency.each do |cur, v| %> <% end %>
CurrencyInvoicedReceivedOutstanding
<%= cur %><%= money.(v[:invoiced]) %><%= money.(v[:paid]) %><%= money.(v[:outstanding]) %>

Top clients

<% s.top_clients.each do |client, n, g| %> <% end %>
ClientInvoicesInvoiced ₾
<%= client %><%= n %><%= money.(g) %>
<% if s.crypto_usage.any? %>

Crypto payment option

<% s.crypto_usage.each do |coin, name, n| %> <% end %>
AssetInvoices
<%= coin %> <%= name %><%= n %>
<% end %>