Intermediate [Exercise 3: Registers] (Training slides exercise)

Create Fixed Asset register with a table and a fori loop to show additions and disposals and add totals at the bottom using registers ($). The table should look like the one below:

|784px;x170px;

Solution:

{% stripnewlines %}
| Description
| Additions
| Disposals
| Total
{% newline %}
|--------
|--------
|--------
|--------#
{% newline %}
{% fori item in custom.fixed_assets %}
  |{% input item.description placeholder:'Description' %}
  |{%=$1+input item.additions as:currency placeholder:0 %}
  |{%=$2+input item.disposals as:currency placeholder:0 %}
  |**{{ item.additions+item.disposals | currency }}**
  {% newline %}
{% endfori %}
|**Total**
|**{{ $1 | currency }}**
|**{{ $2 | currency }}**
|**{{ $1+$2 | currency }}**

{% endstripnewlines %}

Solution in HTML:

<table class="usr-bordered usr-width-100">
  <thead>
    <tr>
      <th class="">Description</th>
      <th class="">Additions</th>
      <th class="">Disposals</th>
      <th class="">Total</th>
    </tr>
  </thead>
  <tbody>
    {% fori item in custom.fixed_assets %}
      <tr>
        <td class="">{% input item.description placeholder:'Description' %}</td>
        <td class="">{%=$1+input item.additions as:currency placeholder:0 %}</td>
        <td class="">{%=$2+input item.disposals as:currency placeholder:0 %}</td>
        <td class="">{{ item.additions+item.disposals | currency }}</td>
      </tr>
    {% endfori %}
    <tr>
        <td class=""><b>Total</b></td>
        <td class=""><b>{{ $1 | currency }}</b></td>
        <td class=""><b>{{ $2 | currency }}</b></td>
        <td class="">{{ $1+$2 | currency }}</td>
      </tr>
  </tbody>
</table>