debug wallet audit

This commit is contained in:
edmondlang
2023-04-26 11:59:44 +08:00
parent 52a55e32c8
commit 344fac9e50
+4 -2
View File
@@ -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.")<br>Current Balance: ". $wallet->amount ."<br>Audit Balance: ". (($topups + $credit) - ($payments + $debit)) ."<br>Difference: ". round((float) $wallet->amount - (($topups + $credit) - ($payments + $debit)), 2) ."<br><br><br>";
echo $i.". Marking: ". $wallet->owner->reference ."(".$wallet->id.")<br>Current Balance: ". $wallet->amount ."<br>Audit Balance: ". ($auditBalance) ."<br>Difference: ". $diffenrence ."<br><br><br>";
}
});