{extends file="layout.html"}
{block name=title}LMS: {$layout.pagetitle|striphtml}{/block}
{block name=module_content}
<!--// $Id$ //-->

<style>

	.print-menu {
		display: flex;
		align-items: center;
	}

	.print-menu > *:not(:first-child) {
		margin-left: 1em;
	}

	.print-filter {
		display: flex;
		align-items: center;
	}

	#additional-properties {
		display: flex;
		flex-direction: column;
	}

</style>

<H1>{$layout.pagetitle}</H1>
{$default_printpage = ConfigHelper::getConfig('invoices.default_printpage')}
{if $printmenu=="customer"}
<form method="POST" name="printcustomerlist" id="printcustomerlist" action="?m=customerprint&type=customerlist">
<INPUT type="submit" class="hiddenbtn">
<TABLE class="lmsbox">
    <COLGROUP>
        <COL style="width: 1%;">
        <COL style="width: 99%;">
    </COLGROUP>
	<THEAD>
	<TR>
		<TH scope="col">
			<IMG src="img/customer.gif" alt="">
		</TH>
		<TH scope="col" class="bold nobr">
			{trans("Customers List:")}
		</TH>
	</TR>
	</THEAD>
	<TBODY>
	<TR>
		<TD class="container" style="width: 100%;" colspan="2">
			<TABLE width="100%" cellpadding="3">
				<TR>
					<TD style="width: 1%;" class="nobr">
						<TABLE>
							<TR>
								<TD style="width: 1%;"><IMG src="img/customer.gif" alt=""></TD>
								<TD style="width: 1%;" class="bold nobr">{trans("Status:")}</TD>
								<TD style="width: 98%;">
									<SELECT size="1" name="filter[]" {tip class="lms-ui-multiselect" text="Select customer's group"}
											data-default-value="— {trans("all<!customers>")} —" multiple>
										{foreach $_CSTATUSES as $statusidx => $status}
										<OPTION value="{$statusidx}"{if $statusidx == $smarty.const.CSTATUS_CONNECTED} selected{/if}>{$status.plurallabel}</OPTION>
										{/foreach}
										<OPTION VALUE="50">{trans("deleted<!plural>")}</OPTION>
										<OPTION VALUE="72">{trans("existing<!plural>")}</OPTION>
										<OPTION value="51">{trans("with disconnected nodes")}</OPTION>
										<OPTION value="63">{trans("with connected nodes")}</OPTION>
										<OPTION value="52">{trans("in debt")}</OPTION>
										<OPTION value="57">{trans("in debt above 100%")}</OPTION>
										<OPTION value="58">{trans("in debt above 200%")}</OPTION>
										<option value="79">{trans("with active tariffless liabilities")}</option>
										<option value="80">{trans("with tariffless liabilities")}</option>
										<OPTION value="59">{trans("without contracts")}</OPTION>
										<OPTION value="76">{trans("without active contracts")}</OPTION>
										<OPTION value="60">{trans("with expired contracts")}</OPTION>
										<OPTION value="77">{trans("with expired, active contracts")}</OPTION>
										<OPTION value="61">{trans("with expiring contracts")}</OPTION>
										<OPTION value="78">{trans("with expiring, active contracts")}</OPTION>
										<OPTION VALUE="75">{trans("with discount")}</OPTION>
										<OPTION value="73">{trans("with unarchived documents")}</OPTION>
										<OPTION value="-1" data-exclusive>{trans("without nodes")}</OPTION>
									</SELECT>
									<label>
										<INPUT class="radio" type="radio" value="AND" name="sk"{if $sk!='OR'} checked{/if}>
										{trans("and")}
									</label>
									<label>
										<INPUT class="radio" type="radio" value="OR" name="sk"{if $sk=='OR'} checked{/if}>
										{trans("or")}
									</label>
								</TD>
							</TR>
							<TR>
								<TD style="width: 1%;" class="nobr"><IMG src="img/division.gif" alt=""></TD>
								<TD style="width: 1%;" class="bold nobr">{trans("Division")}:</TD>
								<TD style="width: 98%;" class="nobr">
									<SELECT size="1" name="division" {tip text="Select division"}>
										<OPTION value="0">{trans("— all —")}</OPTION>
										{foreach $divisions as $item}
											<OPTION value="{$item.id}">{$item.label|escape}</OPTION>
										{/foreach}
									</SELECT>
								</TD>
							</TR>
							<TR>
								<TD style="width: 1%;"><IMG src="img/folder.gif" alt=""></TD>
								<TD style="width: 1%;" class="bold nobr">{trans("Legal personality:")}</TD>
								<TD style="width: 98%;" class="nobr">
									<SELECT size="1" name="type" {tip text="Select legal personality type"}>
										<OPTION value="" selected>{trans("— all —")}</OPTION>
										<OPTION value="{$smarty.const.CTYPES_PRIVATE}">{assign var='type' value=$smarty.const.CTYPES_PRIVATE}{$_CTYPES.$type}</OPTION>
										<OPTION value="{$smarty.const.CTYPES_COMPANY}">{assign var='type' value=$smarty.const.CTYPES_COMPANY}{$_CTYPES.$type}</OPTION>
									</SELECT>
								</TD>
							</TR>
							<TR>
								<TD style="width: 1%;"><IMG src="img/netdev.gif" alt=""></TD>
								<TD style="width: 1%;" class="bold nobr">{trans("Link type:")}</TD>
								<TD style="width: 98%;" class="nobr">
									<select size="1" name="linktype" {tip text="Select link type"}>
										<option value="">{trans("— all —")}</option>
										{foreach $_LINKTECHNOLOGIES as $linktype => $linktech}
											<option value="{$linktype}">{$_LINKTYPES[$linktype]}</option>
										{/foreach}
									</select>
								</TD>
							</TR>
							<TR>
								<TD style="width: 1%;"><IMG src="img/netdev.gif" alt=""></TD>
								<TD style="width: 1%;" class="bold nobr">{trans("Link speed:")}</TD>
								<TD style="width: 98%;" class="nobr">
									<SELECT size="1" name="linkspeed" {tip text="Select link speed"}>
										<OPTION value="">{trans("— all —")}</OPTION>
										{foreach from=$_LINKSPEEDS item=item key=key}
										<OPTION value="{$key}">{$item}</OPTION>
										{/foreach}
									</SELECT>
								</TD>
							</TR>
							<TR>
								<TD style="width: 1%;"><IMG src="img/network.gif" alt=""></TD>
								<TD style="width: 1%;" class="bold nobr">{trans("Network:")}</TD>
								<TD style="width: 98%;" class="nobr">
									<SELECT size="1" name="network" {tip text="Select network"}>
										<OPTION value="0" selected>{trans("— all networks —")}</OPTION>
										{section name="networks" loop=$networks}
										<OPTION value="{$networks[networks].id}">{$networks[networks].name|truncate:40:"&hellip;":true}</OPTION>
										{/section}
									</SELECT>
								</TD>
							</TR>
							<TR>
								<TD style="width: 1%;"><IMG src="img/group.gif" alt=""></TD>
								<TD style="width: 1%;" class="bold nobr">{trans("Group:")}</TD>
								<TD style="width: 98%;" class="nobr">
									<SELECT size="1" name="customergroup" {tip text="Select group"}>
										<OPTION value="0" selected>{trans("— all groups —")}</OPTION>
										{section name="customergroups" loop=$customergroups}
										<OPTION value="{$customergroups[customergroups].id}">{$customergroups[customergroups].name|truncate:40:"&hellip;":true}</OPTION>
										{/section}
									</SELECT>
								</TD>
							</TR>
							<TR>
								<TD style="width: 1%;"><IMG src="img/nodegroup.gif" alt=""></TD>
								<TD style="width: 1%;" class="bold nobr">{trans("Nodes Group:")}</TD>
								<TD style="width: 98%;" class="nobr">
									<SELECT size="1" name="nodegroup" {tip text="Select group"}>
										<OPTION value="" selected>{trans("— all groups —")}</OPTION>
										{foreach from=$nodegroups item=nodegroup}
										<OPTION value="{$nodegroup.id}">{$nodegroup.name|truncate:30:"&hellip;":true}</OPTION>
										{/foreach}
									</SELECT>
								</TD>
							</TR>
							<TR>
								<TD style="width: 1%;"><IMG src="img/state.gif" alt=""></TD>
								<TD style="width: 1%;" class="bold nobr">{trans("Country state:")}</TD>
								<TD style="width: 98%;" class="nobr">
									<SELECT name="stateid" {tip text="Select country state"}>
										<OPTION value="0">{trans("— all states —")}</OPTION>
										{foreach from=$cstateslist item=item key=key}
										<OPTION value="{$key}">{$item.name}</OPTION>
										{/foreach}
									</SELECT>
								</TD>
							</TR>
						</TABLE>
					</TD>
					<TD style="width: 1%;"><IMG src="img/view.gif" alt=""></TD>
					<TD style="width: 1%;" class="bold nobr">{trans("Sorting:")}</TD>
					<TD style="width: 97%;">
						<TABLE style="width: 1%;" {tip text="Select sorting direction and criteria"}>
							<TR>
								<TD style="width: 100%;" class="nobr">
									<SELECT SIZE="1" name="order">
										<OPTION value="customername" selected>{trans("First/last or Company name")}</OPTION>
										<OPTION value="id">{trans("Id")}</OPTION>
										<OPTION value="extid">{trans("External ID")}</OPTION>
										<OPTION value="balance">{trans("Balance")}</OPTION>
										<OPTION value="tariff">{trans("Subscription")}</OPTION>
										<OPTION value="address">{trans("Address")}</OPTION>
									</SELECT>
								</TD>
							</TR>
							<TR>
								<TD style="width: 100%;" class="nobr">
									<SELECT SIZE="1" name="direction">
										<OPTION value="asc" selected>{trans("ascending")}</OPTION>
										<OPTION value="desc">{trans("descending")}</OPTION>
									</SELECT>
								</TD>
							</TR>
						</TABLE>
					</TD>
				</TR>
				<TR>
					<TD style="width: 100%;" colspan="4">
						<TABLE>
							<TR>
								<TD style="width: 1%;"><IMG src="img/calendar.gif" alt=""></TD>
								<TD style="width: 1%;" class="bold nobr">{trans("Balance date:")}</TD>
								<TD style="width: 98%;" class="nobr">
									<INPUT type="text" name="day" size="10" maxlength="10" placeholder="{trans("yyyy/mm/dd")}" {tip class="lms-ui-date" text="Enter date in 'yyyy/mm/dd' format or click to choose it from calendar"}>
								</TD>
							</TR>
							<TR>
								<TD style="width: 1%;"><IMG src="img/docum.gif" alt=""></TD>
								<TD style="width: 99%;" class="nobr" colspan="2">
									<span class="bold nobr">{trans("With document of type:")}</span>
									<SELECT SIZE="1" name="doctype" {tip text="Select document type"}>
										<OPTION value="0">{trans("— all —")}</OPTION>
										{foreach from=$_DOCTYPES key=key item=item}
										<OPTION value="{$key}">{$item}</OPTION>
										{/foreach}
									</SELECT>
									<span class="bold nobr">{trans("in date:")}</span>
									{trans("From")}&nbsp;<INPUT type="text" name="docfrom" size="10" maxlength="10" placeholder="{trans("yyyy/mm/dd")}" {tip class="lms-ui-date" text="Enter date in 'yyyy/mm/dd' format or click to choose it from calendar"}>
									{trans("To")}&nbsp;<INPUT type="text" name="docto" size="10" maxlength="10" placeholder="{trans("yyyy/mm/dd")}" {tip class="lms-ui-date" text="Enter date in 'yyyy/mm/dd' format or click to choose it from calendar"}>
								</TD>
							</TR>
							<TR>
								<TD>
									<INPUT type="checkbox" name="sendingregister" value="1" id="sendingregister" {tip text="Check if would like to print customer list as sending register"}>
								</TD>
								<TD class="bold nobr" colspan="2">
									<label for="sendingregister">
										{trans("sending register format")}
									</label>
								</TD>
							</TR>
							{if !empty($promotions)}
								<tr>
									<td>
										{icon name="money"}
									</td>
									<td class="nobr">
										<strong>{trans("Promotion schema")}</strong>
									</td>
									<td colspan="2" class="nobr">
										<select size="1" name="promotion-schema">
											<option value="">{trans("— any —")}</option>
											{foreach $promotions as $promotion}
												<optgroup title="{$promotion.description|trunescape:512}"
													label="{$promotion.name}" data-valid="{$promotion.valid}"
													{if !$promotion.valid} class="blend"{/if}>
													{foreach $promotion.schemas as $schemaid => $schema}
														<option title="{$schema.description|trunescape:512}"
															value="{$schemaid}"{if $variables.schemaid == $schemaid} SELECTED{/if}
															data-valid="{$promotion.valid}"{if !$promotion.valid} class="blend"{/if}
														>{$schema.name|trunescape:40}</option>
													{/foreach}
											</optgroup>
											{/foreach}
										</select>
									</td>
								</tr>
							{/if}
							<TR>
								<TD>
									<INPUT type="checkbox" name="customernodes" value="1" id="customernodes">
								</TD>
								<TD class="bold nobr" colspan="2">
									<label for="customernodes">
										{trans("include customer node info")}
									</label>
								</TD>
							</TR>
						</TABLE>
					</TD>
				</TR>
			</TABLE>
		</TD>
	</TR>
	<TR>
		<TD style="width: 100%;" class="text-right" colspan="2">
			<A href="javascript:document.printcustomerlist.target='_blank';document.printcustomerlist.submit();">{trans("Print")} <IMG src="img/print.gif" alt="" style="margin: 0px 2px;"></A>
		</TD>
	</TR>
	</TBODY>
