{literal}
<html>
<head>
<style>
@page {
  size: auto;
  odd-header-name: html_MyHeader1;
  odd-footer-name: html_MyFooter1;
}
@page chapter2 {
    odd-header-name: html_MyHeader2;
    odd-footer-name: html_MyFooter2;
}
@page noheader {
    odd-header-name: _blank;
    odd-footer-name: _blank;
}
div.chapter2 {
    page-break-before: always;
    page: chapter2;
}
div.noheader {
    page-break-before: always;
    page: noheader;
}
		body {
			font-size: 8px;
		}
		/* overall */
		.tablesorter-blue {
			width: 100%;
			background-color: #fff;
			margin: 10px 0 15px;
			text-align: left;
			border-spacing: 0;
			border: #fff 1px solid;
			border-width: 1px 0 0 1px;
		}
		.tablesorter-blue th,
		.tablesorter-blue td {
			border: #fff 1px solid;
			border-width: 0 1px 1px 0;
			border-bottom: 1px solid black;
		}
		
		/* header */
		.tablesorter-blue th,
		.tablesorter-blue thead td {
			font: bold 10px/18px Arial, Sans-serif;
			color: #000;
			background-color: #fff;
			padding: 4px;
			border-top: 2px solid red;
		}
		.tablesorter-blue tbody td,
		.tablesorter-blue tfoot th,
		.tablesorter-blue tfoot td {
			padding: 4px;
			vertical-align: top;
		}
		.tablesorter-blue .header,
		.tablesorter-blue .tablesorter-header {
			/* black (unsorted) double arrow */
			background-image: url(data:image/gif;base64,R0lGODlhFQAJAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAkAAAIXjI+AywnaYnhUMoqt3gZXPmVg94yJVQAAOw==);
			/* white (unsorted) double arrow */
			/* background-image: url(data:image/gif;base64,R0lGODlhFQAJAIAAAP///////yH5BAEAAAEALAAAAAAVAAkAAAIXjI+AywnaYnhUMoqt3gZXPmVg94yJVQAAOw==); */
			/* image */
			/* background-image: url(images/black-unsorted.gif); */
			background-repeat: no-repeat;
			background-position: center right;
			padding: 3px 18px 3px 3px;
			white-space: normal;
			cursor: pointer;
		}
		.tablesorter-blue .headerSortUp,
		.tablesorter-blue .tablesorter-headerSortUp,
		.tablesorter-blue .tablesorter-headerAsc {
			background-color: #E7E7E9;
			/* black asc arrow */
			background-image: url(data:image/gif;base64,R0lGODlhFQAEAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAQAAAINjI8Bya2wnINUMopZAQA7);
			/* white asc arrow */
			/* background-image: url(data:image/gif;base64,R0lGODlhFQAEAIAAAP///////yH5BAEAAAEALAAAAAAVAAQAAAINjI8Bya2wnINUMopZAQA7); */
			/* image */
			/* background-image: url(images/black-asc.gif); */
		}
		.tablesorter-blue .headerSortDown,
		.tablesorter-blue .tablesorter-headerSortDown,
		.tablesorter-blue .tablesorter-headerDesc {
			background-color: #E7E7E9;
			/* black desc arrow */
			background-image: url(data:image/gif;base64,R0lGODlhFQAEAIAAACMtMP///yH5BAEAAAEALAAAAAAVAAQAAAINjB+gC+jP2ptn0WskLQA7);
			/* white desc arrow */
			/* background-image: url(data:image/gif;base64,R0lGODlhFQAEAIAAAP///////yH5BAEAAAEALAAAAAAVAAQAAAINjB+gC+jP2ptn0WskLQA7); */
			/* image */
			/* background-image: url(images/black-desc.gif); */
		}
		.tablesorter-blue thead .sorter-false {
			background-image: none;
			padding: 4px;
		}
		
		/* tfoot */
		.tablesorter-blue tfoot .tablesorter-headerSortUp,
		.tablesorter-blue tfoot .tablesorter-headerSortDown,
		.tablesorter-blue tfoot .tablesorter-headerAsc,
		.tablesorter-blue tfoot .tablesorter-headerDesc {
			/* remove sort arrows from footer */
			background-image: none;
		}
		
		/* tbody */
		.tablesorter-blue td {
			color: #3d3d3d;
			background-color: #fff;
			padding: 0px;
			vertical-align: top;
		}
		
		/* hovered row colors
		 you'll need to add additional lines for
		 rows with more than 2 child rows
		 */
		.tablesorter-blue tbody > tr:hover > td,
		.tablesorter-blue tbody > tr:hover + tr.tablesorter-childRow > td,
		.tablesorter-blue tbody > tr:hover + tr.tablesorter-childRow + tr.tablesorter-childRow > td,
		.tablesorter-blue tbody > tr.even:hover > td,
		.tablesorter-blue tbody > tr.even:hover + tr.tablesorter-childRow > td,
		.tablesorter-blue tbody > tr.even:hover + tr.tablesorter-childRow + tr.tablesorter-childRow > td {
			background: #d9d9d9;
		}
		.tablesorter-blue tbody > tr.odd:hover > td,
		.tablesorter-blue tbody > tr.odd:hover + tr.tablesorter-childRow > td,
		.tablesorter-blue tbody > tr.odd:hover + tr.tablesorter-childRow + tr.tablesorter-childRow > td {
			background: #bfbfbf;
		}
		
		
		/* Zebra Widget - row alternating colors */
		.tablesorter-blue tbody tr.odd td {
			background-color: #ebf2fa;
		}
		.tablesorter-blue tbody tr.even td {
			background-color: #fff;
		}
		
		/* Column Widget - column sort colors */
		.tablesorter-blue td.primary,
		.tablesorter-blue tr.odd td.primary {
			background-color: #99b3e6;
		}
		.tablesorter-blue tr.even td.primary {
			background-color: #c2d1f0;
		}
		.tablesorter-blue td.secondary,
		.tablesorter-blue tr.odd td.secondary {
			background-color: #c2d1f0;
		}
		.tablesorter-blue tr.even td.secondary {
			background-color: #d6e0f5;
		}
		.tablesorter-blue td.tertiary,
		.tablesorter-blue tr.odd td.tertiary {
			background-color: #d6e0f5;
		}
		.tablesorter-blue tr.even td.tertiary {
			background-color: #ebf0fa;
		}
		   
		/* caption */
		caption {
			background: #fff;
		}   
		
		/* filter widget */
		.tablesorter-blue .tablesorter-filter-row td {
			background: #eee;
			line-height: normal;
			text-align: center; /* center the input */
			-webkit-transition: line-height 0.1s ease;
			-moz-transition: line-height 0.1s ease;
			-o-transition: line-height 0.1s ease;
			transition: line-height 0.1s ease;
		}
		/* optional disabled input styling */
		.tablesorter-blue .tablesorter-filter-row .disabled {
			opacity: 0.5;
			filter: alpha(opacity=50);
			cursor: not-allowed;
		}
		/* hidden filter row */
		.tablesorter-blue .tablesorter-filter-row.hideme td {
			/*** *********************************************** ***/
			/*** change this padding to modify the thickness     ***/
			/*** of the closed filter row (height = padding x 2) ***/
			padding: 2px;
			/*** *********************************************** ***/
			margin: 0;
			line-height: 0;
			cursor: pointer;
		}
		.tablesorter-blue .tablesorter-filter-row.hideme .tablesorter-filter {
			height: 1px;
			min-height: 0;
			border: 0;
			padding: 0;
			margin: 0;
			/* don't use visibility: hidden because it disables tabbing */
			opacity: 0;
			filter: alpha(opacity=0);
		}
		/* filters */
		.tablesorter-blue .tablesorter-filter {
			width: 98%;
			height: auto;
			margin: 0;
			padding: 4px;
			background-color: #fff;
			border: 1px solid #bbb;
			color: #333;
			-webkit-box-sizing: border-box;
			-moz-box-sizing: border-box;
			box-sizing: border-box;
			-webkit-transition: height 0.1s ease;
			-moz-transition: height 0.1s ease;
			-o-transition: height 0.1s ease;
			transition: height 0.1s ease;
		}
		
		/* ajax error row */
		.tablesorter .tablesorter-errorRow td {
			cursor: pointer;
			background-color: #e6bf99;
		}
		
		#myTable tfoot th {
			text-align: right;
		} 



