﻿<!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: 20pt; font-weight: bold; color: #1f3a5f; }
.subtitle { font-size: 12pt; color: #1f3a5f; }
.label { font-size: 8pt; font-weight: bold; color: #5a6b80; }
.muted { color: #5a6b80; }
.party { border-top: 2px solid #1f3a5f; padding-top: 4px; }
.items th { background-color: #e6ecf3; color: #1f3a5f; font-size: 8pt; border: 1px solid #b3bfcc; padding: 4px; }
.items td { font-size: 9pt; border: 1px solid #c7d0da; padding: 4px; }
.nowrap { white-space: nowrap; }
.total { background-color: #e6ecf3; font-size: 13pt; font-weight: bold; color: #1f3a5f; padding: 6px; }
.sign { border-top: 1px dotted #5a6b80; padding-top: 4px; font-size: 8pt; color: #5a6b80; }
</style>
</head>
<body>

<table width="100%" cellspacing="0" cellpadding="0">
<tr>
  <td>
    <span class="title">RACHUNEK</span><br/>
    <span class="subtitle">nr <b>{{ invoice.id }}</b></span><br/>
    <span class="muted">do umowy o dzieło z dnia {{ invoice.start_date }}</span>
  </td>
  <td align="right">
    <span class="muted">Miejsce wystawienia:</span> {{ translator.city }}<br/>
    <span class="muted">Data wystawienia:</span> {{ invoice.invoice_date }}
  </td>
</tr>
</table>
<br/>

<table width="100%" cellspacing="0" cellpadding="0">
<tr>
  <td width="50%" class="party">
    <span class="label">ZLECENIODAWCA</span><br/>
    <b>{{ customer.name }}</b><br/>
    {% if customer.street %}{{ customer.street }}<br/>{% endif %}
    {{ customer.code }} {{ customer.city }}<br/>
    {% if customer.country and customer.country != 'Polska' %}{{ customer.country }}<br/>{% endif %}
    {% if customer.NIP %}NIP: {{ customer.prefix_UE }}{{ customer.NIP }}<br/>{% endif %}
  </td>
  <td width="50%" class="party">
    <span class="label">ZLECENIOBIORCA</span><br/>
    <b>{{ translator.name }}</b><br/>
    {% if translator.street %}{{ translator.street }}<br/>{% endif %}
    {{ translator.code }} {{ translator.city }}<br/>
    {% if translator.PESEL %}PESEL: {{ translator.PESEL }}<br/>{% endif %}
    {% if translator.NIP %}NIP: {{ translator.NIP }}<br/>{% endif %}
  </td>
</tr>
</table>
<br/>

<table class="items" width="100%" cellspacing="0" cellpadding="4" style="border-collapse: collapse">
<tr>
  <th width="5%" class="nowrap">Lp.</th>
  <th width="95%" align="left">Zakres wykonanego dzieła</th>
</tr>
{% for translation in translations %}
<tr>
  <td align="center" class="nowrap">{{ loop.index }}</td>
  <td>{% if translation.translation_type == 'Poświadczenie' %}{{ translation.translation_type }} tłumaczenia{% else %}{{ translation.translation_type }} tłumaczenie{% endif %} {{ translation.translation_comb }}: {{ translation.document_type }}</td>
</tr>
{% endfor %}
</table>
<br/>

<table class="items" width="100%" cellspacing="0" cellpadding="4" style="border-collapse: collapse">
<tr>
  <td width="5%" align="center">1.</td>
  <td width="70%">Wynagrodzenie brutto</td>
  <td width="25%" align="right" class="nowrap"><b>{{ invoice.final_price|currency }} {{ invoice.currency }}</b></td>
</tr>
<tr>
  <td align="center">2.</td>
  <td>Koszty uzyskania przychodu ({{ invoice.author_tax|number }}% pozycji 1)</td>
  <td align="right" class="nowrap">{{ invoice.author_tax_cost|currency }} {{ invoice.currency }}</td>
</tr>
<tr>
  <td align="center">3.</td>
  <td>Kwota do opodatkowania (pozycja 1 minus pozycja 2)</td>
  <td align="right" class="nowrap">{{ invoice.final_price_without_cost|currency }} {{ invoice.currency }}</td>
</tr>
<tr>
  <td align="center">4.</td>
  <td>Podatek dochodowy ({{ invoice.tax_rate|number }}% pozycji 3)</td>
  <td align="right" class="nowrap">{{ invoice.tax|currency }} {{ invoice.currency }}</td>
</tr>
</table>
<br/>

<table width="100%" cellspacing="0" cellpadding="0">
<tr>
  <td class="total">Do wypłaty: {{ invoice.final_price_without_tax|currency }} {{ invoice.currency }}</td>
</tr>
</table>
<p>
<span class="muted">Słownie:</span> {{ invoice.final_price_without_tax_words }}<br/>
<span class="muted">Forma płatności:</span> {{ invoice.payment_type }}<br/>
{% if invoice.payment_type == 'przelew' %}
<span class="muted">Numer konta:</span> <b>{{ translator.account_number1 }}</b>{% if translator.bank_name %} ({{ translator.bank_name }}){% endif %}<br/>
{% endif %}
</p>
<br/><br/>

<table width="100%" cellspacing="0" cellpadding="0">
<tr>
  <td width="40%" align="center" class="sign">Zleceniodawca</td>
  <td width="20%"></td>
  <td width="40%" align="center" class="sign">Zleceniobiorca</td>
</tr>
</table>
</body>
</html>
