|
|
@@ -624,17 +624,24 @@ frappe.views.ReportView = frappe.ui.BaseList.extend({ |
|
|
|
this.data.pop(); |
|
|
|
} |
|
|
|
|
|
|
|
var total_flag = ""; |
|
|
|
if(this.add_totals_row) { |
|
|
|
var totals_row = {_totals_row: 1}; |
|
|
|
if(this.data.length) { |
|
|
|
this.data.forEach(function(row, ri) { |
|
|
|
$.each(row, function(key, value) { |
|
|
|
if($.isNumeric(value)) { |
|
|
|
totals_row[key] = (totals_row[key] || 0) + value; |
|
|
|
} |
|
|
|
}); |
|
|
|
if(row._totals_row && !total_flag) |
|
|
|
total_flag = ri; |
|
|
|
else { |
|
|
|
$.each(row, function(key, value) { |
|
|
|
if($.isNumeric(value)) { |
|
|
|
totals_row[key] = (totals_row[key] || 0) + value; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
if(total_flag) |
|
|
|
this.data.splice(total_flag, 1); |
|
|
|
this.data.push(totals_row); |
|
|
|
} |
|
|
|
}, |
|
|
|