<% if (m.grandTotalExists) { %> Grand total: {{m.total|escape}} <% } else { %> <% if (m.total) { %> Total: {{m.total|escape}} <% } %> <% } %>