Adjustment for statement calculations

This commit is contained in:
David Bomba 2025-03-21 07:30:59 +11:00
parent c09c996c13
commit f9496447b6
1 changed files with 5 additions and 1 deletions

View File

@ -454,13 +454,17 @@ class Statement
->where('is_deleted', 0);
if ($range == '0') {
nlog("rrrrr");
$query->where(function ($q) use ($to, $from) {
$q->whereBetween('due_date', [$to, $from])->orWhereNull('due_date');
$q->where('due_date','>=', now())->orWhereNull('due_date');
// $q->whereBetween('due_date', [$to, $from])->orWhereNull('due_date');
});
} else {
$query->whereBetween('due_date', [$to, $from]);
}
nlog($query->toRawSql());
$amount = $query->sum('balance');
return Number::formatMoney($amount, $this->client);