</style>
</head>
<body>
<htmlpageheader name="MyHeader1">
{/literal}
<div style="text-align: left; border-bottom: 1px solid #000000; font-weight: bold; font-size: 10pt;">
	<table>
		<tr>
			<td style="font-size: 25px; font-weight: bold">Rejestr sprzedaży VAT</td>
		</tr>
		<tr>
			<td style="font-size: 12px; font-weight: bold">SAAS-SYSTEMS</td>
		</tr>
		<tr>
			<td style="font-size: 12px; font-weight: bold">Data wygenerowania: {$current_date_formatted}</td>
		</tr>
		<tr>
			<td style="font-size: 12px; font-weight: bold">Rejestr od {$date_from_formatted} do {$date_to_formatted}</td>
		</tr>
		<tr>
			<td style="font-size: 12px; font-weight: bold">Typ dokumentu: {$searchByType|upper} </td>
		</tr>
	</table>
</div>
{literal}
</htmlpageheader>


<htmlpagefooter name="MyFooter1">
<table width="100%" style="vertical-align: bottom; font-family: serif; font-size: 8pt;
    color: #000000; font-weight: bold; font-style: italic;"><tr>
    <td width="33%"><span style="font-weight: bold; font-style: italic;">{DATE j.m.Y}</span></td>
    <td width="33%" align="center" style="font-weight: bold; font-style: italic;">{PAGENO}/{nbpg}</td>
    <td width="33%" style="text-align: right; ">Rejestr sprzedaży VAT</td>
    </tr></table>
