I would like to extend the template ‘Fleet’ with data coming directly from the accounts, instead of adding the amounts manually. For this we will add the car plate to the reference during the booking and I want to group the value based on the reference and add the value to the correct line.
So I add in the fleet template the different cars with their car plate and adjusted the code below. However I am not able to make {% if name == plate_name %} to work. What is wrong in the code?
{% for car in var2 %}{% capture car_key %}car_{{ car.key }}{% endcapture %}
|{{ car.beneficiary }}|{% capture carlink %}license_plate{{ forloop.index0 }}{% endcapture %}{{ car.license_plate | upcase }}
|
{% assign name = car.license_plate | upcase %}
{% for account in accounts_totaal1 %}
{% comment %}take current account to display for each account, and use it to call on transactions-drop of that account{% endcomment %}
{% assign current_acc = account.number %}
{% assign transactions = period.accounts[current_acc].first.transactions %}
{% comment %}loop over all transactions for each account{% endcomment %}
{% for tr in transactions %}
{% assign plate_name = tr.Ref_ | upcase %}
{% if name == plate_name %}
{% assign $1 = $1+tr.value %}
{% endif %}
{% endfor %}
{% endfor %}
{% ifi car_insurance %}|{% =$2+input car.insurance placeholder:pl_holder_c2 as:currency %}{% endifi %}
{% ifi car_tax %}|{% =$3+input car.tax placeholder:pl_holder_c3 as:currency %}{% endifi %}
{% ifi car_parking %}|{% =$4+input car.parking placeholder:pl_holder_c4 as:currency %}{% endifi %}
{% ifi car_depreciation %}|{% =$5+input car.depreciation placeholder:pl_holder_c5 as:currency %}{% endifi %}
{% ifi car_leasing %}|{% =$6+input car.leasing placeholder:pl_holder_c6 as:currency %}{% endifi %}
{% fori cat in custom.categories %}{% if cat.name == blank %}{% capture pl_holder %}{% t "Kost" %}{% endcapture %}{% else %}{% assign pl_holder = cat.name %}{% endif %}|
{% capture total %}total_{{ cat.key }}{% endcapture %}
{% capture celid %}{{ car_key }}_{{ cat.key }}{% endcapture %}
{% input cat.[celid] placeholder:pl_holder as:currency %}
{% assign [total] = [total]+cat.[celid] %}
{% endfori %}{% newline %}
{% endfor %}