<!DOCTYPE html>
<html lang="cs">
<head>
  <meta charset="utf-8"/>
  <title>{{ tran("{DeliverySheet}") }} {{ delivery._name }}</title>
  <link href="{{ url_prefix }}/static/style.css" rel="stylesheet"/>

  <style>
    @media print {
      @page {
        size: A5 landscape;
        margin: 9mm;
      }
    }

    body {
      font-family: serif;
      font-size: 16px;
      margin: 0;
      line-height: 1.5;
    }

    b {
      font-size: 18px;
    }

    table {
      width: 100%;
    }

    td {
      padding: 4px;
      vertical-align: top;
      text-align: left;
    }

    .bordered {
      border: 1px solid black;
      border-collapse: collapse;
    }

    td.tb {
      border-top: 1px solid black;
      border-bottom: 1px solid black;
    }

    td.tbl {
      border-top: 1px solid black;
      border-bottom: 1px solid black;
      border-left: 1px solid black;
    }

    td.tbr {
      border-top: 1px solid black;
      border-bottom: 1px solid black;
      border-right: 1px solid black;
    }

    td.tblr {
      border: 1px solid black;
    }

    td.t {
      border-top: 1px solid black;
    }

    td.tl {
      border-top: 1px solid black;
      border-left: 1px solid black;
    }

    td.tr {
      border-top: 1px solid black;
      border-right: 1px solid black;
      border-bottom: hidden;
      border-left: hidden;
    }

    td.bl {
      border-bottom: 1px solid black;
      border-left: 1px solid black;
    }

    .nowrap {
      white-space: nowrap;
    }

    .multiline {
      white-space: pre !important;
    }

    .right {
      text-align: right;
    }
  </style>

