From 86467bc9c9ff365a67df15b1e50a2ec08f002927 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Mon, 5 Dec 2022 21:54:09 -0500 Subject: [PATCH] Fix Regression issues with invoice quote amounts --- client_invoices.php | 2 +- client_quotes.php | 2 +- client_recurring_invoices.php | 2 +- guest_view_invoice.php | 20 ++++++++++---------- guest_view_quote.php | 11 +++++------ invoice.php | 13 ++++++------- invoices.php | 2 +- quote.php | 11 +++++------ quotes.php | 2 +- recurring_invoice.php | 11 +++++------ recurring_invoices.php | 2 +- 11 files changed, 37 insertions(+), 41 deletions(-) diff --git a/client_invoices.php b/client_invoices.php index 229bd34d..4ba41ed0 100644 --- a/client_invoices.php +++ b/client_invoices.php @@ -87,7 +87,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()")); $invoice_status = htmlentities($row['invoice_status']); $invoice_date = $row['invoice_date']; $invoice_due = $row['invoice_due']; - $invoice_amount = htmlentities($row['invoice_amount']); + $invoice_amount = floatval($row['invoice_amount']); $invoice_currency_code = htmlentities($row['invoice_currency_code']); $invoice_created_at = $row['invoice_created_at']; $category_id = $row['category_id']; diff --git a/client_quotes.php b/client_quotes.php index 9f1571bb..c48735df 100644 --- a/client_quotes.php +++ b/client_quotes.php @@ -85,7 +85,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()")); } $quote_status = htmlentities($row['quote_status']); $quote_date = $row['quote_date']; - $quote_amount = htmlentities($row['quote_amount']); + $quote_amount = floatval($row['quote_amount']); $quote_currency_code = htmlentities($row['quote_currency_code']); $quote_created_at = $row['quote_created_at']; $category_id = $row['category_id']; diff --git a/client_recurring_invoices.php b/client_recurring_invoices.php index 1eec38cc..345ea32f 100644 --- a/client_recurring_invoices.php +++ b/client_recurring_invoices.php @@ -81,7 +81,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()")); $recurring_last_sent = "-"; } $recurring_next_date = $row['recurring_next_date']; - $recurring_amount = htmlentities($row['recurring_amount']); + $recurring_amount = floatval($row['recurring_amount']); $recurring_currency_code = htmlentities($row['recurring_currency_code']); $recurring_created_at = $row['recurring_created_at']; $category_id = $row['category_id']; diff --git a/guest_view_invoice.php b/guest_view_invoice.php index de85fa40..104ab558 100644 --- a/guest_view_invoice.php +++ b/guest_view_invoice.php @@ -26,7 +26,7 @@ if(isset($_GET['invoice_id'], $_GET['url_key'])){ $invoice_status = htmlentities($row['invoice_status']); $invoice_date = $row['invoice_date']; $invoice_due = $row['invoice_due']; - $invoice_amount = htmlentities($row['invoice_amount']); + $invoice_amount = floatval($row['invoice_amount']); $invoice_currency_code = htmlentities($row['invoice_currency_code']); $invoice_note = htmlentities($row['invoice_note']); $invoice_category_id = $row['invoice_category_id']; @@ -218,11 +218,11 @@ if(isset($_GET['invoice_id'], $_GET['url_key'])){ $item_id = $row['item_id']; $item_name = htmlentities($row['item_name']); $item_description = htmlentities($row['item_description']); - $item_quantity = $row['item_quantity']; - $item_price = $row['item_price']; - $item_subtotal = $row['item_price']; - $item_tax = $row['item_tax']; - $item_total = $row['item_total']; + $item_quantity = floatval($row['item_quantity']); + $item_price = floatval($row['item_price']); + $item_subtotal = floatval($row['item_price']); + $item_tax = floatval($row['item_tax']); + $item_total = floatval($row['item_total']); $total_tax = $item_tax + $total_tax; $sub_total = $item_price * $item_quantity + $sub_total; @@ -748,7 +748,7 @@ var docDefinition = { $invoice_number = htmlentities($row['invoice_number']); $invoice_date = $row['invoice_date']; $invoice_due = $row['invoice_due']; - $invoice_amount = htmlentities($row['invoice_amount']); + $invoice_amount = floatval($row['invoice_amount']); $invoice_currency_code = htmlentities($row['invoice_currency_code']); $invoice_url_key = htmlentities($row['invoice_url_key']); $invoice_tally_total = $invoice_amount + $invoice_tally_total; @@ -808,7 +808,7 @@ var docDefinition = { $invoice_number = htmlentities($row['invoice_number']); $invoice_date = $row['invoice_date']; $invoice_due = $row['invoice_due']; - $invoice_amount = htmlentities($row['invoice_amount']); + $invoice_amount = floatval($row['invoice_amount']); $invoice_currency_code = htmlentities($row['invoice_currency_code']); $invoice_url_key = htmlentities($row['invoice_url_key']); $invoice_tally_total = $invoice_amount + $invoice_tally_total; @@ -869,7 +869,7 @@ var docDefinition = { $invoice_number = htmlentities($row['invoice_number']); $invoice_date = $row['invoice_date']; $invoice_due = $row['invoice_due']; - $invoice_amount = htmlentities($row['invoice_amount']); + $invoice_amount = floatval($row['invoice_amount']); $invoice_currency_code = htmlentities($row['invoice_currency_code']); $invoice_url_key = htmlentities($row['invoice_url_key']); $invoice_tally_total = $invoice_amount + $invoice_tally_total; @@ -894,7 +894,7 @@ var docDefinition = { while($row = mysqli_fetch_array($sql_payments)){ $payment_id = $row['payment_id']; $payment_date = $row['payment_date']; - $payment_amount = htmlentities($row['payment_amount']); + $payment_amount = floatval($row['payment_amount']); $payment_currency_code = htmlentities($row['payment_currency_code']); $payment_method = htmlentities($row['payment_method']); $payment_reference = htmlentities($row['payment_reference']); diff --git a/guest_view_quote.php b/guest_view_quote.php index 6baa03bd..eda38cec 100644 --- a/guest_view_quote.php +++ b/guest_view_quote.php @@ -26,7 +26,7 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){ $quote_number = htmlentities($row['quote_number']); $quote_status = htmlentities($row['quote_status']); $quote_date = $row['quote_date']; - $quote_amount = htmlentities($row['quote_amount']); + $quote_amount = floatval($row['quote_amount']); $quote_currency_code = htmlentities($row['quote_currency_code']); $quote_note = htmlentities($row['quote_note']); $category_id = $row['category_id']; @@ -172,11 +172,10 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){ $item_id = $row['item_id']; $item_name = htmlentities($row['item_name']); $item_description = htmlentities($row['item_description']); - $item_quantity = $row['item_quantity']; - $item_price = $row['item_price']; - $item_subtotal = $row['item_price']; - $item_tax = $row['item_tax']; - $item_total = $row['item_total']; + $item_quantity = floatval($row['item_quantity']); + $item_price = floatval($row['item_price']); + $item_tax = floatval($row['item_tax']); + $item_total = floatval($row['item_total']); $total_tax = $item_tax + $total_tax; $sub_total = $item_price * $item_quantity + $sub_total; diff --git a/invoice.php b/invoice.php index 4fa395a5..2156638a 100644 --- a/invoice.php +++ b/invoice.php @@ -26,7 +26,7 @@ if(isset($_GET['invoice_id'])){ $invoice_status = htmlentities($row['invoice_status']); $invoice_date = $row['invoice_date']; $invoice_due = $row['invoice_due']; - $invoice_amount = htmlentities($row['invoice_amount']); + $invoice_amount = floatval($row['invoice_amount']); $invoice_currency_code = htmlentities($row['invoice_currency_code']); $invoice_note = htmlentities($row['invoice_note']); $invoice_url_key = htmlentities($row['invoice_url_key']); @@ -259,11 +259,10 @@ if(isset($_GET['invoice_id'])){ $item_id = $row['item_id']; $item_name = htmlentities($row['item_name']); $item_description = htmlentities($row['item_description']); - $item_quantity = htmlentities($row['item_quantity']); - $item_price = htmlentities($row['item_price']); - $item_subtotal = htmlentities($row['item_price']); - $item_tax = htmlentities($row['item_tax']); - $item_total = htmlentities($row['item_total']); + $item_quantity = floatval($row['item_quantity']); + $item_price = floatval($row['item_price']); + $item_tax = floatval($row['item_tax']); + $item_total = floatval($row['item_total']); $item_created_at = $row['item_created_at']; $tax_id = $row['item_tax_id']; $total_tax = $item_tax + $total_tax; @@ -459,7 +458,7 @@ if(isset($_GET['invoice_id'])){ while($row = mysqli_fetch_array($sql_payments)){ $payment_id = $row['payment_id']; $payment_date = $row['payment_date']; - $payment_amount = htmlentities($row['payment_amount']); + $payment_amount = floatval($row['payment_amount']); $payment_currency_code = htmlentities($row['payment_currency_code']); $payment_reference = htmlentities($row['payment_reference']); $account_name = htmlentities($row['account_name']); diff --git a/invoices.php b/invoices.php index 35be00d5..aef0b555 100644 --- a/invoices.php +++ b/invoices.php @@ -278,7 +278,7 @@ $invoice_status = htmlentities($row['invoice_status']); $invoice_date = $row['invoice_date']; $invoice_due = $row['invoice_due']; - $invoice_amount = htmlentities($row['invoice_amount']); + $invoice_amount = floatval($row['invoice_amount']); $invoice_currency_code = htmlentities($row['invoice_currency_code']); $invoice_created_at = $row['invoice_created_at']; $client_id = $row['client_id']; diff --git a/quote.php b/quote.php index 561008c1..3c0cde8b 100644 --- a/quote.php +++ b/quote.php @@ -21,7 +21,7 @@ if(isset($_GET['quote_id'])){ $quote_scope = htmlentities($row['quote_scope']); $quote_status = htmlentities($row['quote_status']); $quote_date = $row['quote_date']; - $quote_amount = htmlentities($row['quote_amount']); + $quote_amount = floatval($row['quote_amount']); $quote_currency_code = htmlentities($row['quote_currency_code']); $quote_note = htmlentities($row['quote_note']); $quote_url_key = htmlentities($row['quote_url_key']); @@ -223,11 +223,10 @@ if(isset($_GET['quote_id'])){ $item_id = $row['item_id']; $item_name = htmlentities($row['item_name']); $item_description = htmlentities($row['item_description']); - $item_quantity = htmlentities($row['item_quantity']); - $item_price = htmlentities($row['item_price']); - $item_subtotal = htmlentities($row['item_price']); - $item_tax = htmlentities($row['item_tax']); - $item_total = htmlentities($row['item_total']); + $item_quantity = floatval($row['item_quantity']); + $item_price = floatval($row['item_price']); + $item_tax = floatval($row['item_tax']); + $item_total = floatval($row['item_total']); $item_created_at = $row['item_created_at']; $tax_id = $row['item_tax_id']; $total_tax = $item_tax + $total_tax; diff --git a/quotes.php b/quotes.php index bb272114..7492e7a4 100644 --- a/quotes.php +++ b/quotes.php @@ -150,7 +150,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()")); } $quote_status = htmlentities($row['quote_status']); $quote_date = $row['quote_date']; - $quote_amount = htmlentities($row['quote_amount']); + $quote_amount = floatval($row['quote_amount']); $quote_currency_code = htmlentities($row['quote_currency_code']); $quote_created_at = $row['quote_created_at']; $client_id = $row['client_id']; diff --git a/recurring_invoice.php b/recurring_invoice.php index 360fdebe..43f1385f 100644 --- a/recurring_invoice.php +++ b/recurring_invoice.php @@ -27,7 +27,7 @@ if(isset($_GET['recurring_id'])){ $recurring_last_sent = '-'; } $recurring_next_date = $row['recurring_next_date']; - $recurring_amount = htmlentities($row['recurring_amount']); + $recurring_amount = float($row['recurring_amount']); $recurring_currency_code = htmlentities($row['recurring_currency_code']); $recurring_note = htmlentities($row['recurring_note']); $recurring_created_at = $row['recurring_created_at']; @@ -194,11 +194,10 @@ if(isset($_GET['recurring_id'])){ $item_id = $row['item_id']; $item_name = htmlentities($row['item_name']); $item_description = htmlentities($row['item_description']); - $item_quantity = htmlentities($row['item_quantity']); - $item_price = htmlentities($row['item_price']); - $item_subtotal = htmlentities($row['item_price']); - $item_tax = htmlentities($row['item_tax']); - $item_total = htmlentities($row['item_total']); + $item_quantity = floatval($row['item_quantity']); + $item_price = floatval($row['item_price']); + $item_tax = floatval($row['item_tax']); + $item_total = floatval($row['item_total']); $item_created_at = $row['item_created_at']; $tax_id = $row['item_tax_id']; $total_tax = $item_tax + $total_tax; diff --git a/recurring_invoices.php b/recurring_invoices.php index 52801f46..7c658bf0 100644 --- a/recurring_invoices.php +++ b/recurring_invoices.php @@ -153,7 +153,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()")); $recurring_last_sent = "-"; } $recurring_next_date = $row['recurring_next_date']; - $recurring_amount = htmlentities($row['recurring_amount']); + $recurring_amount = floatval($row['recurring_amount']); $recurring_currency_code = htmlentities($row['recurring_currency_code']); $recurring_created_at = $row['recurring_created_at']; $client_id = $row['client_id'];