{extends 'pdf/invoicePDF.tpl'}

<style>
   {block "style-pdf"}

   /* @formatter:off */
   {function custom_page}{
      size: A4 portrait;

   @frame frame_header {
      -pdf-frame-content: header{$iteration};
      top: 5mm;
      left: 10mm;
      width: 190mm;
      height: 10mm;
   }

   @frame frame_left {
      -pdf-frame-content: left_column{$iteration};
      left: 10mm;
      top: 15mm;
      width: 90mm;
      height: 100mm;
   }

   @frame frame_right {
      -pdf-frame-content: right_column{$iteration};
      left: 110.22mm;
      top: 15mm;
      width: 90mm;
      height: 92mm;
   {* -pdf-frame-border: 1; *}
   }

   @frame frame_down {
      left: 10mm;
      top: 110mm;
      width: 190mm;
      height: 190mm;
   }

   @frame frame_footer {
      -pdf-frame-content: footer;
      top: 289mm;
      left: 10mm;
      width: 190mm;
      height: 8mm;
   }
   }
   {/function}

   {if $iteration}
   @page first{$iteration} {custom_page iteration=$iteration}
   {else}
   @page {custom_page iteration=$iteration}
   {/if}

   /* druhá a další stránka */
   @page regular_template {
      @frame frame_header {
      -pdf-frame-content: header;
      top: 5mm;
      left: 10mm;
      width: 190mm;
      height: 10mm;
   }

   @frame frame_footer {
   -pdf-frame-content:footer;
   top: 289mm;
   left: 10mm;
   width: 190mm;
   height: 8mm;
   }

   @frame frame_down {
   left: 10mm;
   top: 21mm;
   width: 190mm;
   height: 263mm;
   }
   }
   /* @formatter:on */
   {/block}

   {block "style-css"}

   @font-face {
      font-family: ArialFont;
      src: url(http://html2pdf.wpj.cz/fonts/arial.ttf);
   }

   @font-face {
      font-family: ArialFont;
      src: url(http://html2pdf.wpj.cz/fonts/arialbd.ttf);
      font-weight: bold;
   }

   body {
      color: #000000;
      font-family: ArialFont, sans-serif;
      font-size: 8pt;
      line-height: 1.5;
   }

   /* cislo faktury - v ramecku */
   h1 {
      font-size: 13pt;
      font-weight: normal;
      padding: 3mm 2.5mm 1.8mm;
      margin: 0 0 5mm;
      border: 1pt solid #000000;
      border-top: 0;
      line-height: 1;
   }

   /* bank ucet, odberatel, dodaci udaje a zpusob odberu */
   h2 {
      border-bottom: 1pt solid #bbb;
      font-size: 8pt;
      font-weight: bold;
      margin: 0 0 2mm;
      padding: 2mm 0 1mm;
      line-height: 1;
   }

   /* jmeno a firma (dodaci i fakturacni) */
   h3 {
      font-weight: bold;
      font-size: 9pt;
      margin: 0;
      padding: 0;
      line-height: 1.2;
   }

   p {
      margin: 0;
      padding: 0;
      line-height: 1.5;
   }

   /* hlavicka, adresa prodejce */
   .header {
      border-bottom: 0.7mm solid black;
      font-weight: bold;
      height: 10mm;
   }

   .header td {
      vertical-align: top;
   }

   {* kdyz je sidlo firmy na 3 radky, zmensi se to *}
   .header div {
      -pdf-keep-in-frame-mode: shrink;
   }

   /* obchod používá wpjshop */
   .print-footer {
      color: #999;
   }

   /* bankovni udaje, data splatnosti */
   .bank {
      margin-bottom: 2mm;
   }

   .bank td {
      vertical-align: top;
   }

   /* 2 tabulky odberatel a dodaci udaje */
   .address td {
      vertical-align: top;
   }

   /* nesmi se oriznout! */
   .address {
      -pdf-keep-in-frame-mode: shrink;
   }

   .product-list {
      margin-bottom: 10mm;
   }

   .product-list td {
      vertical-align: top;
   }

   .product-list tr:first-child td {
      border-top: 1pt solid #bbb;
   }

   .product-list h2 {
      border-bottom: 0;
   }

   /* posledni radek productlistu, doprava */
   .last td {
      border-top: 1pt solid #333;
      border-bottom: 1pt solid #999;
   }

   /* boxík s cenou */
   .pricebox th {
      border: 1pt solid #fff;
      background: #ddd;
      font-size: 8pt;
      font-weight: bold;
      line-height: 1;
      padding: 0.5mm 1mm;
      height: 6mm;
   }

   .pricebox td {
      font-size: 8pt;
      line-height: 1;
      padding: 0 0.5mm;
      height: 6mm;
   }

   /* cena celkem */
   .pricebox-final td {
      border: 2pt solid #222;
      height: 8mm;
      font-weight: bold;
      font-size: 10pt;
      line-height: 1;
      padding: 0.2mm 0.6mm 0;
   }

   .pricebox-final td:first-child {
      border-right: 0;
   }

   .pricebox-final td:last-child {
      border-left: 0;
   }

   .logo td {
      vertical-align: middle;
      padding: 4mm 1mm;
   }

   .print:last-of-type {
      page-break-after: auto;
   }

   .large {
      font-size: 10pt;
      font-weight: 700;
   }

   .storno {
      font-size: 50pt;
      color: red;
      text-align: center;
   }

   #header td {
         font-size: 7.5pt;
         line-height: 1.2;
      }
   {/block}
</style>

{block "header-table"}
   <td align="right" valign="bottom" width="136"><pdf:barcode value="{$return.code}" type="code128" humanreadable="0" barheight="27" barWidth="1" /></td>
{/block}

{block "header-title"}
   {t}Odstoupení od smlouvy{/t}: {$return.code}
{/block}

{block "invoice-title"}
   <h1 class="bordered">{t}Odstoupení od smlouvy{/t} {$return.code}</h1>
   <p>{t}z objednávky č.{/t} {$return.order_no}</p><br>
{/block}

{block "invoice-dates"}
   <table width="100%" class="dates">
      <tr>
         <td width="60%">
            {get_datetime assign="now"}
            <strong>{t}Datum vytvoření{/t}:</strong>
         </td>
         <td align="right" width="40%" style="padding-right: 1mm;">{$return.date_created|format_date:'d.m.Y'}</td>
      </tr>
      <tr>
         <td>
            <strong>{t}Vyřízení{/t}:</strong>
         </td>
         {$date_handle = $return.date_handle|default:$now}
         <td align="right" style="padding-right: 1mm;"> {$date_handle|format_date:'d.m.Y'}</td>
      </tr>
   </table>
{/block}

{block "bank"}
   <h2>{t}Bankovní účet{/t}:</h2>
   <p>
      <strong>{t}Variabilní symbol{/t}:</strong> {$return.order_no}<br/>
       {if !empty({$dbcfg.bank_name})}
            {$dbcfg.bank_name}<br/>
       {/if}
       {if !findModule('translations') && findModule('currencies') && !empty($cfg.Currencies['EUR']) && $order.currency == 'EUR' && !empty($dbcfg.bank_iban_EUR)}
         <strong>BIC/SWIFT:</strong> {$dbcfg.bank_swift_EUR}<br/>
         <strong>IBAN:</strong> {$dbcfg.bank_iban_EUR}
      {else}
         {if !empty({$dbcfg.bank_account_number})}
         <strong>{t}Číslo účtu{/t}:</strong> {if $dbcfg.bank_account_prefix}{$dbcfg.bank_account_prefix}-{/if}{$dbcfg.bank_account_number}
         {if $dbcfg.bank_code}/{/if}{$dbcfg.bank_code}<br/>
         {/if}
         {if !empty($dbcfg.bank_swift)}<strong>BIC/SWIFT:</strong> {$dbcfg.bank_swift}{/if}<br/>
         {if !empty($dbcfg.bank_iban)}<strong>IBAN:</strong> {$dbcfg.bank_iban}<br/>{/if}
      {/if}
   </p>
{/block}

{block "left-table"}
   <tr>
      <td colspan="2">
         <h2>{t}Dodavatel{/t}:</h2>
         {$dbcfg.shop_firm_name}<br>
         {$dbcfg.shop_address|nl2br nofilter}<br>
         {if $dbcfg.shop_ico}{t}IČO{/t}: {$dbcfg.shop_ico} {/if}<br>
         {if $dbcfg.shop_dic}{t}DIČ{/t}: {$dbcfg.shop_dic}{/if}
      </td>
   </tr>
{/block}

{block "customer-address"}
   <table class="address">
      <tr>
         <td colspan="2">
            <h2>{t}Odběratel{/t}:</h2>
         </td>
      </tr>
      <tr>
         <td>
            <h3>{$return.address.name} {$return.address.surname}</h3>
         </td>
         <td>
            {$return.address.street} <br/>
            {$return.address.zip} {$return.address.city}
         </td>
      </tr>
      <tr>
         <td>
            <h3><strong>{t}Telefon{/t}:</strong> {$return.address.phone}</h3>
            <p>
               <strong>{t}Email{/t}:</strong> {$return.email}
            </p>
         </td>
      </tr>
      {block "delivery-address"}
         <tr>
            <td colspan="2">
               <h2>{t}Dodací údaje{/t}</h2>
            </td>
         </tr>
         <tr>
            <td>
               <h3>{$return.address.name} {$return.address.surname}</h3>
            </td>
            <td>
               {$return.address.street} <br/>
               {$return.address.zip} {$return.address.city}
            </td>
         </tr>
      {/block}
   </table>
{/block}

{block "delivery"}{/block}


{block "items"}
   <div class="product-list">
      <h2>{t}Informace o reklamaci{/t}</h2>
      <table>
         <tr>
            <td width="25%" style="vertical-align: top;"><strong>{t}Název zboží{/t}</strong></td>
            <td width="75%">{foreach $return.items as $item}{$item.pieces}x {$item.descr}<br>{/foreach}
            </td>
         </tr>
      </table>
   </div>
{/block}

{block "invoice-bottom"}{/block}
