{% extends "base.html" %} {% from "units/_m.html" import unit_badge, doc_badge with context %} {% block title %}{{ r.number }}{% endblock %} {% block content %} {% set cur = branch.currency if branch else company.currency %}
{{ t('Rental Contracts') }}

{{ r.number }} {{ doc_badge(r.state) }}

{% if can_write %}
{% if r.state == 'draft' %}{{ t('Edit') }}
{% endif %}
{% endif %}
{{ t('Customer') }}
{{ nm({'name_en': r.cust_en, 'name_ar': r.cust_ar}) }}
{{ t('Project') }}
{{ r.pcode or '—' }}
{{ t('Site') }}
{{ r.site or '—' }}
{{ t('Start date') }}
{{ r.start_date }}
{{ t('End') }}
{{ r.end_date or '—' }}
{{ t('VAT') }}
{{ r.tax_en or '—' }}
{{ t('Invoiced to') }}
{{ r.billed_until or '—' }}

{{ t('Units') }}

{% if can_write and r.state == 'active' %}{% endif %}
{% for ln in lines %}{% endfor %}
{{ t('Serial') }}{{ t('Product') }}{{ t('On hire') }}{{ t('Off hire') }}{{ t('Monthly rate') }}{{ t('Status') }}
{% if r.state == 'active' and not ln.off_hire %}{% endif %} {{ ln.serial }}{{ nm(ln) }}{{ ln.on_hire or '—' }}{{ ln.off_hire or '—' }} {{ ln.monthly_rate|money(cur) }}{{ unit_badge(ln.unit_state) }}
{% if r.state in ('active', 'ended') %}

{{ t('Rent due') }}

{{ t('From') }} {{ preview_from }} {{ t('to') }}
{% for ln in preview %} {% else %}{% endfor %} {% if preview %}{% endif %}
{{ t('Serial') }}{{ t('Period') }}{{ t('Monthly rate') }}{{ t('Amount') }}
{{ ln.serial }}{{ ln.from }} – {{ ln.to }}{{ ln.monthly_rate|money(cur) }}{{ ln.amount|money(cur) }}
{{ t('Nothing due for this period.') }}
{{ t('Total before VAT') }}{{ preview|sum(attribute='amount')|money(cur) }}

{{ t('Full calendar months at the monthly rate; part months pro rata by days on hire.') }}

{% if can_write and preview %}
{% endif %} {% endif %}

{{ t('Rent invoices') }}

{% for i in invoices %} {% else %}{% endfor %}
{{ i.number or t('Draft') }}{{ i.period_from }} – {{ i.period_to }}{{ i.amount_total|money(cur) }}{{ i.state }}
{{ t('No rent invoiced yet.') }}
{% endblock %}