Lev/kun behavior
Documented against app commit ed7d6935. The same text lives in docs/agent/levkun.md in the app repo.
Leverandør and kunde
Section titled “Leverandør and kunde”Master data for suppliers and customers, their account cards, CSV import, and modfaktura. A party does not have its own balance table. The kontokort is bogføring lines whose header points at that party. The fold is docs/agent/transactions.md.
Both sides render resources/views/pages/levkun/index.blade.php and resources/views/pages/levkun/detailed.blade.php. The controller decides which id column is set.
Middleware: auth.check, account, year, plus module:leverandorer or module:kunder.
Screens
Section titled “Screens”| Path | What it is |
|---|---|
GET /leverandorers | Supplier list. Create and edit are modals. |
GET /leverandorers/detailed/{category?}/{quarter?} | Leverandørkontokort. |
GET /leverandorers/import and POST | CSV preview. POST /leverandorers/import/save writes it. |
GET /kunders | Customer list. |
GET /kunders/detailed/{category?}/{quarter?} | Kundekontokort. |
GET /kunders/import and POST | CSV preview. POST /kunders/import/save writes it. |
resources/views/pages/kunders_delete_this/ is not routed.
List regions: number, name, and the modkonto number used as a default. Kontokort regions: category and quarter, the party’s lines, reconciliation, and modfaktura.
Off-screen
Section titled “Off-screen”POST /leverandorers and POST /leverandorers/{id} store and update a supplier (number, name, modkonto number, and the rest of the modal). GET /leverandorers/next-number returns the next free number for the form. GET /leverandorers/get/{id} and GET /leverandorers/latest-invoice/{id} feed the booking forms. Delete is GET /leverandorers/delete/{id}. Customers use the same verbs under /kunders except there is no next-number or get/{id} route.
The rule form creates a party without leaving the form: POST /api/leverandorers and POST /api/kunders (Api\LeverandorerController@store, Api\KunderController@store). Those are the calls in public/js/rule.js.
Kontokort lines are bogføringer with leverandorer_id or kunder_id set, is_active = 1, folded like the daybook. Category and quarter only filter.
POST /leverandorers/modfaktura and POST /kunders/modfaktura (generateModfaktura) call ModfakturaService. It creates a counterpart bilag on the other company and sets generated_from_bogforing_id. BogforingAuditLogWriter::logModfakturaGenerated writes modfaktura_generated on the source header. POST .../modfaktura/delete removes the generated bilag. The daybook and the kontokort can then call POST /api/bogforing/remove-generated-from to clear the link on the source.
POST /leverandorers/reconciliation and POST /kunders/reconciliation (setLevkunReconciliation) store a levkun_reconciliations row for that party and period. It does not change line amounts.
Import save inserts parties only. It does not post. A default modkonto number on the party is what faktura-scan and the booking form offer next time. The number is resolved to a kontoplan_id for the invoice year at posting time, not stored as an id on the party.