- title t('.title', number: @invoice.number) - total = 0 .row-fluid .span6 %dl.dl-horizontal %dt= heading_helper(Invoice, :created_at) + ':' %dd= format_time(@invoice.created_at) %dt= heading_helper(Invoice, :created_by) + ':' %dd= show_user(@invoice.created_by) %dt= heading_helper(Invoice, :supplier) + ':' %dd= @invoice.supplier.name - if @invoice.deliveries.any? %dt= heading_helper(Invoice, :deliveries) + ':' %dd>< - @invoice.deliveries.order(:date).each_with_index do |delivery, index| - sum = delivery.sum - total += sum = ', ' if index > 0 = link_to format_date(delivery.date), [delivery.supplier, delivery] = ' (' + number_to_currency(sum) + ')' - if @invoice.orders.any? %dt= heading_helper(Invoice, :orders) + ':' %dd>< - @invoice.orders.order(:ends).each_with_index do |order, index| - sum = order.sum - transport = order.transport || 0 - total += sum + transport = ', ' if index > 0 = link_to format_date(order.ends), new_finance_order_path(order_id: order) = ' (' + number_to_currency(sum) - if transport != 0 = ' + ' + number_to_currency(transport) = ')' %dt= heading_helper(Invoice, :number) + ':' %dd= @invoice.number %dt= heading_helper(Invoice, :date) + ':' %dd= format_date(@invoice.date) %dt= heading_helper(Invoice, :paid_on) + ':' %dd= format_date(@invoice.paid_on) %dt= heading_helper(Invoice, :amount) + ':' %dd= number_to_currency @invoice.amount %dt= heading_helper(Invoice, :deposit) + ':' %dd= number_to_currency @invoice.deposit %dt= heading_helper(Invoice, :deposit_credit) + ':' %dd= number_to_currency @invoice.deposit_credit %dt= heading_helper(Invoice, :net_amount) + ':' %dd= number_to_currency @invoice.net_amount - if @invoice.deliveries.any? || @invoice.orders.any? %dt= heading_helper(Invoice, :total) + ':' %dd= number_to_currency total - if @invoice.attachment_data %dt= heading_helper(Invoice, :attachment) + ':' %dd= link_to t('ui.download'), finance_invoice_attachment_path(@invoice) %dt= heading_helper(Invoice, :note) + ':' %dd= simple_format(@invoice.note) - if @invoice.financial_link %dt= heading_helper(Invoice, :financial_link) + ':' %dd= link_to t('ui.show'), finance_link_path(@invoice.financial_link) .clearfix .form-actions - if @invoice.user_can_edit?(current_user) = link_to t('ui.edit'), edit_finance_invoice_path(@invoice), class: 'btn' = link_to t('ui.or_cancel'), finance_invoices_path