</htmlpagefooter>

<htmlpagefooter name="MyFooter2">
<table width="100%" style="vertical-align: bottom; font-family: serif; font-size: 8pt;
    color: #000000; font-weight: bold; font-style: italic;"><tr>
    <td width="33%"><span style="font-weight: bold; font-style: italic;">SAAS-SYSTEMS</span></td>
    <td width="33%" align="center" style="font-weight: bold; font-style: italic;">{PAGENO}/{nbpg}</td>
    <td width="33%" style="text-align: right; ">{DATE j-m-Y}</td>
    </tr></table>
</htmlpagefooter>
{/literal}
<div>
{assign var=position value=1} 
{foreach from=$DATA item=PART name=part"}
{assign var=dataCount value=$DATA|@count} 

<table id="myTable" class="tablesorter-blue">
<thead>
		<tr>
			<th style="border-left: 1px solid black; border-top: 1px solid black;">Lp.</th>
			<th style="border-left: 1px solid black; border-top: 1px solid black;">{$MOD.LBL_DOC_NUMBER}</th>
			<th style="border-top: 1px solid black;">{$MOD.LBL_CREATE_LAB}</th>
			<th style="border-top: 1px solid black;">{$MOD.LBL_SALE_DATE}</th>
			<th style="border-top: 1px solid black;">{$MOD.LBL_CONTRACTOR_NIP}</th>
			<th style="border-top: 1px solid black;">{$MOD.LBL_LIST_SUBJECT}</th> 
			<th class="sorter-saas" style="border-top: 1px solid black;">{$MOD.LBL_ADDRESS}</th> 
			<th class="sorter-saas" style="border-top: 1px solid black;">{$MOD.LBL_GROSS_SALES}</th> 
			{ if $showNetto7 }<th class="sorter-saas" style="border-top: 1px solid black;">{$MOD.LBL_NET_SALES} 7%</th>{/if}
			{ if $showNetto7 }<th class="sorter-saas" style="border-top: 1px solid black;">{$MOD.LBL_VAT} 7%</th>{/if} 
			{ if $showNetto8 }<th class="sorter-saas" style="border-top: 1px solid black;">{$MOD.LBL_NET_SALES} 8%</th>{/if}
			{ if $showNetto8 }<th class="sorter-saas" style="border-top: 1px solid black;">{$MOD.LBL_VAT} 8%</th>{/if} 
			{ if $showNetto22 }<th class="sorter-saas" style="border-top: 1px solid black;">{$MOD.LBL_NET_SALES} 22%</th>{/if}
			{ if $showNetto22 }<th class="sorter-saas" style="border-top: 1px solid black;">{$MOD.LBL_VAT} 22%</th> {/if}
			{ if $showNetto23 }<th class="sorter-saas" style="border-top: 1px solid black;">{$MOD.LBL_NET_SALES} 23%</th>{/if}
			{ if $showNetto23 }<th class="sorter-saas" style="border-top: 1px solid black;">{$MOD.LBL_VAT} 23%</th>{/if} 
			{ if $showNetto0 }<th class="sorter-saas" style="border-top: 1px solid black;">{$MOD.LBL_NET_SALES} 0%</th> {/if} 
			<th class="sorter-saas" style="border-top: 1px solid black; border-right: 1px solid black;">{$MOD.LBL_SUM_VAT}</th> 
			<!-- <th class="sorter-saas">{$MOD.LBL_COST_OF}</th>  --> 
		</tr>
	</thead>
	<tfoot>
		<tr>
			<th colspan="7">Suma strony</th>
			<th style="text-align:right;">{ $PART.partSum.brutto|number_format:2:",":"." }</th>
			{ if $showNetto7 }<th style="text-align:right;">{ $PART.partSum.netto7|number_format:2:",":"." }</th>{/if}
			{ if $showNetto7 }<th style="text-align:right;">{ $PART.partSum.vat7|number_format:2:",":"." }</th>{/if}
			{ if $showNetto8 }<th style="text-align:right;">{ $PART.partSum.netto8|number_format:2:",":"." }</th>{/if}
			{ if $showNetto8 }<th style="text-align:right;">{ $PART.partSum.vat8|number_format:2:",":"." }</th>{/if}
			{ if $showNetto22 }<th style="text-align:right;">{ $PART.partSum.netto22|number_format:2:",":"." }</th>{/if}
			{ if $showNetto22 }<th style="text-align:right;">{ $PART.partSum.vat22|number_format:2:",":"." }</th>{/if}
			{ if $showNetto23 }<th style="text-align:right;">{ $PART.partSum.netto23|number_format:2:",":"." }</th>{/if}
			{ if $showNetto23 }<th style="text-align:right;">{ $PART.partSum.vat23|number_format:2:",":"." }</th>{/if}
			{ if $showNetto0 }<th style="text-align:right;">{ $PART.partSum.netto0|number_format:2:",":"." }</th>{/if}
			<th class="align-right">{ $PART.partSum.vat|number_format:2:",":"." }</th>
			<!-- <th class="align-right">{ $PART.partSum.purchase_price|number_format:2:",":"."}</th> -->
		</tr>
		<tr>
			<th colspan="7">Suma z przeniesienia:</th>
			<th style="text-align:right;">{ $PART.transferSum.brutto|number_format:2:",":"." }</th>
			{ if $showNetto7 }<th style="text-align:right;">{ $PART.transferSum.netto7|number_format:2:",":"." }</th>{/if}
			{ if $showNetto7 }<th style="text-align:right;">{ $PART.transferSum.vat7|number_format:2:",":"." }</th>{/if}
			{ if $showNetto8 }<th style="text-align:right;">{ $PART.transferSum.netto8|number_format:2:",":"." }</th>{/if}
			{ if $showNetto8 }<th style="text-align:right;">{ $PART.transferSum.vat8|number_format:2:",":"." }</th>{/if}
			{ if $showNetto22 }<th style="text-align:right;">{ $PART.transferSum.netto22|number_format:2:",":"." }</th>{/if}
			{ if $showNetto22 }<th style="text-align:right;">{ $PART.transferSum.vat22|number_format:2:",":"." }</th>{/if}
			{ if $showNetto23 }<th style="text-align:right;">{ $PART.transferSum.netto23|number_format:2:",":"." }</th>{/if}
			{ if $showNetto23 }<th style="text-align:right;">{ $PART.transferSum.vat23|number_format:2:",":"." }</th>{/if}
			{ if $showNetto0 }<th style="text-align:right;">{ $PART.transferSum.netto0|number_format:2:",":"." }</th>{/if}
			<th class="align-right">{ $PART.transferSum.vat|number_format:2:",":"." }</th>
			<!--  <th class="align-right">{ $PART.transferSum.purchase_price|number_format:2:",":"."}</th>  -->
		</tr>
		<tr>
			<th colspan="7">Suma razem:</th>
			<th style="text-align:right;">{ $PART.partSum.brutto+$PART.transferSum.brutto|number_format:2:",":"." }</th>
			{ if $showNetto7 }<th style="text-align:right;">{ $PART.partSum.netto7+$PART.transferSum.netto7|number_format:2:",":"." }</th>{/if}
			{ if $showNetto7 }<th style="text-align:right;">{ $PART.partSum.vat7+$PART.transferSum.vat7|number_format:2:",":"." }</th>{/if}
			{ if $showNetto8 }<th style="text-align:right;">{ $PART.partSum.netto8+$PART.transferSum.netto8|number_format:2:",":"." }</th>{/if}
			{ if $showNetto8 }<th style="text-align:right;">{ $PART.partSum.vat8+$PART.transferSum.vat8|number_format:2:",":"." }</th>{/if}
			{ if $showNetto22 }<th style="text-align:right;">{ $PART.partSum.netto22+$PART.transferSum.netto22|number_format:2:",":"." }</th>{/if}
			{ if $showNetto22 }<th style="text-align:right;">{ $PART.partSum.vat22+$PART.transferSum.vat22|number_format:2:",":"." }</th>{/if}
			{ if $showNetto23 }<th style="text-align:right;">{ $PART.partSum.netto23+$PART.transferSum.netto23|number_format:2:",":"." }</th>{/if}
			{ if $showNetto23 }<th style="text-align:right;">{ $PART.partSum.vat23+$PART.transferSum.vat23|number_format:2:",":"." }</th>{/if}
			{ if $showNetto0 }<th style="text-align:right;">{ $PART.partSum.netto0+$PART.transferSum.netto0|number_format:2:",":"." }</th>{/if}
			<th class="align-right">{ $PART.partSum.vat+$PART.transferSum.vat|number_format:2:",":"." }</th>
			<!-- <th class="align-right">{ $PART.partSum.purchase_price+$PART.transferSum.purchase_price|number_format:2:",":"."}</th>  -->
		</tr>
		
		{if $smarty.foreach.part.index == $dataCount-1 }
		<tr>
			<th colspan="15" style="text-align: left; padding: 5px; background-color: white; border-bottom: 2px solid black; color: #000; font-size: 12px;">Koniec wydruku</th>
		</tr>
		{/if}
	</tfoot>
	<tbody aria-live="polite" aria-relevant="all">
		{foreach from=$PART  key=key item=ROW name=loop}
		{assign var=partCount value=$PART|@count} 
		{if $smarty.foreach.loop.index != $partCount-1 and $smarty.foreach.loop.index != $partCount-2 }
			<tr>
			<td>{$position}</td>
			<td>{$ROW.document_no }</td>
			<td>{$ROW.register_date}</td>
			<td>{$ROW.sell_date }</td>
			<td>{$ROW.account.to_vatid}</td>
			<td>{$ROW.account.name}</td>
			<td>{$ROW.account.register_address_postalcode} {$ROW.account.register_address_city}</td>
			<td style="text-align:right;">{$ROW.total_brutto|number_format:2:",":"."}</td>		
			{ if $showNetto7 }<td style="text-align:right;">{$ROW.netto7|number_format:2:",":"."}</td>{/if}
			{ if $showNetto7 }<td style="text-align:right;">{$ROW.vat7|number_format:2:",":"."}</td>{/if}
			{ if $showNetto8 }<td style="text-align:right;">{$ROW.netto8|number_format:2:",":"."}</td>{/if}
			{ if $showNetto8 }<td style="text-align:right;">{$ROW.vat8|number_format:2:",":"."}</td>{/if}
			{ if $showNetto22 }<td style="text-align:right;">{$ROW.netto22|number_format:2:",":"."}</td>{/if}
			{ if $showNetto22 }<td style="text-align:right;">{$ROW.vat22|number_format:2:",":"."}</td>{/if}
			{ if $showNetto23 }<td style="text-align:right;">{$ROW.netto23|number_format:2:",":"."}</td>{/if}
			{ if $showNetto23 }<td style="text-align:right;">{$ROW.vat23|number_format:2:",":"."}</td>{/if}
			{ if $showNetto0 }<td style="text-align:right;">{$ROW.netto0|number_format:2:",":"."}</td>{/if}
			<td style="text-align:right;">{$ROW.netto23*0.23|number_format:2:",":"."}</td>
			<!--  <td style="text-align:right;">{$ROW.purchase_price|number_format:2:",":"."}</td>  -->
			</tr>
			{assign var=position value=$position+1}
		{/if}
		{/foreach}
	</tbody>
	</table>
	{if $smarty.foreach.part.index != $dataCount-1 }
	<newpage>
	{/if}

{/foreach}
</div>


 

</body></html>


