info
Locale locale
String date_column
String fromDate
String toDate
String defaultDataSize
de.sep.sesam.util.RendererUtils rendererUtils
}
@returnIf(clients == null || clients.isEmpty())
@returnIf(items == null || items.isEmpty())
@*Queries:
* [
* {
* "paramName" : "client_ids",
* "condition" : [
* "@returnIf(location_ids == null || location_ids.isEmpty())"
* ],
* "query" : [
* "SELECT",
* "client_id",
* "FROM",
* "clients",
* "WHERE",
* "location in (WITH RECURSIVE children(id) AS (SELECT l.id FROM locations l WHERE l.id in @(sqlList:@(location_ids)",
* "UNION ALL SELECT l.id from children c,locations l where l.parent=c.id) SELECT * FROM children)"
* ],
* "converter" : [
* "toList(client_id)"
* ]
* },
* {
* "paramName" : "clients",
* "condition" : [
* "@returnIf(client_ids == null || client_ids.isEmpty())"
* ],
* "query" : [
* "SELECT",
* "clients.client_id,",
* "clients.name as name,",
* "locations.name as location,",
* "clients.os as os,",
* "clients.sesam_version as version",
* "FROM",
* "clients, locations",
* "WHERE",
* "clients.client_id in @(sqlList:@(client_ids))",
* "AND",
* "locations.id = clients.location",
* "ORDER BY",
* "locations.name, clients.client_id"
* ],
* "converter" : [
* "toMap(client_id)"
* ]
* },
* {
* "paramName" : "items",
* "condition" : [
* "@returnIf(client_ids == null || client_ids.isEmpty())"
* ],
* "query" : [
* "SELECT",
* "client_id,",
* "task,",
* "media_pool,",
* "data_size",
* "FROM",
* "results",
* "WHERE",
* "@(dateRange:@(date_column))",
* "AND",
* "client_id in @(sqlList:@(client_ids))",
* "AND",
* "data_size is not null",
* "ORDER BY",
* "client_id, task, media_pool"
* ]
* }
* ]
*@
@include("../commons/tags.html")
@include("../commons/functions.html")
@sepReportHeader("SEP Report")
@sepTitleBox("Title", sepFnGetToday(locale), "")
@if (date_column == "sesam_date") {
@sepDateRangeLabel(sepFnGetDate(sepFnStringToDate(fromDate), locale), sepFnGetDate(sepFnStringToDate(toDate), locale), date_column)
} else {
@sepDateRangeLabel(sepFnGetDateLong(sepFnStringToDate(fromDate), locale), sepFnGetDateLong(sepFnStringToDate(toDate), locale), date_column)
}
@{
Object client_id = null;
String client_name = null;
String client_location = null;
long total = 0;
long all_total = 0;
String task = null;
String pool = null;
boolean hasOpenTable = false;
boolean printLocationInfo = false;
}
@for (Map item : items) {
@{
Object key = item.get("client_id");
boolean newClient = false;
if (client_id == null || !client_id.equals(key)) {
newClient = true;
client_id = key;
}
String previousClientLocation = client_location;
Map client = clients.get(key);
client_name = client != null ? String.valueOf(client.get("name")) : "";
client_location = client != null ? String.valueOf(client.get("location")) : "";
String client_os = client != null ? String.valueOf(client.get("os")) : "";
String client_version = client != null ? String.valueOf(client.get("version")) : "";
if (location_ids != null && !location_ids.isEmpty()) {
if (previousClientLocation == null || !previousClientLocation.equals(client_location)) {
printLocationInfo = true;
}
}
}
@if(newClient) {
@if(hasOpenTable) {
@if(task) {
@(task) |
@(pool) |
@sepFnFormatBytes(rendererUtils, total, defaultDataSize) |
@{
all_total += total;
}
}
|
|
@i18n("Summary.Total"): |
@sepFnFormatBytes(rendererUtils, all_total, defaultDataSize) |
@{
hasOpenTable = false;
}
}
@{
total = 0;
all_total = 0;
task = null;
pool = null;
}
@if(printLocationInfo) {
@sepTitleLabel("Client.Info.Location", " " + client_location)
@{
printLocationInfo = false;
}
}
@sepTitleLabel("Client.Info.Name", " " + client_name)
@sepInfoLabel("Client.Info.Location", client_location)
@sepInfoLabel("Client.Info.OS", client_os)
@sepInfoLabel("Client.Info.Version", client_version)
@i18n("Column.Task") |
@i18n("Column.Pool") |
@i18n("Column.Size") |
@{
hasOpenTable = true;
}
}
@{
boolean doRenderRow = false;
String currentTask = String.valueOf(item.get("task"));
String currentPool = String.valueOf(item.get("media_pool"));
Object currentDataSize = item.get("data_size");
if (task == null || (currentTask != null && currentTask.equals(task))) {
task = currentTask;
if (currentDataSize != null) {
total += Long.valueOf(String.valueOf(currentDataSize));
}
pool = currentPool;
} else{
doRenderRow = true;
}
}
@if(doRenderRow) {
@(task) |
@(pool) |
@sepFnFormatBytes(rendererUtils, total, defaultDataSize) |
@{
all_total += total;
total = 0;
task = currentTask;
if (currentDataSize != null) {
total += Long.valueOf(String.valueOf(currentDataSize));
}
pool = currentPool;
}
}
}
@if(hasOpenTable) {
@if(task) {
@(task) |
@(pool) |
@sepFnFormatBytes(rendererUtils, total, defaultDataSize) |
@{
all_total += total;
}
}
|
|
@i18n("Summary.Total"): |
@sepFnFormatBytes(rendererUtils, all_total, defaultDataSize) |
@{
hasOpenTable = false;
}
}