aboutsummaryrefslogtreecommitdiffstats
path: root/js/report.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2012-10-23 10:28:49 -0700
committerAdam Soltys <[email protected]>2012-10-23 10:28:49 -0700
commitb94145ff904315c48781f958f54fae1428ef60e6 (patch)
treeb31db13342939584d12b52e88bd83ce23c77571c /js/report.js
parent5ec0a340957a90afe2bcf7073cc368eee77bf856 (diff)
downloadcoinos-server-b94145ff904315c48781f958f54fae1428ef60e6.tar.gz
coinos-server-b94145ff904315c48781f958f54fae1428ef60e6.zip
Clean up report, save transactions as JSON
Diffstat (limited to 'js/report.js')
-rw-r--r--js/report.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/js/report.js b/js/report.js
new file mode 100644
index 00000000..6cacf077
--- /dev/null
+++ b/js/report.js
@@ -0,0 +1,29 @@
+$(function() {
+ $('#date').datepicker();
+
+ $.getJSON('transactions.json', function(data) {
+ $.each(data.transactions, function() {
+ var keys = Object.keys(this);
+ var transaction = this;
+
+ $.each(keys, function(i,v) {
+ $('tbody tr:last td:eq(' + i + ')').html(transaction[v]);
+ });
+
+ $('tbody:last').append($('tbody tr:last').clone());
+ });
+ $('tbody tr:last').remove();
+
+ var btc = 0;
+ $('td:nth-child(4)').each(function() {
+ btc += parseFloat($(this).html());
+ });
+ $('#btc').html(btc);
+
+ var cad = 0;
+ $('td:nth-child(5)').each(function() {
+ cad += parseFloat($(this).html());
+ });
+ $('#cad').html(cad);
+ });
+});