From 0ecabe1e47e4a50a2a9a23dc17b36a4686c64ebc Mon Sep 17 00:00:00 2001 From: "max.mehl" Date: Tue, 19 Oct 2021 17:02:34 +0200 Subject: [PATCH] make 0 the smallest reimbursed amount --- cgi-bin/perdiem.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cgi-bin/perdiem.php b/cgi-bin/perdiem.php index f2864e2d52..790a3f0004 100755 --- a/cgi-bin/perdiem.php +++ b/cgi-bin/perdiem.php @@ -204,6 +204,11 @@ foreach ($use as $d => $day) { // calculate for each day $reimb_day[$d] = $reimb_day[$d] - $maxamount_full * $rate_dinner; } + // Avoid negative amounts + if ($reimb_day[$d] < 0) { + $reimb_day[$d] = 0; + } + // add on top of total reimbursement $reimb_total = $reimb_total + $reimb_day[$d];