{include file="clearheader.html" landscape=true}
<!--// $Id$ //-->
{$report_type = ConfigHelper::getConfig('phpui.report_type')}
{foreach from=$pages item=item}
{assign var=previtem value=$item-1}
{if $report_type == 'pdf'}
{if $item > 1}<page>{/if}
{else}
<DIV{if $item > 1} style="page-break-before: always; border-style: none;"{/if}>
{/if}
<TABLE WIDTH="100%" CELLPADDING="3" ALIGN="CENTER">
	<TR>
		<TD WIDTH="535" ALIGN="LEFT">
			<B><span class="hdf">{$layout.pagetitle}</B></span><span class="sdr">{if $pagescount} ({t a=$item b=$pagescount}Page $a from $b{/t}){/if}</span><BR>
			{if $layout.username} <B>{$layout.username}</B>{/if}
			{if $layout.registry} <B>{$layout.registry}</B>{/if}
			{if $layout.group} <B>{$layout.group}</B>{/if}
		</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}Created 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="45" CLASS="HEAD" ALIGN="CENTER">
			{trans("Number")}<BR>
			{trans("Date")}
		</TD>
		<TD WIDTH="225" CLASS="HEAD" ALIGN="CENTER">
			{trans("Customer")}
		</TD>
		<TD WIDTH="180" CLASS="HEAD" ALIGN="CENTER">
			{trans("Title")}
		</TD>
		<TD WIDTH="50" CLASS="HEAD" ALIGN="CENTER">
			{trans("Income")}
		</TD>
		<TD WIDTH="50" CLASS="HEAD" ALIGN="CENTER">
			{trans("Expense")}
		</TD>
		<TD WIDTH="50" CLASS="HEAD" ALIGN="CENTER">
			{trans("After")}
		</TD>
	</TR>
	{cycle values="white,grey" print=false}
        {section name=receiptlist loop=$receiptlist start=$totals.$item.rowstart max=$totals.$item.rows}
	<TR class="{cycle}">
		<TD ALIGN="CENTER">
			{counter}.
		</TD>
		<TD ALIGN="RIGHT" NOWRAP>
			{$receiptlist[receiptlist].number}<BR>
			{$receiptlist[receiptlist].cdate|date_format:"d.m.Y"}
		</TD>
		<TD ALIGN="LEFT">
			{$receiptlist[receiptlist].name} {if $receiptlist[receiptlist].customerid}({$receiptlist[receiptlist].customerid|string_format:"%04d"}){/if}<BR>
			{$receiptlist[receiptlist].zip} {$receiptlist[receiptlist].city} {$receiptlist[receiptlist].address}
		</TD>
		<TD ALIGN="LEFT">
			{foreach from=$receiptlist[receiptlist].title item=title}
				{$title|truncate:"100":"":true}<BR>
			{/foreach}
		</TD>
		<TD ALIGN="RIGHT" NOWRAP>
			{if $receiptlist[receiptlist].value > 0}{moneyf($receiptlist[receiptlist].value, $receiptlist[receiptlist].currency)}{else}-{/if}
		</TD>
		<TD ALIGN="RIGHT" NOWRAP>
			{if $receiptlist[receiptlist].value < 0}{moneyf($receiptlist[receiptlist].value*-1, $receiptlist[receiptlist].currency)}{else}-{/if}
		</TD>
		<TD ALIGN="RIGHT" NOWRAP>
			{moneyf($receiptlist[receiptlist].after)}
		</TD>
	</TR>
	{/section}
	<TR>
		<TD COLSPAN="4" ALIGN="RIGHT">
			<B>{trans("Page total")}</B>
		</TD>
		<TD ALIGN="RIGHT">
		        <B>{moneyf($totals.$item.income)}</B>
		</TD>
		<TD ALIGN="RIGHT">
		        <B>{moneyf($totals.$item.expense)}</B>
		</TD>
		<TD></TD>
	</TR>
	<TR>
		<TD COLSPAN="4" ALIGN="RIGHT">
			<B>{trans("Transfered from previous page")}</B>
		</TD>
		<TD ALIGN="RIGHT">
		        <B>{moneyf($totals.$previtem.totalincome)}</B>
		</TD>
		<TD ALIGN="RIGHT">
		        <B>{moneyf($totals.$previtem.totalexpense)}</B>
		</TD>
		<TD></TD>
	</TR>
	<TR>
		<TD COLSPAN="4" ALIGN="RIGHT">
			<B>{trans("Total from start of period")}</B>
		</TD>
		<TD ALIGN="RIGHT">
			<B>{moneyf($totals.$item.totalincome)}</B>
		</TD>
		<TD ALIGN="RIGHT">
			<B>{moneyf($totals.$item.totalexpense)}</B>
		</TD>
		<TD></TD>
	</TR>
</TABLE>
{if $report_type == 'pdf'}
{if $item > 1}</page>{/if}
{else}
</DIV>
{/if}
{foreachelse}
<TABLE WIDTH="100%" CELLPADDING="3" ALIGN="CENTER">
	<TR style="border-style: none;">
		<TD WIDTH="535" ALIGN="LEFT">
			<B><span class="hdf">{$layout.pagetitle}</span></B><BR>
			{if $layout.username} <B>{$layout.username}</B>{/if}
			{if $layout.registry} <B>{$layout.registry}</B>{/if}
		</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}Created 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="45" CLASS="HEAD" ALIGN="CENTER">
			{trans("Number")}<BR>
			{trans("Date")}
		</TD>
		<TD WIDTH="225" CLASS="HEAD" ALIGN="CENTER">
			{trans("Customer")}
		</TD>
		<TD WIDTH="180" CLASS="HEAD" ALIGN="CENTER">
			{trans("Title")}
		</TD>
		<TD WIDTH="50" CLASS="HEAD" ALIGN="CENTER">
			{trans("Income")}
		</TD>
		<TD WIDTH="50" CLASS="HEAD" ALIGN="CENTER">
			{trans("Expense")}
		</TD>
		<TD WIDTH="50" CLASS="HEAD" ALIGN="CENTER">
			{trans("After")}
		</TD>
	</TR>
	<tr>
		<td colspan="7" class="empty-table">
			{trans("No such cash receipts in database.")}
		</td>
	</tr>
</TABLE>
{/foreach}
{include file="clearfooter.html"}
