<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>{{ title }}</title>

    <!-- Note: To work in reverse proxy, we cannot use an absolute path beginning with / -->
    <link href="{{ url_prefix }}/static/style.css" rel="stylesheet"/>
    <link href="{{ url_prefix }}/static/vendor/bootstrap.min.css" rel="stylesheet" />
  </head>

  <body>

    <div class="w-100 p-4 print-repeated">

        {% include 'printouts/_logo.html' %}

        <!-- Head -->

        <!-- Production facility -->
        <div class="row mb-2 mt-3">

            <div class="col-6">
              <b>{{ setup.company_name }}</b>
              <div>
                  {{ setup.company_address }}<br>
                  {{ setup.company_zip }}
                  {{ setup.company_city }}<br>
                  {{ tran("{company_idnum}") }}: {{ setup.company_idnum }}
                  {{ tran("{Vat ID}") }}: {{ setup.company_vat_idnum }}<br>
                  {{ setup.company_legal }}
              </div>
            </div>

            <div class="col-6 text-right">
                <h3>{{ title }}</h3>
            </div>

        </div>

        <div class="row border mb-2">
          <div class="col-4">
              <b>{{ tran("{facility}") }}</b>
              <div class="small">
                  {{ setup.facility_name }}<br>
                  {{ setup.facility_address }}<br>
                  {{ setup.facility_zip }}
                  {{ setup.facility_city }}<br>
                  {{ setup.facility_code }}
              </div>
          </div>
          <div class="col-4">
          </div>
          <div class="col-4">
              <table>
                  <tr>
                      <td class="text-right"><b>{{ tran("{date_tax}") }} {{ tran("{since}") }}:</b></td>
                      <td class="px-2">{{ datetime_since }}</td>
                  </tr>
                  <tr>
                      <td class="text-right"><b>{{ tran("{date_tax}") }} {{ tran("{until}") }}:</b></td>
                      <td class="px-2">{{ datetime_until }}</td>
                  </tr>
                  <tr>
                      <td class="text-right"><b>{{ tran("{Customer}") }}:</b></td>
                      <td class="px-2">{{ customer_str }}</td>
                  </tr>
                  <tr>
                      <td class="text-right"><b>{{ tran("{ConstructionSite}") }}:</b></td>
                      <td class="px-2">{{ construction_site_name }}</td>
                  </tr>
              </table>
          </div>
        </div>

        <!-- data -->
        <table class="mb-4 table">
            <thead class="bold">
              <tr>
                <td>{{ tran("{taxdocument_printout_no}") }}</td>
                <td>{{ tran("{date_issue}") }}</td>
                <td>{{ tran("{date_tax}") }}</td>
                <td>{{ tran("{Customer}") }}</td>
                <td>{{ tran("{payment_type}") }}</td>
                <td class="text-right">{{ tran("{Orders}") }}</td>
                <td class="text-right">{{ tran("{PumpOrders}") }}</td>
                <td class="text-right">{{ tran("{MaterialSales}") }}</td>
                <td class="text-right">{{ tran("{price_without_vat}") }}</td>
                <td class="text-right">{{ tran("{vat_rate}") }}</td>
                <td class="text-right">{{ tran("{vat}") }}</td>
                <td class="text-right">{{ tran("{price_with_vat}") }}</td>
                <td class="text-right">{{ tran("{rounding}") }}</td>
                <td class="text-right">{{ tran("{grand_total_to_be_paid}") }}</td>
              </tr>
            </thead>
            {% for row in rows %}
            <tr>
                <td>{{ row.number }}</td>
                <td>{{ row.t_issue_str }}</td>
                <td>{{ row.t_tax_str }}</td>
                <td>{{ row.customer_name or "---" }}</td>
                <td>{{ tran(row.payment_type_name) }}</td>
                <td class="text-right">{{ row.order_count }}</td>
                <td class="text-right">{{ row.pump_order_count }}</td>
                <td class="text-right">{{ row.material_sale_count }}</td>
                <td class="text-right">{{ row.price_net_str }}</td>
                <td class="text-right">{{ row.vat_rate_str }}&nbsp;%</td>
                <td class="text-right">{{ row.price_vat_str }}</td>
                <td class="text-right">{{ row.price_grand_total_str }}</td>
                <td class="text-right">{{ row.rounding_str }}</td>
                <td class="text-right">{{ row.price_to_pay_str }}</td>
            </tr>
            {% endfor %}
                <tr>
                    <td colspan="99"></td>
                </tr>
                <tr class="bold bg-light italic">
                    <td colspan="8">{{ tran("{total}") }}</td>
                    <td class="text-right">{{ totals["price_net"] }}</td>
                    <td></td>
                    <td class="text-right">{{ totals["price_vat"] }}</td>
                    <td class="text-right">{{ totals["price_grand_total"] }}</td>
                    <td class="text-right">{{ totals["rounding"] }}</td>
                    <td class="text-right">{{ totals["price_to_pay"] }}</td>
                </tr>
        </table>

      <div class="row printout-mini">
          <div class="col-5">{{ tran("{ORIGINAL}") }}</div>
          <div class="col-7 text-right">{{ tran("{asterix_footer}") }} {{ datetime_now }}</div>
      </div>

    </div>

    {% include 'printouts/_control_buttons.html' %}

  </body>
</html>
