do not show potential invoices with a negative total (#3579)

This commit is contained in:
Kevin Papst
2022-10-13 12:29:11 +02:00
committed by GitHub
parent 0cefcf0e16
commit a5556a0c63
3 changed files with 105 additions and 1 deletions

View File

@@ -48,7 +48,7 @@ abstract class AbstractCalculator
*/
public function getSubtotal(): float
{
$amount = 0;
$amount = 0.00;
foreach ($this->model->getEntries() as $entry) {
$amount += $entry->getRate();
}

View File

@@ -590,6 +590,10 @@ final class ServiceInvoice
$model->addEntries($settings['entries']);
$this->prepareModelQueryDates($model);
if ($model->getCalculator()->getTotal() < 0.0) {
continue;
}
$models[] = $model;
}