mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Minor fixes
This commit is contained in:
parent
5837d544ea
commit
cdd6bee046
@ -279,7 +279,7 @@ class Statement
|
||||
private function getAgingAmount($range)
|
||||
{
|
||||
$ranges = $this->calculateDateRanges($range);
|
||||
|
||||
nlog($ranges);
|
||||
$from = $ranges[0];
|
||||
$to = $ranges[1];
|
||||
|
||||
@ -287,8 +287,10 @@ class Statement
|
||||
|
||||
$amount = Invoice::where('company_id', $this->client->company->id)
|
||||
->where('client_id', $client->id)
|
||||
->where('company_id', $this->client->company_id)
|
||||
->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL])
|
||||
->where('balance', '>', 0)
|
||||
->where('is_deleted', 0)
|
||||
->whereBetween('date', [$from, $to])
|
||||
->sum('balance');
|
||||
|
||||
@ -307,35 +309,29 @@ class Statement
|
||||
|
||||
switch ($range) {
|
||||
case '30':
|
||||
$ranges[0] = now();
|
||||
$ranges[1] = now()->subDays(30);
|
||||
$ranges[0] = now()->startOfDay();
|
||||
$ranges[1] = now()->startOfDay()->subDays(30);
|
||||
return $ranges;
|
||||
break;
|
||||
case '60':
|
||||
$ranges[0] = now()->subDays(30);
|
||||
$ranges[1] = now()->subDays(60);
|
||||
$ranges[0] = now()->startOfDay()->subDays(30);
|
||||
$ranges[1] = now()->startOfDay()->subDays(60);
|
||||
return $ranges;
|
||||
break;
|
||||
case '90':
|
||||
$ranges[0] = now()->subDays(60);
|
||||
$ranges[1] = now()->subDays(90);
|
||||
$ranges[0] = now()->startOfDay()->subDays(60);
|
||||
$ranges[1] = now()->startOfDay()->subDays(90);
|
||||
return $ranges;
|
||||
break;
|
||||
case '120':
|
||||
$ranges[0] = now()->subDays(90);
|
||||
$ranges[1] = now()->subDays(120);
|
||||
$ranges[0] = now()->startOfDay()->subDays(90);
|
||||
$ranges[1] = now()->startOfDay()->subDays(120);
|
||||
return $ranges;
|
||||
break;
|
||||
case '120+':
|
||||
$ranges[0] = now()->subDays(120);
|
||||
$ranges[1] = now()->subYears(40);
|
||||
$ranges[0] = now()->startOfDay()->subDays(120);
|
||||
$ranges[1] = now()->startOfDay()->subYears(40);
|
||||
return $ranges;
|
||||
break;
|
||||
default:
|
||||
$ranges[0] = now()->subDays(0);
|
||||
$ranges[0] = now()->startOfDay()->subDays(0);
|
||||
$ranges[1] = now()->subDays(30);
|
||||
return $ranges;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -428,7 +428,7 @@ class Design extends BaseDesign
|
||||
|
||||
public function statementPaymentTableTotals(): array
|
||||
{
|
||||
if (!$this->payments->first() || $this->type !== self::STATEMENT) {
|
||||
if (is_null($this->payments) || !$this->payments->first() || $this->type !== self::STATEMENT) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user