<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>{{ tran("{Material consumption}") }}</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 consumption}") }}</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 -->
        <div class="ml-0">
            <table class="w-100 ml-3 mb-4 small">
                <thead class="bold">
                    <td style="width: 40%">{{ tran("{Material}") }}</td>
                    <td class="text-right" style="width: 15%;">{{ tran("{from_recipe}") }}</td>
                    <td class="text-right" style="width: 15%;">{{ tran("{requested}") }}</td>
                    <td class="text-right" style="width: 15%;">{{ tran("{weighted}") }}</td>
                    <td class="text-right" style="width: 15%;">{{ tran("{difference}") }}</td>
                </thead>
                {% for material in materials %}
                <tr>
                    <td>{{ material.long_name or material.name }}</td>
                    <td class="text-right">{{ material.weight_recipe }}</td>
                    <td class="text-right">{{ material.weight_rq }}</td>
                    <td class="text-right">{{ material.weight_e1 }}</td>
                    <td class="text-right">{{ material._weight_difference }}</td>
                </tr>
                {% endfor %}
                <tr>
                    <td class="bold">{{ tran("{total}") }}</td>
                    <td class="bold text-right">{{ totals.weight_recipe }}</td>
                    <td class="bold text-right">{{ totals.weight_rq }}</td>
                    <td class="bold text-right">{{ totals.weight_e1 }}</td>
                    <td class="bold text-right">{{ totals._weight_difference }}</td>
                </tr>
            </table>
        </div>

      <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>
