diff --git a/index.php b/index.php index 34cf99d..5d22554 100644 --- a/index.php +++ b/index.php @@ -90,7 +90,13 @@ function(data){ $('#unpaid').html(parseFloat(data['unpaid']).toFixed() + ' '); $('#received').html(parseFloat(data['received']).toFixed() + ' '); - $('#collecting').html("Collecting " + (parseFloat(data['received']) - parseFloat(data['paid'])).toFixed() + " / " + parseFloat(data['actual']['topay']).toFixed() + " for " + data['actual']['tx'].substring(0,32) + "..."); + var tmp20140808 = "error"; + if (data['actual']['tx'] === undefined) { // nothing + } else { + tmp20140808 = data['actual']['tx'].substring(0,32); + } + + $('#collecting').html("Collecting " + (parseFloat(data['received']) - parseFloat(data['paid'])).toFixed() + " / " + parseFloat(data['actual']['topay']).toFixed() + " for " + tmp20140808 + "..."); $('#trans').html(''); for(var i in data['transactions']) @@ -148,4 +154,4 @@ function(data){ update(); - \ No newline at end of file + diff --git a/script.php b/script.php index 6bbfa53..b866495 100644 --- a/script.php +++ b/script.php @@ -76,15 +76,15 @@ function getAddress($trans) } } - $query = mysql_query("SELECT SUM(amount) FROM `transactions`;"); + $query = mysql_query("SELECT SUM(amount) FROM `transactions` where `state` < 3;"); $query = mysql_fetch_row($query); $money = $query[0]; - $query = mysql_query("SELECT SUM(topay) FROM `transactions` WHERE `state` > 0;"); + $query = mysql_query("SELECT SUM(topay) FROM `transactions` WHERE `state` > 0 and `state` < 3;"); $query = mysql_fetch_row($query); $money -= $query[0]; - $query = mysql_query("SELECT * FROM `transactions` WHERE `state` = 0 AND `topay` > 0 ORDER BY `id` ASC;"); + $query = mysql_query("SELECT * FROM `transactions` WHERE `state` = 0 AND `state` < 3 AND `topay` > 0 ORDER BY `id` ASC;"); while($row = mysql_fetch_assoc($query)) { print("Money: " . $money . "\n"); @@ -111,4 +111,4 @@ function getAddress($trans) echo ("Waiting...\n"); sleep(20); } -?> \ No newline at end of file +?>