From 5ba0649e4a174d1b2d360949b319d222cb2ee078 Mon Sep 17 00:00:00 2001 From: o-psi Date: Sun, 15 Oct 2023 22:08:19 -0500 Subject: [PATCH] sort by order --- quote.php | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/quote.php b/quote.php index dc33d198..6bada633 100644 --- a/quote.php +++ b/quote.php @@ -239,7 +239,7 @@ if (isset($_GET['quote_id'])) { - +
@@ -267,6 +267,7 @@ if (isset($_GET['quote_id'])) { $item_id = intval($row['item_id']); $item_name = nullable_htmlentities($row['item_name']); $item_description = nullable_htmlentities($row['item_description']); + $item_order = intval($row['item_order']); $item_quantity = number_format(floatval($row['item_quantity']),2); $item_price = floatval($row['item_price']); $item_tax = floatval($row['item_tax']); @@ -276,11 +277,36 @@ if (isset($_GET['quote_id'])) { $total_tax = $item_tax + $total_tax; $sub_total = $item_price * $item_quantity + $sub_total; - ?> + // Logic to check if top or bottom arrow should be hidden by looking at max and min of item_order + $sql = mysqli_query($mysqli, "SELECT MAX(item_order) AS item_order FROM invoice_items WHERE item_quote_id = $quote_id"); + $row = mysqli_fetch_array($sql); + $max_item_order = intval($row['item_order']); + $sql = mysqli_query($mysqli, "SELECT MIN(item_order) AS item_order FROM invoice_items WHERE item_quote_id = $quote_id"); + $row = mysqli_fetch_array($sql); + $min_item_order = intval($row['item_order']); + + if ($item_order == $max_item_order) { + $down_hidden = "hidden"; + } else { + $down_hidden = ""; + } + + if ($item_order == $min_item_order) { + $up_hidden = "hidden"; + } else { + $up_hidden = ""; + } + + + + //This is prefered over the screen seen in the invoice menu. + ?> + +
@@ -318,6 +352,13 @@ if (isset($_GET['quote_id'])) { >
+ ">