hr.business_trips
Schema: hr
English table: hr.business_trips
Italian original table: hr.in_trasferta
Description: Management of employee business trips, including vehicle usage, cash advances, and customer/project linking.
Overview
- Columns: 25
- Primary key: id
- Outgoing foreign keys: 7
- Incoming foreign keys: 0
- Indexes: 14
Columns
| English column | Italian original column | Type | Null | Default / Generated | Description |
|---|---|---|---|---|---|
id | id | integer | NO | Surrogate primary key. | |
btr_id | intra_id | integer | NO | Functional identifier for the business trip. | |
btr_parent_id | intra_father_id | integer | NO | Identifier of the related btr parent record. | |
btr_employment_id | intra_rap_id | integer | NO | Reference to the employee employment contract (rap_id). | |
btr_cpr_id | intra_com_id | integer | YES | Reference to the customer project (cpr_id). | |
btr_cpl_id | intra_coml_id | integer | YES | Identifier of the related btr cpl record. | |
btr_start_date | intra_dal | date | NO | Date associated with the record. | |
btr_end_date | intra_al | date | NO | Date associated with the record. | |
btr_is_cancelled | intra_annullata | boolean | NO | Flag indicating if the trip was cancelled. | |
btr_company_car_id | intra_azcp_id | integer | NO | Identifier of the related btr company car record. | |
btr_vehicle_id | intra_anaauto_id | integer | NO | Identifier of the related btr vehicle record. | |
btr_vehicle_type | intra_tipo_auto | numeric(1,0) | NO | Btr vehicle type. | |
btr_cash_advance | intra_contanti | numeric(10,2) | NO | Btr cash advance. | |
btr_is_closed | intra_chiuso | boolean | NO | Boolean flag. | |
btr_reason | intra_motivazione | text | NO | Textual justification for the trip. | |
btr_cust_id | intra_incli_id | integer | YES | Reference to the customer (cust_id). | |
btr_number | intra_numero | character varying(15) | NO | Text value. | |
btr_csl_id | intra_inclise_id | integer | YES | Identifier of the related btr csl record. | |
btr_reason_id | intra_intrac_id | integer | NO | Identifier of the related btr reason record. | |
btr_is_invoiced | intra_fatturato | integer | NO | Flag or status for invoicing (0=No, 1=Yes). | |
btr_attachment_file | intra_file_allegato | character varying(100) | NO | Text value. | |
tenant_id | tenant_id | integer | YES | Tenant identifier for data isolation. | |
colcustom | colcustom | jsonb | YES | '{}'::jsonb | JSON payload containing additional attributes. |
_deleted | _deleted | boolean | YES | false | Flag indicating whether the record is soft-deleted. |
btr_period | intra_periodo | daterange | YES | GENERATED: daterange(btr_start_date, btr_end_date, '[]'::text) | Btr period. |
Relationships
Outgoing foreign keys
| Constraint | Local columns | References | Referenced columns | On update | On delete |
|---|---|---|---|---|---|
fk_business_trips_tenant | tenant_id | cloud.tenants | ten_internal_id | RESTRICT | CASCADE |
fk_intra_com_id | btr_cpr_id, tenant_id | hr.customer_projects | cpr_id, tenant_id | RESTRICT | RESTRICT |
fk_intra_coml_id | btr_cpl_id, tenant_id | hr.customer_project_links | cpl_id, tenant_id | RESTRICT | RESTRICT |
fk_intra_incli_id | btr_cust_id, tenant_id | hr.customers | cust_id, tenant_id | RESTRICT | RESTRICT |
fk_intra_inclise_id | btr_csl_id, tenant_id | hr.in_clienti_sedi | inclise_id, tenant_id | RESTRICT | RESTRICT |
fk_intra_intrac_id | btr_reason_id, tenant_id | hr.business_trip_reasons | btrr_id, tenant_id | RESTRICT | RESTRICT |
fk_intra_rap_id | btr_employment_id, tenant_id | hr.employment_relationships | er_id, tenant_id | RESTRICT | CASCADE |
Referenced by
No incoming foreign keys found.
Constraints
- Primary key:
pk_business_trips→id - Unique:
uk_business_trips_btr_id→btr_id, tenant_id
Indexes
| Name | Unique | Method | Columns / expression |
|---|---|---|---|
idx_btr_employment_id_tenant | NO | btree | tenant_id, btr_employment_id) WHERE (_deleted = false |
idx_btr_id_tenant | NO | btree | tenant_id, btr_id) WHERE (_deleted = false |
idx_btr_period_gist | NO | gist | tenant_id, btr_period) WHERE (_deleted = false |
idx_btr_tenant | NO | btree | tenant_id |
idx_in_trasferta_intra_anaauto_id_tenant | NO | btree | tenant_id, btr_vehicle_id) WHERE (_deleted = false |
idx_in_trasferta_intra_azcp_id_tenant | NO | btree | tenant_id, btr_company_car_id) WHERE (_deleted = false |
idx_in_trasferta_intra_com_id_tenant | NO | btree | tenant_id, btr_cpr_id) WHERE (_deleted = false |
idx_in_trasferta_intra_coml_id_tenant | NO | btree | tenant_id, btr_cpl_id) WHERE (_deleted = false |
idx_in_trasferta_intra_completo_tenant | NO | btree | tenant_id, btr_employment_id, btr_cpr_id, btr_cpr_id, btr_cust_id, btr_csl_id) WHERE (_deleted = false |
idx_in_trasferta_intra_father_id_tenant | NO | btree | tenant_id, btr_parent_id) WHERE (_deleted = false |
idx_in_trasferta_intra_incli_id_tenant | NO | btree | tenant_id, btr_cust_id) WHERE (_deleted = false |
idx_in_trasferta_intra_inclise_id_tenant | NO | btree | tenant_id, btr_csl_id) WHERE (_deleted = false |
idx_in_trasferta_intra_intrac_id_tenant | NO | btree | tenant_id, btr_reason_id) WHERE (_deleted = false |
idx_in_trasferta_tenant_intra_periodo_rap_gist | NO | gist | tenant_id, btr_employment_id, btr_period) WHERE (_deleted = false |
Navigation
- Back to main index
- [Back to
hrindex]../)