diff --git a/client_quotes.php b/client_quotes.php index 15f97d22..1085fcbc 100644 --- a/client_quotes.php +++ b/client_quotes.php @@ -60,6 +60,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); Scope Amount Date + Expire Category Status Action @@ -80,6 +81,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); } $quote_status = nullable_htmlentities($row['quote_status']); $quote_date = nullable_htmlentities($row['quote_date']); + $quote_expire = nullable_htmlentities($row['quote_expire']); $quote_amount = floatval($row['quote_amount']); $quote_currency_code = nullable_htmlentities($row['quote_currency_code']); $quote_created_at = nullable_htmlentities($row['quote_created_at']); @@ -108,6 +110,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); + diff --git a/database_updates.php b/database_updates.php index 1991169f..690783c5 100644 --- a/database_updates.php +++ b/database_updates.php @@ -1150,11 +1150,17 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) { mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.6.3'"); } - //if (CURRENT_DATABASE_VERSION == '0.6.3') { - //Insert queries here required to update to DB version 0.6.4 + if (CURRENT_DATABASE_VERSION == '0.6.3') { + mysqli_query($mysqli, "ALTER TABLE `quotes` ADD COLUMN `quote_expire` DATE NULL DEFAULT NULL AFTER `quote_date`"); + + mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.6.4'"); + } + + //if (CURRENT_DATABASE_VERSION == '0.6.4') { + //Insert queries here required to update to DB version 0.6.5 // Then, update the database to the next sequential version - //mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.6.4'"); + //mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.6.5'"); //} } else { diff --git a/database_version.php b/database_version.php index 9cfb8c55..0045edad 100644 --- a/database_version.php +++ b/database_version.php @@ -5,4 +5,4 @@ * It is used in conjunction with database_updates.php */ -DEFINE("LATEST_DATABASE_VERSION", "0.6.3"); +DEFINE("LATEST_DATABASE_VERSION", "0.6.4"); diff --git a/db.sql b/db.sql index e215d91b..554a640b 100644 --- a/db.sql +++ b/db.sql @@ -871,6 +871,7 @@ CREATE TABLE `quotes` ( `quote_scope` varchar(255) DEFAULT NULL, `quote_status` varchar(200) NOT NULL, `quote_date` date NOT NULL, + `quote_expire` date DEFAULT NULL, `quote_amount` decimal(15,2) NOT NULL DEFAULT 0.00, `quote_currency_code` varchar(200) NOT NULL, `quote_note` text DEFAULT NULL, @@ -1620,4 +1621,4 @@ CREATE TABLE `vendors` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2023-07-11 11:40:09 +-- Dump completed on 2023-07-15 15:32:02 diff --git a/guest_view_quote.php b/guest_view_quote.php index 92159e1d..2a9f881a 100644 --- a/guest_view_quote.php +++ b/guest_view_quote.php @@ -36,6 +36,7 @@ $quote_prefix = nullable_htmlentities($row['quote_prefix']); $quote_number = intval($row['quote_number']); $quote_status = nullable_htmlentities($row['quote_status']); $quote_date = nullable_htmlentities($row['quote_date']); +$quote_expire = nullable_htmlentities($row['quote_expire']); $quote_amount = floatval($row['quote_amount']); $quote_currency_code = nullable_htmlentities($row['quote_currency_code']); $quote_note = nullable_htmlentities($row['quote_note']); @@ -97,7 +98,7 @@ if ($quote_status == "Draft" || $quote_status == "Sent" || $quote_status == "Vie
@@ -337,7 +342,7 @@ if ($quote_status == "Draft" || $quote_status == "Sent" || $quote_status == "Vie [ { text: '', - rowSpan: 2 + rowSpan: 3 }, {}, {}, @@ -353,6 +358,17 @@ if ($quote_status == "Draft" || $quote_status == "Sent" || $quote_status == "Vie style: 'invoiceDateValue' }, ], + [ + {}, + { + text: 'Expire', + style: 'invoiceDateTitle' + }, + { + text: , + style: 'invoiceDateValue' + }, + ], ] }, // table layout: 'lightHorizontalLines' diff --git a/js/quote_edit_modal.js b/js/quote_edit_modal.js index 9e933d75..4c4898fd 100644 --- a/js/quote_edit_modal.js +++ b/js/quote_edit_modal.js @@ -18,6 +18,7 @@ function populateQuoteEditModal(quote_id) { document.getElementById("editQuoteHeaderClient").innerText = quote.client_name; document.getElementById("editQuoteID").value = quote.quote_id; document.getElementById("editQuoteDate").value = quote.quote_date; + document.getElementById("editQuoteExpire").value = quote.quote_expire; document.getElementById("editQuoteScope").value = quote.quote_scope; /* DROPDOWNS */ diff --git a/post/quote.php b/post/quote.php index 1dc7d788..7b679d3c 100644 --- a/post/quote.php +++ b/post/quote.php @@ -18,7 +18,7 @@ if (isset($_POST['add_quote'])) { //Generate a unique URL key for clients to access $quote_url_key = randomString(156); - mysqli_query($mysqli,"INSERT INTO quotes SET quote_prefix = '$config_quote_prefix', quote_number = $quote_number, quote_scope = '$scope', quote_date = '$date', quote_currency_code = '$session_company_currency', quote_category_id = $category, quote_status = 'Draft', quote_url_key = '$quote_url_key', quote_client_id = $client"); + mysqli_query($mysqli,"INSERT INTO quotes SET quote_prefix = '$config_quote_prefix', quote_number = $quote_number, quote_scope = '$scope', quote_date = '$date', quote_expire = '$expire', quote_currency_code = '$session_company_currency', quote_category_id = $category, quote_status = 'Draft', quote_url_key = '$quote_url_key', quote_client_id = $client"); $quote_id = mysqli_insert_id($mysqli); @@ -37,6 +37,7 @@ if (isset($_POST['add_quote_copy'])) { $quote_id = intval($_POST['quote_id']); $date = sanitizeInput($_POST['date']); + $expire = sanitizeInput($_POST['expire']); //Get the last Invoice Number and add 1 for the new invoice number $quote_number = $config_quote_next_number; @@ -55,7 +56,7 @@ if (isset($_POST['add_quote_copy'])) { //Generate a unique URL key for clients to access $quote_url_key = randomString(156); - mysqli_query($mysqli,"INSERT INTO quotes SET quote_prefix = '$config_quote_prefix', quote_number = $quote_number, quote_scope = '$quote_scope', quote_date = '$date', quote_category_id = $category_id, quote_status = 'Draft', quote_amount = $quote_amount, quote_currency_code = '$quote_currency_code', quote_note = '$quote_note', quote_url_key = '$quote_url_key', quote_client_id = $client_id"); + mysqli_query($mysqli,"INSERT INTO quotes SET quote_prefix = '$config_quote_prefix', quote_number = $quote_number, quote_scope = '$quote_scope', quote_date = '$date', quote_expire = '$expire', quote_category_id = $category_id, quote_status = 'Draft', quote_amount = $quote_amount, quote_currency_code = '$quote_currency_code', quote_note = '$quote_note', quote_url_key = '$quote_url_key', quote_client_id = $client_id"); $new_quote_id = mysqli_insert_id($mysqli); @@ -199,7 +200,7 @@ if (isset($_POST['edit_quote'])) { $quote_id = intval($_POST['quote_id']); - mysqli_query($mysqli,"UPDATE quotes SET quote_scope = '$scope', quote_date = '$date', quote_category_id = $category WHERE quote_id = $quote_id"); + mysqli_query($mysqli,"UPDATE quotes SET quote_scope = '$scope', quote_date = '$date', quote_expire = '$expire', quote_category_id = $category WHERE quote_id = $quote_id"); //Logging mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Quote', log_action = 'Modify', log_description = '$quote_id', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id"); @@ -338,6 +339,7 @@ if (isset($_GET['email_quote'])) { $quote_scope = $row['quote_scope']; $quote_status = $row['quote_status']; $quote_date = $row['quote_date']; + $quote_expire = $row['quote_expire']; $quote_amount = floatval($row['quote_amount']); $quote_url_key = $row['quote_url_key']; $quote_currency_code = $row['quote_currency_code']; diff --git a/post/quote_model.php b/post/quote_model.php index 40fad24a..48be970d 100644 --- a/post/quote_model.php +++ b/post/quote_model.php @@ -1,4 +1,5 @@ Date + + Expire + + @@ -553,7 +558,7 @@ require_once("footer.php"); [ { text: '', - rowSpan: 2 + rowSpan: 3 }, {}, {}, @@ -569,6 +574,17 @@ require_once("footer.php"); style: 'invoiceDateValue' }, ], + [ + {}, + { + text: 'Expire', + style: 'invoiceDateTitle' + }, + { + text: , + style: 'invoiceDateValue' + }, + ], ] }, // table layout: 'lightHorizontalLines' diff --git a/quote_add_modal.php b/quote_add_modal.php index 060ce809..2f7a5bd8 100644 --- a/quote_add_modal.php +++ b/quote_add_modal.php @@ -85,6 +85,16 @@ +
+ +
+
+ +
+ " max="2999-12-31" value="" required> +
+
+ +
+ +
+
+ +
+ " max="2999-12-31" value="" required> +
+
+ +
+ +
+
+ +
+ +
+
+
diff --git a/quotes.php b/quotes.php index 57caac02..46a27dcf 100644 --- a/quotes.php +++ b/quotes.php @@ -86,6 +86,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); Client Amount Date + Expire Category Status Action @@ -106,6 +107,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); } $quote_status = nullable_htmlentities($row['quote_status']); $quote_date = nullable_htmlentities($row['quote_date']); + $quote_expire = nullable_htmlentities($row['quote_expire']); $quote_amount = floatval($row['quote_amount']); $quote_currency_code = nullable_htmlentities($row['quote_currency_code']); $quote_created_at = nullable_htmlentities($row['quote_created_at']); @@ -141,6 +143,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); +