Sum balance instead of amount

This commit is contained in:
Benjamin Beganović 2021-09-20 14:55:16 +02:00
parent a5852f61fe
commit 00e37ea681

View File

@ -232,7 +232,7 @@ class Design extends BaseDesign
]],
['element' => 'tr', 'properties' => [], 'elements' => [
['element' => 'th', 'properties' => [], 'content' => '$balance_due_label'],
['element' => 'th', 'properties' => [], 'content' => Number::formatMoney($this->invoices->sum('amount'), $this->entity->client)],
['element' => 'th', 'properties' => [], 'content' => Number::formatMoney($this->invoices->sum('balance'), $this->entity->client)],
]],
];
}
@ -379,7 +379,7 @@ class Design extends BaseDesign
return [];
}
$outstanding = $this->invoices->sum('amount');
$outstanding = $this->invoices->sum('balance');
return [
['element' => 'p', 'content' => '$outstanding_label: ' . Number::formatMoney($outstanding, $this->entity->client)],
@ -424,7 +424,11 @@ class Design extends BaseDesign
public function statementPaymentTableTotals(): array
{
if ($this->type !== self::STATEMENT || !$this->payments->first()) {
if (is_null($this->payments) && $this->type !== self::STATEMENT) {
return [];
}
if (\array_key_exists('show_payments_table', $this->options) && $this->options['show_payments_table'] === false) {
return [];
}