From 344fac9e50a3e80bf01aed82b7c6cbbfa9f7c5e8 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Wed, 26 Apr 2023 11:59:44 +0800 Subject: [PATCH] debug wallet audit --- routes/web.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/routes/web.php b/routes/web.php index 796f1bf6..9ed9a571 100644 --- a/routes/web.php +++ b/routes/web.php @@ -404,11 +404,13 @@ Route::get('/wallet/audit', function (Request $request) { if((int) $transaction->type === TransactionType::PAYMENT) $payments += (float) $transaction->amount; if((int) $transaction->type === TransactionType::DEBIT_NOTE) $debit += (float) $transaction->amount; } - if((round((float) $wallet->amount - (($topups + $credit) - ($payments + $debit)), 2) == 0) AND $wallet->amount > -0.01 AND $wallet->amount == -0) continue; + $auditBalance = ($topups + $credit) - ($payments + $debit); + $diffenrence = round((float) $wallet->amount - (($topups + $credit) - ($payments + $debit)), 2); + if(($diffenrence == 0) AND ($diffenrence == -0) AND $wallet->amount > -0.01) continue; $i++; - echo $i.". Marking: ". $wallet->owner->reference ."(".$wallet->id.")
Current Balance: ". $wallet->amount ."
Audit Balance: ". (($topups + $credit) - ($payments + $debit)) ."
Difference: ". round((float) $wallet->amount - (($topups + $credit) - ($payments + $debit)), 2) ."


"; + echo $i.". Marking: ". $wallet->owner->reference ."(".$wallet->id.")
Current Balance: ". $wallet->amount ."
Audit Balance: ". ($auditBalance) ."
Difference: ". $diffenrence ."


"; } });