(int) round($room * 100)) { http_response_code(400); $return_arr['success'] = "False"; $return_arr['message'] = "amount is more than $reference_text has left to pay with its other payments - " . billingMoney(max(0, $room), $payment_row['invoice_currency_code']) . '.'; echo json_encode($return_arr); exit(); } // Cleared on a reconciled statement - its date, amount and account stay $error = ''; if (!reconcileCheckChange('payment', $payment_id, $date, $amount, $account_id, $error)) { http_response_code(400); $return_arr['success'] = "False"; $return_arr['message'] = $error . '.'; echo json_encode($return_arr); exit(); } // Moved to another account - out of the deposit it was in transferDepositRelease('payment', $payment_id, $account_id); $date_sql = escapeSql($date); $method_sql = escapeSql($payment_method); $reference_sql = escapeSql($reference); $update_sql = mysqli_query($mysqli, "UPDATE payments SET payment_date = '$date_sql', payment_amount = $amount, payment_account_id = $account_id, payment_method = '$method_sql', payment_reference = '$reference_sql' WHERE payment_id = $payment_id"); if ($update_sql) { $update_count = 1; // A changed amount can leave the invoice paid, part paid or owing again updateInvoiceStatusFromPayments($invoice_id); $money = escapeSql(billingMoney($amount, $payment_row['invoice_currency_code'])); logAudit("Payment", "Edit", "Payment on invoice " . escapeSql($reference_text) . " edited to $money via API ($api_key_name)", intval($payment_row['invoice_client_id']), $invoice_id); logAudit("API", "Success", "Edited a payment on invoice " . escapeSql($reference_text) . " via API ($api_key_name)", intval($payment_row['invoice_client_id'])); } } // Output require_once '../update_output.php';