Skip to content

Commit a326cc3

Browse files
committed
Merge pull request #2044 from MPOS/add-bonus-earnings
[ADDED] Bonus to earnings page
2 parents 821d7ad + ed517ed commit a326cc3

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

public/include/classes/transaction.class.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,37 +109,42 @@ public function getTransactionSummary($account_id=NULL) {
109109
public function getTransactionTypebyTime($account_id=NULL) {
110110
$this->debug->append("STA " . __METHOD__, 4);
111111
if ($data = $this->memcache->get(__FUNCTION__)) return $data;
112-
$stmt = $this->mysqli->prepare("
113-
SELECT
112+
$stmt = $this->mysqli->prepare("
113+
SELECT
114114
IFNULL(SUM(IF(t.type = 'Credit' AND timestamp >= DATE_SUB(now(), INTERVAL 3600 SECOND), t.amount, 0)), 0) AS 1HourCredit,
115+
IFNULL(SUM(IF(t.type = 'Bonus' AND timestamp >= DATE_SUB(now(), INTERVAL 3600 SECOND), t.amount, 0)), 0) AS 1HourBonus,
115116
IFNULL(SUM(IF(t.type = 'Debit_MP' AND timestamp >= DATE_SUB(now(), INTERVAL 3600 SECOND), t.amount, 0)), 0) AS 1HourDebitMP,
116117
IFNULL(SUM(IF(t.type = 'Debit_AP' AND timestamp >= DATE_SUB(now(), INTERVAL 3600 SECOND), t.amount, 0)), 0) AS 1HourDebitAP,
117118
IFNULL(SUM(IF(t.type = 'TXFee' AND timestamp >= DATE_SUB(now(), INTERVAL 3600 SECOND), t.amount, 0)), 0) AS 1HourTXFee,
118119
IFNULL(SUM(IF(t.type = 'Fee' AND timestamp >= DATE_SUB(now(), INTERVAL 3600 SECOND), t.amount, 0)), 0) AS 1HourFee,
119120
IFNULL(SUM(IF(t.type = 'Donation' AND timestamp >= DATE_SUB(now(), INTERVAL 3600 SECOND), t.amount, 0)), 0) AS 1HourDonation,
120-
121+
121122
IFNULL(SUM(IF(t.type = 'Credit' AND timestamp >= DATE_SUB(now(), INTERVAL 86400 SECOND), t.amount, 0)), 0) AS 24HourCredit,
123+
IFNULL(SUM(IF(t.type = 'Bonus' AND timestamp >= DATE_SUB(now(), INTERVAL 86400 SECOND), t.amount, 0)), 0) AS 24HourBonus,
122124
IFNULL(SUM(IF(t.type = 'Debit_MP' AND timestamp >= DATE_SUB(now(), INTERVAL 86400 SECOND), t.amount, 0)), 0) AS 24HourDebitMP,
123125
IFNULL(SUM(IF(t.type = 'Debit_AP' AND timestamp >= DATE_SUB(now(), INTERVAL 86400 SECOND), t.amount, 0)), 0) AS 24HourDebitAP,
124126
IFNULL(SUM(IF(t.type = 'TXFee' AND timestamp >= DATE_SUB(now(), INTERVAL 86400 SECOND), t.amount, 0)), 0) AS 24HourTXFee,
125127
IFNULL(SUM(IF(t.type = 'Fee' AND timestamp >= DATE_SUB(now(), INTERVAL 86400 SECOND), t.amount, 0)), 0) AS 24HourFee,
126128
IFNULL(SUM(IF(t.type = 'Donation' AND timestamp >= DATE_SUB(now(), INTERVAL 86400 SECOND), t.amount, 0)), 0) AS 24HourDonation,
127129
128130
IFNULL(SUM(IF(t.type = 'Credit' AND timestamp >= DATE_SUB(now(), INTERVAL 604800 SECOND), t.amount, 0)), 0) AS 1WeekCredit,
131+
IFNULL(SUM(IF(t.type = 'Bonus' AND timestamp >= DATE_SUB(now(), INTERVAL 604800 SECOND), t.amount, 0)), 0) AS 1WeekBonus,
129132
IFNULL(SUM(IF(t.type = 'Debit_MP' AND timestamp >= DATE_SUB(now(), INTERVAL 604800 SECOND), t.amount, 0)), 0) AS 1WeekDebitMP,
130133
IFNULL(SUM(IF(t.type = 'Debit_AP' AND timestamp >= DATE_SUB(now(), INTERVAL 604800 SECOND), t.amount, 0)), 0) AS 1WeekDebitAP,
131134
IFNULL(SUM(IF(t.type = 'TXFee' AND timestamp >= DATE_SUB(now(), INTERVAL 604800 SECOND), t.amount, 0)), 0) AS 1WeekTXFee,
132135
IFNULL(SUM(IF(t.type = 'Fee' AND timestamp >= DATE_SUB(now(), INTERVAL 604800 SECOND), t.amount, 0)), 0) AS 1WeekFee,
133136
IFNULL(SUM(IF(t.type = 'Donation' AND timestamp >= DATE_SUB(now(), INTERVAL 604800 SECOND), t.amount, 0)), 0) AS 1WeekDonation,
134137
135138
IFNULL(SUM(IF(t.type = 'Credit' AND timestamp >= DATE_SUB(now(), INTERVAL 2419200 SECOND), t.amount, 0)), 0) AS 1MonthCredit,
139+
IFNULL(SUM(IF(t.type = 'Bonus' AND timestamp >= DATE_SUB(now(), INTERVAL 2419200 SECOND), t.amount, 0)), 0) AS 1MonthBonus,
136140
IFNULL(SUM(IF(t.type = 'Debit_MP' AND timestamp >= DATE_SUB(now(), INTERVAL 2419200 SECOND), t.amount, 0)), 0) AS 1MonthDebitMP,
137141
IFNULL(SUM(IF(t.type = 'Debit_AP' AND timestamp >= DATE_SUB(now(), INTERVAL 2419200 SECOND), t.amount, 0)), 0) AS 1MonthDebitAP,
138142
IFNULL(SUM(IF(t.type = 'TXFee' AND timestamp >= DATE_SUB(now(), INTERVAL 2419200 SECOND), t.amount, 0)), 0) AS 1MonthTXFee,
139143
IFNULL(SUM(IF(t.type = 'Fee' AND timestamp >= DATE_SUB(now(), INTERVAL 2419200 SECOND), t.amount, 0)), 0) AS 1MonthFee,
140144
IFNULL(SUM(IF(t.type = 'Donation' AND timestamp >= DATE_SUB(now(), INTERVAL 2419200 SECOND), t.amount, 0)), 0) AS 1MonthDonation,
141-
145+
142146
IFNULL(SUM(IF(t.type = 'Credit' AND timestamp >= DATE_SUB(now(), INTERVAL 31536000 SECOND), t.amount, 0)), 0) AS 1YearCredit,
147+
IFNULL(SUM(IF(t.type = 'Bonus' AND timestamp >= DATE_SUB(now(), INTERVAL 31536000 SECOND), t.amount, 0)), 0) AS 1YearBonus,
143148
IFNULL(SUM(IF(t.type = 'Debit_MP' AND timestamp >= DATE_SUB(now(), INTERVAL 31536000 SECOND), t.amount, 0)), 0) AS 1YearDebitMP,
144149
IFNULL(SUM(IF(t.type = 'Debit_AP' AND timestamp >= DATE_SUB(now(), INTERVAL 31536000 SECOND), t.amount, 0)), 0) AS 1YearDebitAP,
145150
IFNULL(SUM(IF(t.type = 'TXFee' AND timestamp >= DATE_SUB(now(), INTERVAL 31536000 SECOND), t.amount, 0)), 0) AS 1YearTXFee,

public/templates/bootstrap/account/earnings/default.tpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
<tr>
4747
<th></th>
4848
<th>Credit</th>
49+
<th>Bonus</th>
4950
<th>Debit AP</th>
5051
<th>Debit MP</th>
5152
<th>Donation</th>
@@ -59,6 +60,7 @@
5960
<tr>
6061
<td>Last Hour</th>
6162
<td>{$BYTIME.1HourCredit|number_format:"8"}</td>
63+
<td>{$BYTIME.1HourBonus|number_format:"8"}</td>
6264
<td>{$BYTIME.1HourDebitAP|number_format:"8"}</td>
6365
<td>{$BYTIME.1HourDebitMP|number_format:"8"}</td>
6466
<td>{$BYTIME.1HourDonation|number_format:"8"}</td>
@@ -70,6 +72,7 @@
7072
<tr>
7173
<td>Last Day</th>
7274
<td>{$BYTIME.24HourCredit|number_format:"8"}</td>
75+
<td>{$BYTIME.24HourBonus|number_format:"8"}</td>
7376
<td>{$BYTIME.24HourDebitAP|number_format:"8"}</td>
7477
<td>{$BYTIME.24HourDebitMP|number_format:"8"}</td>
7578
<td>{$BYTIME.24HourDonation|number_format:"8"}</td>
@@ -81,6 +84,7 @@
8184
<tr>
8285
<td>Last Week</th>
8386
<td>{$BYTIME.1WeekCredit|number_format:"8"}</td>
87+
<td>{$BYTIME.1WeekBonus|number_format:"8"}</td>
8488
<td>{$BYTIME.1WeekDebitAP|number_format:"8"}</td>
8589
<td>{$BYTIME.1WeekDebitMP|number_format:"8"}</td>
8690
<td>{$BYTIME.1WeekDonation|number_format:"8"}</td>
@@ -92,6 +96,7 @@
9296
<tr>
9397
<td>Last Month</th>
9498
<td>{$BYTIME.1MonthCredit|number_format:"8"}</td>
99+
<td>{$BYTIME.1MonthBonus|number_format:"8"}</td>
95100
<td>{$BYTIME.1MonthDebitAP|number_format:"8"}</td>
96101
<td>{$BYTIME.1MonthDebitMP|number_format:"8"}</td>
97102
<td>{$BYTIME.1MonthDonation|number_format:"8"}</td>
@@ -103,6 +108,7 @@
103108
<tr>
104109
<td>Last Year</th>
105110
<td>{$BYTIME.1YearCredit|number_format:"8"}</td>
111+
<td>{$BYTIME.1YearBonus|number_format:"8"}</td>
106112
<td>{$BYTIME.1YearDebitAP|number_format:"8"}</td>
107113
<td>{$BYTIME.1YearDebitMP|number_format:"8"}</td>
108114
<td>{$BYTIME.1YearDonation|number_format:"8"}</td>

0 commit comments

Comments
 (0)