@include("../commons/styles.html") @include("../commons/images.html") @args() { List> items Map info Locale locale String date_column String fromDate String toDate } @returnIf(items == null) @*Queries: * [ * { * "paramName" : "items", * "query" : [ * "SELECT", * "label,barcode,sesam_date,state,message", * "FROM", * "media_results", * "WHERE", * "@(dateRange:sesam_date)", * "AND", * "state <> 'n'", * "AND", * "action = 'readcheck'", * "ORDER BY", * "start_time" * ] * } * ] *@ @include("../commons/tags.html") @include("../commons/functions.html") @sepReportHeader("SEP Report")

@sepTitleBox("Title", sepFnGetToday(locale)) @sepDateRangeLabel(sepFnGetDate(sepFnStringToDate(fromDate), locale), sepFnGetDate(sepFnStringToDate(toDate), locale), date_column)

@{ int total = 0; int successful = 0; int error = 0; } @for (Map item : items) { @{ total++; } @{ String sesamDate = (String) item.get("sesam_date"); String dateStr = ""; if (sesamDate != null) { dateStr = sesamDate.replace("00:00:00", " ").trim(); } } @{ String state = (String) item.get("state"); String stateStr = ""; String color = ""; if ("0".equals(state) || "o".equalsIgnoreCase(state)) { stateStr = "State.Ok"; color = "rgb(0, 178, 0)"; } else if ("1".equals(state) || "w".equalsIgnoreCase(state)) { stateStr = "State.Warning"; color = "rgb(194, 230, 18)"; } else if ("a".equalsIgnoreCase(state)) { stateStr = "State.Active"; color = "rgb(0, 0, 255)"; } else if ("x".equalsIgnoreCase(state) || "f".equalsIgnoreCase(state) || "l".equalsIgnoreCase(state)) { error++; stateStr = "State.Failed"; color = "rgb(178, 0, 0)"; } else if ("n".equalsIgnoreCase(state)) { stateStr = "State.NonRequested"; color = "rgb(192, 192, 192)"; } else if ("p".equalsIgnoreCase(state)) { stateStr = "State.PastDue"; color = "rgb(178, 140, 0)"; } else if ("q".equalsIgnoreCase(state)) { stateStr = "State.Queued"; color = "rgb(0, 255, 255)"; } else if ("t".equalsIgnoreCase(state)) { stateStr = "State.Timeout"; color = "rgb(255, 200, 0)"; } else if ("u".equalsIgnoreCase(state)) { stateStr = "State.Unread"; color = "rgb(128, 128, 128)"; } else if (state != null) { error++; stateStr = "State.Error"; color = "rgb(178, 0, 0)"; } } @if(color) { } else { } }
@i18n("Column.Media") @i18n("Column.Barcode") @i18n("Column.Date") @i18n("Column.State") @i18n("Column.Message")
@(item.get("label")) @(item.get("barcode"))@(dateStr)@i18n(stateStr)@(stateStr)@(item.get("message"))

Summary
@i18n("Summary.MediaChecked"): @(total) @i18n("Summary.Successful"): @(successful)
@i18n("Summary.Failed"): @(error)