Declare more floatvals

This commit is contained in:
johnnyq
2022-12-05 23:10:34 -05:00
parent 86467bc9c9
commit fe4c413643
18 changed files with 25 additions and 26 deletions

View File

@@ -77,7 +77,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$invoice_prefix = htmlentities($row['invoice_prefix']); $invoice_prefix = htmlentities($row['invoice_prefix']);
$invoice_number = htmlentities($row['invoice_number']); $invoice_number = htmlentities($row['invoice_number']);
$invoice_status = htmlentities($row['invoice_status']); $invoice_status = htmlentities($row['invoice_status']);
$invoice_amount = htmlentities($row['invoice_amount']); $invoice_amount = floatval($row['invoice_amount']);
$invoice_currency_code = htmlentities($row['invoice_currency_code']); $invoice_currency_code = htmlentities($row['invoice_currency_code']);
$invoice_date = $row['invoice_date']; $invoice_date = $row['invoice_date'];
$payment_date = $row['payment_date']; $payment_date = $row['payment_date'];
@@ -88,7 +88,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
}else{ }else{
$payment_reference_display = $payment_reference; $payment_reference_display = $payment_reference;
} }
$payment_amount = htmlentities($row['payment_amount']); $payment_amount = floatval($row['payment_amount']);
$payment_currency_code = htmlentities($row['payment_currency_code']); $payment_currency_code = htmlentities($row['payment_currency_code']);
$account_name = htmlentities($row['account_name']); $account_name = htmlentities($row['account_name']);

View File

