Fix: division by zero errors

This commit is contained in:
2026-01-20 12:21:31 +01:00
parent 9ce912baa2
commit 41788d6033
2 changed files with 6 additions and 6 deletions
+5 -5
View File
@@ -170,15 +170,15 @@ public function salesStatistics()
'year' => $currentYear, 'year' => $currentYear,
'totalRevenue' => $totalRevenue, 'totalRevenue' => $totalRevenue,
'paid' => $paid, 'paid' => $paid,
'paidPercent' => round(($paid / $totalRevenue) * 100, 2), 'paidPercent' => ($totalRevenue == 0) ? 0 : round(($paid / $totalRevenue) * 100, 2),
'draft' => $draft, 'draft' => $draft,
'draftPercent' => round(($draft / $totalRevenue) * 100, 2), 'draftPercent' => ($totalRevenue == 0) ? 0 : round(($draft / $totalRevenue) * 100, 2),
'issued' => $issued, 'issued' => $issued,
'issuedPercent' => round(($issued / $totalRevenue) * 100, 2), 'issuedPercent' => ($totalRevenue == 0) ? 0 : round(($issued / $totalRevenue) * 100, 2),
'due' => $due, 'due' => $due,
'duePercent' => round(($due / $totalRevenue) * 100, 2), 'duePercent' => ($totalRevenue == 0) ? 0 : round(($due / $totalRevenue) * 100, 2),
'reminded' => $reminded, 'reminded' => $reminded,
'remindedPercent' => round(($reminded / $totalRevenue) * 100, 2), 'remindedPercent' => ($totalRevenue == 0) ? 0 : round(($reminded / $totalRevenue) * 100, 2),
]; ];
// Daten in camelCase umwandeln // Daten in camelCase umwandeln
+1 -1
View File
@@ -47,7 +47,7 @@
Route::get('/invoices/{id}/remind', [InvoiceController::class, 'remind']); Route::get('/invoices/{id}/remind', [InvoiceController::class, 'remind']);
Route::get('/lineitems/{invoiceId}', [LineItemController::class, 'index']); Route::get('/lineitems/{invoiceId}', [LineItemController::class, 'index']);
Route::post('/lineitems/import/{invoiceId}', [LineItemController::class, 'importFromCsv']); Route::post('/lineitems/import', [LineItemController::class, 'importFromCsv']);
Route::get('/offers/{id}/confirm', function ($id) { Route::get('/offers/{id}/confirm', function ($id) {
// $offer = offerController::single($id); // $offer = offerController::single($id);