<%@ include file="inc_header.jsp"%>

<link rel="stylesheet" href="css/reports.css">
<script type="text/javascript" src="js/reports.js"></script>

<script type="text/javascript">

	$(function() {
		var visnTotalsResultsTable = $('#visnTotalsResultsTable').DataTable({
			paging : false,
			autowidth : false,
			searching : false,
			ordering : false,
			info : false,
			columnDefs: [
				{ targets: 0, "width": "200px"},
				{ targets: '_all', "width": "150px" }
			],
			"language" : {
				// Messages used in the case that selections render no data.
				"emptyTable" : "No data found.",
				"infoEmpty" : "No data found."
			}
		});
	})
</script>

<div id="visnTotalResultsContainer">
<h3 id="reportTitle" tabindex="0">${reportTitle}</h3>
<table id="visnTotalsResultsTable" class="compact stripe dt-head-left dt-body-left hover cell-border">
	<thead>
		<tr>
			<th aria-label="VISN" tabindex="0">VISN</th>
			<th aria-label="Total Patients" tabindex="0">Total Patients</th>
			<c:forEach items="${modalities}" var="modality">
				<th aria-label="${modality.description}" tabindex="0">${modality.description}</th>
			</c:forEach>
		</tr>
	</thead>
	<tbody>
		<c:forEach items="${visnTotalReports}" var="report">
			<tr>
				<td>
				<c:choose>
					<c:when test="${report.visnName == 'Total'}">
					${report.visnName}
					</c:when>
					<c:otherwise>
						<!-- Give the appearance of a link for drilling down into visn and facility. -->
						<form:form method="post" action="reports.html" commandName="form" class="inline">
							<input type="hidden" name="drillDownVisn" value="true"/>
							<form:hidden path="visnId" value="${report.visnId}"/>
							<form:hidden path="modalityCode" value="${modalityCode}"/>
							<form:hidden path="reportEndDate" value="${reportEndDate}"/>
							<form:hidden path="vendorId" value="${vendorId}"/>
							<form:hidden path="facilityId" value="-1"/>
							<button type="submit" value="Submit" class="link-button">
							${report.visnName}</button>
						</form:form>
					</c:otherwise>
				</c:choose>
				</td>
				
				<td><fmt:formatNumber value="${report.patientTotals}" type="number" groupingUsed="true"/></td>
				<c:forEach items="${modalities}" var="modality">
					<td><fmt:formatNumber value="${report.totalsMap[modality.description]}" type="number"
					groupingUsed="true"/></td>
				</c:forEach>
			</tr>
		</c:forEach>
	</tbody>
</table>
</div>
<br>
<%@ include file="reportsMenuButton.jsp"%>

<%@ include file="vendorReportStatus.jsp"%>