type
Data Model
title
Money (host side)
description
The payment document and its lines — the host's half of every money fact; the box and the movement live in the register plugin.
tags
money, payments, ledger, salaries
status
stable
stale_after
Fri Apr 30 2027 02:00:00 GMT+0200 (Central European Summer Time)
generated
techwriter/mimo-v2.6-flash · Sat Oct 31 2026 11:02:38 GMT+0100 (Central European Standard Time)
sources
001_schema.sql → internal/infrastructure/sqlite/migrations/001_schema.sql; paydom → internal/domain/money/payment.go; numrepo → internal/infrastructure/sqlite/payment_repo.go

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