feat: parties with radar, record, checks, VIES and demo data (#41)
Customers, suppliers, prospects and leads live in one parties archive with a kind and a subject type (ADR 0029). A customer that also supplies carries is_also_supplier, so it shows in both radars with one code. - Three radars (/anagrafiche/clienti, /fornitori, /contatti) with search, quick filters and bulk disable/enable; the record has eight tabs (main data, addresses, contacts, terms, fiscal and SDI, banks, notes and attachments, history) on the MasterDataPage base. - PartyService saves the whole record in one transaction, checks it with the fiscal pack (VAT number, tax code, recipient code, country), treats a duplicate VAT number or a consumer without tax code as warnings, fills the default recipient code, runs VIES after commit for EU companies, and converts prospects/leads (new customer code, old one kept as previous_code) and suppliers (become customers that also supply). - Delete falls back to disable when the party is referenced. - DemoPartiesSeeder adds 3 salespeople and 21 parties with fictitious but formally valid identifiers; SeedAsync now runs demo seeders when asked. - Test host accepts service overrides so VIES can be stubbed. Docs: ADR 0029, wiki Anagrafiche and demo data pages, regenerated data model, CHANGELOG and STATUS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a9eda510f2
commit
3401271483
28 files changed
+4600
-85
No files matched your search
+218
-7
@@ -177,13 +177,13 @@ public sealed class M20261013_001_CreateParties : IMigration
|
||||
|
||||
| Tabella | Colonne principali | Relazioni / note |
|
||||
|---|---|---|
|
||||
| `parties` | `code` (automatico), `kind` (cliente/fornitore/prospect/lead), ragione sociale o nome/cognome, P.IVA, codice fiscale, `party_type` (*azienda/privato/PA/UE/extra-UE/forfettario*), sede, contatti, lingua, `country_id` →, `category_id` →, `salesperson_id` →, note, `disabled`, `is_demo`, conti cliente/fornitore → | disabilitazione al posto della cancellazione se esistono documenti |
|
||||
| `party_addresses` | `party_id` →, tipo (destinazione), indirizzo | |
|
||||
| `party_contacts` | `party_id` →, nome, ruolo, telefono, e-mail | |
|
||||
| `party_bank_accounts` | `party_id` →, IBAN, BIC, banca | |
|
||||
| `party_sales_terms` | `party_id` →, listino →, sconti, pagamento →, banca RiBa, agente →, vettore →, porto, deposito →, fido, blocco, raggruppa DDT, giorno fatturazione, invio documenti e-mail/PEC | |
|
||||
| `party_purchase_terms` | `party_id` →, pagamento →, lead time, minimo, sconti | |
|
||||
| `party_fiscal` | `party_id` →, codice destinatario, PEC, split payment, reverse charge, ritenuta e aliquota, causale, cassa previdenza, ENASARCO, EORI, GLN, forfettario, esito VIES | |
|
||||
| `parties` | `code` (automatico per tipo, ADR 0027), `previous_code` (codice da lead o prospect), `kind` (cliente/fornitore/prospect/lead), `is_also_supplier`, `subject_type` (*impresa/privato/PA/UE/extra-UE/forfettario*), ragione sociale o cognome e nome, P.IVA, codice fiscale, REA, sede, `country_code`, recapiti, lingua, valuta, `category_id` →, `salesperson_id` →, consensi, note, esito e data VIES, conti cliente/fornitore, `disabled`, `is_demo` | disattivazione al posto della cancellazione se altri dati la usano (ADR 0029) |
|
||||
| `party_addresses` | `party_id` → (cascata), tipo (destinazione, fatturazione, cantiere, altro), denominazione, indirizzo, predefinito | |
|
||||
| `party_contacts` | `party_id` → (cascata), nome, ruolo, telefono, cellulare, e-mail, principale | |
|
||||
| `party_bank_accounts` | `party_id` → (cascata), IBAN, BIC, banca, ABI, CAB, predefinito | |
|
||||
| `party_sales_terms` | `party_id` → (unico), listino →, sconti, pagamento →, nostra banca →, vettore →, porto →, deposito →, fido, blocco, raggruppa DDT, giorno fatturazione, invio documenti e-mail/PEC | i dati di vendita del cliente |
|
||||
| `party_purchase_terms` | `party_id` → (unico), pagamento →, lead time, minimo d'ordine, sconto, porto →, registro IVA, conto di costo, e-mail ordini | i dati di acquisto del fornitore |
|
||||
| `party_fiscal` | `party_id` → (unico), codice destinatario, PEC, riferimento amministrazione, split payment, reverse charge, codice IVA →, esigibilità, bollo, ritenuta e aliquota, causale, cassa previdenza, ENASARCO, dichiarazione d'intento (numero, data, protocollo, codice IVA →, plafond, utilizzato, validità), EORI, GLN | |
|
||||
| `intent_declarations` † | `party_id` →, direzione (ricevuta/emessa), protocollo, anno, plafond, utilizzato, residuo, validità | mockup 061 |
|
||||
| `party_item_codes` | `party_id` →, `item_id` →, codice e descrizione del cliente/fornitore | |
|
||||
|
||||
@@ -727,6 +727,7 @@ Migrazioni applicate in ordine:
|
||||
- `core` 20261111013 `create_logistics_tables` (M20261111_013_CreateLogisticsTables)
|
||||
- `core` 20261111014 `create_catalog_tables` (M20261111_014_CreateCatalogTables)
|
||||
- `core` 20261111015 `create_code_sequences` (M20261111_015_CreateCodeSequences)
|
||||
- `core` 20261112001 `create_parties` (M20261112_001_CreateParties)
|
||||
|
||||
#### `attachments`
|
||||
|
||||
@@ -1229,6 +1230,103 @@ Migrazioni applicate in ordine:
|
||||
|
||||
- indice `ix_notifications_recipient_user_id` su `recipient_user_id`
|
||||
|
||||
#### `parties`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Int64 | no | | chiave primaria, identity |
|
||||
| `code` | String(30) | no | | |
|
||||
| `previous_code` | String(30) | sì | | |
|
||||
| `kind` | String(40) | no | | |
|
||||
| `is_also_supplier` | Bool | no | `false` | |
|
||||
| `subject_type` | String(40) | no | | |
|
||||
| `name` | String(200) | no | | |
|
||||
| `first_name` | String(80) | sì | | |
|
||||
| `last_name` | String(80) | sì | | |
|
||||
| `fiscal_name` | String(200) | sì | | |
|
||||
| `vat_number` | String(30) | sì | | |
|
||||
| `tax_code` | String(30) | sì | | |
|
||||
| `rea` | String(20) | sì | | |
|
||||
| `category_id` | Int64 | sì | | -> `party_categories` (Restrict) |
|
||||
| `address` | String(200) | sì | | |
|
||||
| `street_number` | String(20) | sì | | |
|
||||
| `postal_code` | String(10) | sì | | |
|
||||
| `city` | String(100) | sì | | |
|
||||
| `province` | String(10) | sì | | |
|
||||
| `country_code` | String(2) | no | | |
|
||||
| `phone` | String(40) | sì | | |
|
||||
| `email` | String(200) | sì | | |
|
||||
| `pec` | String(200) | sì | | |
|
||||
| `website` | String(200) | sì | | |
|
||||
| `salesperson_id` | Int64 | sì | | -> `salespeople` (Restrict) |
|
||||
| `language` | String(5) | no | | |
|
||||
| `currency_code` | String(3) | no | | |
|
||||
| `since` | Date | sì | | |
|
||||
| `privacy_accepted` | Bool | no | `false` | |
|
||||
| `marketing` | Bool | no | `false` | |
|
||||
| `notes` | Text | sì | | |
|
||||
| `vat_check` | String(40) | no | | |
|
||||
| `vat_checked_at` | DateTimeUtc | sì | | |
|
||||
| `customer_account_code` | String(20) | sì | | |
|
||||
| `supplier_account_code` | String(20) | sì | | |
|
||||
| `disabled` | Bool | no | `false` | |
|
||||
| `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_parties_kind` su `kind`
|
||||
- indice `ix_parties_name` su `name`
|
||||
- indice `ix_parties_tax_code` su `tax_code`
|
||||
- indice `ix_parties_vat_number` su `vat_number`
|
||||
- indice unico `ux_parties_code` su `code`
|
||||
|
||||
#### `party_addresses`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Int64 | no | | chiave primaria, identity |
|
||||
| `party_id` | Int64 | no | | -> `parties` (Cascade) |
|
||||
| `kind` | String(40) | no | | |
|
||||
| `name` | String(200) | no | | |
|
||||
| `address` | String(200) | sì | | |
|
||||
| `street_number` | String(20) | sì | | |
|
||||
| `postal_code` | String(10) | sì | | |
|
||||
| `city` | String(100) | sì | | |
|
||||
| `province` | String(10) | sì | | |
|
||||
| `country_code` | String(2) | no | | |
|
||||
| `is_default` | Bool | no | `false` | |
|
||||
| `notes` | Text | sì | | |
|
||||
| `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_party_addresses_party` su `party_id`
|
||||
|
||||
#### `party_bank_accounts`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Int64 | no | | chiave primaria, identity |
|
||||
| `party_id` | Int64 | no | | -> `parties` (Cascade) |
|
||||
| `iban` | String(34) | no | | |
|
||||
| `bic` | String(11) | sì | | |
|
||||
| `bank_name` | String(100) | sì | | |
|
||||
| `bank_code` | String(10) | sì | | |
|
||||
| `branch_code` | String(10) | sì | | |
|
||||
| `is_default` | 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_party_bank_accounts_party` su `party_id`
|
||||
|
||||
#### `party_categories`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
@@ -1246,6 +1344,119 @@ Migrazioni applicate in ordine:
|
||||
|
||||
- indice unico `ux_party_categories_code` su `code`
|
||||
|
||||
#### `party_contacts`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Int64 | no | | chiave primaria, identity |
|
||||
| `party_id` | Int64 | no | | -> `parties` (Cascade) |
|
||||
| `name` | String(120) | no | | |
|
||||
| `role` | String(80) | sì | | |
|
||||
| `phone` | String(40) | sì | | |
|
||||
| `mobile` | String(40) | sì | | |
|
||||
| `email` | String(200) | sì | | |
|
||||
| `is_default` | Bool | no | `false` | |
|
||||
| `notes` | Text | sì | | |
|
||||
| `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_party_contacts_party` su `party_id`
|
||||
|
||||
#### `party_fiscal`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Int64 | no | | chiave primaria, identity |
|
||||
| `party_id` | Int64 | no | | -> `parties` (Cascade) |
|
||||
| `recipient_code` | String(7) | sì | | |
|
||||
| `recipient_pec` | String(200) | sì | | |
|
||||
| `administration_reference` | String(20) | sì | | |
|
||||
| `attach_pdf` | Bool | no | `true` | |
|
||||
| `send_copy` | Bool | no | `false` | |
|
||||
| `split_payment` | Bool | no | `false` | |
|
||||
| `reverse_charge` | Bool | no | `false` | |
|
||||
| `tax_code_id` | Int64 | sì | | -> `tax_codes` (Restrict) |
|
||||
| `exigibility` | String(1) | sì | | |
|
||||
| `stamp_duty_charged` | Bool | no | `true` | |
|
||||
| `withholding` | Bool | no | `false` | |
|
||||
| `withholding_rate` | Decimal(19,6) | sì | | |
|
||||
| `withholding_reason` | String(4) | sì | | |
|
||||
| `pension_fund` | String(4) | sì | | |
|
||||
| `pension_fund_rate` | Decimal(19,6) | sì | | |
|
||||
| `enasarco` | Bool | no | `false` | |
|
||||
| `intent_active` | Bool | no | `false` | |
|
||||
| `intent_number` | String(40) | sì | | |
|
||||
| `intent_date` | Date | sì | | |
|
||||
| `intent_protocol` | String(40) | sì | | |
|
||||
| `intent_tax_code_id` | Int64 | sì | | -> `tax_codes` (Restrict) |
|
||||
| `intent_ceiling` | Decimal(19,6) | sì | | |
|
||||
| `intent_used` | Decimal(19,6) | no | `0` | |
|
||||
| `intent_from` | Date | sì | | |
|
||||
| `intent_to` | Date | sì | | |
|
||||
| `gln` | String(13) | sì | | |
|
||||
| `eori` | String(17) | sì | | |
|
||||
| `our_code` | String(40) | sì | | |
|
||||
| `created_at` | DateTimeUtc | no | | |
|
||||
| `created_by` | String(100) | sì | | |
|
||||
| `updated_at` | DateTimeUtc | sì | | |
|
||||
| `updated_by` | String(100) | sì | | |
|
||||
| `row_version` | Int64 | no | `1` | |
|
||||
|
||||
- indice unico `ux_party_fiscal_party` su `party_id`
|
||||
|
||||
#### `party_purchase_terms`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Int64 | no | | chiave primaria, identity |
|
||||
| `party_id` | Int64 | no | | -> `parties` (Cascade) |
|
||||
| `payment_term_id` | Int64 | sì | | -> `payment_terms` (Restrict) |
|
||||
| `lead_time_days` | Int32 | sì | | |
|
||||
| `minimum_order` | Decimal(19,6) | sì | | |
|
||||
| `discount` | Decimal(19,6) | sì | | |
|
||||
| `shipping_term_id` | Int64 | sì | | -> `shipping_terms` (Restrict) |
|
||||
| `vat_register_code` | String(10) | sì | | |
|
||||
| `cost_account_code` | String(20) | sì | | |
|
||||
| `orders_email` | String(200) | sì | | |
|
||||
| `created_at` | DateTimeUtc | no | | |
|
||||
| `created_by` | String(100) | sì | | |
|
||||
| `updated_at` | DateTimeUtc | sì | | |
|
||||
| `updated_by` | String(100) | sì | | |
|
||||
| `row_version` | Int64 | no | `1` | |
|
||||
|
||||
- indice unico `ux_party_purchase_terms_party` su `party_id`
|
||||
|
||||
#### `party_sales_terms`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Int64 | no | | chiave primaria, identity |
|
||||
| `party_id` | Int64 | no | | -> `parties` (Cascade) |
|
||||
| `price_list_id` | Int64 | sì | | -> `price_lists` (Restrict) |
|
||||
| `discount1` | Decimal(19,6) | sì | | |
|
||||
| `discount2` | Decimal(19,6) | sì | | |
|
||||
| `payment_term_id` | Int64 | sì | | -> `payment_terms` (Restrict) |
|
||||
| `company_bank_account_id` | Int64 | sì | | -> `bank_accounts` (Restrict) |
|
||||
| `carrier_id` | Int64 | sì | | -> `carriers` (Restrict) |
|
||||
| `shipping_term_id` | Int64 | sì | | -> `shipping_terms` (Restrict) |
|
||||
| `warehouse_id` | Int64 | sì | | -> `warehouses` (Restrict) |
|
||||
| `credit_limit` | Decimal(19,6) | sì | | |
|
||||
| `blocked` | Bool | no | `false` | |
|
||||
| `group_delivery_notes` | Bool | no | `true` | |
|
||||
| `invoice_day` | Int32 | sì | | |
|
||||
| `send_documents` | String(40) | no | | |
|
||||
| `documents_email` | String(200) | sì | | |
|
||||
| `created_at` | DateTimeUtc | no | | |
|
||||
| `created_by` | String(100) | sì | | |
|
||||
| `updated_at` | DateTimeUtc | sì | | |
|
||||
| `updated_by` | String(100) | sì | | |
|
||||
| `row_version` | Int64 | no | `1` | |
|
||||
|
||||
- indice unico `ux_party_sales_terms_party` su `party_id`
|
||||
|
||||
#### `payment_methods`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|
||||
Reference in new issue
Block a user