@@ -394,7 +394,7 @@ $vendors_added = $row['vendors_added'];
<?php <?php
while($row = mysqli_fetch_array($sql_latest_invoice_payments)){ while($row = mysqli_fetch_array($sql_latest_invoice_payments)){
$payment_date = $row['payment_date']; $payment_date = $row['payment_date'];
$payment_amount = htmlentities($row['payment_amount']); $payment_amount = floatval($row['payment_amount']);
$invoice_prefix = htmlentities($row['invoice_prefix']); $invoice_prefix = htmlentities($row['invoice_prefix']);
$invoice_number = htmlentities($row['invoice_number']); $invoice_number = htmlentities($row['invoice_number']);
$client_name = htmlentities($row['client_name']); $client_name = htmlentities($row['client_name']);
@@ -437,7 +437,7 @@ $vendors_added = $row['vendors_added'];
<?php <?php
while($row = mysqli_fetch_array($sql_latest_expenses)){ while($row = mysqli_fetch_array($sql_latest_expenses)){
$expense_date = $row['expense_date']; $expense_date = $row['expense_date'];
$expense_amount = htmlentities($row['expense_amount']); $expense_amount = floatval($row['expense_amount']);
$vendor_name = htmlentities($row['vendor_name']); $vendor_name = htmlentities($row['vendor_name']);
$category_name = htmlentities($row['category_name']); $category_name = htmlentities($row['category_name']);

View File

@@ -47,7 +47,7 @@
while($row = mysqli_fetch_array($sql)){ while($row = mysqli_fetch_array($sql)){
$account_id = $row['account_id']; $account_id = $row['account_id'];
$account_name = htmlentities($row['account_name']); $account_name = htmlentities($row['account_name']);
$opening_balance = htmlentities($row['opening_balance']); $opening_balance = floatval($row['opening_balance']);
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id"); $sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id");
$row = mysqli_fetch_array($sql_payments); $row = mysqli_fetch_array($sql_payments);

View File

@@ -48,7 +48,7 @@
while($row = mysqli_fetch_array($sql_accounts)){ while($row = mysqli_fetch_array($sql_accounts)){
$account_id_select = $row['account_id']; $account_id_select = $row['account_id'];
$account_name_select = htmlentities($row['account_name']); $account_name_select = htmlentities($row['account_name']);
$opening_balance = htmlentities($row['opening_balance']); $opening_balance = floatval($row['opening_balance']);
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id_select"); $sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id_select");
$row = mysqli_fetch_array($sql_payments); $row = mysqli_fetch_array($sql_payments);

View File

@@ -50,7 +50,7 @@
while($row = mysqli_fetch_array($sql_accounts)){ while($row = mysqli_fetch_array($sql_accounts)){
$account_id_select = $row['account_id']; $account_id_select = $row['account_id'];
$account_name_select = htmlentities($row['account_name']); $account_name_select = htmlentities($row['account_name']);
$opening_balance = htmlentities($row['opening_balance']); $opening_balance = floatval($row['opening_balance']);
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id_select"); $sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id_select");
$row = mysqli_fetch_array($sql_payments); $row = mysqli_fetch_array($sql_payments);

View File

@@ -149,7 +149,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
while($row = mysqli_fetch_array($sql)){ while($row = mysqli_fetch_array($sql)){
$expense_id = $row['expense_id']; $expense_id = $row['expense_id'];
$expense_date = $row['expense_date']; $expense_date = $row['expense_date'];
$expense_amount = htmlentities($row['expense_amount']); $expense_amount = floatval($row['expense_amount']);
$expense_currency_code = htmlentities($row['expense_currency_code']); $expense_currency_code = htmlentities($row['expense_currency_code']);
$expense_description = htmlentities($row['expense_description']); $expense_description = htmlentities($row['expense_description']);
$expense_receipt = htmlentities($row['expense_receipt']); $expense_receipt = htmlentities($row['expense_receipt']);

View File

@@ -220,7 +220,6 @@ if(isset($_GET['invoice_id'], $_GET['url_key'])){
$item_description = htmlentities($row['item_description']); $item_description = htmlentities($row['item_description']);
$item_quantity = floatval($row['item_quantity']); $item_quantity = floatval($row['item_quantity']);
$item_price = floatval($row['item_price']); $item_price = floatval($row['item_price']);
$item_subtotal = floatval($row['item_price']);
$item_tax = floatval($row['item_tax']); $item_tax = floatval($row['item_tax']);
$item_total = floatval($row['item_total']); $item_total = floatval($row['item_total']);
$total_tax = $item_tax + $total_tax; $total_tax = $item_tax + $total_tax;

View File

@@ -57,7 +57,7 @@
$sql = mysqli_query($mysqli,"SELECT * FROM accounts WHERE account_archived_at IS NULL AND company_id = $session_company_id ORDER BY account_name ASC"); $sql = mysqli_query($mysqli,"SELECT * FROM accounts WHERE account_archived_at IS NULL AND company_id = $session_company_id ORDER BY account_name ASC");
while($row = mysqli_fetch_array($sql)){ while($row = mysqli_fetch_array($sql)){
$account_id = $row['account_id']; $account_id = $row['account_id'];
$account_name = $row['account_name']; $account_name = htmlentities($row['account_name']);
$opening_balance = $row['opening_balance']; $opening_balance = $row['opening_balance'];
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id"); $sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id");
@@ -96,7 +96,7 @@
$sql = mysqli_query($mysqli,"SELECT * FROM categories WHERE category_type = 'Payment Method' AND category_archived_at IS NULL AND company_id = $session_company_id ORDER BY category_name ASC"); $sql = mysqli_query($mysqli,"SELECT * FROM categories WHERE category_type = 'Payment Method' AND category_archived_at IS NULL AND company_id = $session_company_id ORDER BY category_name ASC");
while($row = mysqli_fetch_array($sql)){ while($row = mysqli_fetch_array($sql)){
$category_name = $row['category_name']; $category_name = htmlentities($row['category_name']);
?> ?>
<option <?php if($config_default_payment_method == $category_name){ echo "selected"; } ?>><?php echo $category_name; ?></option> <option <?php if($config_default_payment_method == $category_name){ echo "selected"; } ?>><?php echo $category_name; ?></option>

View File

@@ -80,7 +80,7 @@
$taxes_sql = mysqli_query($mysqli,"SELECT * FROM taxes WHERE (tax_archived_at > '$item_created_at' OR tax_archived_at IS NULL) AND company_id = $session_company_id ORDER BY tax_name ASC"); $taxes_sql = mysqli_query($mysqli,"SELECT * FROM taxes WHERE (tax_archived_at > '$item_created_at' OR tax_archived_at IS NULL) AND company_id = $session_company_id ORDER BY tax_name ASC");
while($row = mysqli_fetch_array($taxes_sql)){ while($row = mysqli_fetch_array($taxes_sql)){
$tax_id_select = $row['tax_id']; $tax_id_select = $row['tax_id'];
$tax_name = $row['tax_name']; $tax_name = htmlentities($row['tax_name']);
$tax_percent = $row['tax_percent']; $tax_percent = $row['tax_percent'];
?> ?>
<option <?php if($tax_id_select == $tax_id){ echo "selected"; } ?> value="<?php echo $tax_id_select; ?>"><?php echo "$tax_name $tax_percent%"; ?></option> <option <?php if($tax_id_select == $tax_id){ echo "selected"; } ?> value="<?php echo $tax_id_select; ?>"><?php echo "$tax_name $tax_percent%"; ?></option>

View File

@@ -145,7 +145,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$invoice_date = $row['invoice_date']; $invoice_date = $row['invoice_date'];
$payment_date = $row['payment_date']; $payment_date = $row['payment_date'];
$payment_method = htmlentities($row['payment_method']); $payment_method = htmlentities($row['payment_method']);
$payment_amount = htmlentities($row['payment_amount']); $payment_amount = floatval($row['payment_amount']);
$payment_currency_code = htmlentities($row['payment_currency_code']); $payment_currency_code = htmlentities($row['payment_currency_code']);
$payment_reference = htmlentities($row['payment_reference']); $payment_reference = htmlentities($row['payment_reference']);
if(empty($payment_reference)){ if(empty($payment_reference)){

View File

@@ -64,7 +64,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
}else{ }else{
$product_description_display = "<div style='white-space:pre-line'>$product_description</div>"; $product_description_display = "<div style='white-space:pre-line'>$product_description</div>";
} }
$product_price = htmlentities($row['product_price']); $product_price = floatval($row['product_price']);
$product_currency_code = htmlentities($row['product_currency_code']); $product_currency_code = htmlentities($row['product_currency_code']);
$product_created_at = $row['product_created_at']; $product_created_at = $row['product_created_at'];
$category_id = $row['category_id']; $category_id = $row['category_id'];

View File

@@ -27,7 +27,7 @@ if(isset($_GET['recurring_id'])){
$recurring_last_sent = '-'; $recurring_last_sent = '-';
} }
$recurring_next_date = $row['recurring_next_date']; $recurring_next_date = $row['recurring_next_date'];
$recurring_amount = float($row['recurring_amount']); $recurring_amount = floatval($row['recurring_amount']);
$recurring_currency_code = htmlentities($row['recurring_currency_code']); $recurring_currency_code = htmlentities($row['recurring_currency_code']);
$recurring_note = htmlentities($row['recurring_note']); $recurring_note = htmlentities($row['recurring_note']);
$recurring_created_at = $row['recurring_created_at']; $recurring_created_at = $row['recurring_created_at'];
@@ -287,17 +287,17 @@ if(isset($_GET['recurring_id'])){
<tbody> <tbody>
<tr class="border-bottom"> <tr class="border-bottom">
<td>Subtotal</td> <td>Subtotal</td>
<td class="text-right"><?php echo htmlentities(numfmt_format_currency($currency_format, $sub_total, $recurring_currency_code)); ?></td> <td class="text-right"><?php echo numfmt_format_currency($currency_format, $sub_total, $recurring_currency_code); ?></td>
</tr> </tr>
<?php if($total_tax > 0){ ?> <?php if($total_tax > 0){ ?>
<tr class="border-bottom"> <tr class="border-bottom">
<td>Tax</td> <td>Tax</td>
<td class="text-right"><?php echo htmlentities(numfmt_format_currency($currency_format, $total_tax, $recurring_currency_code)); ?></td> <td class="text-right"><?php echo numfmt_format_currency($currency_format, $total_tax, $recurring_currency_code); ?></td>
</tr> </tr>
<?php } ?> <?php } ?>
<tr class="border-bottom"> <tr class="border-bottom">
<td><strong>Amount</strong></td> <td><strong>Amount</strong></td>
<td class="text-right"><strong><?php echo htmlentities(numfmt_format_currency($currency_format, $recurring_amount, $recurring_currency_code)); ?></strong></td> <td class="text-right"><strong><?php echo numfmt_format_currency($currency_format, $recurring_amount, $recurring_currency_code); ?></strong></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@@ -65,7 +65,7 @@
while($row = mysqli_fetch_array($sql)){ while($row = mysqli_fetch_array($sql)){
$account_id = $row['account_id']; $account_id = $row['account_id'];
$account_name = htmlentities($row['account_name']); $account_name = htmlentities($row['account_name']);
$opening_balance = htmlentities($row['opening_balance']); $opening_balance = floatval($row['opening_balance']);
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id"); $sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id");
$row = mysqli_fetch_array($sql_payments); $row = mysqli_fetch_array($sql_payments);

View File

@@ -66,7 +66,7 @@
while($row = mysqli_fetch_array($sql_accounts)){ while($row = mysqli_fetch_array($sql_accounts)){
$account_id_select = $row['account_id']; $account_id_select = $row['account_id'];
$account_name_select = htmlentities($row['account_name']); $account_name_select = htmlentities($row['account_name']);
$opening_balance = htmlentities($row['opening_balance']); $opening_balance = floatval($row['opening_balance']);
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id_select"); $sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id_select");
$row = mysqli_fetch_array($sql_payments); $row = mysqli_fetch_array($sql_payments);

View File

@@ -148,7 +148,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
} }
$revenue_date = $row['revenue_date']; $revenue_date = $row['revenue_date'];
$revenue_payment_method = htmlentities($row['revenue_payment_method']); $revenue_payment_method = htmlentities($row['revenue_payment_method']);
$revenue_amount = htmlentities($row['revenue_amount']); $revenue_amount = floatval($row['revenue_amount']);
$revenue_currency_code = htmlentities($row['revenue_currency_code']); $revenue_currency_code = htmlentities($row['revenue_currency_code']);
$revenue_created_at = $row['revenue_created_at']; $revenue_created_at = $row['revenue_created_at'];
$account_id = $row['account_id']; $account_id = $row['account_id'];

View File

@@ -48,7 +48,7 @@
while($row = mysqli_fetch_array($sql)){ while($row = mysqli_fetch_array($sql)){
$account_id = $row['account_id']; $account_id = $row['account_id'];
$account_name = htmlentities($row['account_name']); $account_name = htmlentities($row['account_name']);
$opening_balance = htmlentities($row['opening_balance']); $opening_balance = floatval($row['opening_balance']);
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id"); $sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id");
$row = mysqli_fetch_array($sql_payments); $row = mysqli_fetch_array($sql_payments);
@@ -87,7 +87,7 @@
while($row = mysqli_fetch_array($sql)){ while($row = mysqli_fetch_array($sql)){
$account_id = $row['account_id']; $account_id = $row['account_id'];
$account_name = htmlentities($row['account_name']); $account_name = htmlentities($row['account_name']);
$opening_balance = htmlentities($row['opening_balance']); $opening_balance = floatval($row['opening_balance']);
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id"); $sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id");
$row = mysqli_fetch_array($sql_payments); $row = mysqli_fetch_array($sql_payments);

View File

@@ -51,7 +51,7 @@
while($row = mysqli_fetch_array($sql_accounts)){ while($row = mysqli_fetch_array($sql_accounts)){
$account_id_select = $row['account_id']; $account_id_select = $row['account_id'];
$account_name_select = htmlentities($row['account_name']); $account_name_select = htmlentities($row['account_name']);
$opening_balance = htmlentities($row['opening_balance']); $opening_balance = floatval($row['opening_balance']);
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id_select"); $sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id_select");
$row = mysqli_fetch_array($sql_payments); $row = mysqli_fetch_array($sql_payments);
@@ -89,7 +89,7 @@
while($row = mysqli_fetch_array($sql2)){ while($row = mysqli_fetch_array($sql2)){
$account_id2 = $row['account_id']; $account_id2 = $row['account_id'];
$account_name = htmlentities($row['account_name']); $account_name = htmlentities($row['account_name']);
$opening_balance = htmlentities($row['opening_balance']); $opening_balance = floatval($row['opening_balance']);
$sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id2"); $sql_payments = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id2");
$row = mysqli_fetch_array($sql_payments); $row = mysqli_fetch_array($sql_payments);

View File

@@ -141,7 +141,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$transfer_date = $row['transfer_date']; $transfer_date = $row['transfer_date'];
$transfer_account_from = $row['transfer_account_from']; $transfer_account_from = $row['transfer_account_from'];
$transfer_account_to = $row['transfer_account_to']; $transfer_account_to = $row['transfer_account_to'];
$transfer_amount = htmlentities($row['transfer_amount']); $transfer_amount = floatval($row['transfer_amount']);
$transfer_notes = htmlentities($row['transfer_notes']); $transfer_notes = htmlentities($row['transfer_notes']);
$transfer_created_at = $row['transfer_created_at']; $transfer_created_at = $row['transfer_created_at'];
$expense_id = $row['transfer_expense_id']; $expense_id = $row['transfer_expense_id'];