From 5a92fe16914a906362173f735b01652eece6c395 Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 26 Nov 2024 11:57:24 +0100 Subject: [PATCH] feat: refs #8190 entry_getCommission --- db/routines/vn/functions/entry_getCommission.sql | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/db/routines/vn/functions/entry_getCommission.sql b/db/routines/vn/functions/entry_getCommission.sql index 0d550358f..9e2b53e5e 100644 --- a/db/routines/vn/functions/entry_getCommission.sql +++ b/db/routines/vn/functions/entry_getCommission.sql @@ -34,9 +34,8 @@ BEGIN SELECT e.id INTO vLastEntryFk FROM `entry` e JOIN travel tr ON tr.id = e.travelFk - WHERE tr.landed < vTravelFkLanded - AND e.supplierFk = vSupplierFk - ORDER BY (vTravelFkLanded - tr.landed) ASC, tr.landed DESC + WHERE e.supplierFk = vSupplierFk + ORDER BY (vTravelFkLanded <= tr.landed) ASC, tr.landed DESC LIMIT 1; IF vLastEntryFk THEN