gregmolnar/invoicer

View on GitHub
app/views/invoices/show.html.erb

Summary

Maintainability
Test Coverage
<div class="container">
  <div class="row">
    <div class="span6">
      <h1><%= @invoice.user_address.business_name %></h1>
      <%== @address.join('<br />') %>
      <br />
      <strong>Bank account:</strong><br />
      <%== @invoice.user_address.bank_details.gsub("\n", "<br />") %>
      </p>
    </div>
    <div class="span3 offset3">
      <h1>Invoice <%= @invoice.invoice_number %></h1>
    </div>
  </div>
  <div class="row" id="bill-to">
    <div class="span6">
      <strong>Bill to:</strong><br />
      <%== @bill_to.join('<br />') %>
    </div>
    <div class="span3 offset3">
      <table>
        <tr>
          <td><strong>Invoice Date:</strong></td>
          <td align="right"><%= @invoice.date %></td>
        </tr>
        <tr>
          <td><strong>Due Date:</strong></td>
          <td align="right"><%= @invoice.due_date %></td>
        </tr>
        <tr>
          <td><strong>Amount Due:</strong></td>
          <td align="right"><%= number_to_currency(@invoice.total) %></td>
        </tr>
      </table>
    </div>
  </div>
  <table class="table" id="items">
    <thead>
      <tr>
        <th>Item</th>
        <th>Description</th>
        <th>Qty</th>
        <th>Unit</th>
        <th>Price</th>
        <th>Total</th>
      </tr>
    </thead>
    <tbody>
      <% @invoice.invoice_items.each do |item| %>
      <tr>
        <td><%= item.name %></td>
        <td><%= item.description %></td>
        <td><%= item.quantity %></td>
        <td><%= item.unit %></td>
        <td><%= number_to_currency(item.price) %></td>
        <td><%= number_to_currency(item.price * item.quantity) %></td>
      </tr>
      <% end %>
    </tbody>
  </table>
  <div class="row">
    <div class="span4 offset8 text-right">
      <table class="table">
        <tr>
          <td>Total:</td>
          <td><%= number_to_currency @invoice.total %></td>
        </tr>
        <tr>
          <td>Balance:</td>
          <td><%= number_to_currency @invoice.total %></td>
        </tr>
      </table>
    </div>
  </div>
</div>