</TABLE>
</form>
{/if}
{if $printmenu=="finances"}
<form method="post" name="printbalancelist" id="printbalancelist" action="?m=print&type=balancelist" target="_blank">
	<input type="hidden" name="disposition" value="print">
	<input type="submit" class="hiddenbtn">
</form>
<table class="lmsbox">
	<colgroup>
		<col style="width: 1%;">
		<col style="width: 99%;">
	</colgroup>
	<thead>
		<tr>
			<th scope="col">
				{icon name="money" class="fa-fw"}
			</th>
			<th scope="col" class="nobr">
				<strong>{trans("Network Balance Sheet")}</strong>
			</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td class="container" colspan="2">
				<table>
					<colgroup>
						<col style="width: 1%;">
						<col style="width: 1%;">
						<col style="width: 1%;">
						<col style="width: 1%;">
						<col style="width: 96%;">
					</colgroup>
					<tr>
						<td class="nobr">
							<table>
								<colgroup>
									<col style="width: 1%;">
									<col style="width: 1%;">
									<col style="width: 98%;">
								</colgroup>
								<tbody>
									<tr>
										<td>
											{icon name="user" class="fa-fw"}
										</td>
										<td class="nobr">
											<strong>{trans("User")}</strong>
										</td>
										<td>
											<select size="1" name="user" {tip text="You can select user to limit results"}
												form="printbalancelist">
												<option value="">{trans("— all users —")}</option>
												{foreach $users as $user}
													<option value="{$user.id}">{$user.name|trunescape:40}</option>
												{/foreach}
											</select>
										</td>
									</tr>
									<tr>
										<td>
											{icon name="network" class="fa-fw"}
										</td>
										<td class="nobr">
											<strong>{trans("Network")}</strong>
										</td>
										<td>
											<select size="1" name="network" {tip text="Select network"}
												form="printbalancelist">
												<option value="0" selected>{trans("— all networks —")}</option>
												{foreach $networks as $network}
													<option value="{$network.id}">{$network.name|trunescape:40}</option>
												{/foreach}
											</select>
										</td>
									</tr>
									<tr>
										<td>
											{icon name="division" class="fa-fw"}
										</td>
										<td class="nobr">
											<strong>{trans("Division")}</strong>
										</td>
										<td class="nobr">
											<select size="1" name="division" {tip text="Select division"}
												form="printbalancelist">
												<option value="0">{trans("— all —")}</option>
												{foreach $divisions as $division}
													<option value="{$division.id}">{$division.label|escape}</option>
												{/foreach}
											</select>
										</td>
									</tr>
									<tr>
										<td>
											{icon name="customergroup" class="fa-fw"}
										</td>
										<td class="nobr">
											<strong>{trans("Groups")}</strong>
										</td>
										<td>
											<select size="1" name="customergroup[]" {tip class="lms-ui-multiselect" text="Select group"}
												form="printbalancelist"
												multiple data-default-value="{trans("— all groups —")}">
												{foreach $customergroups as $customergroup}
													<option value="{$customergroup.id}">{$customergroup.name|trunescape:40}</option>
												{/foreach}
											</select>
										</td>
									</tr>
								</tbody>
							</table>
						</td>
						<td class="nobr">
							<table>
								<colgroup>
									<col style="width: 1%;">
									<col style="width: 1%;">
									<col style="width: 98%;">
								</colgroup>
								<tbody>
									<tr>
										<td>
											{icon name="money" class="fa-fw"}}
										</td>
										<td class="nobr">
											<strong>{trans("Transaction type")}</strong>
										</td>
										<td class="multiselect">
											<select name="types[]" class="lms-ui-multiselect" {tip text="Select transaction type"}
												form="printbalancelist"
												multiple data-default-value="{trans("— all types —")}">
												<option value="1">{trans("Liability")}</option>
												<option value="2">{trans("Income")}</option>
												<option value="3">{trans("Expense")}</option>
											</select>
										</td>
									</tr>
									<tr>
										<td>
											{icon name="print" class="fa-fw"}
										</td>
										<td class="nobr">
											<strong>{trans("Documents")}</strong>
										</td>
										<td>
											<select size="1" name="docs" {tip text="Select transaction type"}
												form="printbalancelist">
												<option value="">{trans("— all —")}</option>
												<option value="documented">{trans("with document")}</option>
												<option value="notdocumented">{trans("without document")}</option>
											</select>
										</td>
									</tr>
									<tr>
										<td>
											{icon name="isource" class="fa-fw"}
										</td>
										<td class="nobr">
											<strong>{trans("Source")}</strong>
										</td>
										<td>
											<select size="1" name="source" {tip text="You can select import source to limit results"}
												form="printbalancelist">
												<option value="0">{trans("— all sources —")}</option>
												<option value="-1">{trans("— none —")}</option>
												{foreach $sourcelist as $item}
													<option value="{$item.id}">{$item.name}</option>
												{/foreach}
											</select>
										</td>
									</tr>
								</tbody>
							</table>
						</td>
						<td>
							{icon name="calendar" class="fa-fw"}
						</td>
						<td>
							<span class="lms-ui-date-period-container">
								<strong>{trans("Period")}</strong>
								{date_period_preset from="[form=\"printbalancelist\"][name=\"balancefrom\"]" to="[form=\"printbalancelist\"][name=\"balanceto\"]"}
								<span>{trans("From")}</span>
								<input type="text" name="balancefrom" size="10" maxlength="10"
									form="printbalancelist"
									placeholder="{trans("yyyy/mm/dd")}"
									{tip class="lms-ui-date" text="Enter date in 'yyyy/mm/dd' format or click to choose it from calendar"}>
								<span>{trans("To")}</span>
								<input type="text" name="balanceto" size="10" maxlength="10"
									form="printbalancelist"
									placeholder="{trans("yyyy/mm/dd")}"
									{tip class="lms-ui-date" text="Enter date in 'yyyy/mm/dd' format (empty field means current date) or click to choose it from calendar"}>
							</span>
						</td>
					</tr>
					<tr>
						<td colspan="5">
							<table>
								<colgroup>
									<col style="width: 1%;">
									<col style="width: 1%;">
									<col style="width: 98%;">
								</colgroup>
								<tbody>
									<td>
										{icon name="configuration"}
									</td>
									<td class="nobr">
										<strong>{trans("Adjust the print")}</strong>
									</td>
									<td class="nobr">
										<label>
											<input type="checkbox" name="printcustomerhideid" value="1"
												form="printbalancelist">
											{trans("hide customer ID")}
										</label>
										<label>
											<input type="checkbox" name="printcustomerhidessnten" value="1"
												form="printbalancelist">
											{trans("hide customer SSN/TEN")}
										</label>
										<label>
											<input type="checkbox" name="printcustomerhideaddress" value="1"
												form="printbalancelist">
											{trans("hide customer address")}
										</label>
									</td>
								</tbody>
							</table>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td class="lms-ui-box-buttons" colspan="2">
				{button icon="csv" label="CSV" id="printbalancelist-csv"}
				{button icon="print" label="Print" id="printbalancelist-print"}
			</td>
		</tr>
	</tbody>
</table>

<script>

	$(function() {
		$('#printbalancelist-csv').click(function() {
			$('form[name="printbalancelist"] [name="disposition"]').val('csv');
			$('#printbalancelist').submit();
		});

		$('#printbalancelist-print').click(function() {
			$('form[name="printbalancelist"] [name="disposition"]').val('print');
			$('#printbalancelist').submit();
		});
	});

</script>
{/if}
{if ($printmenu=="customer" || $printmenu=="finances") && (ConfigHelper::checkConfig('privileges.superuser') || !ConfigHelper::checkConfig('privileges.hide_finances'))}
<form method="post" name="printcustomerbalance" id="printcustomerbalance" action="?m=print&type=customerbalance">
<INPUT type="submit" class="hiddenbtn">
<TABLE class="lmsbox">
    <COLGROUP>
        <COL style="width: 1%;">
        <COL style="width: 99%;">
    </COLGROUP>
	<THEAD>
	<TR>
		<TH scope="col">
			<IMG src="img/money.gif" alt="">
		</TH>
		<TH scope="col" class="bold nobr">
			{trans("Customer Balance Sheet")}
		</TH>
	</TR>
	</THEAD>
	<TBODY>
	<TR>
		<TD style="width: 100%;" class="container" colspan="2">
			<TABLE width="100%" cellpadding="3">
				<TR>
					<TD style="width: 1%;">
						<IMG src="img/customer.gif" alt="">
					</TD>
					<TD style="width: 1%;" class="bold nobr">
						{trans("Customer:")}
					</TD>
					<TD style="width: 1%;" class="nobr">
						{customerlist form="printcustomerbalance" customers=$customers version=2
							selectname="cust" inputname="customer" firstoption=""}
					</TD>
					<TD style="width: 1%;">
						<IMG src="img/calendar.gif" alt="">
					</TD>
					<TD style="width: 96%;">
						<span class="lms-ui-date-period-container">
							<strong>{trans("Period:")}</strong>&nbsp;
							{date_period_preset from="#printcustomerbalance [name=\"from\"]" to="#printcustomerbalance [name=\"to\"]"}
							<span>{trans("From")}</span>
							<input type="text" name="from" size="10" maxlength="10"
								placeholder="{trans("yyyy/mm/dd")}"
								{tip class="lms-ui-date" text="Enter date in 'yyyy/mm/dd' format (empty field means 1970/01/01) or click to choose it from calendar"}>
							<span>{trans("To")}</span>
							<input type="text" name="to" size="10" maxlength="10"
								placeholder="{trans("yyyy/mm/dd")}"
								{tip class="lms-ui-date" text="Enter date in 'yyyy/mm/dd' format (empty field means current date) or click to choose it from calendar"}>
						</span>
					</TD>
				</TR>
			</TABLE>
		</TD>
	</TR>
	<TR>
		<TD style="width: 100%;" class="container" colspan="2">
			<TABLE width="100%" cellpadding="3">
				<TR>
					<TD style="width: 1%;">
						<img src="img/group.gif" alt="">
					</TD>
					<TD style="width: 99%;" colspan="4">
						<label>
							<input type="checkbox" name="aggregate_documents" value="1"{if ConfigHelper::checkConfig('phpui.aggregate_documents')} checked{/if}>
							{trans("aggregate documents")}
						</label>
					</TD>
				</TR>
			</TABLE>
		</TD>
	</TR>
	<TR>
		<TD style="width: 100%;" class="text-right" colspan="2">
			<A href="javascript:document.printcustomerbalance.target='_blank';document.printcustomerbalance.submit();">{trans("Print")} <IMG src="img/print.gif" alt="" style="margin: 0px 2px;"></A>
		</TD>
	</TR>
	</TBODY>
