Skip to content

Instantly share code, notes, and snippets.

@awolad
Created February 7, 2018 05:02
Show Gist options
  • Save awolad/2c596eb5e97b06584c545e2b17277c8f to your computer and use it in GitHub Desktop.
Save awolad/2c596eb5e97b06584c545e2b17277c8f to your computer and use it in GitHub Desktop.
Add subtotal row for tally calculation
$("table.report-fix-table tr.unique_tr_for_sub_total").each(function () {
var currentTd = $(this).find('td:nth-child(2)').text()
var nextTd = $(this).next().find('td:nth-child(2)').text()
if (currentTd != nextTd) {
$(this).after(
'<tr class="unique_tr_for_sub_total">' +
'<td style="border: none;border-left: 1px solid #dddcdc;"></td>' +
/*'<td style="border: none;"></td>' +*/
'<td style="border: none;"></td>' +
'<td style="border: none;"></td>' +
'<td style="border: none;"><strong>Sub Total: </strong></td>' +
'<td class="sub_total" style="text-align: right!important;"><strong></strong></td>' +
'</tr>'
);
}
tally('td.sub_total', 'receive_amount')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment