diff options
Diffstat (limited to 'public/js/report.coffee')
| -rw-r--r-- | public/js/report.coffee | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/public/js/report.coffee b/public/js/report.coffee new file mode 100644 index 00000000..650e25b4 --- /dev/null +++ b/public/js/report.coffee @@ -0,0 +1,29 @@ +$(-> + $('.date').datepicker() + + $.getJSON('transactions', (data) -> + $.each(data.transactions, -> + keys = Object.keys(this) + transaction = this + + $.each(keys, (i,v) -> + $('tbody tr:last td:eq(' + i + ')').html(transaction[v]) + }) + + $('tbody:last').append($('tbody tr:last').clone()) + }) + $('tbody tr:last').remove() + + btc = 0 + $('td:nth-child(4)').each(-> + btc += parseFloat($(this).html()) + }) + $('#btc').html(btc) + + cad = 0 + $('td:nth-child(5)').each(-> + cad += parseFloat($(this).html()) + }) + $('#cad').html(cad) + }) +) |