</TABLE>
</form>
{/if}
{if $printmenu=="finances"}
<form method="post" name="invoicereport" id="invoicereport" action="?m=invoicereport" target="_blank">
	<input type="submit" class="hiddenbtn">
</form>
<table class="lmsbox">
	<colgroup>
		<col style="width: 1%;">
		<col style="width: 99%;">
	</colgroup>
	<thead>
		<tr>
			<th scope="col">
				{icon name="money"}
			</th>
			<th scope="col" class="nobr">
				<strong>{trans("Sale Registry")}</strong>
			</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td class="container" style="width: 100%;" colspan="2">
				<table style="width: 100%;" cellpadding="3">
					<colgroup>
						<col style="width: 1%;">
						<col style="width: 1%;">
						<col style="width: 98%;">
					</colgroup>
					<tr>
						<td>
							<table style="width 100%;">
								<colgroup>
									<col style="width: 1%;">
									<col style="width: 1%;">
									<col style="width: 98%;">
								</colgroup>
								<tr>
									<td>
										{icon name="division"}
									</td>
									<td class="nobr">
										<strong>{trans("Division")}</strong>
									</td>
									<td colspan="2">
										<select size="1" name="division[]" form="invoicereport" multiple
											{tip text="Select division" class="lms-ui-multiselect"}
											data-default-value="{trans("— all —")}">
											{foreach $divisions as $item}
												<option value="{$item.id}">{$item.label|escape}</option>
											{/foreach}
										</>
									</td>
								</tr>
								<tr>
									<td>
										{icon name="customer"}
									</td>
									<td>
										<strong>{trans("Customers")}</strong>
									</td>
									<td>
										<select name="customer_type" form="invoicereport">
											<option value="-1">{trans("— all customers —")}</option>
											<option value="{$smarty.const.CTYPES_PRIVATE}">{trans("private person")}</option>
											<option value="{$smarty.const.CTYPES_COMPANY}">{trans("legal entity")}</option>
										</select>
									</td>
								</tr>
								<tr>
									<td>
										{icon name="user-id-number"}
									</td>
									<td>
										<strong>{trans("TEN")}</strong>
										{hint content="uses TEN from invoice"}
									</td>
									<td>
										<select name="customer_ten" form="invoicereport">
											<option value="0">{trans("— ignore —")}</option>
											<option value="1">{trans("with TEN")}</option>
											<option value="2">{trans("without TEN")}</option>
										</select>
									</td>
								</tr>
								<tr>
									<td>
										{icon name="customergroup"}
									</td>
									<td class="nobr">
										<strong>{trans("Group")}</strong>
									</td>
									<td class="multiselect nobr">
										<select size="4" name="group[]" class="lms-ui-multiselect"
												multiple {tip text="Select group"}
												form="invoicereport"
												data-default-value="{trans("— all groups —")}">
											{foreach $customergroups as $customergroup}
												<option value="{$customergroup.id}">{$customergroup.name|truncate:30:"&hellip;":true}</option>
											{/foreach}
										</>
									</td>
									<td>
										<label>
											<input type="checkbox" name="groupexclude" form="invoicereport"
												{if $listdata.groupexclude} checked{/if}>
											{trans("exclude group")}
										</label>
									</>
								</tr>
								<tr>
									<td>
										{icon name="id"}
									</td>
									<td class="nobr">
										<strong>{trans("Plan")}</strong>
									</td>
									<td colspan="2" class="multiselect">
										<select name="numberplanid[]" class="lms-ui-multiselect"
												form="invoicereport"
												style="min-width: 200px;" {tip text="Select numbering plan"} multiple
												data-default-value="{trans("— all —")}">
											{foreach $numberplans as $plan}
												{$period = $plan.period}
												<option value="{$plan.id}">{number number=$plan.next template=$plan.template time=$invoice.cdate}
													({$_NUM_PERIODS.$period})
												</option>
											{/foreach}
										</select>
									</td>
								</tr>
								<tr>
									<td>
										{icon name="money"}
									</td>
									<td class="nobr">
										<strong>{trans("Service types")}</strong>
									</td>
									<td colspan="2" class="nobr">
										<select name="servicetypes[]" class="lms-ui-multiselect" multiple
											form="invoicereport"
											data-default-value="{trans("— any —")}" data-shorten-to-default-value="false">
											{foreach Localisation::arraySort($_SERVICETYPES) as $type => $label}
												<option value="{$type}">{$label}</option>
											{/foreach}
										</select>
										<label>
											<input type="radio" name="servicetypeoper" value="or"
												form="invoicereport" checked>
											{trans("or<!operator>")}
										</label>
										<label>
											<input type="radio" name="servicetypeoper" value="and"
												form="invoicereport">
											{trans("and<!operator>")}
										</label>
									</td>
								</tr>
								<tr>
									<td class="valign-top">
										{icon name="configuration"}
									</td>
									<td class="nobr valign-top">
										<strong>{trans("Adjust the print")}</strong>
									</td>
									<td colspan="2">
										<label>
											<input type="checkbox" name="printcustomerid" value="1"
												form="invoicereport">
											{trans("hide customer ID")}
										</label>
										<label>
											<input type="checkbox" name="printcustomerssn" value="1"
												form="invoicereport">
											{trans("hide customer SSN")}
										</label>
										<label>
											<input type="checkbox" name="print-match-content-service-type" value="1"
												form="invoicereport">
											{trans("match document content service type")}
										</label>
										<label>
											<input type="checkbox" name="printonlysummary" value="1"
												form="invoicereport">
											{trans("only summary")}
										</label>
										<label>
											<input type="checkbox" name="printextid" value="1" form="invoicereport">
											{trans("document external ID")}
										</label>
									</td>
								</tr>
							</table>
						</td>
						<td>
							<table style="width: 100%;">
								<colgroup>
									<col style="width: 1%;">
									<col style="width: 1%;">
									<col style="width: 1%;">
									<col style="width: 97%;">
								</colgroup>
								<tr>
									<td>
										{icon name="calendar"}
									</td>
									<td class="nobr">
										<strong>{trans("Period")}</strong>
									</td>
									<td colspan="2">
										<span class="lms-ui-date-period-container">
											{date_period_preset from="[form=\"invoicereport\"][name=\"from\"]" to="[form=\"invoicereport\"][name=\"to\"]"}
											<span>{trans("From")}</span>
											<input type="text" name="from" size="10" maxlength="10"
												form="invoicereport"
												placeholder="{trans("yyyy/mm/dd")}"
												{tip class="lms-ui-date" text="Enter date in 'yyyy/mm/dd' format (empty field means current date) or click to choose it from calendar"}>
											<span>{trans("To")}</span>
											<input type="text" name="to" size="10" maxlength="10"
												form="invoicereport"
												placeholder="{trans("yyyy/mm/dd")}"
												{tip class="lms-ui-date" text="Enter date in 'yyyy/mm/dd' format (empty field means current date) or click to choose it from calendar"}>
										</span>
									</td>
								</tr>
								<tr>
									<td colspan="2"></td>
									<td colspan="2" class="nobr">
										{trans("Sorting")}
										<select name="sorttype" form="invoicereport" {tip text="Select sorting criterion"}>
											<option value="cdate">{trans("Draw-up date")}</option>
											<option value="sdate">{trans("Sale date")}</option>
											<option value="pdate">{trans("Deadline")}</option>
											<option value="number">{trans("Document number")}</option>
										</select>
									</td>
								</tr>
								<tr>
									<td>
										{icon name="document"}
									</td>
									<td class="nobr">
										<strong>{trans("Type")}</strong>
									</td>
									<TD colspan="2">
										<select name="doctype[]" {tip class="lms-ui-multiselect" text="Select document type"}
											multiple form="invoicereport"
											data-default-value="{trans("— all —")}">
											<option value="invoices">{trans("invoices")}</option>
											<option value="cnotes">{trans("credit notes")}</option>
											<option value="dnotes" data-exclusive>{trans("debit notes")}</option>
										</select>
									</TD>
								</tr>
								<tr>
									<td>
										{icon name="configuration"}
									</td>
									<td class="nobr">
										<strong>{trans("JPK flags")}</strong>
									</td>
									<TD colspan="2">
										<select name="jpk-flag" form="invoicereport">
											<option value="">{trans("— any —")}</option>
											<option value="{$smarty.const.DOC_FLAG_SPLIT_PAYMENT}" {tip text="translates into JPK MPP flag"}>{trans("split payment")}</option>
											<option value="{$smarty.const.DOC_FLAG_RECEIPT}" {tip text="translates into JPK FP flag"}>{trans("with receipt<!plural>")}</option>
											<option value="{$smarty.const.DOC_FLAG_TELECOM_SERVICE}" {tip text="translates into JPK EE flag"}>{trans("<!invoice>telecommunication service")}</option>
											<option value="{$smarty.const.DOC_FLAG_RELATED_ENTITY}" {tip text="translates into JPK TP flag"}>{trans("related entity")}</option>
										</select>
									</TD>
								</tr>
							</table>
						</td>
						<td class="nobr">
							<label>
								<input type="checkbox" name="extended" value="1" form="invoicereport">
								{trans("extended format")}
							</label>
							<br>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td class="lms-ui-box-buttons" colspan="2">
				{button type="submit" icon="print" label="Print" form="invoicereport"}
			</td>
		</tr>
	</tbody>
</table>
{/if}
{if $printmenu == "finances"}
<form method="post" name="printreceiptlist" id="printreceiptlist" action="?m=print&type=receiptlist">
	<input type="submit" class="hiddenbtn">
	<input type="hidden" name="csv" value="1" disabled>
</form>
<table class="lmsbox">
	<colgroup>
		<col style="width: 1%;">
		<col style="width: 99%;">
	</colgroup>
	<thead>
		<tr>
			<td>
				{icon name="money"}
			</td>
			<td class="nobr">
				<strong>{trans("Cash Report")}</strong>
			</td>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td class="container" colspan="2">
				<table style="width: 100%;" cellpadding="3">
					<colgroup>
						<col style="width: 1%;">
						<col style="width: 1%;">
						<col style="width: 1%;">
						<col style="width: 97%;">
					</colgroup>
					<tr>
						<td>
							<table style="width: 100%;">
								<colgroup>
									<col style="width: 1%;">
									<col style="width: 1%;">
									<col style="width: 98%;">
								</colgroup>
								<tr>
									<td>
										{icon name="queue"}
									</td>
									<td class="nobr">
										<strong>{trans("Registry")}</strong>
									</td>
									<td class="nobr">
										<select size="1" name="registry" form="printreceiptlist"
											{tip text="Select cash registry"}>
											<option value="0">{trans("— all —")}</option>
											{foreach $cashreglist as $c}
												<option value="{$c.id}">{$c.name|truncate:40:"&hellip;":true} ({$c.id|string_format:"%04d"})</option>
											{/foreach}
										</select>
									</td>
								</tr>
								<tr>
									<td>
										{icon name="customergroup"}
									</td>
									<td class="nobr">
										<strong>{trans("Group")}</strong>
									</td>
									<td class="nobr">
										<select size="1" name="group" form="printreceiptlist">
											<option value="0" selected>{trans("— all groups —")}</option>
											{foreach $customergroups as $customergroup}
												<option value="{$customergroup.id}">{$customergroup.name|truncate:30:"&hellip;":true}</option>
											{/foreach}
										</select>
										<label>
											<input type="checkbox" name="groupexclude" form="printreceiptlist"
												{if $listdata.groupexclude} checked{/if}>
											{trans("exclude group")}
										</label>
									</td>
								</tr>
								<tr>
									<td>
										{icon name="user"}
									</td>
									<td class="nobr">
										<strong>{trans("User")}</strong>
									</td>
									<td class="nobr">
										<select size="1" name="user" form="printreceiptlist"
											{tip text="You can select user to limit results"}>
											<option value="">{trans("— all users —")}</option>
											{foreach $users as $user}
												<option value="{$user.id}">{$user.name|truncate:40:"&hellip;":true}</option>
											{/foreach}
										</select>
									</td>
								</tr>
							</table>
						</td>
						<td>
							{icon name="calendar"}
						</td>
						<td>
							<table style="width: 100%;">
								<colgroup>
									<col style="width: 1%;">
								</colgroup>
								<tr>
									<td>
										<span class="lms-ui-date-period-container">
											<strong>{trans("Period")}</strong>&nbsp;
											{date_period_preset from="[form=\"printreceiptlist\"][name=\"from\"]" to="[form=\"printreceiptlist\"][name=\"to\"]"}
											<span>{trans("From")}</span>
											<input type="text" name="from" size="10" maxlength="10" form="printreceiptlist"
												placeholder="{trans("yyyy/mm/dd")}"
												{tip class="lms-ui-date" text="Enter date in 'yyyy/mm/dd' format (empty field means current date) or click to choose it from calendar"}>
											<span>{trans("To")}</span>
											<input type="text" name="to" size="10" maxlength="10" form="printreceiptlist"
												placeholder="{trans("yyyy/mm/dd")}"
												{tip class="lms-ui-date" text="Enter date in 'yyyy/mm/dd' format (empty field means current date) or click to choose it from calendar"}>
										</span>
									</td>
								</tr>
								<tr>
									<td class="nobr">
										{trans("Sorting")}
										<select name="sorttype" form="printreceiptlist"
											{tip text="Select sorting criterion"}>
											<option value="cdate">{trans("Draw-up date")}</option>
											<option value="number">{trans("Document number")}</option>
										</select>
									</td>
								</tr>
							</table>
						</td>
						<td class="nobr">
							<label>
								<input type="checkbox" name="extended" value="1" form="printreceiptlist">
								{trans("extended format")}
							</label>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td colspan="2" class="lms-ui-box-buttons">
				{button icon="csv" label="CSV" id="printreceiptlist-csv"}
				{button type="submit" label="Print" icon="print" form="printreceiptlist"}
			</td>
		</tr>
	</tbody>
</table>

<script>

	$(function() {
		$('[form="printreceiptlist"][type="submit"]').click(function() {
			$('#printreceiptlist').attr('target', '_blank').find('[name="csv"]').prop('disabled', true);
		});

		$('#printreceiptlist-csv').click(function() {
			$('#printreceiptlist').attr('target', null).find('[name="csv"]').prop('disabled', false).end().submit();
			$('[form="printreceiptlist"][type="submit"]').prop('disabled', false);
		});
	});

</script>
{/if}
{if $printmenu=="finances"}
<form method="post" name="printinvoices" id="printinvoices" action="?m=print&type=invoices">
	<input type="submit" class="hiddenbtn">
</form>
<script>

	function print() {
		document.printinvoices.action="?m=print&type=invoices";
		document.printinvoices.target='_blank';
		document.printinvoices.submit();
	}

	function print_forms() {
		document.printinvoices.action="?m=print&type=transferforms&kind=1";
		document.printinvoices.target='_blank';
		document.printinvoices.submit();
	}

	function export_to_jpk(type) {
		var divisionElement = $('select[form="printinvoices"][name="division[]"]');
		var tens = [];

		divisionElement.find('option[selected]').each(function() {
			var ten = $(this).attr('data-ten');
			if (tens.indexOf(ten) === -1) {
				tens.push(ten);
			}
		});

		if (tens.length > 1) {
			alertDialog($t("Selected divisions have different TEN identifiers!"), $(".export_to_jpk"));
			return;
		}

		document.printinvoices.action = "?m=print&type=invoices&jpk=" + type + '&jpk_format='
			+ $('select[form="printinvoices"][name="format"]').val();
		document.printinvoices.submit();
	}

</script>
<table class="lmsbox">
	<colgroup>
		<col style="width: 1%;">
		<col style="width: 99%;">
	</colgroup>
	<thead>
		<tr>
			<th scope="col">
				{icon name="money"}
			</th>
			<th scope="col" class="nobr">
				<strong>{trans("Invoices")}</strong>
			</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td class="container" colspan="2">
				<table style="width: 100%;">
					<colgroup>
						<col style="width: 1%;">
						<col style="width: 99%;">
					</colgroup>
					<tr>
						<td>
							<table style="width: 100%;">
								<colgroup>
									<col style="width: 1%;">
									<col style="width: 1%;">
									<col style="width: 98%;">
								</colgroup>
								<tr>
									<td>
										{icon name="division"}
									</td>
									<td class="nobr">
										<strong>{trans("Division")}</strong>
									</td>
									<td>
										<select size="1" name="division[]" form="printinvoices" multiple
											{tip text="Select division" class="lms-ui-multiselect"}
											data-default-value="{trans("— all —")}">
											{foreach $divisions as $division}
												<option value="{$division.id}" data-ten="{$division.ten|regex_replace:"/[^0-9A-Z]/":""}">{$division.label|escape}</option>
											{/foreach}
										</select>
									</td>
								</tr>
								<tr>
									<td>
										{icon name="customer"}
									</td>
									<td class="nobr">
										<strong>{trans("Customer")}</strong>
									</td>
									<td class="nobr">
										{customerlist form="printinvoices" customers=$customers version=2
											selectname="cust" inputname="customer" firstoption="— all customers —"
											selecttip="You can select customer to limit results" inputtip="Enter customer ID or leave empty for all customers"}
									</td>
								</tr>
								<tr>
									<td>
										{icon name="customer"}
									</td>
									<td>
										<strong>{trans("Customers")}</strong>
									</td>
									<td>
										<select name="customer_type" form="printinvoices">
											<option value="-1">{trans("— all customers —")}</option>
											{foreach $_CTYPES as $key => $item}
												<option value="{$key}">{$item}</option>
											{/foreach}
										</select>
									</td>
								</tr>
								<tr>
									<td>
										{icon name="customergroup"}
									</td>
									<td class="nobr">
										<strong>{trans("Group")}</strong>
									</td>
									<td class="nobr">
										<input type="hidden" name="group" value="all" form="printinvoices">
										<select size="1" name="group[]" class="lms-ui-multiselect" form="printinvoices"
											data-default-value="{trans("— all groups —")}" multiple>
											{foreach $customergroups as $customergroup}
												<option value="{$customergroup.id}">{$customergroup.name|trunescape:30}</option>
											{/foreach}
										</select>
										<label>
											<input type="checkbox" name="groupexclude" form="printinvoices"
												{if $listdata.groupexclude} checked{/if}>
											{trans("exclude group")}
										</label>
									</td>
								</tr>
								<tr>
									<td>
										{icon name="queue"}
									</td>
									<td class="nobr">
										<strong>{trans("Plan")}</strong>
									</td>
									<td>
										<input type="hidden" name="numberplan" value="all" form="printinvoices">
										<select name="numberplan[]" {tip class="lms-ui-multiselect" text="Select numbering plan"}
											form="printinvoices" data-default-value="{trans("— all —")}" multiple>
											{foreach $numberplans as $plan}
												{assign var=period value=$plan.period}
												<option value="{$plan.id}"
													>{number number=$plan.next template=$plan.template time=$invoice.cdate} ({$_NUM_PERIODS.$period})</option>
											{/foreach}
										</select>
									</td>
								</tr>
							</table>
						</td>
						<td>
							<table style="width: 100%;">
								<colgroup>
									<col style="width: 1%;">
									<col style="width: 1%;">
									<col style="width: 1%;">
									<col style="width: 97%;">
								</colgroup>
								<tr>
									<td>
										{icon name="calendar"}
									</td>
									<td>
										<span class="lms-ui-date-period-container">
											<strong>{trans("Period:")}</strong>
											{date_period_preset from="[form=\"printinvoices\"][name=\"invoicefrom\"]" to="[form=\"printinvoices\"][name=\"invoiceto\"]"}
											<span>{trans("From")}</span>
											<input type="text" name="invoicefrom" size="10" maxlength="10" form="printinvoices"
												placeholder="{trans("yyyy/mm/dd")}"
												{tip class="lms-ui-date" text="Enter date in 'yyyy/mm/dd' format (empty field means current date) or click to choose it from calendar"}>
											<span>{trans("To")}</span>
											<input type="text" name="invoiceto" size="10" maxlength="10" form="printinvoices"
												placeholder="{trans("yyyy/mm/dd")}"
												{tip class="lms-ui-date" text="Enter date in 'yyyy/mm/dd' format (empty field means current date) or click to choose it from calendar"}>
										</span>
									</td>
									<td>
										{icon name="info"}
									</td>
									<td class="nobr">
										<label>
											<input type="checkbox" name="invoiceorg" form="printinvoices"
												{if preg_match('/original/i', $default_printpage)} checked{/if}>
											{trans("original")}
										</label>
										<label>
											<input type="checkbox" name="invoicecopy" form="printinvoices"
												{if preg_match('/copy/i', $default_printpage)}  checked{/if}>
											{trans("copy")}
										</label>
										<label>
											<input type="checkbox" name="invoicedup" form="printinvoices"
												{if preg_match('/duplicate/i', $default_printpage)} checked{/if}>
											{trans("duplicate")}
										</label>
									</td>
								</tr>
								<tr>
									<td>
										{icon name="options"}
									</td>
									<td colspan="2" class="nobr">
										<strong>
											{trans("Agreement for an electronic invoice")}
										</strong>
										<select name="einvoice" form="printinvoices">
											<option value="0">{trans("— all —")}</option>
											<option value="1">{trans("yes")}</option>
											<option value="2">{trans("no")}</option>
										</select>
									</td>
									<td>
										<label>
											<input type="checkbox" name="autoissued" form="printinvoices">
											{trans("only automatically issued")}
										</label>
										<br>
										<label>
											<input type="checkbox" name="manualissued" form="printinvoices">
											{trans("only manually issued")}
										</label>
									</td>
								</tr>
								<tr>
									<td>
										{icon name="document"}
									</td>
									<td collspan="3">
										<label>
											<input type="checkbox" name="related-documents" form="printinvoices">
											<strong>
												{trans("related documents")}
											</strong>
										</label>
									</td>
								</tr>
								<tr>
									<td>
										{icon name="configuration"}
									</td>
									<td colspan="3">
										<input type="hidden" name="transfer-forms" value="0" form="printinvoices">
										<label>
											<input type="checkbox" name="transfer-forms" value="1" form="printinvoices">
											<strong>
												{trans("transfer forms")}
											</strong>
										</label>
									</td>
								</tr>
								<tr>
									<td>
										{icon name="web"}
									</td>
									<td colspan="3">
										<strong>{trans("Submit to KSeF")}</strong>
										<select name="ksef-submit" form="printinvoices">
											<option value="">{trans("— any —")}</option>
											<option value="yes">{trans("yes")}</option>
											<option value="no">{trans("no")}</option>
										</select>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td colspan="2" class="lms-ui-box-buttons">
				<label style="display: none;">
					{trans("JPK format")}
					<select name="format" form="printinvoices">
						<option value="xml">{trans("XML")}</option>
						<option value="csv">{trans("CSV")}</option>
					</select>
				</label>
				<input type="hidden" name="format" value="xml" form="printinvoices">
				{button class="export_to_jpk" icon="document" onclick="javascript:export_to_jpk('fa');" label="Export to JPK-FA format"}
				{button class="export_to_jpk" icon="document" onclick="javascript:export_to_jpk('vat');" label="Export to JPK-VAT format"}
				{button icon="print" label="Print form of cash transfer" onclick="print()_forms;"}
				{button icon="print" label="Print" onclick="print();"}
			</td>
		</tr>
	</tbody>
