<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>{{ tran("{DeliverySheet}") }} {{ order.auto_number }}</title>

    <!-- Do not import Bootstrap in this file, it fucks it up -->
    <!-- Note: in order to work in reverse proxy, we cannot use an absolute path beginning with / -->
    {% include 'printouts/_overlay.html' %}

    <style>
      body {
        font-family: "Helvetica Neue", sans-serif;
      }
      .float {
        font-size: 13px;
      }
      .smaller {
        font-size: 10px;
      }
      .bigger {
        height: 5mm;
        font-size: 16px;
        font-weight: bold;
      }
      .right {
        text-align: right;
      }
    </style>
  </head>
  <body onload="prune()">

    <div class="print-repeated" id="main">

      <!-- ramecek -->
      <div class="float heavy-box" style="top: 10mm; left: 10mm; width: 190mm; height: 140mm;"></div>

      <!-- dodavatel -->
      <div class="float light-box" style="top: 10mm; left: 10mm; width: 95mm; height: 39mm;"></div>
      <span class="float" style="top: 12mm; left: 13mm;">Dodavatel:</span>
      <span class="float" style="top: 12mm; left: 43mm;">IČO: {{ setup.company_idnum}}</span>
      <span class="float bigger" style="top: 17mm; left: 13mm;">{{ setup.company_name }}</span>
      <span class="float" style="top: 23mm; left: 13mm;">{{ setup.company_address }}</span>
      <span class="float" style="top: 28mm; left: 13mm;">{{ setup.company_zip }} {{ setup.company_city }}</span>
      <span class="float" style="top: 33mm; left: 13mm;">DIČ: {{ setup.company_vat_idnum}}</span>
      <span class="float" style="top: 38mm; left: 13mm;">fax: 491 520 462 tel: {{ setup.company_phone }}</span>  <!-- TODO: We don't have fax field -->
      <span class="float" style="top: 43mm; left: 13mm;">{{ setup.company_legal}}</span>

      <!-- hlavicka -->
      <div class="float light-box" style="top: 10mm; left: 105mm; width: 95mm; height: 9mm;"></div>
      <span class="float bigger" style="top: 12mm; left: 108mm;">Daňový doklad: {{ order.auto_number }}</span>
      <span class="float" style="top: 12mm; left: 160mm;">Ze dne: <b>{{ order._date_human }}</b></span>

      <!-- odberatel -->
      {% set customer = order._customer_record or {} %}
      <div class="float light-box" style="top: 19mm; left: 105mm; width: 95mm; height: 30mm;"></div>
      <span class="float" style="top: 22mm; left: 108mm;">Odběratel:</span>
      <span class="float" style="top: 22mm; left: 160mm;">IČO: <b>{{ customer.company_idnum}}</b></span>
      <span class="float bigger" style="top: 27mm; left: 108mm;">{{ order.customer_name}}</span>
      <span class="float" style="top: 33mm; left: 108mm;">{{ customer.address }}</span>
      <span class="float" style="top: 38mm; left: 108mm;">{{ customer.zip }} {{ customer.city }}</span>
      <span class="float" style="top: 43mm; left: 108mm;">DIČ: {{ setup.vat_idnum}}</span>

      <!-- betonarna + stavba -->
      <div class="float light-box" style="top: 49mm; left: 10mm; width: 190mm; height: 8mm;"></div>
      <span class="float" style="top: 51mm; left: 13mm;">Betonárna: {{ setup.facility_name }}</span>
      <span class="float" style="top: 51mm; left: 108mm;">Stavba:</span>
      <span class="float bigger" style="top: 51mm; left: 123mm;">{{ order.construction_site_name }}</span>

      <!-- beton -->
      <div class="float light-box" style="top: 57mm; left: 10mm; width: 190mm; height: 13mm;"></div>
      <span class="float" style="top: 59mm; left: 13mm;">Konzistence: {{ order.r_consistency_class }}</span>
      <span class="float" style="top: 59mm; left: 50mm;">Cement: {{ materials["Cement_oneline"] }}</span>
      <span class="float" style="top: 59mm; left: 108mm;">Vodní součinitel: {{ order.r_vc }}</span>
      <span class="float" style="top: 59mm; left: 155mm;">Max. velikost zrna: {{ order.r_d_max }}mm</span>
      <span class="float" style="top: 64mm; left: 13mm;">Poznámka: {{ order.comment }}</span>

      <!-- recept hlavicka -->
      <div class="float light-box" style="top: 70mm; left: 10mm; width: 190mm; height: 9mm;"></div>
      <span class="float" style="top: 72mm; left: 13mm;">Receptura kod</span>
      <span class="float" style="top: 72mm; left: 38mm;">Název</span>
      <span class="float" style="top: 72mm; left: 80mm;">Počet MJ</span>
      <span class="float" style="top: 72mm; left: 97mm;">MJ</span>
      <span class="float" style="top: 72mm; left: 105mm;">Jedn.cena</span>
      <span class="float" style="top: 72mm; left: 124mm;">DPH %</span>
      <span class="float" style="top: 72mm; left: 137mm;">Sleva %</span>
      <span class="float" style="top: 72mm; left: 152mm;">Jedn.cena</span>
      <span class="float" style="top: 72mm; left: 170mm;">Celkem bez DPH</span>

      <!-- recept -->
      <div class="float light-box" style="top: 79mm; left: 10mm; width: 190mm; height: 14mm;"></div>
      <span class="float" style="top: 81mm; left: 13mm;">{{ order.r_number }}</span>
      <span class="float" style="top: 81mm; left: 38mm;">{{ order.r_name }}</span>
      <span class="float" style="top: 81mm; left: 80mm;">{{ order.volume }}</span>
      <span class="float" style="top: 81mm; left: 97mm;">m³</span>
      <span class="float" style="top: 81mm; left: 105mm;">{{ order.r_price }}</span>
      <span class="float" style="top: 81mm; left: 124mm;">{{ setup.vat_rate }}</span>
      <span class="float" style="top: 81mm; left: 137mm;">{{ order.best_price_modifier }}</span>
      <span class="float" style="top: 81mm; left: 152mm;">{{ order.best_price }}</span>
      <span class="float" style="top: 81mm; left: 170mm;">{{ order._price_total_calculated }}</span>

      <!-- transport -->
      <div class="float light-box" style="top: 93mm; left: 10mm; width: 38mm; height: 13mm;"></div>
      <!-- Přepravce -->
      <span class="float" style="top: 95mm; left: 13mm;">Přepravce</span>
      <span class="float" style="top: 100mm; left: 18mm;">{{ delivery.car_operator }}</span>
      <div class="float light-box" style="top: 93mm; left: 48mm; width: 38mm; height: 13mm;"></div>
      <!-- Vozidlo -->
      <span class="float" style="top: 95mm; left: 50mm;">Vozidlo</span>
      <span class="float" style="top: 100mm; left: 55mm;">{{ delivery.car_car_type }}</span>
      <div class="float light-box" style="top: 93mm; left: 86mm; width: 38mm; height: 13mm;"></div>
      <!-- SPZ -->
      <span class="float" style="top: 95mm; left: 88mm;">SPZ</span>
      <span class="float" style="top: 100mm; left: 93mm;">{{ delivery.car_registration_number }}</span>
      <div class="float light-box" style="top: 93mm; left: 124mm; width: 38mm; height: 13mm;"></div>
      <!-- Řidič -->
      <span class="float" style="top: 95mm; left: 126mm;">Řidič</span>
      <span class="float" style="top: 100mm; left: 131mm;">{{ delivery.driver_name }}</span>
      <div class="float light-box" style="top: 93mm; left: 162mm; width: 38mm; height: 13mm;"></div>
      <!-- Teplota -->
      <span class="float" style="top: 95mm; left: 164mm;">Teplota</span>
      <span class="float" style="top: 100mm; left: 169mm;">{{ order.temperature_air }} °C</span>

      <!-- footer -->
      <div class="float light-box" style="top: 106mm; left: 10mm; width: 70mm; height: 18mm;"></div>
      <span class="float smaller multiline-wrap" style="top: 106.5mm; left: 10.5mm; width: 69.5mm; height: 17.5mm;">{{ setup.certification_text }}</span>
      <div class="float light-box" style="top: 124mm; left: 10mm; width: 70mm; height: 26mm;"></div>
      <span class="float smaller" style="top: 125mm; left: 11mm;">Razítko a podpis:</span>
      <!-- ceny -->
      <div class="right">
        <!-- hlavicka -->
        <div class="float light-box" style="top: 106mm; left: 80mm; width: 30mm; height: 24mm;"></div>
        <span class="float smaller" style="top: 117mm; left: 81mm; width: 28mm">V základní sazbě 21%</span>
        <span class="float smaller" style="top: 121mm; left: 81mm; width: 28mm">zaokrouhlení</span>
        <span class="float smaller" style="top: 125mm; left: 81mm; width: 28mm">Ve snížené sazbě 15%</span>
        <!-- bez DPH -->
        <div class="float light-box" style="top: 106mm; left: 110mm; width: 30mm; height: 8mm;"></div>
        <span class="float" style="top: 108mm; left: 111mm; width: 28mm">Částka bez DPH</span>
        <div class="float light-box" style="top: 114mm; left: 110mm; width: 30mm; height: 16mm;"></div>
        <span class="float smaller" style="top: 117mm; left: 110mm; width: 28mm">{{ order._price_total_calculated }}</span>
        <span class="float smaller" style="top: 121mm; left: 110mm; width: 28mm"></span>  <!-- TODO we don't have this. Should it be added ? -->
        <span class="float smaller" style="top: 125mm; left: 110mm; width: 28mm">0.00</span>  <!-- TODO what here? -->
        <!-- DPH -->
        <div class="float light-box" style="top: 106mm; left: 140mm; width: 30mm; height: 8mm;"></div>
        <span class="float" style="top: 108mm; left: 141mm; width: 28mm">DPH</span>
        <div class="float light-box" style="top: 114mm; left: 140mm; width: 30mm; height: 16mm;"></div>
        <span class="float smaller" style="top: 117mm; left: 140mm; width: 28mm">{{ order._price_total_calculated_vat }}</span>
        <span class="float smaller" style="top: 121mm; left: 140mm; width: 28mm"></span>  <!-- TODO we don't have this. Should it be added ? -->
        <span class="float smaller" style="top: 125mm; left: 140mm; width: 28mm">0.00</span>  <!-- TODO what here? -->
        <!-- Celkem -->
        <div class="float light-box" style="top: 106mm; left: 170mm; width: 30mm; height: 8mm;"></div>
        <span class="float" style="top: 108mm; left: 171mm; width: 28mm">Částka celkem</span>
        <div class="float light-box" style="top: 114mm; left: 170mm; width: 30mm; height: 16mm;"></div>
        <span class="float smaller" style="top: 117mm; left: 170mm; width: 28mm">{{ order._price_total_calculated_with_vat }}</span>
        <span class="float smaller" style="top: 121mm; left: 170mm; width: 28mm">{{ order._rounding_calculated}}</span>
        <span class="float smaller" style="top: 125mm; left: 170mm; width: 28mm">0.00</span>  <!-- TODO what here? -->
      </div>
      <!-- celkem -->
      <div class="float light-box" style="top: 130mm; left: 80mm; width: 65mm; height: 8mm;"></div>
      <span class="float bigger" style="top: 131.5mm; left: 81.5mm;">Zaokrouhleno celkem k úhradě</span>
      <div class="float light-box" style="top: 130mm; left: 145mm; width: 55mm; height: 8mm;"></div>
      <span class="float bigger right" style="top: 131.5mm; left: 146mm; width: 52mm;">{{ order._price_grand_total_calculated }}</span>
      <!-- podpisy -->
      <div class="float light-box" style="top: 138mm; left: 80mm; width: 65mm; height: 12mm;"></div>
      <span class="float smaller" style="top: 139mm; left: 81mm;">Příjemce - řidič:</span>
      <div class="float light-box" style="top: 138mm; left: 145mm; width: 55mm; height: 12mm;"></div>
      <span class="float smaller" style="top: 139mm; left: 146mm;">Příjemce - podpis:</span>

    </div>

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

  </body>
</html>
