feat: document engine with kinds, states, atomic numbering and fulfilment (#47)
One engine for sales, purchases and warehouse documents (ADR 0032). Each document type now carries a kind that decides its family of tables, life cycle, effects, accepted lines, the kinds it fulfils and its permissions, so company-defined types work without code. - Six families of header and line tables plus document_links; document_types gets document_kind (seeded types filled by the migration and the Italian template), document_numerators gets last_date. - DocumentStateMachine with the order, invoice and simple life cycles and the actions each state admits; issued invoices are immutable and are cancelled with a reason only before the file reaches the exchange system. - DocumentNumberingService numbers at confirmation inside the transaction under the numerator lock (advisory lock on PostgreSQL, write lock on SQLite): no duplicates, a rollback gives the number back, out-of-sequence dates refused on gap-free numerators, the new year's numerator created on first use, gap report. - DocumentEngine, the generic DocumentService<THeader, TLine> and DocumentCopyService: save, confirm or issue, cancel, close, reopen, delete, duplicate and transform; links are recorded at confirmation and removed at cancellation, and FulfillmentCalculator recomputes quantities and states. - Tests: rules in Core, concurrent numbering on SQLite and PostgreSQL (data tests, run on PostgreSQL 18 locally), order to delivery notes to deferred invoice on a real instance. Wiki (Vendite, Tabelle azienda), CHANGELOG, STATUS, DATA-MODEL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fa9304834a
commit
ddd2273f7e
33 files changed
+4081
-37
No files matched your search
@@ -729,6 +729,7 @@ Migrazioni applicate in ordine:
|
||||
- `core` 20261111015 `create_code_sequences` (M20261111_015_CreateCodeSequences)
|
||||
- `core` 20261112001 `create_parties` (M20261112_001_CreateParties)
|
||||
- `core` 20261112002 `create_items` (M20261112_002_CreateItems)
|
||||
- `core` 20261112003 `create_documents` (M20261112_003_CreateDocuments)
|
||||
|
||||
#### `attachments`
|
||||
|
||||
@@ -990,6 +991,28 @@ Migrazioni applicate in ordine:
|
||||
|
||||
- indice unico `ux_discount_policies_code` su `code`
|
||||
|
||||
#### `document_links`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Int64 | no | | chiave primaria, identity |
|
||||
| `target_family` | String(40) | no | | |
|
||||
| `target_document_id` | Int64 | no | | |
|
||||
| `target_line_id` | Int64 | no | | |
|
||||
| `source_family` | String(40) | no | | |
|
||||
| `source_document_id` | Int64 | no | | |
|
||||
| `source_line_id` | Int64 | no | | |
|
||||
| `quantity` | Decimal(19,6) | no | | |
|
||||
| `created_at` | DateTimeUtc | no | | |
|
||||
| `created_by` | String(100) | sì | | |
|
||||
| `updated_at` | DateTimeUtc | sì | | |
|
||||
| `updated_by` | String(100) | sì | | |
|
||||
| `row_version` | Int64 | no | `1` | |
|
||||
|
||||
- indice `ix_document_links_source` su `source_family`, `source_line_id`
|
||||
- indice `ix_document_links_source_document` su `source_family`, `source_document_id`
|
||||
- indice `ix_document_links_target` su `target_family`, `target_document_id`
|
||||
|
||||
#### `document_numerators`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
@@ -1011,6 +1034,7 @@ Migrazioni applicate in ordine:
|
||||
| `updated_at` | DateTimeUtc | sì | | |
|
||||
| `updated_by` | String(100) | sì | | |
|
||||
| `row_version` | Int64 | no | `1` | |
|
||||
| `last_date` | Date | sì | | |
|
||||
|
||||
- indice unico `ux_document_numerators_code_year` su `code`, `year`
|
||||
|
||||
@@ -1035,6 +1059,7 @@ Migrazioni applicate in ordine:
|
||||
| `updated_at` | DateTimeUtc | sì | | |
|
||||
| `updated_by` | String(100) | sì | | |
|
||||
| `row_version` | Int64 | no | `1` | |
|
||||
| `document_kind` | String(40) | sì | | |
|
||||
|
||||
- indice unico `ux_document_types_code` su `code`
|
||||
|
||||
@@ -1112,6 +1137,115 @@ Migrazioni applicate in ordine:
|
||||
|
||||
- indice unico `ux_goods_appearances_code` su `code`
|
||||
|
||||
#### `inventory_document_lines`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Int64 | no | | chiave primaria, identity |
|
||||
| `document_id` | Int64 | no | | -> `inventory_documents` (Cascade) |
|
||||
| `line_number` | Int32 | no | | |
|
||||
| `kind` | String(40) | no | | |
|
||||
| `item_id` | Int64 | sì | | -> `items` (Restrict) |
|
||||
| `description` | String(1000) | no | | |
|
||||
| `unit_of_measure_id` | Int64 | sì | | -> `units_of_measure` (Restrict) |
|
||||
| `quantity` | Decimal(19,6) | no | `0` | |
|
||||
| `price` | Decimal(19,6) | no | `0` | |
|
||||
| `price_source` | String(40) | no | | |
|
||||
| `discount_formula` | String(30) | sì | | |
|
||||
| `tax_code_id` | Int64 | sì | | -> `tax_codes` (Restrict) |
|
||||
| `taxable_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `warehouse_id` | Int64 | sì | | -> `warehouses` (Restrict) |
|
||||
| `delivery_date` | Date | sì | | |
|
||||
| `fulfilled_quantity` | Decimal(19,6) | no | `0` | |
|
||||
| `fulfillment_closed` | Bool | no | `false` | |
|
||||
| `source_family` | String(40) | sì | | |
|
||||
| `source_line_id` | Int64 | sì | | |
|
||||
| `account_code` | String(20) | sì | | |
|
||||
| `cost_center_id` | Int64 | sì | | -> `cost_centers` (Restrict) |
|
||||
| `job_id` | Int64 | sì | | -> `jobs` (Restrict) |
|
||||
| `notes` | Text | sì | | |
|
||||
| `sort_order` | Int32 | no | `0` | |
|
||||
| `created_at` | DateTimeUtc | no | | |
|
||||
| `created_by` | String(100) | sì | | |
|
||||
| `updated_at` | DateTimeUtc | sì | | |
|
||||
| `updated_by` | String(100) | sì | | |
|
||||
| `row_version` | Int64 | no | `1` | |
|
||||
|
||||
- indice `ix_inventory_document_lines_document` su `document_id`
|
||||
- indice `ix_inventory_document_lines_item` su `item_id`
|
||||
- indice `ix_inventory_document_lines_source` su `source_family`, `source_line_id`
|
||||
|
||||
#### `inventory_documents`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Int64 | no | | chiave primaria, identity |
|
||||
| `document_type_id` | Int64 | no | | -> `document_types` (Restrict) |
|
||||
| `kind` | String(40) | no | | |
|
||||
| `status` | String(40) | no | | |
|
||||
| `numerator_id` | Int64 | sì | | -> `document_numerators` (Restrict) |
|
||||
| `section` | String(10) | sì | | |
|
||||
| `number` | Int64 | sì | | |
|
||||
| `document_number` | String(30) | sì | | |
|
||||
| `document_date` | Date | no | | |
|
||||
| `year` | Int32 | no | | |
|
||||
| `party_id` | Int64 | sì | | -> `parties` (Restrict) |
|
||||
| `destination_id` | Int64 | sì | | -> `party_addresses` (Restrict) |
|
||||
| `external_reference` | String(40) | sì | | |
|
||||
| `external_date` | Date | sì | | |
|
||||
| `currency_code` | String(3) | no | | |
|
||||
| `exchange_rate` | Decimal(19,6) | no | `1` | |
|
||||
| `price_list_id` | Int64 | sì | | -> `price_lists` (Restrict) |
|
||||
| `payment_term_id` | Int64 | sì | | -> `payment_terms` (Restrict) |
|
||||
| `payment_method_id` | Int64 | sì | | -> `payment_methods` (Restrict) |
|
||||
| `bank_account_id` | Int64 | sì | | -> `bank_accounts` (Restrict) |
|
||||
| `salesperson_id` | Int64 | sì | | -> `salespeople` (Restrict) |
|
||||
| `warehouse_id` | Int64 | sì | | -> `warehouses` (Restrict) |
|
||||
| `inventory_reason_id` | Int64 | sì | | -> `inventory_reasons` (Restrict) |
|
||||
| `transport_reason_id` | Int64 | sì | | -> `transport_reasons` (Restrict) |
|
||||
| `shipping_term_id` | Int64 | sì | | -> `shipping_terms` (Restrict) |
|
||||
| `carrier_id` | Int64 | sì | | -> `carriers` (Restrict) |
|
||||
| `goods_appearance_id` | Int64 | sì | | -> `goods_appearances` (Restrict) |
|
||||
| `packages` | Int32 | sì | | |
|
||||
| `gross_weight` | Decimal(19,6) | sì | | |
|
||||
| `net_weight` | Decimal(19,6) | sì | | |
|
||||
| `transport_start` | DateTimeUtc | sì | | |
|
||||
| `valid_until` | Date | sì | | |
|
||||
| `delivery_date` | Date | sì | | |
|
||||
| `revision` | Int32 | no | `0` | |
|
||||
| `printed` | Bool | no | `false` | |
|
||||
| `sent` | Bool | no | `false` | |
|
||||
| `posted` | Bool | no | `false` | |
|
||||
| `installments_generated` | Bool | no | `false` | |
|
||||
| `xml_generated` | Bool | no | `false` | |
|
||||
| `taxable_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `tax_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `total_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `footer_discount` | String(30) | sì | | |
|
||||
| `expenses_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `stamp_duty` | Decimal(19,6) | no | `0` | |
|
||||
| `withholding_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `social_security_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `net_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `notes` | Text | sì | | |
|
||||
| `gl_entry_id` | Int64 | sì | | |
|
||||
| `vat_protocol` | Int64 | sì | | |
|
||||
| `confirmed_at` | DateTimeUtc | sì | | |
|
||||
| `confirmed_by` | String(100) | sì | | |
|
||||
| `cancelled_at` | DateTimeUtc | sì | | |
|
||||
| `cancel_reason` | String(200) | sì | | |
|
||||
| `is_demo` | Bool | no | `false` | |
|
||||
| `created_at` | DateTimeUtc | no | | |
|
||||
| `created_by` | String(100) | sì | | |
|
||||
| `updated_at` | DateTimeUtc | sì | | |
|
||||
| `updated_by` | String(100) | sì | | |
|
||||
| `row_version` | Int64 | no | `1` | |
|
||||
|
||||
- indice `ix_inventory_documents_date` su `document_date`
|
||||
- indice `ix_inventory_documents_party` su `party_id`
|
||||
- indice `ix_inventory_documents_status` su `status`
|
||||
- indice unico `ux_inventory_documents_number` su `numerator_id`, `number`
|
||||
|
||||
#### `inventory_reasons`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
@@ -1710,6 +1844,224 @@ Migrazioni applicate in ordine:
|
||||
|
||||
- indice unico `ux_provinces_code` su `code`
|
||||
|
||||
#### `purchase_document_lines`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Int64 | no | | chiave primaria, identity |
|
||||
| `document_id` | Int64 | no | | -> `purchase_documents` (Cascade) |
|
||||
| `line_number` | Int32 | no | | |
|
||||
| `kind` | String(40) | no | | |
|
||||
| `item_id` | Int64 | sì | | -> `items` (Restrict) |
|
||||
| `description` | String(1000) | no | | |
|
||||
| `unit_of_measure_id` | Int64 | sì | | -> `units_of_measure` (Restrict) |
|
||||
| `quantity` | Decimal(19,6) | no | `0` | |
|
||||
| `price` | Decimal(19,6) | no | `0` | |
|
||||
| `price_source` | String(40) | no | | |
|
||||
| `discount_formula` | String(30) | sì | | |
|
||||
| `tax_code_id` | Int64 | sì | | -> `tax_codes` (Restrict) |
|
||||
| `taxable_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `warehouse_id` | Int64 | sì | | -> `warehouses` (Restrict) |
|
||||
| `delivery_date` | Date | sì | | |
|
||||
| `fulfilled_quantity` | Decimal(19,6) | no | `0` | |
|
||||
| `fulfillment_closed` | Bool | no | `false` | |
|
||||
| `source_family` | String(40) | sì | | |
|
||||
| `source_line_id` | Int64 | sì | | |
|
||||
| `account_code` | String(20) | sì | | |
|
||||
| `cost_center_id` | Int64 | sì | | -> `cost_centers` (Restrict) |
|
||||
| `job_id` | Int64 | sì | | -> `jobs` (Restrict) |
|
||||
| `notes` | Text | sì | | |
|
||||
| `sort_order` | Int32 | no | `0` | |
|
||||
| `created_at` | DateTimeUtc | no | | |
|
||||
| `created_by` | String(100) | sì | | |
|
||||
| `updated_at` | DateTimeUtc | sì | | |
|
||||
| `updated_by` | String(100) | sì | | |
|
||||
| `row_version` | Int64 | no | `1` | |
|
||||
|
||||
- indice `ix_purchase_document_lines_document` su `document_id`
|
||||
- indice `ix_purchase_document_lines_item` su `item_id`
|
||||
- indice `ix_purchase_document_lines_source` su `source_family`, `source_line_id`
|
||||
|
||||
#### `purchase_documents`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Int64 | no | | chiave primaria, identity |
|
||||
| `document_type_id` | Int64 | no | | -> `document_types` (Restrict) |
|
||||
| `kind` | String(40) | no | | |
|
||||
| `status` | String(40) | no | | |
|
||||
| `numerator_id` | Int64 | sì | | -> `document_numerators` (Restrict) |
|
||||
| `section` | String(10) | sì | | |
|
||||
| `number` | Int64 | sì | | |
|
||||
| `document_number` | String(30) | sì | | |
|
||||
| `document_date` | Date | no | | |
|
||||
| `year` | Int32 | no | | |
|
||||
| `party_id` | Int64 | sì | | -> `parties` (Restrict) |
|
||||
| `destination_id` | Int64 | sì | | -> `party_addresses` (Restrict) |
|
||||
| `external_reference` | String(40) | sì | | |
|
||||
| `external_date` | Date | sì | | |
|
||||
| `currency_code` | String(3) | no | | |
|
||||
| `exchange_rate` | Decimal(19,6) | no | `1` | |
|
||||
| `price_list_id` | Int64 | sì | | -> `price_lists` (Restrict) |
|
||||
| `payment_term_id` | Int64 | sì | | -> `payment_terms` (Restrict) |
|
||||
| `payment_method_id` | Int64 | sì | | -> `payment_methods` (Restrict) |
|
||||
| `bank_account_id` | Int64 | sì | | -> `bank_accounts` (Restrict) |
|
||||
| `salesperson_id` | Int64 | sì | | -> `salespeople` (Restrict) |
|
||||
| `warehouse_id` | Int64 | sì | | -> `warehouses` (Restrict) |
|
||||
| `inventory_reason_id` | Int64 | sì | | -> `inventory_reasons` (Restrict) |
|
||||
| `transport_reason_id` | Int64 | sì | | -> `transport_reasons` (Restrict) |
|
||||
| `shipping_term_id` | Int64 | sì | | -> `shipping_terms` (Restrict) |
|
||||
| `carrier_id` | Int64 | sì | | -> `carriers` (Restrict) |
|
||||
| `goods_appearance_id` | Int64 | sì | | -> `goods_appearances` (Restrict) |
|
||||
| `packages` | Int32 | sì | | |
|
||||
| `gross_weight` | Decimal(19,6) | sì | | |
|
||||
| `net_weight` | Decimal(19,6) | sì | | |
|
||||
| `transport_start` | DateTimeUtc | sì | | |
|
||||
| `valid_until` | Date | sì | | |
|
||||
| `delivery_date` | Date | sì | | |
|
||||
| `revision` | Int32 | no | `0` | |
|
||||
| `printed` | Bool | no | `false` | |
|
||||
| `sent` | Bool | no | `false` | |
|
||||
| `posted` | Bool | no | `false` | |
|
||||
| `installments_generated` | Bool | no | `false` | |
|
||||
| `xml_generated` | Bool | no | `false` | |
|
||||
| `taxable_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `tax_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `total_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `footer_discount` | String(30) | sì | | |
|
||||
| `expenses_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `stamp_duty` | Decimal(19,6) | no | `0` | |
|
||||
| `withholding_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `social_security_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `net_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `notes` | Text | sì | | |
|
||||
| `gl_entry_id` | Int64 | sì | | |
|
||||
| `vat_protocol` | Int64 | sì | | |
|
||||
| `confirmed_at` | DateTimeUtc | sì | | |
|
||||
| `confirmed_by` | String(100) | sì | | |
|
||||
| `cancelled_at` | DateTimeUtc | sì | | |
|
||||
| `cancel_reason` | String(200) | sì | | |
|
||||
| `is_demo` | Bool | no | `false` | |
|
||||
| `created_at` | DateTimeUtc | no | | |
|
||||
| `created_by` | String(100) | sì | | |
|
||||
| `updated_at` | DateTimeUtc | sì | | |
|
||||
| `updated_by` | String(100) | sì | | |
|
||||
| `row_version` | Int64 | no | `1` | |
|
||||
|
||||
- indice `ix_purchase_documents_date` su `document_date`
|
||||
- indice `ix_purchase_documents_party` su `party_id`
|
||||
- indice `ix_purchase_documents_status` su `status`
|
||||
- indice unico `ux_purchase_documents_number` su `numerator_id`, `number`
|
||||
|
||||
#### `purchase_order_lines`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Int64 | no | | chiave primaria, identity |
|
||||
| `document_id` | Int64 | no | | -> `purchase_orders` (Cascade) |
|
||||
| `line_number` | Int32 | no | | |
|
||||
| `kind` | String(40) | no | | |
|
||||
| `item_id` | Int64 | sì | | -> `items` (Restrict) |
|
||||
| `description` | String(1000) | no | | |
|
||||
| `unit_of_measure_id` | Int64 | sì | | -> `units_of_measure` (Restrict) |
|
||||
| `quantity` | Decimal(19,6) | no | `0` | |
|
||||
| `price` | Decimal(19,6) | no | `0` | |
|
||||
| `price_source` | String(40) | no | | |
|
||||
| `discount_formula` | String(30) | sì | | |
|
||||
| `tax_code_id` | Int64 | sì | | -> `tax_codes` (Restrict) |
|
||||
| `taxable_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `warehouse_id` | Int64 | sì | | -> `warehouses` (Restrict) |
|
||||
| `delivery_date` | Date | sì | | |
|
||||
| `fulfilled_quantity` | Decimal(19,6) | no | `0` | |
|
||||
| `fulfillment_closed` | Bool | no | `false` | |
|
||||
| `source_family` | String(40) | sì | | |
|
||||
| `source_line_id` | Int64 | sì | | |
|
||||
| `account_code` | String(20) | sì | | |
|
||||
| `cost_center_id` | Int64 | sì | | -> `cost_centers` (Restrict) |
|
||||
| `job_id` | Int64 | sì | | -> `jobs` (Restrict) |
|
||||
| `notes` | Text | sì | | |
|
||||
| `sort_order` | Int32 | no | `0` | |
|
||||
| `created_at` | DateTimeUtc | no | | |
|
||||
| `created_by` | String(100) | sì | | |
|
||||
| `updated_at` | DateTimeUtc | sì | | |
|
||||
| `updated_by` | String(100) | sì | | |
|
||||
| `row_version` | Int64 | no | `1` | |
|
||||
|
||||
- indice `ix_purchase_order_lines_document` su `document_id`
|
||||
- indice `ix_purchase_order_lines_item` su `item_id`
|
||||
- indice `ix_purchase_order_lines_source` su `source_family`, `source_line_id`
|
||||
|
||||
#### `purchase_orders`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Int64 | no | | chiave primaria, identity |
|
||||
| `document_type_id` | Int64 | no | | -> `document_types` (Restrict) |
|
||||
| `kind` | String(40) | no | | |
|
||||
| `status` | String(40) | no | | |
|
||||
| `numerator_id` | Int64 | sì | | -> `document_numerators` (Restrict) |
|
||||
| `section` | String(10) | sì | | |
|
||||
| `number` | Int64 | sì | | |
|
||||
| `document_number` | String(30) | sì | | |
|
||||
| `document_date` | Date | no | | |
|
||||
| `year` | Int32 | no | | |
|
||||
| `party_id` | Int64 | sì | | -> `parties` (Restrict) |
|
||||
| `destination_id` | Int64 | sì | | -> `party_addresses` (Restrict) |
|
||||
| `external_reference` | String(40) | sì | | |
|
||||
| `external_date` | Date | sì | | |
|
||||
| `currency_code` | String(3) | no | | |
|
||||
| `exchange_rate` | Decimal(19,6) | no | `1` | |
|
||||
| `price_list_id` | Int64 | sì | | -> `price_lists` (Restrict) |
|
||||
| `payment_term_id` | Int64 | sì | | -> `payment_terms` (Restrict) |
|
||||
| `payment_method_id` | Int64 | sì | | -> `payment_methods` (Restrict) |
|
||||
| `bank_account_id` | Int64 | sì | | -> `bank_accounts` (Restrict) |
|
||||
| `salesperson_id` | Int64 | sì | | -> `salespeople` (Restrict) |
|
||||
| `warehouse_id` | Int64 | sì | | -> `warehouses` (Restrict) |
|
||||
| `inventory_reason_id` | Int64 | sì | | -> `inventory_reasons` (Restrict) |
|
||||
| `transport_reason_id` | Int64 | sì | | -> `transport_reasons` (Restrict) |
|
||||
| `shipping_term_id` | Int64 | sì | | -> `shipping_terms` (Restrict) |
|
||||
| `carrier_id` | Int64 | sì | | -> `carriers` (Restrict) |
|
||||
| `goods_appearance_id` | Int64 | sì | | -> `goods_appearances` (Restrict) |
|
||||
| `packages` | Int32 | sì | | |
|
||||
| `gross_weight` | Decimal(19,6) | sì | | |
|
||||
| `net_weight` | Decimal(19,6) | sì | | |
|
||||
| `transport_start` | DateTimeUtc | sì | | |
|
||||
| `valid_until` | Date | sì | | |
|
||||
| `delivery_date` | Date | sì | | |
|
||||
| `revision` | Int32 | no | `0` | |
|
||||
| `printed` | Bool | no | `false` | |
|
||||
| `sent` | Bool | no | `false` | |
|
||||
| `posted` | Bool | no | `false` | |
|
||||
| `installments_generated` | Bool | no | `false` | |
|
||||
| `xml_generated` | Bool | no | `false` | |
|
||||
| `taxable_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `tax_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `total_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `footer_discount` | String(30) | sì | | |
|
||||
| `expenses_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `stamp_duty` | Decimal(19,6) | no | `0` | |
|
||||
| `withholding_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `social_security_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `net_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `notes` | Text | sì | | |
|
||||
| `gl_entry_id` | Int64 | sì | | |
|
||||
| `vat_protocol` | Int64 | sì | | |
|
||||
| `confirmed_at` | DateTimeUtc | sì | | |
|
||||
| `confirmed_by` | String(100) | sì | | |
|
||||
| `cancelled_at` | DateTimeUtc | sì | | |
|
||||
| `cancel_reason` | String(200) | sì | | |
|
||||
| `is_demo` | Bool | no | `false` | |
|
||||
| `created_at` | DateTimeUtc | no | | |
|
||||
| `created_by` | String(100) | sì | | |
|
||||
| `updated_at` | DateTimeUtc | sì | | |
|
||||
| `updated_by` | String(100) | sì | | |
|
||||
| `row_version` | Int64 | no | `1` | |
|
||||
|
||||
- indice `ix_purchase_orders_date` su `document_date`
|
||||
- indice `ix_purchase_orders_party` su `party_id`
|
||||
- indice `ix_purchase_orders_status` su `status`
|
||||
- indice unico `ux_purchase_orders_number` su `numerator_id`, `number`
|
||||
|
||||
#### `role_permissions`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
@@ -1743,6 +2095,333 @@ Migrazioni applicate in ordine:
|
||||
|
||||
- indice unico `ux_roles_code` su `code`
|
||||
|
||||
#### `sale_document_lines`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Int64 | no | | chiave primaria, identity |
|
||||
| `document_id` | Int64 | no | | -> `sale_documents` (Cascade) |
|
||||
| `line_number` | Int32 | no | | |
|
||||
| `kind` | String(40) | no | | |
|
||||
| `item_id` | Int64 | sì | | -> `items` (Restrict) |
|
||||
| `description` | String(1000) | no | | |
|
||||
| `unit_of_measure_id` | Int64 | sì | | -> `units_of_measure` (Restrict) |
|
||||
| `quantity` | Decimal(19,6) | no | `0` | |
|
||||
| `price` | Decimal(19,6) | no | `0` | |
|
||||
| `price_source` | String(40) | no | | |
|
||||
| `discount_formula` | String(30) | sì | | |
|
||||
| `tax_code_id` | Int64 | sì | | -> `tax_codes` (Restrict) |
|
||||
| `taxable_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `warehouse_id` | Int64 | sì | | -> `warehouses` (Restrict) |
|
||||
| `delivery_date` | Date | sì | | |
|
||||
| `fulfilled_quantity` | Decimal(19,6) | no | `0` | |
|
||||
| `fulfillment_closed` | Bool | no | `false` | |
|
||||
| `source_family` | String(40) | sì | | |
|
||||
| `source_line_id` | Int64 | sì | | |
|
||||
| `account_code` | String(20) | sì | | |
|
||||
| `cost_center_id` | Int64 | sì | | -> `cost_centers` (Restrict) |
|
||||
| `job_id` | Int64 | sì | | -> `jobs` (Restrict) |
|
||||
| `notes` | Text | sì | | |
|
||||
| `sort_order` | Int32 | no | `0` | |
|
||||
| `created_at` | DateTimeUtc | no | | |
|
||||
| `created_by` | String(100) | sì | | |
|
||||
| `updated_at` | DateTimeUtc | sì | | |
|
||||
| `updated_by` | String(100) | sì | | |
|
||||
| `row_version` | Int64 | no | `1` | |
|
||||
|
||||
- indice `ix_sale_document_lines_document` su `document_id`
|
||||
- indice `ix_sale_document_lines_item` su `item_id`
|
||||
- indice `ix_sale_document_lines_source` su `source_family`, `source_line_id`
|
||||
|
||||
#### `sale_documents`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Int64 | no | | chiave primaria, identity |
|
||||
| `document_type_id` | Int64 | no | | -> `document_types` (Restrict) |
|
||||
| `kind` | String(40) | no | | |
|
||||
| `status` | String(40) | no | | |
|
||||
| `numerator_id` | Int64 | sì | | -> `document_numerators` (Restrict) |
|
||||
| `section` | String(10) | sì | | |
|
||||
| `number` | Int64 | sì | | |
|
||||
| `document_number` | String(30) | sì | | |
|
||||
| `document_date` | Date | no | | |
|
||||
| `year` | Int32 | no | | |
|
||||
| `party_id` | Int64 | sì | | -> `parties` (Restrict) |
|
||||
| `destination_id` | Int64 | sì | | -> `party_addresses` (Restrict) |
|
||||
| `external_reference` | String(40) | sì | | |
|
||||
| `external_date` | Date | sì | | |
|
||||
| `currency_code` | String(3) | no | | |
|
||||
| `exchange_rate` | Decimal(19,6) | no | `1` | |
|
||||
| `price_list_id` | Int64 | sì | | -> `price_lists` (Restrict) |
|
||||
| `payment_term_id` | Int64 | sì | | -> `payment_terms` (Restrict) |
|
||||
| `payment_method_id` | Int64 | sì | | -> `payment_methods` (Restrict) |
|
||||
| `bank_account_id` | Int64 | sì | | -> `bank_accounts` (Restrict) |
|
||||
| `salesperson_id` | Int64 | sì | | -> `salespeople` (Restrict) |
|
||||
| `warehouse_id` | Int64 | sì | | -> `warehouses` (Restrict) |
|
||||
| `inventory_reason_id` | Int64 | sì | | -> `inventory_reasons` (Restrict) |
|
||||
| `transport_reason_id` | Int64 | sì | | -> `transport_reasons` (Restrict) |
|
||||
| `shipping_term_id` | Int64 | sì | | -> `shipping_terms` (Restrict) |
|
||||
| `carrier_id` | Int64 | sì | | -> `carriers` (Restrict) |
|
||||
| `goods_appearance_id` | Int64 | sì | | -> `goods_appearances` (Restrict) |
|
||||
| `packages` | Int32 | sì | | |
|
||||
| `gross_weight` | Decimal(19,6) | sì | | |
|
||||
| `net_weight` | Decimal(19,6) | sì | | |
|
||||
| `transport_start` | DateTimeUtc | sì | | |
|
||||
| `valid_until` | Date | sì | | |
|
||||
| `delivery_date` | Date | sì | | |
|
||||
| `revision` | Int32 | no | `0` | |
|
||||
| `printed` | Bool | no | `false` | |
|
||||
| `sent` | Bool | no | `false` | |
|
||||
| `posted` | Bool | no | `false` | |
|
||||
| `installments_generated` | Bool | no | `false` | |
|
||||
| `xml_generated` | Bool | no | `false` | |
|
||||
| `taxable_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `tax_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `total_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `footer_discount` | String(30) | sì | | |
|
||||
| `expenses_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `stamp_duty` | Decimal(19,6) | no | `0` | |
|
||||
| `withholding_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `social_security_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `net_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `notes` | Text | sì | | |
|
||||
| `gl_entry_id` | Int64 | sì | | |
|
||||
| `vat_protocol` | Int64 | sì | | |
|
||||
| `confirmed_at` | DateTimeUtc | sì | | |
|
||||
| `confirmed_by` | String(100) | sì | | |
|
||||
| `cancelled_at` | DateTimeUtc | sì | | |
|
||||
| `cancel_reason` | String(200) | sì | | |
|
||||
| `is_demo` | Bool | no | `false` | |
|
||||
| `created_at` | DateTimeUtc | no | | |
|
||||
| `created_by` | String(100) | sì | | |
|
||||
| `updated_at` | DateTimeUtc | sì | | |
|
||||
| `updated_by` | String(100) | sì | | |
|
||||
| `row_version` | Int64 | no | `1` | |
|
||||
|
||||
- indice `ix_sale_documents_date` su `document_date`
|
||||
- indice `ix_sale_documents_party` su `party_id`
|
||||
- indice `ix_sale_documents_status` su `status`
|
||||
- indice unico `ux_sale_documents_number` su `numerator_id`, `number`
|
||||
|
||||
#### `sale_order_lines`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Int64 | no | | chiave primaria, identity |
|
||||
| `document_id` | Int64 | no | | -> `sale_orders` (Cascade) |
|
||||
| `line_number` | Int32 | no | | |
|
||||
| `kind` | String(40) | no | | |
|
||||
| `item_id` | Int64 | sì | | -> `items` (Restrict) |
|
||||
| `description` | String(1000) | no | | |
|
||||
| `unit_of_measure_id` | Int64 | sì | | -> `units_of_measure` (Restrict) |
|
||||
| `quantity` | Decimal(19,6) | no | `0` | |
|
||||
| `price` | Decimal(19,6) | no | `0` | |
|
||||
| `price_source` | String(40) | no | | |
|
||||
| `discount_formula` | String(30) | sì | | |
|
||||
| `tax_code_id` | Int64 | sì | | -> `tax_codes` (Restrict) |
|
||||
| `taxable_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `warehouse_id` | Int64 | sì | | -> `warehouses` (Restrict) |
|
||||
| `delivery_date` | Date | sì | | |
|
||||
| `fulfilled_quantity` | Decimal(19,6) | no | `0` | |
|
||||
| `fulfillment_closed` | Bool | no | `false` | |
|
||||
| `source_family` | String(40) | sì | | |
|
||||
| `source_line_id` | Int64 | sì | | |
|
||||
| `account_code` | String(20) | sì | | |
|
||||
| `cost_center_id` | Int64 | sì | | -> `cost_centers` (Restrict) |
|
||||
| `job_id` | Int64 | sì | | -> `jobs` (Restrict) |
|
||||
| `notes` | Text | sì | | |
|
||||
| `sort_order` | Int32 | no | `0` | |
|
||||
| `created_at` | DateTimeUtc | no | | |
|
||||
| `created_by` | String(100) | sì | | |
|
||||
| `updated_at` | DateTimeUtc | sì | | |
|
||||
| `updated_by` | String(100) | sì | | |
|
||||
| `row_version` | Int64 | no | `1` | |
|
||||
|
||||
- indice `ix_sale_order_lines_document` su `document_id`
|
||||
- indice `ix_sale_order_lines_item` su `item_id`
|
||||
- indice `ix_sale_order_lines_source` su `source_family`, `source_line_id`
|
||||
|
||||
#### `sale_orders`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Int64 | no | | chiave primaria, identity |
|
||||
| `document_type_id` | Int64 | no | | -> `document_types` (Restrict) |
|
||||
| `kind` | String(40) | no | | |
|
||||
| `status` | String(40) | no | | |
|
||||
| `numerator_id` | Int64 | sì | | -> `document_numerators` (Restrict) |
|
||||
| `section` | String(10) | sì | | |
|
||||
| `number` | Int64 | sì | | |
|
||||
| `document_number` | String(30) | sì | | |
|
||||
| `document_date` | Date | no | | |
|
||||
| `year` | Int32 | no | | |
|
||||
| `party_id` | Int64 | sì | | -> `parties` (Restrict) |
|
||||
| `destination_id` | Int64 | sì | | -> `party_addresses` (Restrict) |
|
||||
| `external_reference` | String(40) | sì | | |
|
||||
| `external_date` | Date | sì | | |
|
||||
| `currency_code` | String(3) | no | | |
|
||||
| `exchange_rate` | Decimal(19,6) | no | `1` | |
|
||||
| `price_list_id` | Int64 | sì | | -> `price_lists` (Restrict) |
|
||||
| `payment_term_id` | Int64 | sì | | -> `payment_terms` (Restrict) |
|
||||
| `payment_method_id` | Int64 | sì | | -> `payment_methods` (Restrict) |
|
||||
| `bank_account_id` | Int64 | sì | | -> `bank_accounts` (Restrict) |
|
||||
| `salesperson_id` | Int64 | sì | | -> `salespeople` (Restrict) |
|
||||
| `warehouse_id` | Int64 | sì | | -> `warehouses` (Restrict) |
|
||||
| `inventory_reason_id` | Int64 | sì | | -> `inventory_reasons` (Restrict) |
|
||||
| `transport_reason_id` | Int64 | sì | | -> `transport_reasons` (Restrict) |
|
||||
| `shipping_term_id` | Int64 | sì | | -> `shipping_terms` (Restrict) |
|
||||
| `carrier_id` | Int64 | sì | | -> `carriers` (Restrict) |
|
||||
| `goods_appearance_id` | Int64 | sì | | -> `goods_appearances` (Restrict) |
|
||||
| `packages` | Int32 | sì | | |
|
||||
| `gross_weight` | Decimal(19,6) | sì | | |
|
||||
| `net_weight` | Decimal(19,6) | sì | | |
|
||||
| `transport_start` | DateTimeUtc | sì | | |
|
||||
| `valid_until` | Date | sì | | |
|
||||
| `delivery_date` | Date | sì | | |
|
||||
| `revision` | Int32 | no | `0` | |
|
||||
| `printed` | Bool | no | `false` | |
|
||||
| `sent` | Bool | no | `false` | |
|
||||
| `posted` | Bool | no | `false` | |
|
||||
| `installments_generated` | Bool | no | `false` | |
|
||||
| `xml_generated` | Bool | no | `false` | |
|
||||
| `taxable_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `tax_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `total_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `footer_discount` | String(30) | sì | | |
|
||||
| `expenses_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `stamp_duty` | Decimal(19,6) | no | `0` | |
|
||||
| `withholding_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `social_security_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `net_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `notes` | Text | sì | | |
|
||||
| `gl_entry_id` | Int64 | sì | | |
|
||||
| `vat_protocol` | Int64 | sì | | |
|
||||
| `confirmed_at` | DateTimeUtc | sì | | |
|
||||
| `confirmed_by` | String(100) | sì | | |
|
||||
| `cancelled_at` | DateTimeUtc | sì | | |
|
||||
| `cancel_reason` | String(200) | sì | | |
|
||||
| `is_demo` | Bool | no | `false` | |
|
||||
| `created_at` | DateTimeUtc | no | | |
|
||||
| `created_by` | String(100) | sì | | |
|
||||
| `updated_at` | DateTimeUtc | sì | | |
|
||||
| `updated_by` | String(100) | sì | | |
|
||||
| `row_version` | Int64 | no | `1` | |
|
||||
|
||||
- indice `ix_sale_orders_date` su `document_date`
|
||||
- indice `ix_sale_orders_party` su `party_id`
|
||||
- indice `ix_sale_orders_status` su `status`
|
||||
- indice unico `ux_sale_orders_number` su `numerator_id`, `number`
|
||||
|
||||
#### `sale_quotation_lines`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Int64 | no | | chiave primaria, identity |
|
||||
| `document_id` | Int64 | no | | -> `sale_quotations` (Cascade) |
|
||||
| `line_number` | Int32 | no | | |
|
||||
| `kind` | String(40) | no | | |
|
||||
| `item_id` | Int64 | sì | | -> `items` (Restrict) |
|
||||
| `description` | String(1000) | no | | |
|
||||
| `unit_of_measure_id` | Int64 | sì | | -> `units_of_measure` (Restrict) |
|
||||
| `quantity` | Decimal(19,6) | no | `0` | |
|
||||
| `price` | Decimal(19,6) | no | `0` | |
|
||||
| `price_source` | String(40) | no | | |
|
||||
| `discount_formula` | String(30) | sì | | |
|
||||
| `tax_code_id` | Int64 | sì | | -> `tax_codes` (Restrict) |
|
||||
| `taxable_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `warehouse_id` | Int64 | sì | | -> `warehouses` (Restrict) |
|
||||
| `delivery_date` | Date | sì | | |
|
||||
| `fulfilled_quantity` | Decimal(19,6) | no | `0` | |
|
||||
| `fulfillment_closed` | Bool | no | `false` | |
|
||||
| `source_family` | String(40) | sì | | |
|
||||
| `source_line_id` | Int64 | sì | | |
|
||||
| `account_code` | String(20) | sì | | |
|
||||
| `cost_center_id` | Int64 | sì | | -> `cost_centers` (Restrict) |
|
||||
| `job_id` | Int64 | sì | | -> `jobs` (Restrict) |
|
||||
| `notes` | Text | sì | | |
|
||||
| `sort_order` | Int32 | no | `0` | |
|
||||
| `created_at` | DateTimeUtc | no | | |
|
||||
| `created_by` | String(100) | sì | | |
|
||||
| `updated_at` | DateTimeUtc | sì | | |
|
||||
| `updated_by` | String(100) | sì | | |
|
||||
| `row_version` | Int64 | no | `1` | |
|
||||
|
||||
- indice `ix_sale_quotation_lines_document` su `document_id`
|
||||
- indice `ix_sale_quotation_lines_item` su `item_id`
|
||||
- indice `ix_sale_quotation_lines_source` su `source_family`, `source_line_id`
|
||||
|
||||
#### `sale_quotations`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Int64 | no | | chiave primaria, identity |
|
||||
| `document_type_id` | Int64 | no | | -> `document_types` (Restrict) |
|
||||
| `kind` | String(40) | no | | |
|
||||
| `status` | String(40) | no | | |
|
||||
| `numerator_id` | Int64 | sì | | -> `document_numerators` (Restrict) |
|
||||
| `section` | String(10) | sì | | |
|
||||
| `number` | Int64 | sì | | |
|
||||
| `document_number` | String(30) | sì | | |
|
||||
| `document_date` | Date | no | | |
|
||||
| `year` | Int32 | no | | |
|
||||
| `party_id` | Int64 | sì | | -> `parties` (Restrict) |
|
||||
| `destination_id` | Int64 | sì | | -> `party_addresses` (Restrict) |
|
||||
| `external_reference` | String(40) | sì | | |
|
||||
| `external_date` | Date | sì | | |
|
||||
| `currency_code` | String(3) | no | | |
|
||||
| `exchange_rate` | Decimal(19,6) | no | `1` | |
|
||||
| `price_list_id` | Int64 | sì | | -> `price_lists` (Restrict) |
|
||||
| `payment_term_id` | Int64 | sì | | -> `payment_terms` (Restrict) |
|
||||
| `payment_method_id` | Int64 | sì | | -> `payment_methods` (Restrict) |
|
||||
| `bank_account_id` | Int64 | sì | | -> `bank_accounts` (Restrict) |
|
||||
| `salesperson_id` | Int64 | sì | | -> `salespeople` (Restrict) |
|
||||
| `warehouse_id` | Int64 | sì | | -> `warehouses` (Restrict) |
|
||||
| `inventory_reason_id` | Int64 | sì | | -> `inventory_reasons` (Restrict) |
|
||||
| `transport_reason_id` | Int64 | sì | | -> `transport_reasons` (Restrict) |
|
||||
| `shipping_term_id` | Int64 | sì | | -> `shipping_terms` (Restrict) |
|
||||
| `carrier_id` | Int64 | sì | | -> `carriers` (Restrict) |
|
||||
| `goods_appearance_id` | Int64 | sì | | -> `goods_appearances` (Restrict) |
|
||||
| `packages` | Int32 | sì | | |
|
||||
| `gross_weight` | Decimal(19,6) | sì | | |
|
||||
| `net_weight` | Decimal(19,6) | sì | | |
|
||||
| `transport_start` | DateTimeUtc | sì | | |
|
||||
| `valid_until` | Date | sì | | |
|
||||
| `delivery_date` | Date | sì | | |
|
||||
| `revision` | Int32 | no | `0` | |
|
||||
| `printed` | Bool | no | `false` | |
|
||||
| `sent` | Bool | no | `false` | |
|
||||
| `posted` | Bool | no | `false` | |
|
||||
| `installments_generated` | Bool | no | `false` | |
|
||||
| `xml_generated` | Bool | no | `false` | |
|
||||
| `taxable_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `tax_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `total_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `footer_discount` | String(30) | sì | | |
|
||||
| `expenses_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `stamp_duty` | Decimal(19,6) | no | `0` | |
|
||||
| `withholding_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `social_security_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `net_amount` | Decimal(19,6) | no | `0` | |
|
||||
| `notes` | Text | sì | | |
|
||||
| `gl_entry_id` | Int64 | sì | | |
|
||||
| `vat_protocol` | Int64 | sì | | |
|
||||
| `confirmed_at` | DateTimeUtc | sì | | |
|
||||
| `confirmed_by` | String(100) | sì | | |
|
||||
| `cancelled_at` | DateTimeUtc | sì | | |
|
||||
| `cancel_reason` | String(200) | sì | | |
|
||||
| `is_demo` | Bool | no | `false` | |
|
||||
| `created_at` | DateTimeUtc | no | | |
|
||||
| `created_by` | String(100) | sì | | |
|
||||
| `updated_at` | DateTimeUtc | sì | | |
|
||||
| `updated_by` | String(100) | sì | | |
|
||||
| `row_version` | Int64 | no | `1` | |
|
||||
|
||||
- indice `ix_sale_quotations_date` su `document_date`
|
||||
- indice `ix_sale_quotations_party` su `party_id`
|
||||
- indice `ix_sale_quotations_status` su `status`
|
||||
- indice unico `ux_sale_quotations_number` su `numerator_id`, `number`
|
||||
|
||||
#### `salespeople`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|
||||
Reference in new issue
Block a user