<% settings = @reportSettingsFromInfo(@reportInfo) %> <% fieldItems = @form.getReportItems() %> <% groupFields = settings.reportGroupFields %> <% if settings.layout == @types.ReportLayouts.Align: %> <% groupFieldsNames = groupFields.map (g) -> g.groupField %> <% notGroupItems = fieldItems.filter ( i ) -> ( groupFieldsNames.indexOf( i.field ) == -1 ) %> <% fieldItems = notGroupItems %> <% end %> <% sumFields = @reportInfo.fields.filter( (f) -> f.sum ).map( (f) -> f.field ) %> <% minFields = @reportInfo.fields.filter( (f) -> f.min ).map( (f) -> f.field ) %> <% maxFields = @reportInfo.fields.filter( (f) -> f.max ).map( (f) -> f.field ) %> <% avgFields = @reportInfo.fields.filter( (f) -> f.avg ).map( (f) -> f.field ) %> <% if settings.pageSummary : %> [ { text: '<%= @message 'PAGE_SUMMARY' %> {$page_total_cnt} - <%= @message 'RECORDS_TOTAL' %>', colSpan: <%- fieldItems.length %>, style: 'pagesummary', } ], <% if sumFields.length : %> [ <% for item, ikey in fieldItems : %> <% fInfo = @reportInfo.field item.field %> { text: [ <% if ikey == 0 : %> '<%= @message 'SUM' %> ', <% end %> <% if fInfo && fInfo.sum :%> {$page_total<%- @goodFieldName( item.field ) %>_sum}, <% else : %> '', <% end %> ], style: 'pagesummary', <% if ikey != 0 && fInfo && fInfo.sum : %> alignment: '{$<%- @goodFieldName( item.field ) %>_align}', <% end %> }, <% end %> ], <% end %> <% if avgFields.length : %> [ <% for item, ikey in fieldItems : %> <% fInfo = @reportInfo.field item.field %> { text: [ <% if ikey == 0 : %> '<%= @message 'AVERAGE' %> ', <% end %> <% if fInfo && fInfo.avg :%> {$page_total<%- @goodFieldName( item.field ) %>_avg}, <% else :%> '', <% end %> ], style: 'pagesummary', <% if ikey != 0 && fInfo && fInfo.avg : %> alignment: '{$<%- @goodFieldName( item.field ) %>_align}', <% end %> }, <% end %> ], <% end %> <% if minFields.length : %> [ <% for item, ikey in fieldItems : %> <% fInfo = @reportInfo.field item.field %> { text: [ <% if ikey == 0 : %> '<%= @message 'MIN' %> ', <% end %> <% if fInfo && fInfo.min :%> {$page_total<%- @goodFieldName( item.field ) %>_min}, <% else :%> '', <% end %> ], style: 'pagesummary', <% if ikey != 0 && fInfo && fInfo.min : %> alignment: '{$<%- @goodFieldName( item.field ) %>_align}', <% end %> }, <% end %> ], <% end %> <% if maxFields.length : %> [ <% for item, ikey in fieldItems : %> <% fInfo = @reportInfo.field item.field %> { text: [ <% if ikey == 0 : %> '<%= @message 'MAX' %> ', <% end %> <% if fInfo && fInfo.max :%> {$page_total<%- @goodFieldName( item.field ) %>_max}, <% else :%> '', <% end %> ], style: 'pagesummary', <% if ikey != 0 && fInfo && fInfo.max : %> alignment: '{$<%- @goodFieldName( item.field ) %>_align}', <% end %> }, <% end %> ], <% end %> <% end %> <% if settings.reportGlobalSummary : %> {BEGIN global_summary} [ { text: '<%= @message 'GLOBAL_SUMMARY' %> {$global_total_cnt} - <%= @message 'RECORDS_TOTAL' %>', colSpan: <%- fieldItems.length %>, style: 'globalsummary', } ], <% if sumFields.length : %> [ <% for item, ikey in fieldItems : %> <% fInfo = @reportInfo.field item.field %> { text: [ <% if ikey == 0 :%> '<%- @message 'SUM' %> ', <% end %> <% if fInfo && fInfo.sum : %> {$global_total<%- @goodFieldName( item.field ) %>_sum}, <% else : %> '', <% end %> ], style: 'globalsummary', <% if ikey != 0 && fInfo && fInfo.sum : %> alignment: '{$<%- @goodFieldName( item.field ) %>_align}', <% end %> }, <% end %> ], <% end %> <% if avgFields.length : %> [ <% for item, ikey in fieldItems : %> <% fInfo = @reportInfo.field item.field %> { text: [ <% if ikey == 0 :%> '<%- @message 'AVERAGE' %> ', <% end %> <% if fInfo && fInfo.avg : %> {$global_total<%- @goodFieldName( item.field ) %>_avg}, <% else : %> '', <% end %> ], style: 'globalsummary', <% if ikey != 0 && fInfo && fInfo.avg : %> alignment: '{$<%- @goodFieldName( item.field ) %>_align}', <% end %> }, <% end %> ], <% end %> <% if minFields.length : %> [ <% for item, ikey in fieldItems : %> <% fInfo = @reportInfo.field item.field %> { text: [ <% if ikey == 0 :%> '<%- @message 'MIN' %> ', <% end %> <% if fInfo && fInfo.min : %> {$global_total<%- @goodFieldName( item.field ) %>_min}, <% else : %> '', <% end %> ], style: 'globalsummary', <% if ikey != 0 && fInfo && fInfo.min : %> alignment: '{$<%- @goodFieldName( item.field ) %>_align}', <% end %> }, <% end %> ], <% end %> <% if maxFields.length : %> [ <% for item, ikey in fieldItems : %> <% fInfo = @reportInfo.field item.field %> { text: [ <% if ikey == 0 :%> '<%- @message 'MAX' %> ', <% end %> <% if fInfo && fInfo.max : %> {$global_total<%- @goodFieldName( item.field ) %>_max}, <% else : %> '', <% end %> ], style: 'globalsummary', <% if ikey != 0 && fInfo && fInfo.max : %> alignment: '{$<%- @goodFieldName( item.field ) %>_align}', <% end %> }, <% end %> ], <% end %> {END global_summary} <% end %>