diff --git a/functions.php b/functions.php index c831a83a..a158ee13 100644 --- a/functions.php +++ b/functions.php @@ -850,7 +850,7 @@ function calculateAccountBalance($mysqli, $account_id) { $sql_account = mysqli_query($mysqli, "SELECT * FROM accounts LEFT JOIN account_types ON accounts.account_type = account_types.account_type_id WHERE account_archived_at IS NULL AND account_id = $account_id ORDER BY account_name ASC; "); $row = mysqli_fetch_array($sql_account); $opening_balance = floatval($row['opening_balance']); - $account_id = $row['account_id']; + $account_id = intval($row['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); @@ -877,7 +877,7 @@ function calculateInvoiceBalance($mysqli, $invoice_id) { $sql_invoice = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_id = $invoice_id"); $row = mysqli_fetch_array($sql_invoice); $invoice_amount = floatval($row['invoice_amount']); - $invoice_id = $row['invoice_id']; + $invoice_id = intval($row['invoice_id']); $sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_invoice_id = $invoice_id"); $row = mysqli_fetch_array($sql_payments);