﻿<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style>
body { font-family: Arial, Helvetica, sans-serif; font-size: 10pt; color: #222222; }
/* Przeglądarka: komórki do góry, jak w PDF (Qt nie tworzy tbody, a atrybut valign psuje eksport ODT) */
tbody > tr > td { vertical-align: top; }
.title { font-size: 18pt; font-weight: bold; color: #1f3a5f; }
.muted { color: #5a6b80; }
.items th { background-color: #e6ecf3; color: #1f3a5f; font-size: 7.5pt; border: 1px solid #b3bfcc; padding: 3px; }
.items td { font-size: 8pt; border: 1px solid #c7d0da; padding: 3px; }
.nowrap { white-space: nowrap; }
.sum td { background-color: #e6ecf3; font-weight: bold; }
</style>
</head>
<body>

<table width="100%" cellspacing="0" cellpadding="0">
<tr>
  <td><span class="title">RAPORT ZLECEŃ</span></td>
  <td align="right" class="muted">{{ translator.name }}<br/>stan na {{ today }}</td>
</tr>
</table>
<br/>

<table class="items" width="100%" cellspacing="0" cellpadding="3" style="border-collapse: collapse">
<tr>
  <th width="4%" class="nowrap">Lp.</th>
  <th width="8%">Nr rep.</th>
  <th width="9%">Data</th>
  <th width="19%">Klient</th>
  <th width="22%">Dokument</th>
  <th width="5%" class="nowrap">Ilość</th>
  <th width="5%" class="nowrap">J.m.</th>
  <th width="10%">Wartość netto</th>
  <th width="5%" class="nowrap">VAT</th>
  <th width="13%">Wartość brutto</th>
</tr>
{% set total = namespace(netto=0) %}
{% for translation in translations %}
{% set netto = translation.final_price|float %}
{% set total.netto = total.netto + netto %}
<tr>
  <td align="center" class="nowrap">{{ loop.index }}</td>
  <td align="center" class="nowrap">{{ translation.repertory_id }}</td>
  <td align="center" class="nowrap">{{ translation.start_date }}</td>
  <td>{{ translation.customer.name }}</td>
  <td>{{ translation.document_type }}</td>
  <td align="right" class="nowrap">{{ translation.page_count|number }}</td>
  <td align="center" class="nowrap">
    {%- if translation.count_type == 'Godzin' %}godz.
    {%- elif translation.count_type == 'Stron' %}str.
    {%- elif translation.count_type == 'Dokumenty' %}dok.
    {%- else %}blok{% endif -%}
  </td>
  <td align="right" class="nowrap">{{ netto|currency }}</td>
  <td align="center" class="nowrap">{{ translation.VAT ~ ' %' if translation.VAT else 'zw' }}</td>
  <td align="right" class="nowrap">{{ (netto * (1 + translation.VAT|float * 0.01))|currency }}</td>
</tr>
{% endfor %}
<tr class="sum">
  <td colspan="7" align="right">Razem</td>
  <td align="right" class="nowrap">{{ total.netto|currency }}</td>
  <td></td>
  <td align="right" class="nowrap">{{ invoice.final_price|currency }}</td>
</tr>
</table>
</body>
</html>
