Money — the host's tables
These describe what a payment is; the register plugin's tables describe the
money itself (plugin tables).
box_id is deliberately absent from both — the box belongs to the register
line, not the host row.
| Table | Columns (keys) | Notes |
|---|---|---|
payments |
id PK · number UNIQUE (IN-00001/OUT-00001) · type (in/out) · kind (fees/salary/expense/transfer/adjustment/income/other) · student_id FK (nullable) · employee_id FK→users (nullable) · amount · currency · method · reference · date · description · status (active/cancelled) · created_by · created_at |
the header; number is derived per prefix from MAX(number) inside the posting transaction; reference is the document number a method tag demands |
payment_lines |
id PK · payment_id FK · student_fee_id (nullable) · description · amount · currency · fee_amount · fee_currency · movement_id |
one line settles at most one student_fees row; movement_id links to the re_movements row this line posted — a plain string, no cross-owner FK |
salaries |
id PK · employee_id FK→users · amount · currency · frequency · effective_date · end_date · notes |
a salary entitlement, not a payment; paying it creates an out/salary payment, and SumSalaryPaid derives what has been paid against it |
Relationships
payments 1 —< payment_lines >— student_fees; payments >— users (employee);
salaries >— users.
Why amount is REAL while the register's is integer
The host stores display units (major) because screens and reports deal in
major; every amount crosses into the plugin as an integer in minor units,
converted with the currency's own exponent (toMinor/fromMinor). No float
ever reaches the ledger. See money.
Rendered from simple-lms/data-model/money.md · OKF bundle · regenerate with npm run render