[UPDATE] Do not round balances from SQL
This commit is contained in:
parent
52dcd05c99
commit
2f2b3f578c
@ -296,11 +296,11 @@ class Transaction extends Base {
|
|||||||
$this->debug->append("STA " . __METHOD__, 4);
|
$this->debug->append("STA " . __METHOD__, 4);
|
||||||
$stmt = $this->mysqli->prepare("
|
$stmt = $this->mysqli->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
ROUND((
|
(
|
||||||
SUM( IF( ( t.type IN ('Credit','Bonus') AND b.confirmations >= ? ) OR t.type = 'Credit_PPS', t.amount, 0 ) ) -
|
SUM( IF( ( t.type IN ('Credit','Bonus') AND b.confirmations >= ? ) OR t.type = 'Credit_PPS', t.amount, 0 ) ) -
|
||||||
SUM( IF( t.type IN ('Debit_MP', 'Debit_AP'), t.amount, 0 ) ) -
|
SUM( IF( t.type IN ('Debit_MP', 'Debit_AP'), t.amount, 0 ) ) -
|
||||||
SUM( IF( ( t.type IN ('Donation','Fee') AND b.confirmations >= ? ) OR ( t.type IN ('Donation_PPS', 'Fee_PPS', 'TXFee') ), t.amount, 0 ) )
|
SUM( IF( ( t.type IN ('Donation','Fee') AND b.confirmations >= ? ) OR ( t.type IN ('Donation_PPS', 'Fee_PPS', 'TXFee') ), t.amount, 0 ) )
|
||||||
), 8) AS balance
|
) AS balance
|
||||||
FROM $this->table AS t
|
FROM $this->table AS t
|
||||||
LEFT JOIN " . $this->block->getTableName() . " AS b
|
LEFT JOIN " . $this->block->getTableName() . " AS b
|
||||||
ON t.block_id = b.id
|
ON t.block_id = b.id
|
||||||
@ -319,19 +319,19 @@ class Transaction extends Base {
|
|||||||
$this->debug->append("STA " . __METHOD__, 4);
|
$this->debug->append("STA " . __METHOD__, 4);
|
||||||
$stmt = $this->mysqli->prepare("
|
$stmt = $this->mysqli->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
IFNULL(ROUND((
|
IFNULL((
|
||||||
SUM( IF( ( t.type IN ('Credit','Bonus') AND b.confirmations >= ? ) OR t.type = 'Credit_PPS', t.amount, 0 ) ) -
|
SUM( IF( ( t.type IN ('Credit','Bonus') AND b.confirmations >= ? ) OR t.type = 'Credit_PPS', t.amount, 0 ) ) -
|
||||||
SUM( IF( t.type IN ('Debit_MP', 'Debit_AP'), t.amount, 0 ) ) -
|
SUM( IF( t.type IN ('Debit_MP', 'Debit_AP'), t.amount, 0 ) ) -
|
||||||
SUM( IF( ( t.type IN ('Donation','Fee') AND b.confirmations >= ? ) OR ( t.type IN ('Donation_PPS', 'Fee_PPS', 'TXFee') ), t.amount, 0 ) )
|
SUM( IF( ( t.type IN ('Donation','Fee') AND b.confirmations >= ? ) OR ( t.type IN ('Donation_PPS', 'Fee_PPS', 'TXFee') ), t.amount, 0 ) )
|
||||||
), 8), 0) AS confirmed,
|
), 0) AS confirmed,
|
||||||
IFNULL(ROUND((
|
IFNULL((
|
||||||
SUM( IF( t.type IN ('Credit','Bonus') AND b.confirmations < ? AND b.confirmations >= 0, t.amount, 0 ) ) -
|
SUM( IF( t.type IN ('Credit','Bonus') AND b.confirmations < ? AND b.confirmations >= 0, t.amount, 0 ) ) -
|
||||||
SUM( IF( t.type IN ('Donation','Fee') AND b.confirmations < ? AND b.confirmations >= 0, t.amount, 0 ) )
|
SUM( IF( t.type IN ('Donation','Fee') AND b.confirmations < ? AND b.confirmations >= 0, t.amount, 0 ) )
|
||||||
), 8), 0) AS unconfirmed,
|
), 0) AS unconfirmed,
|
||||||
IFNULL(ROUND((
|
IFNULL((
|
||||||
SUM( IF( t.type IN ('Credit','Bonus') AND b.confirmations = -1, t.amount, 0) ) -
|
SUM( IF( t.type IN ('Credit','Bonus') AND b.confirmations = -1, t.amount, 0) ) -
|
||||||
SUM( IF( t.type IN ('Donation','Fee') AND b.confirmations = -1, t.amount, 0) )
|
SUM( IF( t.type IN ('Donation','Fee') AND b.confirmations = -1, t.amount, 0) )
|
||||||
), 8), 0) AS orphaned
|
), 0) AS orphaned
|
||||||
FROM $this->table AS t
|
FROM $this->table AS t
|
||||||
LEFT JOIN " . $this->block->getTableName() . " AS b
|
LEFT JOIN " . $this->block->getTableName() . " AS b
|
||||||
ON t.block_id = b.id
|
ON t.block_id = b.id
|
||||||
@ -357,12 +357,10 @@ class Transaction extends Base {
|
|||||||
a.ap_threshold,
|
a.ap_threshold,
|
||||||
a.coin_address,
|
a.coin_address,
|
||||||
IFNULL(
|
IFNULL(
|
||||||
ROUND(
|
|
||||||
(
|
(
|
||||||
SUM( IF( ( t.type IN ('Credit','Bonus') AND b.confirmations >= " . $this->config['confirmations'] . ") OR t.type = 'Credit_PPS', t.amount, 0 ) ) -
|
SUM( IF( ( t.type IN ('Credit','Bonus') AND b.confirmations >= " . $this->config['confirmations'] . ") OR t.type = 'Credit_PPS', t.amount, 0 ) ) -
|
||||||
SUM( IF( t.type IN ('Debit_MP', 'Debit_AP'), t.amount, 0 ) ) -
|
SUM( IF( t.type IN ('Debit_MP', 'Debit_AP'), t.amount, 0 ) ) -
|
||||||
SUM( IF( ( t.type IN ('Donation','Fee') AND b.confirmations >= " . $this->config['confirmations'] . ") OR ( t.type IN ('Donation_PPS', 'Fee_PPS', 'TXFee') ), t.amount, 0 ) )
|
SUM( IF( ( t.type IN ('Donation','Fee') AND b.confirmations >= " . $this->config['confirmations'] . ") OR ( t.type IN ('Donation_PPS', 'Fee_PPS', 'TXFee') ), t.amount, 0 ) )
|
||||||
), 8
|
|
||||||
), 0
|
), 0
|
||||||
) AS confirmed
|
) AS confirmed
|
||||||
FROM $this->table AS t
|
FROM $this->table AS t
|
||||||
@ -449,12 +447,10 @@ class Transaction extends Base {
|
|||||||
a.coin_address,
|
a.coin_address,
|
||||||
p.id AS payout_id,
|
p.id AS payout_id,
|
||||||
IFNULL(
|
IFNULL(
|
||||||
ROUND(
|
|
||||||
(
|
(
|
||||||
SUM( IF( ( t.type IN ('Credit','Bonus') AND b.confirmations >= " . $this->config['confirmations'] . ") OR t.type = 'Credit_PPS', t.amount, 0 ) ) -
|
SUM( IF( ( t.type IN ('Credit','Bonus') AND b.confirmations >= " . $this->config['confirmations'] . ") OR t.type = 'Credit_PPS', t.amount, 0 ) ) -
|
||||||
SUM( IF( t.type IN ('Debit_MP', 'Debit_AP'), t.amount, 0 ) ) -
|
SUM( IF( t.type IN ('Debit_MP', 'Debit_AP'), t.amount, 0 ) ) -
|
||||||
SUM( IF( ( t.type IN ('Donation','Fee') AND b.confirmations >= " . $this->config['confirmations'] . ") OR ( t.type IN ('Donation_PPS', 'Fee_PPS', 'TXFee') ), t.amount, 0 ) )
|
SUM( IF( ( t.type IN ('Donation','Fee') AND b.confirmations >= " . $this->config['confirmations'] . ") OR ( t.type IN ('Donation_PPS', 'Fee_PPS', 'TXFee') ), t.amount, 0 ) )
|
||||||
), 8
|
|
||||||
), 0
|
), 0
|
||||||
) AS confirmed
|
) AS confirmed
|
||||||
FROM " . $this->payout->getTableName() . " AS p
|
FROM " . $this->payout->getTableName() . " AS p
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user