<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>{{ tran("{Material stock}") }}</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="container print-repeated" id="main">

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

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

        <div class="col-6">
          <b>{{ setup.company_name }}</b>
          <div class="small">
              {{ 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">
            <h3 class="text-right">{{ tran("{Material stock}") }}</h3>
        </div>

        </div>

        <!-- Production facility -->
        <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">
              <b>{{ tran("{Date range}") }}</b><br>
              {{ datetime_since }} - {{ datetime_until }}
          </div>
        </div>

        <!-- materials -->
            <table class="w-100 mb-4 small table table-bordered table-striped">
                <thead class="bold">
                    <td style="width: 40%">{{ tran("{Material}") }}</td>
                    <td class="text-right" style="width: 15%;">{{ tran("{initial_stock}") }}</td>
                    <td class="text-right" style="width: 15%;">{{ tran("{received}") }}</td>
                    <td class="text-right" style="width: 15%;">{{ tran("{consumed}") }}</td>
                    <td class="text-right" style="width: 15%;">{{ tran("{stock_status}") }}</td>
                </thead>
                {% for material in materials %}
                <tr>
                    <td class="py-1">{{ material.long_name or material.name }}</td>
                    <td class="py-1 text-right">{{ material.stock_initial }} kg</td>
                    <td class="py-1 text-right">{{ material.stock_positive }} kg</td>
                    <td class="py-1 text-right">{{ material.stock_negative }} kg</td>
                    <td class="py-1 text-right bold">{{ material.stock_sum }} kg</td>
                </tr>
                {% endfor %}
            </table>

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

    </div>

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

  </body>
</html>
