hr.expense_notes
Schema: hr
English table: hr.expense_notes
Italian original table: hr.in_notaspese
Description: Expense notes (headers) for employees/people, with date range, totals and workflow flags (multi-tenant).
Overview
- Columns: 19
- Primary key: id
- Outgoing foreign keys: 1
- Incoming foreign keys: 2
- Indexes: 8
Columns
| English column | Italian original column | Type | Null | Default / Generated | Description |
|---|---|---|---|---|---|
id | id | integer | NO | Surrogate primary key. | |
en_id | ns_id | integer | NO | Logical expense note identifier (unique per tenant). | |
en_er_id | ns_rap_id | integer | NO | Employment relationship identifier (rapporto). To be linked to hr.employment_relationships(er_id, tenant_id) once FK exists. | |
en_cost_center_id | ns_com_id | integer | YES | Cost center / job / assignment reference (com_* domain). | |
en_cost_center_line_id | ns_coml_id | integer | YES | Cost center detail/line reference (coml_* domain). | |
en_from_date | ns_dal | date | NO | Expense note start date. | |
en_to_date | ns_al | date | NO | Expense note end date. | |
en_transport_type_id | ns_tipo_trasporto | integer | NO | Transport type identifier (likely a lookup). | |
en_is_requested | ns_richiesto | boolean | NO | True if the expense note has been submitted/requested. | |
en_total_amount | ns_totale | numeric(10,2) | NO | Total amount for the expense note (base currency / module currency). | |
en_is_closed | ns_chiusa | boolean | NO | True if the expense note is closed/finalized. | |
en_is_sent_to_payroll | ns_inviata_paghe | boolean | NO | True if the expense note has been sent to payroll processing. | |
en_request_number | ns_numero_richiesta | character varying(15) | NO | Request number / external reference. | |
en_trip_id | ns_intra_id | integer | YES | Trip/transfer identifier (intra_* domain), if applicable. | |
en_notes | ns_note | text | NO | Free text notes. | |
tenant_id | tenant_id | integer | YES | Tenant identifier for data isolation. | |
colcustom | colcustom | jsonb | YES | '{}'::jsonb | Custom fields (JSON). |
_deleted | _deleted | boolean | YES | false | Technical soft-delete flag. |
en_period | ns_periodo | daterange | YES | GENERATED: daterange(en_from_date, en_to_date, '[]'::text) | Date range as daterange (derived from from/to dates). |
Relationships
Outgoing foreign keys
| Constraint | Local columns | References | Referenced columns | On update | On delete |
|---|---|---|---|---|---|
fk_en_tenant | tenant_id | cloud.tenants | ten_internal_id | RESTRICT | CASCADE |
Referenced by
| From table | Foreign key | Source columns | Target columns |
|---|---|---|---|
hr.expense_note_lines | fk_enl_expense_note_id | enl_expense_note_id, tenant_id | en_id, tenant_id |
hr.person_wallet_ledger | fk_pwl_expense_note_id | pwl_expense_note_id, tenant_id | en_id, tenant_id |
Constraints
- Primary key:
pk_expense_notes→id - Unique:
uk_en_id_tenant→en_id, tenant_id
Indexes
| Name | Unique | Method | Columns / expression |
|---|---|---|---|
idx_en_cost_center_id_tenant | NO | btree | tenant_id, en_cost_center_id) WHERE (_deleted = false |
idx_en_cost_center_line_id_tenant | NO | btree | tenant_id, en_cost_center_line_id) WHERE (_deleted = false |
idx_en_er_id_cost_center_cost_center_line_tenant | NO | btree | tenant_id, en_er_id, en_cost_center_id, en_cost_center_line_id) WHERE (_deleted = false |
idx_en_er_id_tenant | NO | btree | tenant_id, en_er_id) WHERE (_deleted = false |
idx_en_id_tenant | NO | btree | tenant_id, en_id) WHERE (_deleted = false |
idx_en_trip_id_tenant | NO | btree | tenant_id, en_trip_id) WHERE (_deleted = false |
idx_expense_notes_tenant | NO | btree | tenant_id |
idx_expense_notes_tenant_period_gist | NO | gist | tenant_id, en_period) WHERE (_deleted = false |
Navigation
- Back to main index
- [Back to
hrindex]../)