<%= render 'header' %>

Invoice

<%= @invoice.stripe_id %>


Invoice details

ID:
<%= @invoice.stripe_id %>
Date:
<%= @invoice.created_at.strftime('%Y/%m/%d %H:%M') %>
Period:
<%= @invoice.period_start.strftime('%Y/%m/%d %H:%M') %> to <%= @invoice.period_end.strftime('%Y/%m/%d %H:%M') %>
Customer:
<%= link_to @invoice.customer.stripe_id, tang.admin_customer_path(@invoice.customer) %>
<% if @invoice.subscription.present? %>
Subscription:
<%= link_to @invoice.subscription.stripe_id, tang.admin_subscription_path(@invoice.subscription) %>
<% end %>

Status

Status:
<%= @invoice.status %>
Payment:
<% if @invoice.charge.present? %> <%= link_to @invoice.charge.stripe_id, tang.admin_payment_path(@invoice.charge) %> <% end %>

Summary

<% if @invoice.coupon.present? %> <% end %> <% if @invoice.charge.present? %> <% end %>
Subtotal: <%= number_to_currency(@invoice.subtotal.to_f / 100.0) %>
<%= "#{@invoice.coupon.stripe_id} (#{coupon_off(@invoice.coupon)})" %> <%= number_to_currency(@invoice.coupon.discount(@invoice.subtotal) / 100.0) %>
Total: <%= number_to_currency(@invoice.total.to_f / 100.0) %>
Amount paid: <%= number_to_currency(@invoice.charge.amount.to_f / 100.0) %>

Invoice line items

<% @invoice.invoice_items.each do |invoice_item| %> <% if invoice_item.description.present? %> <% else %> <% end %> <% end %>
Amount Description Period
<%= number_to_currency(invoice_item.amount.to_f / 100.0) %><%= invoice_item.description %>Subscription to <%= invoice_item.plan.name %> (<%= plan_cost(invoice_item.plan) %>)<%= invoice_item.period_start.strftime('%Y/%m/%d %H:%M') %> to <%= invoice_item.period_end.strftime('%Y/%m/%d %H:%M') %>
<%= render 'footer' %>