<!--// $Id$ //-->
{include file="clearheader.html"}
{$colspan = 5 + $taxescount}
{$colspan2 = 4}
{if $printextid}
	{$colspan = $colspan + 1}
	{$colspan2 = $colspan2 + 1}
{/if}
<TABLE WIDTH="100%" CELLPADDING="3" ALIGN="CENTER">
	<TR>
		<TD WIDTH="800" ALIGN="LEFT">
			<P class="hdf"><B>{$layout.pagetitle}</B>
			{if $layout.division}<BR><span class="sdr"><B>{implode(', ', $layout.division)}</B></span>{/if}
			{if $layout.group}<BR><span class="sdr"><B>{$layout.group}</B></span>{/if}
			{if $layout.servicetypes}<BR><span class="sdr"><strong>{$layout.servicetypes}</strong></span>{/if}
			</P>
		</TD>
		<TD WIDTH="200" ALIGN="RIGHT" NOWRAP>
			LMS {$layout.lmsv} @ {$layout.hostname}<BR>
			{t a=trans($smarty.now|date_format:"l") b=$smarty.now|date_format:"Y-m-d"}<!date-format>$a, $b{/t}
			<br>
			{t a=$layout.logname}Created by: $a{/t}
		</TD>
	</TR>
</TABLE>
<BR>
<TABLE WIDTH="100%" CELLPADDING="3" BORDER="1" ALIGN="CENTER">
	<TR>
		<TD WIDTH="25" CLASS="HEAD" ALIGN="CENTER">
			{trans("No.")}
		</TD>
		<TD WIDTH="100" CLASS="HEAD" ALIGN="CENTER">
			{if in_array(DOC_DNOTE, $doctypes)}{trans("Debit Note No.")}{else}{trans("Invoice No.")}{/if}<BR>
			{trans("Draw-up date")}
		</TD>
		<TD WIDTH="100" CLASS="HEAD" ALIGN="CENTER">
			{trans("Sale date")}<BR>
			{trans("Deadline")}
		</TD>
		<TD WIDTH="520" CLASS="HEAD" ALIGN="CENTER">
			{trans("Contractor")}
		</TD>
		{if $printextid}
			<td width="25" class="HEAD" align="center">
				{trans("Document external ID")}
			</td>
		{/if}
		<TD WIDTH="50" CLASS="HEAD" ALIGN="CENTER">
			{if in_array(DOC_DNOTE, $doctypes)}{trans("Value")}{else}{trans("Gross value")}{/if}
		</TD>
		{if !in_array(DOC_DNOTE, $doctypes)}
		{foreach item=tax from=$taxes}
		<TD WIDTH="50" CLASS="HEAD" ALIGN="CENTER">
			{trans("Net value")} {$tax.label}
		</TD>
		{if $tax.value}
		<TD WIDTH="50" CLASS="HEAD" ALIGN="CENTER">
			{trans("Tax value")} {$tax.label}
		</TD>
		{/if}
		{/foreach}
		<TD WIDTH="50" CLASS="HEAD" ALIGN="CENTER">
			{trans("Total Tax")}
		</TD>
		{/if}
	</TR>
	{if !$printonlysummary}
	{cycle values="grey,white" print=false}
	{foreach $invoicelist as $invoice}
	<TR class="{cycle}">
		<TD ALIGN="CENTER">
			{counter}.
		</TD>
		<TD ALIGN="RIGHT">
			<B>{$invoice.number}</B><BR>
			{$invoice.cdate|date_format:"d.m.Y"}
		</TD>
		<TD ALIGN="RIGHT">
			{if $invoice.sdate}{$invoice.sdate|date_format:"d.m.Y"}{else}{$invoice.cdate|date_format:"d.m.Y"}{/if}<BR>
			{$invoice.pdate|date_format:"d.m.Y"}
		</TD>
		<TD>
			{strip}
			<strong>{$invoice.custname}</strong>
			{if !$printcustomerid}&nbsp;(#{$invoice.customerid}){/if}
			{if $invoice.ctype == $smarty.const.CTYPES_COMPANY || !$printcustomerssn}
				{if $invoice.ten}, {$invoice.ten}{/if}
			{/if}
			<br>
			{$invoice.custaddress}
			{/strip}
		</TD>
		{if $printextid}
			<td width="25" class="head" align="center">
				{$invoice.extid}
			</td>
		{/if}
		<TD ALIGN="RIGHT">
			{($invoice.brutto * $invoice.currencyvalue)|string_format:"%01.2f"}
			{if $invoice.currency != Localisation::getCurrentCurrency()}<br>({moneyf($invoice.brutto, $invoice.currency)}){/if}
		</TD>
		{if !in_array(DOC_DNOTE, $doctypes)}
		{foreach item=tax from=$taxes}
		{assign var=taxid value=$tax.id}
		<TD ALIGN="RIGHT">
			{($invoice.$taxid.val * $invoice.currencyvalue)|string_format:"%01.2f"}
			{if $invoice.currency != Localisation::getCurrentCurrency()}<br>({moneyf($invoice.$taxid.val, $invoice.currency)}){/if}
		</TD>
		{if $tax.value}
		<TD ALIGN="RIGHT">
			{($invoice.$taxid.tax * $invoice.currencyvalue)|string_format:"%01.2f"}
			{if $invoice.currency != Localisation::getCurrentCurrency()}<br>({moneyf($invoice.$taxid.tax, $invoice.currency)}){/if}
		</TD>
		{/if}
		{/foreach}
		<TD ALIGN="RIGHT">
			{($invoice.tax * $invoice.currencyvalue)|string_format:"%01.2f"}
			{if $invoice.currency != Localisation::getCurrentCurrency()}<br>({moneyf($invoice.tax, $invoice.currency)}){/if}
		</TD>
		{/if}
	</TR>
	{foreachelse}
	<tr>
		<td colspan="{$colspan}" class="empty-table">
			{trans("No such invoices in selected time period.")}
		</td>
	</tr>
	{/foreach}
	{/if}
	<TR>
		<TD CLASS="HEADGREY" COLSPAN="{$colspan2}" ALIGN="RIGHT">
			<B>{trans("<!invoice>Invoices with receipt")}</B>
		</TD>
		<TD CLASS="HEADGREY" ALIGN="RIGHT">
			<B>{$listdata.brutto_receipt|string_format:"%01.2f"}</B>
		</TD>
		{foreach item=tax from=$taxes}
			{assign var=taxid value=$tax.id}
			<TD CLASS="HEADGREY" ALIGN="RIGHT">
				<B>{$listdata.$taxid.val_receipt|string_format:"%01.2f"}</B>
			</TD>
			{if $tax.value}
				<TD CLASS="HEADGREY" ALIGN="RIGHT">
					<B>{$listdata.$taxid.tax_receipt|string_format:"%01.2f"}</B>
				</TD>
				{/if}
			{/foreach}
		<TD CLASS="HEADGREY" ALIGN="RIGHT">
			<B>{$listdata.tax_receipt|string_format:"%01.2f"}</B>
		</TD>
	</TR>
	<TR>
		<TD CLASS="HEADGREY" COLSPAN="{$colspan2}" ALIGN="RIGHT">
			<B>{trans("<!invoice>Correction notes with receipt")}</B>
		</TD>
		<TD CLASS="HEADGREY" ALIGN="RIGHT">
			<B>{$listdata.brutto_correction_note_receipt|string_format:"%01.2f"}</B>
		</TD>
		{foreach item=tax from=$taxes}
			{assign var=taxid value=$tax.id}
			<TD CLASS="HEADGREY" ALIGN="RIGHT">
				<B>{$listdata.$taxid.val_correction_note_receipt|string_format:"%01.2f"}</B>
			</TD>
			{if $tax.value}
				<TD CLASS="HEADGREY" ALIGN="RIGHT">
					<B>{$listdata.$taxid.tax_correction_note_receipt|string_format:"%01.2f"}</B>
				</TD>
			{/if}
		{/foreach}
		<TD CLASS="HEADGREY" ALIGN="RIGHT">
			<B>{$listdata.tax_correction_note_receipt|string_format:"%01.2f"}</B>
		</TD>
	</TR>
	<TR>
		<TD CLASS="HEADGREY" COLSPAN="{$colspan2}" ALIGN="RIGHT">
			<B>{trans("<!invoice>Without receipt")}</B>
		</TD>
		<TD CLASS="HEADGREY" ALIGN="RIGHT">
			<B>{$listdata.brutto|string_format:"%01.2f"}</B>
		</TD>
		{if !in_array(DOC_DNOTE, $doctypes)}
		{foreach item=tax from=$taxes}
		{assign var=taxid value=$tax.id}
		<TD CLASS="HEADGREY" ALIGN="RIGHT">
			<B>{$listdata.$taxid.val|string_format:"%01.2f"}</B>
		</TD>
		{if $tax.value}
		<TD CLASS="HEADGREY" ALIGN="RIGHT">
			<B>{$listdata.$taxid.tax|string_format:"%01.2f"}</B>
		</TD>
		{/if}
		{/foreach}
		<TD CLASS="HEADGREY" ALIGN="RIGHT">
			<B>{$listdata.tax|string_format:"%01.2f"}</B>
		</TD>
		{/if}
	</TR>
	<TR>
		<TD CLASS="HEADGREY" COLSPAN="{$colspan2}" ALIGN="RIGHT">
			<B>{trans("Total")}</B>
		</TD>
		<TD CLASS="HEADGREY" ALIGN="RIGHT">
			<B>{($listdata.brutto+$listdata.brutto_receipt)|string_format:"%01.2f"}</B>
		</TD>
		{foreach item=tax from=$taxes}
			{assign var=taxid value=$tax.id}
			<TD CLASS="HEADGREY" ALIGN="RIGHT">
				<B>{($listdata.$taxid.val+$listdata.$taxid.val_receipt)|string_format:"%01.2f"}</B>
			</TD>
			{if $tax.value}
				<TD CLASS="HEADGREY" ALIGN="RIGHT">
					<B>{($listdata.$taxid.tax+$listdata.$taxid.tax_receipt)|string_format:"%01.2f"}</B>
				</TD>
			{/if}
		{/foreach}
		<TD CLASS="HEADGREY" ALIGN="RIGHT">
			<B>{($listdata.tax+$listdata.tax_receipt)|string_format:"%01.2f"}</B>
		</TD>
	</TR>
</TABLE>
{include file="clearfooter.html"}