</table>
{/if}
{if $printmenu=="finances"}
<form method="post" name="printforms" id="printforms" action="?m=print&type=transferforms&kind=2">
<INPUT type="submit" class="hiddenbtn">
<TABLE class="lmsbox">
    <COLGROUP>
        <COL style="width: 1%;">
        <COL style="width: 99%;">
    </COLGROUP>
    <THEAD>
	<TR>
		<TH scope="col">
			<IMG src="img/money.gif" alt="">
		</TH>
		<TH scope="col" class="bold nobr">
			{trans("Transfer forms")}
		</TH>
	</TR>
    </THEAD>
    <TBODY>
	<TR>
		<TD class="container" width="100%" colspan="2">
			<TABLE width="100%" cellpadding="3">
				<TR>
					<TD style="width: 1%;">
					    <TABLE width="100%">
						<TR>
							<TD style="width: 1%;">
								<IMG src="img/customer.gif" alt="">
							</TD>
							<TD style="width: 1%;" class="bold nobr">
								{trans("Customer:")}
							</TD>
							<TD style="width: 98%;" class="nobr">
								{customerlist form="printforms" customers=$customers version=2
									selectname="cust" inputname="customer" firstoption="— all customers —"
									selecttip="You can select customer to limit results"
									inputtip="Enter customer ID or leave empty for all customers"}
							</TD>
						</TR>
						<TR>
						    <TD style="width: 1%;">
							<IMG src="img/group.gif" alt="">
						    </TD>
						    <TD style="width: 1%;" class="bold nobr">
							{trans("Group:")}
						    </TD>
						    <TD style="width: 98%;" class="nobr">
							<SELECT size="1" name="customergroup">
							    <OPTION value="0" SELECTED>{trans("— all groups —")}</OPTION>
			    				    {section name="customergroups" loop=$customergroups}
							    <OPTION value="{$customergroups[customergroups].id}">{$customergroups[customergroups].name|truncate:30:"&hellip;":true}</OPTION>
							    {/section}
							</SELECT>
    							<INPUT type="checkbox" name="groupexclude" id="printforms-groupexclude" {if $listdata.groupexclude} CHECKED{/if}><label for="printforms-groupexclude">{trans("exclude group")}</label>
						    </TD>
						</TR>
					    </TABLE>
					</TD>
					<TD style="width: 1%;">
						<IMG src="img/value.gif" alt="">
					</TD>
					<TD style="width: 98%;" class="bold nobr">
						{trans("Balance:")}&nbsp;<INPUT type="text" name="balance" SIZE="10" {tip text="Enter balance limit (default 0)"}>
					</TD>
				</TR>
			</TABLE>
		</TD>
	</TR>
	<TR>
		<TD style="width: 100%;" colspan="2" align="right">
			<A href="javascript:document.printforms.target='_blank';document.printforms.submit();">{trans("Print")} <IMG src="img/print.gif" alt="" hspace="2"></A>
		</TD>
	</TR>
    </TBODY>
</TABLE>
</form>
{/if}
{if $printmenu=="incomereport" || $printmenu=="finances"}
<FORM method="post" name="printincomereport" id="printincomereport" action="?m=print&type=incomereport">
<INPUT type="submit" class="hiddenbtn">
<TABLE class="lmsbox">
    <COLGROUP>
        <COL style="width: 1%;">
        <COL style="width: 99%;">
    </COLGROUP>
    <THEAD>
	<TR>
		<TH scope="col">
			<IMG src="img/money.gif" alt="">
		</TH>
		<TH scope="col" class="bold nobr">
			{trans("Total Invoiceless Income")}
		</TH>
	</TR>
    </THEAD>
    <TBODY>
	<TR>
		<TD class="container" width="100%" colspan="2">
			<TABLE width="100%" cellpadding="3">
				<TR>
					<TD style="width: 1%;">
						<IMG src="img/calendar.gif" alt="">
					</TD>
					<TD style="width: 99%;">
						<span class="lms-ui-date-period-container">
							<strong>{trans("Period:")}</strong>&nbsp;
							{date_period_preset from="#printincomereport [name=\"from\"]" to="#printincomereport [name=\"to\"]"}
							<span>{trans("From")}</span>
							<input type="text" name="from" size="10" maxlength="10"
								placeholder="{trans("yyyy/mm/dd")}"
								{tip class="lms-ui-date" text="Enter date in 'yyyy/mm/dd' format or click to choose it from calendar"}>
							<span>{trans("To")}</span>
							<input type="text" name="to" SIZE="10" maxlength="10"
								placeholder="{trans("yyyy/mm/dd")}"
								{tip class="lms-ui-date" text="Enter date in 'yyyy/mm/dd' format (empty field means current date) or click to choose it from calendar"}>
						</span>
					</TD>
				</TR>
			</TABLE>
		</TD>
	</TR>
	<TR>
		<TD style="width: 100%;" colspan="2" align="right">
			<A href="javascript:document.printincomereport.target='_blank';document.printincomereport.submit();">{trans("Print")} <IMG src="img/print.gif" alt="" hspace="2"></A>
		</TD>
	</TR>
    </TBODY>
</TABLE>
</FORM>
{/if}
{if ($printmenu=="customer" || $printmenu=="finances") && (ConfigHelper::checkConfig('privileges.superuser') || !ConfigHelper::checkConfig('privileges.hide_finances'))}
<form method="post" name="liabilityreport" id="liabilityreport" action="?m=print&type=liabilityreport">
<p style="display: none;">
<INPUT type="submit" class="hiddenbtn">
</p>
<TABLE class="lmsbox">
    <COLGROUP>
        <COL style="width: 1%;">
        <COL style="width: 99%;">
    </COLGROUP>
	<THEAD>
	<TR>
		<TH scope="col">
			<IMG src="img/money.gif" alt="">
		</TH>
		<TH scope="col" class="bold nobr">
			{trans("Liability Report")}
		</TH>
	</TR>
	</THEAD>
	<TBODY>
	<TR>
		<TD class="container" colspan="2">
			<TABLE width="100%" cellpadding="3">
				<TR>
					<TD style="width: 1%;">
						<table width="100%">
							<COLGROUP>
								<COL style="width: 1%;">
								<COL style="width: 1%;">
								<COL style="width: 98%;">
							</COLGROUP>
							<TR>
								<TD>
									<IMG src="img/division.gif" alt="">
								</TD>
								<TD class="bold nobr">
									{trans("Division")}:
								</TD>
								<TD class="nobr">
									<SELECT size="1" name="division" {tip text="Select division"}>
										<OPTION value="0">{trans("— all —")}</OPTION>
										{foreach $divisions as $division}
										<OPTION value="{$division.id}">{$division.label|escape}</OPTION>
										{/foreach}
									</SELECT>
								</TD>
							</TR>
							<TR>
								<TD>
									<IMG src="img/customer.gif" alt="">
								</TD>
								<TD class="bold nobr">
									{trans("Customer:")}
								</TD>
								<TD class="nobr">
									{customerlist form="liabilityreport" customers=$customers version=2
										selectname="cust" inputname="customer" firstoption="— all customers —"
										inputtip="Enter customer ID or leave empty for all customers"}
								</TD>
							</TR>
						</table>
					</td>
					<td style="width: 99%;">
						<table width="100%">
							<COLGROUP>
								<COL style="width: 1%;">
								<COL style="width: 1%;">
								<COL style="width: 1%;">
								<COL style="width: 1%;">
								<COL style="width: 96%;">
							</COLGROUP>
							<TR>
								<td>
									<table style="width: 100%">
										<tr>
											<td style="width: 100%;" class="nobr">
												{icon name="calendar"}
												<strong>{trans("Day")}</strong>
												<input type="text" name="day" size="10" maxlength="10"
													placeholder="{trans("yyyy/mm/dd")}"
													{tip class="lms-ui-date" text="Enter date in 'yyyy/mm/dd' format (empty field means current date) or click to choose it from calendar"}>
											</td>
										</tr>
										<tr>
											<td style="width: 100%;" class="nobr">
												{icon name="calendar"}
												<strong>{trans("Period")}</strong>
												<select size="1" name="period" {tip text="Select time period to account liability"}>
													<option value="">{trans("- all -")}</option>
													{foreach $_PERIODS as $key => $item}
														<option value="{$key}">{$item}</option>
													{/foreach}
												</select>
											</td>
										</tr>
									</table>
								</td>
								<TD>
									<IMG src="img/view.gif" alt="">
								</TD>
								<TD class="bold nobr">
									{trans("Sorting:")}
								</TD>
								<TD {tip text="Select sorting direction and criteria"}>
									<TABLE width="100%">
										<TR>
											<TD style="width: 100%;" class="nobr">
												<SELECT size="1" name="order">
													<OPTION value="customername" selected>{trans("First/last or Company name")}</OPTION>
													<OPTION value="grossvalue">{trans("Gross value")}</OPTION>
												</SELECT>
											</TD>
										</TR>
										<TR>
											<TD style="width: 100%;" class="nobr">
												<SELECT SIZE="1" name="direction">
													<OPTION value="asc" selected>{trans("ascending")}</OPTION>
													<OPTION value="desc">{trans("descending")}</OPTION>
												</SELECT>
											</TD>
										</TR>
									</TABLE>
								</TD>
							</TR>
						</table>
					</td>
				</tr>
			</TABLE>
		</TD>
	</TR>
	<TR>
		<TD style="width: 100%;" class="text-right" colspan="2">
			<A href="javascript:document.liabilityreport.target='_blank';document.liabilityreport.submit();">{trans("Print")} <IMG src="img/print.gif" alt="" style="margin: 0px 2px;"></A>
		</TD>
	</TR>
	</TBODY>
</TABLE>
</form>
{/if}
{if $printmenu=="finances"}
<FORM method="post" name="printimportlist" id="printimportlist" action="?m=print&type=importlist">
<INPUT type="submit" class="hiddenbtn">
<TABLE class="lmsbox">
    <COLGROUP>
        <COL style="width: 1%;">
        <COL style="width: 99%;">
    </COLGROUP>
    <THEAD>
	<TR>
		<TH scope="col">
			<IMG src="img/money.gif" alt="">
		</TH>
		<TH scope="col" class="bold nobr">
			{trans("Cash Import History")}
		</TH>
	</TR>
    </THEAD>
    <TBODY>
	<TR>
		<TD class="container" width="100%" colspan="2">
			<TABLE width="100%" cellpadding="3">
				<TR>
					<TD style="width: 1%;" class="nobr">
						<IMG src="img/isource.gif" alt="">
					</TD>
					<TD style="width: 1%;" class="bold nobr">
						{trans("Source:")}
					</TD>
					<TD style="width: 1%;">
						<SELECT size="1" name="source" {tip text="You can select import source to limit results"}>
						<OPTION value="0">{trans("— all sources —")}</OPTION>
						{foreach from=$sourcelist item=item}
						<OPTION value="{$item.id}">{$item.name}</OPTION>
						{/foreach}
						</SELECT>
					</TD>
					<TD style="width: 1%;">
						<IMG src="img/calendar.gif" alt="">
					</TD>
					<TD style="width: 96%;">
						<span class="lms-ui-date-period-container">
							<strong>{trans("Period:")}</strong>
							{date_period_preset from="#printimportlist [name=\"importfrom\"]" to="#printimportlist [name=\"importto\"]"}
							<span>{trans("From")}</span>
							<input type="text" name="importfrom" size="10" maxlength="10"
								placeholder="{trans("yyyy/mm/dd")}"
								{tip class="lms-ui-date" text="Enter date in 'yyyy/mm/dd' format or click to choose it from calendar"}>
							<span>{trans("To")}</span>
							<input type="text" name="importto" size="10" maxlength="10"
								placeholder="{trans("yyyy/mm/dd")}"
								{tip class="lms-ui-date" text="Enter date in 'yyyy/mm/dd' format (empty field means current date) or click to choose it from calendar"}>
						</span>
					</TD>
				</TR>
			</TABLE>
		</TD>
	</TR>
	<TR>
		<TD style="width: 100%;" colspan="2" align="right">
			<A href="javascript:document.printimportlist.target='_blank';document.printimportlist.submit();">{trans("Print")} <IMG src="img/print.gif" alt="" hspace="2"></A>
		</TD>
	</TR>
    </TBODY>
