diff --git a/client_invoices.php b/client_invoices.php
index dabaf39d..ecc84c0c 100644
--- a/client_invoices.php
+++ b/client_invoices.php
@@ -82,6 +82,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
$invoice_status = nullable_htmlentities($row['invoice_status']);
$invoice_date = nullable_htmlentities($row['invoice_date']);
$invoice_due = nullable_htmlentities($row['invoice_due']);
+ $invoice_discount = floatval($row['invoice_discount_amount']);
$invoice_amount = floatval($row['invoice_amount']);
$invoice_currency_code = nullable_htmlentities($row['invoice_currency_code']);
$invoice_created_at = nullable_htmlentities($row['invoice_created_at']);
diff --git a/database_updates.php b/database_updates.php
index e8dd31ce..bfae7fe8 100644
--- a/database_updates.php
+++ b/database_updates.php
@@ -1459,8 +1459,18 @@ if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
//
// Then, update the database to the next sequential version
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.9.0'");
- }
- //
+ }
+
+ if (CURRENT_DATABASE_VERSION == '0.9.1') {
+ // Insert queries here required to update to DB version 0.9.2
+ mysqli_query($mysqli, "ALTER TABLE `invoices` ADD `invoice_discount_amount` DECIMAL(15,2) NOT NULL DEFAULT 0.00 AFTER `invoice_due`");
+ mysqli_query($mysqli, "ALTER TABLE `recurring` ADD `recurring_discount_amount` DECIMAL(15,2) NOT NULL DEFAULT 0.00 AFTER `recurring_status`");
+ mysqli_query($mysqli, "ALTER TABLE `quotes` ADD `quote_discount_amount` DECIMAL(15,2) NOT NULL DEFAULT 0.00 AFTER `quote_status`");
+
+ // Then update the database to the next sequential version
+ mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.9.2'");
+
+ }
// Be sure to change database_version.php to reflect the version you are updating to here
// Please add this same comment block to the bottom of this file, and update the version number.
diff --git a/database_version.php b/database_version.php
index 6815157f..a7270c3d 100644
--- a/database_version.php
+++ b/database_version.php
@@ -5,4 +5,5 @@
* It is used in conjunction with database_updates.php
*/
-DEFINE("LATEST_DATABASE_VERSION", "0.9.1");
+DEFINE("LATEST_DATABASE_VERSION", "0.9.2");
+
diff --git a/db.sql b/db.sql
index dc782fc1..b21d0773 100644
--- a/db.sql
+++ b/db.sql
@@ -715,6 +715,7 @@ CREATE TABLE `invoices` (
`invoice_status` varchar(200) NOT NULL,
`invoice_date` date NOT NULL,
`invoice_due` date NOT NULL,
+ `invoice_discount_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
`invoice_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
`invoice_currency_code` varchar(200) NOT NULL,
`invoice_note` text DEFAULT NULL,
@@ -939,6 +940,7 @@ CREATE TABLE `quotes` (
`quote_status` varchar(200) NOT NULL,
`quote_date` date NOT NULL,
`quote_expire` date DEFAULT NULL,
+ `quote_discount_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
`quote_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
`quote_currency_code` varchar(200) NOT NULL,
`quote_note` text DEFAULT NULL,
@@ -989,6 +991,7 @@ CREATE TABLE `recurring` (
`recurring_last_sent` date DEFAULT NULL,
`recurring_next_date` date NOT NULL,
`recurring_status` int(1) NOT NULL,
+ `recurring_discount_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
`recurring_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
`recurring_currency_code` varchar(200) NOT NULL,
`recurring_note` text DEFAULT NULL,
diff --git a/guest_pay_invoice_stripe.php b/guest_pay_invoice_stripe.php
index 4cfb8e9e..c21e71b1 100644
--- a/guest_pay_invoice_stripe.php
+++ b/guest_pay_invoice_stripe.php
@@ -54,6 +54,7 @@ if (isset($_GET['invoice_id'], $_GET['url_key']) && !isset($_GET['payment_intent
$invoice_status = nullable_htmlentities($row['invoice_status']);
$invoice_date = nullable_htmlentities($row['invoice_date']);
$invoice_due = nullable_htmlentities($row['invoice_due']);
+ $invoice_discount = floatval($row['invoice_discount_amount']);
$invoice_amount = floatval($row['invoice_amount']);
$invoice_currency_code = nullable_htmlentities($row['invoice_currency_code']);
$client_id = intval($row['client_id']);
@@ -120,12 +121,17 @@ if (isset($_GET['invoice_id'], $_GET['url_key']) && !isset($_GET['payment_intent
+
+ 0){ echo "Discount: " . numfmt_format_currency($currency_format, $invoice_discount, $invoice_currency_code); } ?>
+
+
0) { ?> Already paid: