Model Domains
Core Entity
| Entity | Table | Role |
|---|---|---|
| Users | users | account + role |
| Projects | projects | main project |
| SPB | spbs | letter of request for goods |
| Items | items | items from SPB |
| PreOrder (PO) | pre_orders | purchase orders |
| POItems | po_items | pivot item to PO + PO item status |
| Suppliers | suppliers | vendors/suppliers |
| Payment | payments | PO payment data |
| PaymentTerm | payment_terms | payment terms |
| Taxes | taxes | tax data related to payment |
| PaymentSplit | payment_splits | DP/repayment scheme |
| PriceChangeRequest | price_change_requests | proposed total change to PO |
| SPK | spks | employment contract |
| SPKPayment | spk_payments | SPK payments |
| SPKRevision | spk_revisions | revised SPK |
| SPKPaymentAccounting | spk_payment_accountings | accounting SPK payments |
| PO/SPK Payment Receipt | po_payment_receipts, spk_payment_receipts | proof of payment |
Relationships Matter
Business Invariants (indicative)
- SPB approved can proceed to PO.
- PO received prompts the payment process.
- Payment status moves waiting → approved → verified.
- SPK payment & accounting are separate but connected to
spk_payment_id.
Critical Field
| Models | Fields | Notes |
|---|---|---|
PreOrder | status, received_at, approved_by, received_by | PO lifecycle |
Payment | subtotal, total, new_total, is_split, status | nominal final |
SPB | status, delivery_date | SPB lifecycle |
SPK | status, contract_nominal | contract lifecycle |
Verification Notes
- Status: Partial
- Scope: Actual FK constraints in production have not been verified directly to the running DB instance.
- Action: Take a constraint snapshot from the live DB and match it to the model/migration.