</TABLE>
</FORM>
{/if}
{if $printmenu=="node"}
<form method="post" name="printnodelist" id="printnodelist" action="?m=nodeprint&type=nodelist">
	<input type="submit" class="hiddenbtn">
	<input type="hidden" name="type" value="print">
</form>
<table class="lmsbox">
	<colgroup>
		<col style="width: 1%;">
		<col style="width: 99%;">
	</colgroup>
	<thead>
		<tr>
			<td>
				{icon name="node"}
			</td>
			<td class="nobr">
				<strong>{trans("Nodes List")}</strong>
			</td>
		</TR>
	</thead>
	<tbody>
		<tr>
			<td class="container" width="100%" colspan="2">
				<table cellpadding="3">
					<tr>
						<td class="nobr">
							{icon name="node"}
							<strong>{trans("Status")}</strong>
						</td>
						<td {tip text="Select nodes group"}>
							<label>
								<input class="radio light" type="radio" form="printnodelist" name="filter" value="0" checked>
								{trans("all")}
							</label>
							<label>
								<input class="radio light" type="radio" form="printnodelist" name="filter" value="1">
								{trans("connected<!plural:item>")}
							</label>
							<label>
								<input class="radio light" type="radio" form="printnodelist" name="filter" value="2">
								{trans("disconnected<!plural:item>")}
							</label>
							<label>
								<input class="radio light" type="radio" form="printnodelist" name="filter" value="3">
								{trans("indebted owner")}
							</label>
						</TD>
					</tr>
					<tr>
						<td class="nobr">
							{icon name="network"}
							<strong>{trans("Network")}</strong>
						</td>
						<td>
							<select size="1" name="network"
								form="printnodelist"
								{tip text="Select network"}>
								<option value="0">{trans("— all networks —")}</option>
								{foreach $networks as $network}
									<option value="{$network.id}">{$network.name|truncate:40:"&hellip;":true}</option>
								{/foreach}
							</select>
						</td>
					</tr>
					<tr>
						<td class="nobr">
							{icon name="customergroup"}
							<strong>{trans("Group")}</strong>
						</td>
						<td>
							<select size="1" name="customergroup"
								form="printnodelist"
								{tip text="Select group"}>
								<option value="0">{trans("— all groups —")}</option>
								{foreach $customergroups as $customergroup}
									<option value="{$customergroup.id}">{$customergroup.name|truncate:40:"&hellip;":true}</option>
								{/foreach}
							</select>
						</td>
					</tr>
					<tr>
						<td class="nobr valign-top">
							{icon name="option"}
							<label>{strip}
								<input type="checkbox" id="all-properties">
								<strong>{trans("Additional properties")}</strong>
							{/strip}</label>
						</td>
						<td>
							<div id="additional-properties">
								<label>
									<input type="checkbox" name="options[description]" form="printnodelist">
									{trans("description")}
								</label>
								<label>
									<input type="checkbox" name="options[gps-coordinates]" form="printnodelist">
									{trans("GPS coordinates")}
								</label>
								<label>
									<input type="checkbox" name="options[assigned-bandwidth]" form="printnodelist">
									{trans("assigned bandwidth")}
								</label>
								<label>
									<input type="checkbox" name="options[customer-id]" form="printnodelist">
									{trans("customer ID")}
								</label>
							</div>
						</td>
					</tr>
					<tr>
						<td class="nobr">
							{icon name="view"}
							<strong>{trans("Sorting")}</strong>
						</td>
						<td {tip text="Select sorting direction and criteria"}>
							<select size="1" name="order" form="printnodelist">
								<option value="name">{trans("Name")}</option>
								<option value="id">{trans("Id")}</option>
								<option value="owner">{trans("Customer name")}</option>
								<option value="ownerid">{trans("Customer ID")}</option>
								<option value="ip">{trans("IP address")}</option>
								<option value="mac">{trans("MAC address")}</option>
							</select>
							<select size="1" name="direction" form="printnodelist">
								<option value="asc">{trans("ascending")}</option>
								<option value="desc">{trans("descending")}</option>
							</select>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td class="lms-ui-box-buttons" colspan="2">
				{button class="printnodelist-button" data_type="print" label="Print" icon="print"}
				{button class="printnodelist-button" data_type="csv" label="Download (CSV)" icon="csv"}
			</td>
		</tr>
	</tbody>
</table>
<script>

	$(function() {
		$('#all-properties').change(function() {
			$('[form="printnodelist"][name^="options"]').prop('checked', $(this).prop('checked'));
		});

		$('[form="printnodelist"][name^="options"]').change(function() {
			var options = $('[form="printnodelist"][name^="options"]');
			$('#all-properties').prop('checked', options.length == options.filter(':checked').length);
		});

		$(".printnodelist-button").click(function() {
			var type = $(this).attr("data-type");
			$('#printnodelist [name="type"]').val(type);
			$("#printnodelist").attr("target", type == "print" ? "_blank" : null).submit();
		});
	});

</script>
{/if}
{if $printmenu=="traffic" || $printmenu=="customer"}
<form method="post" name="printcustomertraffic" id="printcustomertraffic"  action="?m=trafficprint&type=customertraffic">
<INPUT type="submit" class="hiddenbtn">
<TABLE class="lmsbox">
    <COLGROUP>
        <COL style="width: 1%;">
        <COL style="width: 99%;">
    </COLGROUP>
	<THEAD>
	<TR>
		<TH scope="col">
			<IMG src="img/traffic.gif" alt="">
		</TH>
		<TH scope="col" class="bold nobr">
			{trans("Stats")}
		</TH>
	</TR>
	</THEAD>
	<TBODY>
	<TR>
		<TD style="width: 100%;" class="container" colspan="2">
			<TABLE width="100%" cellpadding="3">
				<TR>
					<TD style="width: 1%;">
						<IMG src="img/customer.gif" alt="">
					</TD>
					<TD style="width: 1%;" class="bold nobr">
						{trans("Customer:")}
					</TD>
					<TD style="width: 1%;" class="nobr">
						{customerlist form="printcustomertraffic" customers=$customers version=2
							selectname="cust" inputname="customer" firstoption=""}
					</TD>
					<TD style="width: 1%;">
						<IMG src="img/calendar.gif" alt="">
					</TD>
					<TD style="width: 1%;" class="bold nobr">
						{trans("Year:")}
					</TD>
					<TD style="width: 1%;">
						<SELECT size="1" name="year" {tip text="Select period"}>
							{foreach item=year from=$statyears}
							<OPTION value="{$year}"{if $year == $curryear} selected{/if}>{$year}</OPTION>
							{/foreach}
						</SELECT>
					</TD>
					<TD style="width: 1%;" class="bold nobr">
						{trans("Month:")}
					</TD>
					<TD style="width: 1%;">
						<SELECT size="1" name="month" {tip text="Select period"}>
							{foreach item=month key=id from=$months}
							<OPTION value="{$id}"{if $id == $currmonth} selected{/if}>{$month}</OPTION>
							{/foreach}
						</SELECT>
					</TD>
					<TD style="width: 92%;"></TD>
				</TR>
				<tr>
					<td colspan="9">
						<label>
							<input type="checkbox" name="showavg" value="1" checked>
							{trans("show average speed")}
						</label>
						<label>
							<input type="checkbox" name="showmax" value="1" checked>
							{trans("show maximum speed")}
						</label>
					</td>
				</tr>
			</TABLE>
		</TD>
	</TR>
	<TR>
		<TD style="width: 100%;" class="text-right" colspan="2">
			<A href="javascript:document.printcustomertraffic.target='_blank';document.printcustomertraffic.submit();">{trans("Print")} <IMG src="img/print.gif" alt="" style="margin: 0px 2px;"></A>
		</TD>
	</TR>
	</TBODY>
</TABLE>
</form>
{/if}

{if $printmenu == "customer"}
	<FORM method="POST" name="printtransgus" id="printtransgus" action="?m=customerprint&type=transgus">
		<INPUT type="submit" class="hiddenbtn">
		<TABLE class="lmsbox">
			<COLGROUP>
				<COL style="width: 1%;">
				<COL style="width: 99%;">
			</COLGROUP>
			<THEAD>
			<TR>
				<TH scope="col">
					<IMG src="img/customer.gif" alt="">
				</TH>
				<TH scope="col" class="bold nobr">
					{trans("TransGUS:")}
				</TH>
			</TR>
			</THEAD>
			<TBODY>
			<TR>
				<TD class="container" style="width: 100%;" colspan="2">
					<TABLE width="100%" cellpadding="3">
						<COLGROUP>
							<COL style="width: 1%;">
							<COL style="width: 1%;">
							<COL style="width: 98%;">
						</COLGROUP>
						<TR>
							<TD class="nobr"><IMG src="img/division.gif" alt=""></TD>
							<TD class="bold nobr">{trans("Division")}:</TD>
							<TD class="nobr">
								<SELECT size="1" name="division" {tip text="Select division"}>
									<OPTION value="0">{trans("— none —")}</OPTION>
									{foreach $divisions as $item}
										<OPTION value="{$item.id}">{$item.label|escape}</OPTION>
									{/foreach}
								</SELECT>
							</TD>
						</TR>
						<TR>
							<TD>
								<IMG src="img/group.gif" alt="">
							</TD>
							<TD class="bold nobr">
								{trans("Group:")}
							</TD>
							<TD class="nobr">
								<SELECT size="4" name="customergroups[]" class="lms-ui-multiselect"
										multiple {tip text="Select group"}
										data-default-value="{trans("— all groups —")}">
									{foreach $customergroups as $customergroup}
										<OPTION value="{$customergroup.id}">{$customergroup.name|truncate:30:"&hellip;":true}</OPTION>
									{/foreach}
								</SELECT>
							</TD>
						</TR>
						<TR>
							<TD class="nobr"><IMG src="img/phone.gif" alt=""></TD>
							<TD class="bold nobr">
								<label for="transgus-phonecontacts">
									{trans("Phone contacts:")}
								</label>
							</TD>
							<TD class="nobr">
								<input type="checkbox" id="transgus-phonecontacts" name="phonecontacts" value="1">
							</TD>
						</TR>
						<TR>
							<TD class="nobr"><IMG src="img/division.gif" alt=""></TD>
							<TD class="bold nobr">
								<label for="transgus-soletraders">
									{trans("Sole traders")}
								</label>
							</TD>
							<TD class="nobr">
								<input type="checkbox" id="transgus-soletraders" name="soletraders" value="1">
							</TD>
						</TR>
					</TABLE>
				</TD>
			</TR>
			<TR>
				<TD style="width: 100%;" class="text-right" colspan="2">
					<A id="transgus-submit" href="#">{trans("Generate XML report")}
						<IMG src="img/print.gif" alt="" style="margin: 0px 2px;"></A>
				</TD>
			</TR>
			</TBODY>
		</TABLE>
	</FORM>

	<script>

		$(function () {
			$("#transgus-submit").click(function () {
				if ($('form[name="printtransgus"] select[name="division"]').val() == '0') {
					alertDialog($t("Division not selected!"), this);
					return;
				}
				javascript:document.printtransgus.submit();
			});
		});

	</script>

{/if}


{if $printmenu=="netdev"}
<style>

	.range-value {
		width: 10em;
	}

</style>

<form method="post" name="uke-siis" id="uke-siis" action="?m=netdevprint&type=uke-siis">
	<input type="submit" class="hiddenbtn">
</form>

