diff --git a/invoice_payment_add_modal.php b/invoice_payment_add_modal.php index bdedf3c5..7a25845d 100644 --- a/invoice_payment_add_modal.php +++ b/invoice_payment_add_modal.php @@ -51,38 +51,37 @@ - - Account - + - Select an Account - 10) { - $account_id = intval($row['account_id']); - $account_name = nullable_htmlentities($row['account_name']); - $opening_balance = floatval($row['opening_balance']); + $account_id = intval($row['account_id']); + $account_name = nullable_htmlentities($row['account_name']); + $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"); - $row = mysqli_fetch_array($sql_payments); - $total_payments = floatval($row['total_payments']); + $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); + $total_payments = floatval($row['total_payments']); - $sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id"); - $row = mysqli_fetch_array($sql_revenues); - $total_revenues = floatval($row['total_revenues']); + $sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id"); + $row = mysqli_fetch_array($sql_revenues); + $total_revenues = floatval($row['total_revenues']); - $sql_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id"); - $row = mysqli_fetch_array($sql_expenses); - $total_expenses = floatval($row['total_expenses']); + $sql_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id"); + $row = mysqli_fetch_array($sql_expenses); + $total_expenses = floatval($row['total_expenses']); - $account_balance = $opening_balance + $total_payments + $total_revenues - $total_expenses; + $account_balance = $opening_balance + $total_payments + $total_revenues - $total_expenses; ?> - value=""> [$] + + value=""> + [$] +