Fixes for statements

This commit is contained in:
David Bomba 2021-09-21 22:50:44 +10:00
parent cdd6bee046
commit 6bcca461ef

View File

@ -279,10 +279,13 @@ class Statement
private function getAgingAmount($range)
{
$ranges = $this->calculateDateRanges($range);
nlog($ranges);
$from = $ranges[0];
$to = $ranges[1];
nlog("from ".$from->format("Y-m-d"));
nlog("to ".$to->format("Y-m-d"));
$client = Client::where('id', $this->client->id)->first();
$amount = Invoice::where('company_id', $this->client->company->id)
@ -291,7 +294,7 @@ nlog($ranges);
->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL])
->where('balance', '>', 0)
->where('is_deleted', 0)
->whereBetween('date', [$from, $to])
->whereBetween('date', [$to, $from])
->sum('balance');
return Number::formatMoney($amount, $client);