<% if @invoice.present? %>

Invoice number: INV<%= @invoice.invoice_number %>

Account Name:
<%= @account.name %> 
<%= link_to @account.email, Kaui.account_home_path.call(@account.external_key) %> 
Invoice date:
<%= @invoice.invoice_date.html_safe %> 
Target date:
<%= @invoice.target_date.html_safe %> 
Amount:
<%= humanized_money_with_symbol @invoice.amount_to_money %> (<%= @account.currency %>) 
Balance:
<%= humanized_money_with_symbol @invoice.balance_to_money %> (<%= @account.currency %>) 
<% @invoice.items.each do |item| %> <% sub = @subscriptions[item.subscription_id] %> <% bundle = @bundles[item.bundle_id] %> > <% end %>
External Key Description Start date End date Charged through date Price list Amount Comments
<%= link_to Kaui.bundle_key_display_string.call(bundle.external_key), Kaui.bundle_home_path.call(bundle.bundle_id) if bundle.present? and bundle.external_key.present? %> <%= item.description %> <%= item.start_date.html_safe if item.start_date %> <%= item.end_date.html_safe if item.end_date %> <%= format_date(sub.charged_through_date, @account.timezone).html_safe if sub.present? %> <%= sub.price_list.downcase.capitalize if sub.present? and sub.price_list.present? %> <%= humanized_money_with_symbol Kaui::InvoiceItem.amount_to_money(item) %> (<%= item.currency %>) <%= item.audit_logs.map {|log| log.comments}.compact.join('
') if item.audit_logs.present? %>
<% if can? :item_adjust, Kaui::Invoice %> <%= link_to "Adjust", kaui_engine.edit_invoice_item_path(item.invoice_item_id, :invoice_id => @invoice.invoice_id), :class => "btn btn-mini #{"disabled" unless item.amount > 0 and item.subscription_id.present?}" %> <% end %> <%= link_to "Delete", kaui_engine.invoice_item_path(item.invoice_item_id, :account_id => @invoice.account_id, :invoice_id => @invoice.invoice_id), :confirm => 'Are you sure?', :method => :delete, :class => "btn btn-mini #{"disabled" unless item.description =~ /account credit/ and item.amount > 0 and item.linked_invoice_item_id.nil? and !@cba_items_not_deleteable.include?(item.invoice_item_id) and @invoice.balance - item.amount >= 0}" %>
<% else %>

Invoice not found

<% end %> <%= link_to 'Back', :back, :class => 'btn' %> <%= link_to "View customer invoice html", kaui_engine.show_html_invoice_path(@invoice.invoice_id), :class => 'btn', :target => "_blank" unless @invoice.blank? %> <%= javascript_tag do %> function disableLinks() { $('a.btn.disabled').click(function (e) { // preventDefault is not enough due to the confirmation popup return false; }); } $(document).ready(function() { disableLinks(); }); <% end %>