<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/WEB-INF/jspf/include/taglibs.jsp"%>

<div class="report">
<form action="">
<input type="hidden" name="action" value="ShowBalance">
<input type="hidden" name="module" value="contract"/>
<input type="hidden" name="mid" value="0"/>
<table class="filter" cellspacing="0" border="0">
	<tr>
		<td>Месяц:</td>
		<td>
			<c:set var="selectNameMonth" value="month" />
			<c:set var="selectMonth" value="${dataMap['month']}" />
			<%@include file="../include/month.jsp" %>
		</td>
		<td>Год:</td>
		<td>
			<select name="year">
				<c:forEach var="item" items="${dataMap['yearList']}">
					<c:choose>
						<c:when test="${item==dataMap['year']}">
							<option value="${item}" selected="selected">${item}</option>
						</c:when>
						<c:otherwise>
							<option value="${item}">${item}</option>
						</c:otherwise>
					</c:choose>
				</c:forEach>
			</select>
		</td>
		<td>
			<input type="submit" value="Вывести">
		</td>
	</tr>
</table>
</form>
<table cellspacing="1" style="width: 600px;">
		<thead>
			<tr>
				<td>Описание</td>
				<td>Сумма, руб.</td>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>Входящий остаток на начало месяца</td>
				<td>${dataMap['summa1']}</td>
			</tr>
			<tr>
				<td>Приход за месяц (всего)</td>
				<td>${dataMap['summa2']}</td>
				<c:if test="${not empty dataMap['paymentList']}">
				<c:forEach var="item" items="${dataMap['paymentList']}">
					<tr>
						<td>${item[0]}</td>
						<td>${item[1]}</td>
					</tr>
				</c:forEach>
				</c:if>
			</tr>
			<tr>
				<td>Расход за месяц (всего)</td>
				<td> - ${dataMap['summa4']}</td>
				<c:if test="${not empty dataMap['chargeList']}">
				<c:forEach var="item" items="${dataMap['chargeList']}">
					<tr>
						<td>${item[0]}</td>
						<td>${item[1]}</td>
					</tr>
				</c:forEach>
				</c:if>
			</tr>
			<tr>
				<td>Наработка за месяц (всего)</td>
				<td>${dataMap['summa3']}</td>
				<c:if test="${not empty dataMap['accountList']}">
				<c:forEach var="item" items="${dataMap['accountList']}">
					<tr>
						<td>${item[0]}</td>
						<td>${item[1]}</td>
					</tr>
				</c:forEach>
				</c:if>
			</tr>
			<tr>
				<td>Исходящий остаток на конец месяца</td>
				<td>${dataMap['summa5']}</td>
			</tr>
			<c:if test="${contract.balanceMode==1}">
				<tr>
					<td>Лимит</td>
					<td>${dataMap['limit']}</td>
				</tr>
			</c:if>
		</tbody>
	</table>
</div>

<c:if test="${dataMap['has_independent_subs']==1}">
<form method='get' action=''>
		<input type="hidden" name="action" value="DistributeBalance"/>
		<input type="hidden" name="module" value="contract"/>
		<input type="hidden" name="mid" value="0"/>
		<br></br>
		<input type="submit" value="Перенос средств"/> 
</form>
</c:if>
