{include file="clearheader.html"}
<!--// $Id$ //-->
<TABLE WIDTH="100%" CELLPADDING="3" ALIGN="CENTER">
	<TR>
		<TD WIDTH="535" ALIGN="LEFT">
			<H1>{$layout.pagetitle}</H1>
		</TD>
		<TD WIDTH="180" 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}Prepared by: $a{/t}
		</TD>
	</TR>
</TABLE>
<BR>
<TABLE WIDTH="100%" CELLPADDING="3" BORDER="1" ALIGN="CENTER">
	<TR>
		<TD WIDTH="15" CLASS="HEAD" ALIGN="CENTER">
			{trans("No.")}
		</TD>
		<TD WIDTH="450" CLASS="HEAD" ALIGN="CENTER">
			{trans("Customer")}
		</TD>
		<TD WIDTH="35" CLASS="HEAD" ALIGN="CENTER">
			{trans("Gross value")}
		</TD>
		{foreach item=tax from=$taxes}
		<TD WIDTH="35" CLASS="HEAD" ALIGN="CENTER">
			{trans("Net value")}
		</TD>
		<TD WIDTH="35" CLASS="HEAD" ALIGN="CENTER">
			{trans("Tax value")} {$tax.label}
		</TD>
		{/foreach}
		<TD WIDTH="35" CLASS="HEAD" ALIGN="CENTER">
			{trans("Total Tax")}
		</TD>
	</TR>
	{$total_value = array()}
	{$total_tax = array()}
	{cycle values="white,grey" print=false}
	{foreach $reportlist as $report}
	<TR class="{cycle}">
		<TD ALIGN="CENTER">
			{counter}.
		</TD>
		<TD>
			<B>{$report.customername}</B> ({$report.id|string_format:"%04d"})<BR>
			{$report.address}
			{if $report.ten}<BR>{$report.ten}{/if}
		</TD>
		<TD ALIGN="RIGHT">
			{foreach $report.values as $currency => $values}
				{if !$values@first}<br>{/if}
				{moneyf($values.value, $currency)}
				{if !isset($total_value[$currency])}
					{$total_value[$currency] = 0}
				{/if}
				{$total_value[$currency] = $total_value[$currency] + $values.value}
			{/foreach}
		</TD>
		{foreach item=tax from=$taxes}
		{assign var=taxid value=$tax.id}
		<TD ALIGN="RIGHT">
			{foreach $report.values as $currency => $values}
				{if !$values@first}<br>{/if}
				{moneyf($values[$taxid].netto, $currency)}
			{/foreach}
		</TD>
		<TD ALIGN="RIGHT">
			{foreach $report.values as $currency => $values}
				{if !$values@first}<br>{/if}
				{moneyf($values[$taxid].tax, $currency)}
			{/foreach}
		</TD>
		{/foreach}
		<TD ALIGN="RIGHT">
			{foreach $report.values as $currency => $values}
				{if !$values@first}<br>{/if}
				{moneyf($values.taxsum, $currency)}
				{if !isset($total_tax[$currency])}
					{$total_tax[$currency] = 0}
				{/if}
				{$total_tax[$currency] = $total_tax[$currency] + $values.taxsum}
			{/foreach}
		</TD>
	</TR>
	{foreachelse}
	<tr>
		<td colspan="{math equation="4+x*2" x=$taxescount}" class="empty-table">
			{trans("No such liabilities in selected date.")}
		</td>
	</tr>
	{/foreach}
	<TR>
		<TD CLASS="HEADGREY" COLSPAN="2" ALIGN="RIGHT">
			<B>{trans("Total:")}</B>
		</TD>
		<TD CLASS="HEADGREY" ALIGN="RIGHT">
			<B>
				{foreach $total_value as $currency => $value}
					{if !$value@first}<br>{/if}
					{moneyf($value, $currency)}
				{/foreach}
			</B>
		</TD>
		{foreach item=tax from=$taxes}
		{assign var=taxid value=$tax.id}
		<TD CLASS="HEADGREY" ALIGN="RIGHT">
			<B>
				{foreach $total.netto as $currency => $total_netto}
					{if !$total_netto@first}<br>{/if}
					{moneyf($total_netto.$taxid, $currency)}
				{/foreach}
			</B>
		</TD>
		<TD CLASS="HEADGREY" ALIGN="RIGHT">
			<B>
				{foreach $total.tax as $currency => $total_tax}
					{if !$total_tax@first}<br>{/if}
					{moneyf($total_tax.$taxid, $currency)}
				{/foreach}
			</B>
		</TD>
		{/foreach}
		<TD CLASS="HEADGREY" ALIGN="RIGHT">
			<B>
				{foreach $total_tax as $currency => $tax}
					{if !$tax@first}<br>{/if}
					{moneyf($tax, $currency)}
				{/foreach}
			</B>
		</TD>
	</TR>
</TABLE>
{include file="clearfooter.html"}
