<% settings = @reportSettingsFromInfo(@reportInfo) %> <% fieldItems = @form.getReportItems() %> <% totalTypes = [ {type: 'sum', label: 'SUM'} {type: 'avg', label: 'AVERAGE'} {type: 'min', label: 'MIN'} {type: 'max', label: 'MAX'} ] %> <% totalTypes = totalTypes.filter( (total) => @reportInfo.fields.some( (f) -> f[total.type] ) ) %> <% groupFields = settings.reportGroupFields %> <% groupFieldsNames = groupFields.map (g) -> g.groupField %> <% notGroupItems = fieldItems.filter (i) -> groupFieldsNames.indexOf(i.field) == -1 %> <% if settings.layout != @types.ReportLayouts.Align && @reportInfo.groupFields.length : %> <% items = fieldItems %> <% else : %> <% items = notGroupItems %> <% end %> <% summaries = [ {type: 'page', enabled: settings.pageSummary, label: 'PAGE_SUMMARY'} {type: 'global', enabled: settings.reportGlobalSummary, label: 'GLOBAL_SUMMARY'} ] %> <% for summary in summaries.filter( (s) -> s.enabled ) : %> <% summaryId = 'report_' + summary.type + '_summary_{$pageid}_{$pageno}' %> <% cellClass = summary.type + 'summary' %> {BEGIN <%- summary.type %>_summary} <%= @message summary.label %> <% if summary.type == 'page' : %> {$page_total_cnt} <% else : %> {$global_total_cnt} <% end %> - <%= @message 'RECORDS_TOTAL' %> <% if totalTypes.length : %> <% for item in items : %> <%= @fieldLabel(item.field) %> <% end %> <% end %> <% for total in totalTypes : %> <% totalHeaderId = summaryId + '_' + total.type %> <% for item, ikey in items : %> <% fInfo = @reportInfo.field item.field %> <% hasTotal = fInfo && fInfo[total.type] %> <% cellTag = if ikey == 0 then 'th' else 'td' %> <<%- cellTag %> class="<%- cellClass %><% if hasTotal && ikey != 0 : %> {$fieldclass_<%- @goodFieldName(item.field) %>}<% end %>" <% if ikey == 0 : %>id="<%- totalHeaderId %>"<% end %> headers="<%- summaryId %><%- if ikey != 0 then ' ' + totalHeaderId %><%- if hasTotal then ' ' + summaryId + '_field_' + @goodFieldName(item.field) %>" > <% if ikey == 0 : %> <%= @message total.label %><% if hasTotal : %> <% end %> <% end %> <% if hasTotal : %> <% if summary.type == 'page' : %> {$page_total<%- @goodFieldName(item.field) %>_<%- total.type %>} <% else : %> {$global_total<%- @goodFieldName(item.field) %>_<%- total.type %>} <% end %> <% else if ikey != 0 : %>   <% end %> > <% end %> <% end %> {END <%- summary.type %>_summary} <% end %>