<table class="lmsbox">
	<colgroup>
		<col style="width: 1%;">
		<col style="width: 1%;">
		<col style="width: 99%;">
	</colgroup>
	<thead>
		<tr>
			<th scope="col" colspan="3" class="bold nobr">
				{icon name="netdev" class="fa-fw"}
				{trans("UKE SIIS report")}
			</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td>
				{icon name="document" class="fa-fw"}
			</td>
			<td class="nobr">
				<strong>{trans("Exported sheets:")}</strong>
			</td>
			<td style="width: 98%;">
				{*
				<label>
					<input type="checkbox" name="sheets[dp]" form="uke-siis"
						value="1" checked>
					DP
				</label>
				*}
				<label>
					<input type="checkbox" name="sheets[proj]" form="uke-siis"
						value="1" checked>
					PROJ
				</label>
				<label>
					<input type="checkbox" name="sheets[ob]" form="uke-siis"
						value="1" checked>
					OB
				</label>
				<label>
					<input type="checkbox" name="sheets[ww]" form="uke-siis"
						value="1" checked>
					WW
				</label>
				<label>
					<input type="checkbox" name="sheets[wo]" form="uke-siis"
						value="1" checked>
					WO
				</label>
				<label>
					<input type="checkbox" name="sheets[int]" form="uke-siis"
						value="1" checked>
					INT
				</label>
				<label>
					<input type="checkbox" name="sheets[sr]" form="uke-siis"
						value="1" checked>
					SR
				</label>
				<label>
					<input type="checkbox" name="sheets[ps]" form="uke-siis"
						value="1" checked>
					PS
				</label>
				<label>
					<input type="checkbox" name="sheets[lp]" form="uke-siis"
						value="1" checked>
					LP
				</label>
				<label>
					<input type="checkbox" name="sheets[rl]" form="uke-siis"
						value="1" checked>
					RL
				</label>
				<label>
					<input type="checkbox" name="sheets[pol]" form="uke-siis"
						value="1" checked>
					POL
				</label>
				<label>
					<input type="checkbox" name="sheets[zas]" form="uke-siis"
						value="1" checked>
					ZAS
				</label>
				<label>
					<input type="checkbox" name="sheets[us]" form="uke-siis"
						value="1" checked>
					US
				</label>
			</td>
		</tr>
		<tr>
			<td>
				{icon name="netdevice" class="fa-fw"}
			</td>
			<td class="nobr">
				<label for="customernetdevices">
					<strong>{trans("Include customer network device assignments")}</strong>
				</label>
			</td>
			<td>
				<input type="checkbox" name="customernetdevices" form="uke-siis"
					id="customernetdevices" value="1">
			</td>
		</tr>

		{if $linktypes}
			<tr>
				<td class="valign-top">
					{icon name="view" class="fa-fw"}
				</td>
				<td class="valign-top">
					<strong>{trans('Potential range')}<strong>
				</td>
				<td>
					{$def_vals = json_decode(ConfigHelper::getConfig("phpui.linktype_ranges", '{"0":100,"1":2000,"2":300}'), true)}
					{$i = 0}

					<table>
						{foreach $linktypes as $l_id=>$l_name}
						<tr class="blend">
							<td>
								<label>
									<input type="checkbox" class="range_chk" form="uke-siis"
										name="uke[linktypes][{$i}][type]" value="{$l_id}">{$l_name}
								</label>
							</td>
							<td>
								<input type="number" min="0" class="range-value" form="uke-siis"
									name="uke[linktypes][{$i}][range]"
									{if $def_vals[$l_id]}value="{$def_vals[$l_id]}"{/if}
									disabled>
								{trans('meters')}
							</td>
						</tr>
						{$i = $i+1}
						{/foreach}
					</table>
				</td>
			</tr>
		{/if}

		<tr>
			<td colspan="3" class="lms-ui-box-buttons">
				{button form="uke-siis" icon="save" label="Submit" onclick="$('#uke-siis').submit();"}
			</td>
		</tr>
	</tbody>
</table>

<script>

	$(function() {
		$('.range_chk').click( function() {
			var tr  = $(this).closest('tr');
			var inp = tr.find('input[type=number]');

			tr.toggleClass('blend');

			inp.prop('disabled', !inp.prop('disabled'));
		});
	});

</script>

{/if}

{if $printmenu == "netdev"}
<form method="post" name="uke-pit" id="uke-pit" action="?m=netdevprint&type=uke-pit">
	<input type="submit" class="hiddenbtn">
</form>

<table class="lmsbox">
	<colgroup>
		<col style="width: 1%;">
		<col style="width: 1%;">
		<col style="width: 99%;">
	</colgroup>
	<thead>
		<tr>
			<th scope="col" colspan="3" class="bold nobr">
				{icon name="netdev" class="fa-fw"}
				{trans("UKE PIT report")}
			</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td>
				{icon name="configuration" class="fa-fw"}
			</td>
			<td class="nobr">
				<strong>{trans("<!uke-pit>Report type")}</strong>
			</td>
			<td>
				<label>
					<input type="radio" name="report-type" form="uke-pit"
						value="full" checked>
					{trans("<!uke-pit>full")}
				</label>
				<label>
					<input type="radio" name="report-type" form="uke-pit"
						value="customer-services">
					{trans("<!uke-pit>customer services")}
				</label>
			</td>
		</tr>
		<tr style="display: none;">
			<td>
				{icon name="configuration" class="fa-fw"}
			</td>
			<td class="nobr">
				<strong>{trans("<!uke-pit>Dash character")}</strong>
			</td>
			<td>
				<select size="1" name="dash-character" form="uke-pit">
					<option value="pit">pit.uke.gov.pl</option>
					<option value="inwentaryzacja" selected>inwentaryzacja.uke.gov.pl</option>
				</select>
			</td>
		</tr>
		<tr>
			<td>
				{icon name="division" class="fa-fw"}
			</td>
			<td class="nobr">
				<label for="uke-pit-division">
					<strong>{trans("Division")}</strong>
				</label>
			</td>
			<td>
				<select size="1" name="division" form="uke-pit"
					id="uke-pit-division"
					{tip text="Select division"}>
					<option value="0">- {trans("all")} -</option>
					{foreach $divisions as $item}
						<option value="{$item.id}">{$item.label|escape}</option>
					{/foreach}
				</>
			</td>
		</tr>
		<tr>
			<td>
				{icon name="configuration" class="fa-fw"}
			</td>
			<td class="nobr">
				<label for="uke-pit-aggregate-customer-services" class="lms-ui-disabled">
					<strong>{trans("<!uke-pit>Aggregate customer services")}</strong>
				</label>
			</td>
			<td>
				<input type="checkbox" name="aggregate-customer-services" form="uke-pit"
					id="uke-pit-aggregate-customer-services" value="1" disabled>
			</td>
		</tr>
		<tr>
			<td>
				{icon name="summary" class="fa-fw"}
			</td>
			<td class="nobr">
				<label for="uke-pit-summary-only">
					<strong>{trans("<!uke-pit>Generate summary only")}</strong>
				</label>
			</td>
			<td>
				<input type="checkbox" name="summaryonly" form="uke-pit"
					   id="uke-pit-summary-only" value="1">
			</td>
		</tr>
		<tr>
			<td>
				{icon name="netdevice" class="fa-fw"}
			</td>
			<td class="nobr">
				<label for="uke-pit-customer-resources-as-operator-resources">
					<strong>{trans("<!uke-pit>Customer network resources as operator resources")}</strong>
				</label>
			</td>
			<td>
				<input type="checkbox" name="customer-resources-as-operator-resources" form="uke-pit"
					id="uke-pit-customer-resources-as-operator-resources" value="1">
			</td>
		</tr>
		{$report_other_duct_type_as = ConfigHelper::getConfig('uke.pit_report_other_duct_type_as')}
		<tr>
			<td>
				{icon name="wired" class="fa-fw"}
			</td>
			<td class="nobr">
				<label for="uke-pit-report-other-duct-type-as">
					<strong>{trans("<!uke-pit>Report other duct type as")}</strong>
				</label>
			</td>
			<td>
				<select size="1" name="report-other-duct-type-as" form="uke-pit"
					id="uke-pit-report-other-duct-type-as">
					<option value="0">{trans("<!uke-pit>— preserve —")}</option>
					{foreach $_NETWORK_DUCT_TYPES as $duct => $duct_type}
						<option value="{$duct}"{if $duct == $report_other_duct_type_as} selected{/if}>{$duct_type}</option>
					{/foreach}
				</select>
			</td>
		</tr>
		<tr>
			<td>
				{icon name="network" class="fa-fw"}
			</td>
			<td class="nobr">
				<label for="uke-pit-report-elements-outside-network-infrastructure">
					<strong>{trans("<!uke-pit>Report elements outside network infrastructure")}</strong>
				</label>
			</td>
			<td>
				<input type="checkbox" name="report-elements-outside-network-infrastructure" form="uke-pit"
					id="uke-pit-report-elements-outside-network-infrastructure" value="1" checked>
			</td>
		</tr>
		<tr>
			<td>
				{icon name="network" class="fa-fw"}
			</td>
			<td class="nobr">
				<label for="uke-pit-report-cable-lines-shorter-than-1m">
					<strong>{trans("<!uke-pit>Report cable lines shorter than 1 meter")}</strong>
				</label>
			</td>
			<td>
				<input type="checkbox" name="uke-pit-report-cable-lines-shorter-than-1m" form="uke-pit"
					id="uke-pit-report-cable-lines-shorter-than-1m" value="1">
			</td>
		</tr>
		<tr>
			<td>
				{icon name="network" class="fa-fw"}
			</td>
			<td class="nobr">
				<label for="uke-pit-verify-feeding-netnodes-of-flexibility-points">
					<strong>{trans("<!uke-pit>Verify feeding network nodes if flexibility points")}</strong>
				</label>
			</td>
			<td>
				<input type="checkbox" name="uke-pit-verify-feeding-netnodes-of-flexibility-points" form="uke-pit"
					id="uke-pit-verify-feeding-netnodes-of-flexibility-points" value="1" checked>
			</td>
		</tr>
		<tr>
			<td>
				{icon name="wired" class="fa-fw"}
			</td>
			<td class="nobr">
				<label for="uke-pit-complete-breakdown-points">
					<strong>{trans("<!uke-pit>Complete breakdown points of network connections")}</strong>
				</label>
			</td>
			<td>
				<input type="checkbox" name="complete-breakdown-points" form="uke-pit"
					id="uke-pit-complete-breakdown-points" value="1" checked>
			</td>
		</tr>
		<tr>
			<td>
				{icon name="location" class="fa-fw"}
			</td>
			<td class="nobr">
				<label for="uke-pit-validate-teryt">
					<strong>{trans("<!uke-pit>Validate TERYT properties")}</strong>
				</label>
			</td>
			<td>
				<input type="checkbox" name="validate-teryt" form="uke-pit"
					id="uke-pit-validate-teryt" value="1" checked>
			</td>
		</tr>
		<tr>
			<td>
				{icon name="location" class="fa-fw"}
			</td>
			<td class="nobr">
				<label for="uke-pit-validate-building-numbers">
					<strong>{trans("<!uke-pit>Validate building numbers")}</strong>
				</label>
			</td>
			<td>
				<input type="checkbox" name="validate-building-numbers" form="uke-pit"
					   id="uke-pit-validate-building-numbers" value="1" checked>
			</td>
		</tr>
		<tr>
			<td>
				{icon name="location" class="fa-fw"}
			</td>
			<td class="nobr">
				<label for="uke-pit-validate-gps">
					<strong>{trans("<!uke-pit>Validate GPS coordinates")}</strong>
				</label>
			</td>
			<td>
				<input type="checkbox" name="validate-gps" form="uke-pit"
					id="uke-pit-validate-gps" value="1" checked>
			</td>
		</tr>
		<tr>
			<td>
				{icon name="wireless" class="fa-fw"}
			</td>
			<td class="nobr">
				<label for="uke-pit-validate-wireless-links">
					<strong>{trans("<!uke-pit>Validate wireless links")}</strong>
				</label>
			</td>
			<td>
				<input type="checkbox" name="validate-wireless-links" form="uke-pit"
					id="uke-pit-validate-wireless-links" value="1" checked>
			</td>
		</tr>
		<tr>
			<td>
				{icon name="reload" class="fa-fw"}
			</td>
			<td class="nobr">
				<label for="uke-pit-detect-loops">
					<strong>{trans("<!uke-pit>Detect network loops")}</strong>
				</label>
			</td>
			<td>
				<input type="checkbox" name="detectloops" form="uke-pit"
					   id="uke-pit-detect-loops" value="1" checked>
			</td>
		</tr>
		<tr>
			<td colspan="3" class="lms-ui-box-buttons">
				{button form="uke-pit" icon="save" label="Submit" onclick="$('#uke-pit').submit();"}
			</td>
		</tr>
	</tbody>