</head>
<body>

  <table class="bordered print-repeated">
    <tr>
      <td colspan="4">
        Dodavatel:
      </td>
      <td class="tbl nowrap">
        Dodací list č.:
      </td>
      <td class="tb">
        <b>{{ delivery._name }}</b>
      </td>
      <td class="tb right" colspan="2">
        Ze dne:
      </td>
      <td class="tbr" colspan="4">
        <b>{{ delivery._t_human }}</b>
      </td>
    </tr>

    <tr>
      <td colspan="2">
        <b>{{ setup.company_name }}</b><br>
        {{ setup.company_address }}<br>
        {{ setup.company_zip }} {{ setup.company_city }}<br>
        {{ tran("{company_idnum}") }}: {{ setup.company_idnum }}<br>
        {{ tran("{Vat ID}") }}: {{ setup.company_vat_idnum }}
      </td>
      <td colspan="2">
        {% include 'printouts/_logo.html' %}<br>
        Tel: {{ setup.facility_phone }}
      </td>
      <td class="tblr" colspan="8">
        Odběratel:<br>
        <b>{{ order.customer }}</b><br>
        {{ tran("{company_idnum}") }}: {{ order._customer_record.company_idnum }}<br>
        {{ tran("{Vat ID}") }}: {{ order._customer_record.vat_idnum }}
      </td>
    </tr>

    <tr>
      <td class="tbl">
        Provozovna:
      </td>
      <td class="tb nowrap">
        {{ setup.facility_name }}<br>
      </td>
      <td class="tb right" colspan="2">
        Míchal:
      </td>
      <td class="tb">
        {{ order.audit_created_by }}
      </td>
      <td class="tb right" colspan="4">
        Stavba:
      </td>
      <td class="tbr" colspan="4">
        <b>{{ order.construction_site }}</b>
      </td>
    </tr>

    <tr>
      <td class="tbl">
        Konzistence:
      </td>
      <td class="tb">
        {{ order.r_consistency_class }}
      </td>
      <td class="tb right nowrap">
        Max. velikost zrna:
      </td>
      <td class="tb">
        {{ order.r_d_max }}
      </td>
      <td class="tb right nowrap" colspan="4">
        čas naplnění míchačky:
      </td>
      <td class="tbr nowrap" colspan="5">
        {{ delivery._water_cement_contact_t_human }}
      </td>
    </tr>

    <tr>
      <td class="tbl nowrap">
        Receptura/přísady:
      </td>
      <td class="tb right">
        V/C:
      </td>
      <td class="tb">
        {{ order.r_vc }}
      </td>
      <td class="tb nowrap">
        Počet MJ:
      </td>
      <td class="tb">
        MJ:
      </td>
      <td class="tb nowrap" colspan="2">
        Cement/příměsi:
      </td>
      <td class="tb" colspan="2">
      </td>
      <td class="tb nowrap">
        Obsah Cl:
      </td>
      <td class="tbr" colspan="3">
        {{ order.r_cl_content }}
      </td>
    </tr>

    <tr>
      <td colspan="3">
        <b>{{ order.r_number }} {{ order.r_name }}</b><br>
        {{ tran("{ufi_code}:") }} {{ order.r_ufi_code }}
      </td>
      <td>
        <b>{{ delivery._volume }}</b>
      </td>
      <td>
        m³
      </td>
      <td colspan="4">
      </td>
      <td colspan="4" class="tblr nowrap" rowspan="3">
        Množství vody nebo přísady<br>
        přidané odběratelem + podpis<br>
        <br>
        <br>
        <br>
      </td>
    </tr>

    <tr>
      <td class="multiline" colspan="3">{{ materials['Admixture_multiline'] }}</td>
      <td colspan="2">
      </td>
      <td class="multiline" colspan="4">{{ materials['Cement_multiline'] }}<br>{{ materials['Addition_multiline'] }}</td>
    </tr>

    <tr>
      <td class="nowrap">
        Stupně vlivu prostředí:
      </td>
      <td colspan="8">
        {{ order.r_exposure_classes }}
      </td>
    </tr>

    <tr>
      <td class="tl">
        Přepravce:
      </td>
      <td class="tl">
        Vozidlo:
      </td>
      <td class="tl" colspan="2">
        SPZ:
      </td>
      <td class="tl" colspan="2">
        Řidič:
      </td>
      <td class="tl" colspan="2">
        <!-- Poznámka: TODO - the following is hacked for now -->
        Požadované vlivy prostředí:
      </td>
      <td class="tl" colspan="4">
        Čekání - doba vykládky:
      </td>
    </tr>

    <tr>
      <td class="bl">
        {{ delivery.car_operator }}
      </td>
      <td class="bl">
        {{ delivery.car_car_type }}
      </td>
      <td class="bl" colspan="2">
        {{ delivery.car_registration_number }}
      </td>
      <td class="bl" colspan="2">
        {{ delivery.driver_name }}
      </td>
      <td class="bl" colspan="2">
        {{ order.comment }}
      </td>
      <td class="bl" colspan="4">
        Čas dodání na stavbu:
      </td>
    </tr>

    <tr>
      <td class="tl">
        Teplota:
      </td>
      <td class="tl">
        Zpracoval dle PZ do:
      </td>
      <td class="tl" colspan="2">
        Čas dod. na staveniště:
      </td>
      <td class="tl" colspan="2">
        Začátek vyprazdňování:
      </td>
      <td class="tl" colspan="2">
        Konec vyprazdňování:
      </td>
      <td class="tl" colspan="4" height="50px">
        Příjemce - podpis + hůlkovým:
      </td>
    </tr>

    <tr>
      <td class="bl">
        {{ order._temperature_air_str }}
      </td>
      <td class="bl">
        90 minut
      </td>
      <td class="bl" colspan="2">
      </td>
      <td class="bl" colspan="2">
      </td>
      <td class="bl" colspan="2">
      </td>
      <td class="bl" colspan="4">
      </td>
    </tr>

    <tr>
      <td class="tr multiline" colspan="8">{{ setup.certification_text }}</td>
      <td class="tblr" colspan="4" height="80px">
        Vystavil - podpis + hůlkovým
      </td>
    </tr>
  </table>

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

</body>
</html>
