The payment module records money received from customers — including cheque payments, bank transfers, and deposits. Each payment row in the MySQLDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/arsinousltd-sudo/Arsinous-V8-Sales/llms.txt
Use this file to discover all available pages before exploring further.
customers_payments table carries an optional deposit date and deposit reference number, which lets the P&D (Payments & Deposits) sheet filter for undeposited versus deposited payments. The functions here cover the dialog entry points, sheet-level row selectors for edit and delete, and the query-driven refresh of the P&D sheet. Persistent changes are handled by saveCustomerPaymentToDb and deleteCustomerPayment in the DB layer.
showPayment(id)
Opens an 800 × 350 modal dialog rendered from the Payment/index HTML template.
The
customers_payments primary key to edit. When provided, the dialog sets html.id = id and titles itself “Edit Customer Payment”, loading the existing record on the front-end. When null or omitted, the dialog opens with an empty form titled “Create Customer Payment” and html.id is set to the empty string.selectPaymentToEdit()
Reads the currently selected row from the Balance or P&D sheet and opens the payment edit dialog for the payment found on that row.
Validation rules — at least one of the following conditions must be met:
| Sheet | Row condition | Column A | Column C (type) |
|---|---|---|---|
"Balance" | row ≥ 4 | non-empty (the payment id) | must equal "Payment" |
"P&D" | row ≥ 7 | non-empty | any value |
'Select Payment from "Balance" or "P&D" tabs '.
The
amount variable is read for both sheet cases but is not used after assignment — it exists in the source as a guard expression that implicitly confirms the row has the expected shape. The actual editing is done entirely by showPayment(id).selectPaymentToDelete()
Reads the currently selected row from the Customer sheet, shows a confirmation dialog with the payment’s date and amount, and — if confirmed — deletes the payment and refreshes the P&D sheet.
Validation rules (throws on failure):
- Active sheet name must be
"Customer". - Column C (type) of the selected row must equal
"Payment". - Row must be ≥ 4.
type, date, and amount from the selected row so the user can verify the correct record before deletion. If the user clicks NO, a toast confirms the operation was cancelled and nothing is changed.
updateCustomersPayments()
Refreshes the P&D (Payments & Deposits) sheet by querying customers_payments with optional filters for date range, payment type, and customer.
| Cell | Variable | Purpose |
|---|---|---|
C1 | startDate | Start of the date range (inclusive) |
C2 | endDate | End of the date range (inclusive) |
E1 | type | Payment type filter (see below) |
F4 | customer | Customer ID filter; empty string = all customers |
type cell value | SQL condition added |
|---|---|
"Payments w/o Deposits" | AND deposit_date IS NULL |
"Payments with Deposits" | AND deposit_date IS NOT NULL |
| Any other value (including blank) | No deposit filter |
startDate or endDate is non-empty, the value is formatted with Utilities.formatDate(..., "yyyy-MM-dd") before being interpolated into the SQL string. This ensures the sheet’s locale-formatted dates are correctly converted to MySQL date literals.
Base query:
id, date, name, num, deposit_date, deposit_num, amount, comments.
The
updateCustomersPayments function is also triggered automatically by the onEdit trigger whenever cells C1, C2, E1, or C4 on the P&D sheet are edited. This means changing any filter input in the sheet refreshes the data immediately without needing to use the menu.