</table>

<script>

	$(function() {
		$('[name="report-type"]').change(function() {
			var checked = $(this).prop('checked') && $(this).is('[value="customer-services"]');
			$('#uke-pit-aggregate-customer-services').prop('disabled', !checked).closest('tr').find('label').toggleClass('lms-ui-disabled', !checked);
			$('#uke-pit-report-other-duct-type-as,#uke-pit-complete-breakdown-points').prop('disabled', checked).closest('tr').find('label').toggleClass('lms-ui-disabled', checked);
		});
	});

</script>

{/if}

{if $printmenu == "netdev" || $printmenu == "finances"}
<style>

	#uke-income-customergroup-selection {
		display: flex;
		flex-wrap: wrap;
		align-items: flex-start;
	}

</style>

<form method="post" name="uke-income" id="uke-income-form" action="?m=netdevprint&type=uke-income&module-filter=print" target="_blank">
	<input type="submit" class="hiddenbtn">
</form>

<table class="lmsbox">
	<colgroup>
		<col style="width: 1%;">
		<col style="width: 1%;">
		<col style="width: 99%;">
	</colgroup>
	<thead>
		<tr>
			<td colspan="3" class="nobr">
				{icon name="money" class="fa-fw"}
				<strong>{trans("UKE income report")}</strong>
			</td>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td>
				{icon name="document" class="fa-fw"}
			</td>
			<td class="nobr">
				<strong>{trans("Type:")}</strong>
			</td>
			<td class="nobr">
				<label>
					<input type="radio" name="type" value="linktechnologies" form="uke-income-form"
						{if !isset($filter['uke-income']['type']) || $filter['uke-income']['type'] == 'linktechnologies'} checked{/if}>
					{trans("link technologies")}
				</label>
				<label>
					<input type="radio" name="type" value="servicetypes" form="uke-income-form"
						{if isset($filter['uke-income']['type']) && $filter['uke-income']['type'] == 'servicetypes'} checked{/if}>
					{trans("service types")}
				</label>
			</td>
		</tr>
		<tr>
			<td>
				{icon name="division" class="fa-fw"}
			</td>
			<td class="nobr">
				<strong>{trans("Division:")}</strong>
			</td>
			<td>
				<select name="division"	form="uke-income-form" {tip text="Select division"}>
					<option value="">{trans("— all —")}</option>
					{foreach $divisions as $division}
						<option value="{$division.id}"{if isset($filter['uke-income']['division']) && $filter['uke-income']['division'] == $division.id} selected{/if}
							>{$division.label|escape}</option>
					{/foreach}
				</select>
			</td>
		</tr>
		<tr>
			<td class="valign-top">
				{icon name="customergroup" class="fa-fw"}
			</td>
			<td class="nobr valign-top">
				<strong>{trans("Customer groups")}</strong>
			</td>
			<td>
				<div id="uke-income-customergroup-selection">
					<select name="customergroup" form="uke-income-form">
						<option value="">{trans("— any —")}</option>
						{foreach $customergroups as $group}
							<option value="{$group.id}"{if isset($filter['uke-income']['customergroup']) && $filter['uke-income']['customergroup'] == $group.id} selected{/if}
								>{$group.name|escape}</option>
						{/foreach}
					</select>
					<span>
						<label {tip text="current customer group assignments"}>
							<input type="radio" name="customergroup-intersection" value="current" form="uke-income-form"
								{if !isset($filter['uke-income']['customergroup-intersection']) || $filter['uke-income']['customergroup-intersection'] == 'current'} checked{/if}>
							{trans("<!uke>current")}
						</label>
						<label {tip text="customer group assignment full time intersection with selected period"}>
							<input type="radio" name="customergroup-intersection" value="fully" form="uke-income-form"
								{if isset($filter['uke-income']['customergroup-intersection']) && $filter['uke-income']['customergroup-intersection'] == 'fully'} checked{/if}>
							{trans("<!uke>fully")}
						</label>
						<label {tip text="customer group assignment partial time intersection with selected period"}>
							<input type="radio" name="customergroup-intersection" value="partially" form="uke-income-form"
								{if isset($filter['uke-income']['customergroup-intersection']) && $filter['uke-income']['customergroup-intersection'] == 'partially'} checked{/if}>
							{trans("<!uke>partially")}
						</label>
					</span>
				</div>
			</td>
		</tr>
		<tr>
			<td>
				{icon name="calendar" class="fa-fw"}
			</td>
			<td class="nobr">
				<strong>{trans("Period:")}</strong>
			</td>
			<td>
				<span class="lms-ui-date-period-container">
					{date_period_preset from="[form=\"uke-income-form\"][name=\"from\"]" to="[form=\"uke-income-form\"][name=\"to\"]" periods="previous-year,previous-month,current-year,current-month,next-month,next-year"}
					<span>{trans("From")}</span>
					<input type="text" name="from" size="10" maxlength="10" placeholder="{trans("yyyy/mm/dd")}"
						form="uke-income-form" required
						{tip class="lms-ui-date no-persistent-filter-field" text="Enter date in 'yyyy/mm/dd' format or click to choose it from calendar"}>
					<span>{trans("To")}</span>
					<input type="text" name="to" size="10" maxlength="10" placeholder="{trans("yyyy/mm/dd")}"
						form="uke-income-form" required
						{tip class="lms-ui-date no-persistent-filter-field" text="Enter date in 'yyyy/mm/dd' format (empty field means current date) or click to choose it from calendar"}>
				</span>
			</td>
		</tr>
		<tr>
			<td>
				{icon name="download" class="fa-fw"}
			</td>
			<td class="nobr">
				<label for="bandwidths">
					<strong>{trans("Bandwidth distribution:")}</strong>
				</label>
			</td>
			<td>
				<input type="checkbox" name="bandwidths" id="bandwidths" value="1"
					form="uke-income-form"
					{if isset($filter['uke-income']['bandwidths'])} checked{/if}>
			</td>
		</tr>
		<tr>
			<td>
				{icon name="tax" class="fa-fw"}
			</td>
			<td class="nobr">
				<label for="brutto">
					<strong>{trans("Brutto:")}</strong>
				</label>
			</td>
			<td>
				<input type="checkbox" name="brutto" id="brutto" value="1"
					form="uke-income-form"
					{if isset($filter['uke-income']['brutto'])} checked{/if}>
			</td>
		</tr>
		<tr>
			<td>
				{icon name="legal-personality" class="fa-fw"}
			</td>
			<td class="nobr">
				<label for="budgetaryunits">
					<strong>{trans("Separate budgetary units")}</strong>
				</label>
			</td>
			<td>
				<input type="checkbox" name="budgetaryunits" id="budgetaryunits" value="1"
					form="uke-income-form"
					{if isset($filter['uke-income']['budgetaryunits'])} checked{/if}>
			</td>
		</tr>
		<tr>
			<td colspan="3" class="lms-ui-box-buttons">
				<div class="print-menu">
					{button type="submit" form="uke-income-form" icon="print" label="Print"}
					<div class="print-filter">
						<strong>{trans("Filter:")}</strong>
						{persistent_filter id="uke-income" form="uke-income-form"}
					</div>
				<div>
			</td>
		</tr>
	</tbody>
</table>

{/if}

{if $printmenu == "netdev"}
<form method="post" name="sidusis" id="sidusis-form" action="?m=netdevprint&type=uke-sidusis">
	<input type="submit" class="hiddenbtn">
</form>

<table class="lmsbox">
	<colgroup>
		<col style="width: 1%;">
		<col style="width: 1%;">
		<col style="width: 99%;">
	</colgroup>
	<thead>
		<tr>
			<td colspan="3" class="nobr">
				{icon name="netdev" class="fa-fw"}
				<strong>{trans("SIDUSIS report")}</strong>
			</td>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td>
				{icon name="division" class="fa-fw"}
			</td>
			<td class="nobr">
				<strong>{trans("Division")}</strong>
			</td>
			<td>
				<select name="division"	form="sidusis-form" required {tip text="Select division"}>
					<option value="">{trans("— all —")}</option>
					{foreach $divisions as $division}
						<option value="{$division.id}">{$division.label|escape}</option>
					{/foreach}
				</select>
			</td>
		</tr>
		{if !empty($invprojects)}
			<tr>
				<td>
					{icon name="money" class="fa-fw"}
				</td>
				<td class="nobr">
					<strong>{trans("Investment projects")}</strong>
				</td>
				<td>
					<select name="projects[]" form="sidusis-form" required
						{tip text="Select projects" class="lms-ui-multiselect"}
						data-default-value="{trans("<!invproject>— without project —")}"
						multiple>
						<option value="" data-exclusive selected>{trans("<!invproject>— without project —")}</option>
						{foreach $invprojects as $project}
							<option value="{$project.id}"{if !empty($project.divisionid)} data-divisionid="{$project.divisionid}"{/if}>{$project.name|escape}</option>
						{/foreach}
					</select>
				</td>
			</tr>
		{/if}
		<tr>
			<td colspan="3" class="lms-ui-box-buttons">
				{button type="submit" form="sidusis-form" icon="submit" label="Submit"}
			</td>
		</tr>
	</tbody>
</table>

<script>

	$(function() {
		$('#sidusis-form').submit(function () {
			$('[form="sidusis-form"][type="submit"]').prop('disabled', false);
		})

		$('[form="sidusis-form"][name="division"]').change(function() {
			var divisionId = $(this).val();
			$('[form="sidusis-form"][name="projects[]"]').find('option').each(function() {
				var optionDivisionId = $(this).attr('data-divisionid');
				$(this).toggle(!optionDivisionId || divisionId == "" || optionDivisionId == divisionId);
			});
			$('[form="sidusis-form"][name="projects[]"]').trigger('lms:multiselect:updated');
		});
	});

</script>

{/if}

{if $printmenu == "voip"}

<form method="post" name="printvoipsummary" id="printvoipsummary" action="?m=voipprint&type=summary">
	<input type="submit" class="hiddenbtn">
</form>

<table class="lmsbox">
	<colgroup>
		<col style="width: 1%;">
		<col style="width: 1%;">
		<col style="width: 98%;">
	</colgroup>
	<thead>
		<tr>
			<td>
				{icon name="money"}
			</td>
			<td class="nobr" colspan="2">
				<strong>{trans("VoIP summary")}</strong>
			</td>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td>
				{icon name="country"}
			</td>
			<td class="nobr">
				<strong>{trans("<!voip-summary>Domestic prefix")}</strong>
			</td>
			<td>
				<input type="text" size="5" name="domestic-prefix" form="printvoipsummary" value="{$domestic_prefix}">
			</td>
		</tr>
		<tr>
			<td>
				{icon name="calendar"}
			</td>
			<td>
				<strong>{trans("Period")}</strong>
			</td>
			<td>
				{date_period_preset from="[form=\"printvoipsummary\"][name=\"datefrom\"]" to="[form=\"printvoipsummary\"][name=\"dateto\"]"
					periods="previous-year,previous-month,current-year,current-month,next-month,next-year"}
				<span>{trans("From")}</span>
				<input type="text" name="datefrom" form="printvoipsummary" size="10" maxlength="10"
					placeholder="{trans("yyyy/mm/dd")}"
					{tip class="lms-ui-date" text="Enter date in 'yyyy/mm/dd' format (empty field means 1970/01/01) or click to choose it from calendar"}>
				<span>{trans("To")}</span>
				<input type="text" name="dateto" form="printvoipsummary" size="10" maxlength="10"
					placeholder="{trans("yyyy/mm/dd")}"
					{tip class="lms-ui-date" text="Enter date in 'yyyy/mm/dd' format (empty field means current date) or click to choose it from calendar"}>
			</td>
		</tr>
		<tr>
			<td colspan="3" class="lms-ui-box-buttons">
				{button label="Print" icon="print" type="submit" form="printvoipsummary"}
			</td>
		</tr>
	</tbody>
</table>

{/if}

{/block}
