Payment orders — system description
Data model of the payment order basket, the restrictions on adding invoices, batching and netting rules of the giro file (HCT XML, Electra .HUF), document and transaction side effects, and permissions.
Overview
Payment order basket: an invoice is added with a row action of the Invoices list (with source and target account, amount, value date); items not tied to an invoice (wages, tax, other) can also be added. From the selected items a giro file (HCT XML or Erste Electra .HUF) is generated per client into the document centre, together with an outgoing draft transaction that the bank import recognises from the reference.
Data model
Table names carry the installation's own prefix in the database.
| Table | Purpose | Main fields, relation |
|---|---|---|
payment_order_item | basket item | client, partner, invoice (optional), title (wage, tax, other, reimburse), amount, value date, instant flag, source and target account, payee_kind, status (0 = open, 1 = in a file) |
payment_order | generated batch header | items reference it after generation |
company_setting | client parameter | payment_order_merge: 1 = merged per partner (default), 0 = one per invoice |
doc | the file in the document centre | object type payment_order |
transaction | outgoing draft transaction | direction 2, created idempotently |
Process
- Adding an invoice: amount = outstanding amount minus the unreleased retention; target account from the document, otherwise the partner's active default account in the currency; source is the client's default account; value date is the due date.
- Item without invoice: title, amount, target account, remittance information.
- Bulk value date: for the selected items the invoice due date or a fixed date.
- Third-party reimbursement:
payee_kind = third, titlereimburse, amount defaults to gross, note with the payment method's name; the cash and card restriction deliberately does not apply here. Invoice, payee name and account are required; customer invoices are refused. - Generation: selected items grouped by batch key (client + debit account + currency + value date); netting per partner (credit note as a negative item, a partner with non-positive net is left out) or one transfer per invoice according to the client setting; a unique batch reference with client identifier and timestamp; HCT XML or Electra
.HUF(HUF only); filing by the client's storage rule (document, otherwiseinvoice); batch header written, items set to status 1 and linked to the batch; an outgoing draft transaction through the idempotent batch handler of thefinance/transactionmodel. - Delete: the selected, still open items are physically deleted.
Rules and validation
- Adding an invoice is refused for: cash, card or deduction payment method; an already settled invoice (absolute outstanding at most 0.5); an open item for the same invoice; a customer invoice with a positive amount (only an overpayment refund is allowed); zero amount; missing target account (with the partner's name); missing source account.
- Only items with status 0 can be changed.
- Generation errors: an item of a cash or card invoice, Electra in a currency other than HUF, a partner without a target account, a missing storage rule.
- Saving the merge mode fails with a message if the settings table migration has not run.
Permissions
- Layer 1: saving the merge mode and generating also require modify permission.
- Layer 2:
list(also the page),edit(add, edit, value date, merge mode),reimburse,export,delete,debug. - Layer 3: at every endpoint the client must be one of the user's permitted companies (filtered in the model query); reimbursement filters on the invoice's client.
Known limitations
- The payee account helper of the reimbursement returns the bank account of the given company without a content scope check.