feat: items and price lists with dated prices, derived lists and demo catalogue (#42)
Items get their own archive and record (mockup 017): codes from the per-category mask, EAN and NC8 checks, alternative units and bar codes, suppliers with the usual one, substitutes, notes and history. Only goods can be stocked; stock itself comes with the warehouse in M6. Costs are hidden from users without items.cost.read and kept as they were when those users save. A used item is disabled instead of deleted. Prices live in one item_prices table, either for a price list or as a customer's net price, each valid from a date, so documents keep the price of their day. Derived lists compute a price from their base list with markup and rounding when they have none of their own. The price grid (mockup 018) edits every list at one validity date, keeps changes pending and highlighted until saved, and computes mass updates as a preview. PriceListService.QuoteAsync gives documents (M5) the price search order net, list, base, item price with its source. Parties get the "Articoli e codici" tab: the codes a customer or supplier uses for our items, found by the item search in that party's documents. Demo data adds 120 items of a plumbing wholesaler, the PUBB and RIV lists, last year's prices, suppliers, units, codes and a customer's net prices; seed --demo [--scale N] loads them from the command line and repeats the catalogue for performance tests. ADR 0030 records the decisions; wiki, data model, CHANGELOG and STATUS are updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c8241a414e
commit
3dbbaba86e
46 files changed
+5318
-144
No files matched your search
+161
-8
@@ -168,7 +168,7 @@ public sealed class M20261013_001_CreateParties : IMigration
|
||||
| `warehouses` | codice, descrizione, indirizzo | |
|
||||
| `item_categories` | codice, descrizione, `parent_id` → (3 livelli) | |
|
||||
| `party_categories` | codice, descrizione | |
|
||||
| `price_lists` | codice, descrizione, valuta, IVA inclusa, listino padre → | listini derivati |
|
||||
| `price_lists` | codice, descrizione, valuta, IVA inclusa, `is_base` (listino base), listino di partenza →, ricarico %, passo di arrotondamento, validità | listini derivati (ADR 0030) |
|
||||
| `discount_policies` | codice, descrizione, formula sconto | |
|
||||
| `document_types` | kind, numeratore →, causale magazzino →, causale contabile →, registro IVA →, TD SDI, modello stampa | catalogo statico |
|
||||
| `cost_centers`, `jobs` | codice, descrizione | centri di costo, commesse |
|
||||
@@ -185,18 +185,18 @@ public sealed class M20261013_001_CreateParties : IMigration
|
||||
| `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 | |
|
||||
| `party_item_codes` | `party_id` → (cascata), `item_id` → (cascata), codice e descrizione del cliente/fornitore | salvati con la scheda dell'anagrafica; codice unico per anagrafica (ADR 0030) |
|
||||
|
||||
### 4.4 Articoli e listini (`Items`, CORE)
|
||||
|
||||
| Tabella | Colonne principali | Relazioni / note |
|
||||
|---|---|---|
|
||||
| `items` | `code` (automatico), descrizioni, `item_type` (*merce/servizio/spesa/testo/cespite*), `category_id` →, UM →, IVA vendita/acquisto →, EAN, NC8, produttore, marca, pesi, deposito →, scorta minima, punto/lotto di riordino, costi (standard/ultimo/medio), gestione a magazzino, conti ricavo/costo → | immagine come allegato |
|
||||
| `item_uoms` | `item_id` →, UM →, fattore di conversione | |
|
||||
| `item_barcodes` | `item_id` →, codice, tipo | |
|
||||
| `item_prices` | `item_id` →, `price_list_id` →, prezzo, validità, `party_id` → (prezzo netto cliente) | griglia listino x articolo (mockup 018) |
|
||||
| `item_suppliers` | `item_id` →, `party_id` →, codice fornitore, prezzo, lead time, minimo | |
|
||||
| `item_substitutes` | `item_id` →, `substitute_item_id` → | |
|
||||
| `items` | `code` (automatico, maschera `{categoria}-{seq:0000}`), descrizioni, `kind` (*merce/servizio/spesa/testo/cespite*), `category_id` →, UM →, IVA vendita/acquisto →, EAN, NC8, produttore, marca, pesi, deposito →, scorta minima, punto/lotto di riordino, prezzo, costi (standard/ultimo/medio), gestione a magazzino (solo merci), conti ricavo/costo →, `disabled`, `is_demo` | immagine come allegato; disattivazione al posto della cancellazione se usato |
|
||||
| `item_uoms` | `item_id` → (cascata), UM →, fattore di conversione, EAN della confezione | |
|
||||
| `item_barcodes` | `item_id` → (cascata), codice, descrizione | codici alternativi, trovati dalla ricerca |
|
||||
| `item_prices` | `item_id` → (cascata), `price_list_id` → oppure `party_id` → (prezzo netto cliente), prezzo, `valid_from` | storico per data di validità; griglia listino x articolo (mockup 018, ADR 0030) |
|
||||
| `item_suppliers` | `item_id` → (cascata), `party_id` →, codice fornitore, prezzo, lead time, minimo, `is_default` (fornitore abituale) | |
|
||||
| `item_substitutes` | `item_id` → (cascata), `substitute_id` →, note | |
|
||||
|
||||
### 4.5 Documenti, vendite e acquisti (`Sales`, `Purchases`, CORE)
|
||||
|
||||
@@ -728,6 +728,7 @@ Migrazioni applicate in ordine:
|
||||
- `core` 20261111014 `create_catalog_tables` (M20261111_014_CreateCatalogTables)
|
||||
- `core` 20261111015 `create_code_sequences` (M20261111_015_CreateCodeSequences)
|
||||
- `core` 20261112001 `create_parties` (M20261112_001_CreateParties)
|
||||
- `core` 20261112002 `create_items` (M20261112_002_CreateItems)
|
||||
|
||||
#### `attachments`
|
||||
|
||||
@@ -1131,6 +1132,22 @@ Migrazioni applicate in ordine:
|
||||
|
||||
- indice unico `ux_inventory_reasons_code` su `code`
|
||||
|
||||
#### `item_barcodes`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Int64 | no | | chiave primaria, identity |
|
||||
| `item_id` | Int64 | no | | -> `items` (Cascade) |
|
||||
| `code` | String(40) | no | | |
|
||||
| `description` | String(100) | 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_item_barcodes_code` su `code`
|
||||
|
||||
#### `item_categories`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
@@ -1150,6 +1167,123 @@ Migrazioni applicate in ordine:
|
||||
|
||||
- indice unico `ux_item_categories_code` su `code`
|
||||
|
||||
#### `item_prices`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Int64 | no | | chiave primaria, identity |
|
||||
| `item_id` | Int64 | no | | -> `items` (Cascade) |
|
||||
| `price_list_id` | Int64 | sì | | -> `price_lists` (Restrict) |
|
||||
| `party_id` | Int64 | sì | | -> `parties` (Restrict) |
|
||||
| `price` | Decimal(19,6) | no | | |
|
||||
| `valid_from` | Date | 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_item_prices_item` su `item_id`
|
||||
- indice `ix_item_prices_party` su `party_id`
|
||||
- indice `ix_item_prices_price_list` su `price_list_id`
|
||||
|
||||
#### `item_substitutes`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Int64 | no | | chiave primaria, identity |
|
||||
| `item_id` | Int64 | no | | -> `items` (Cascade) |
|
||||
| `substitute_id` | Int64 | no | | -> `items` (Restrict) |
|
||||
| `notes` | 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_item_substitutes_pair` su `item_id`, `substitute_id`
|
||||
|
||||
#### `item_suppliers`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Int64 | no | | chiave primaria, identity |
|
||||
| `item_id` | Int64 | no | | -> `items` (Cascade) |
|
||||
| `party_id` | Int64 | no | | -> `parties` (Restrict) |
|
||||
| `supplier_code` | String(40) | sì | | |
|
||||
| `price` | Decimal(19,6) | sì | | |
|
||||
| `lead_time_days` | Int32 | sì | | |
|
||||
| `minimum_quantity` | Decimal(19,6) | 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 unico `ux_item_suppliers_item_party` su `item_id`, `party_id`
|
||||
|
||||
#### `item_uoms`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Int64 | no | | chiave primaria, identity |
|
||||
| `item_id` | Int64 | no | | -> `items` (Cascade) |
|
||||
| `unit_of_measure_id` | Int64 | no | | -> `units_of_measure` (Restrict) |
|
||||
| `factor` | Decimal(19,6) | no | `1` | |
|
||||
| `barcode` | String(20) | 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_item_uoms_item_unit` su `item_id`, `unit_of_measure_id`
|
||||
|
||||
#### `items`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Int64 | no | | chiave primaria, identity |
|
||||
| `code` | String(30) | no | | |
|
||||
| `kind` | String(40) | no | | |
|
||||
| `description` | String(200) | no | | |
|
||||
| `extended_description` | Text | sì | | |
|
||||
| `category_id` | Int64 | sì | | -> `item_categories` (Restrict) |
|
||||
| `unit_of_measure_id` | Int64 | sì | | -> `units_of_measure` (Restrict) |
|
||||
| `sales_tax_code_id` | Int64 | sì | | -> `tax_codes` (Restrict) |
|
||||
| `purchase_tax_code_id` | Int64 | sì | | -> `tax_codes` (Restrict) |
|
||||
| `barcode` | String(20) | sì | | |
|
||||
| `customs_code` | String(10) | sì | | |
|
||||
| `manufacturer` | String(100) | sì | | |
|
||||
| `brand` | String(100) | sì | | |
|
||||
| `net_weight` | Decimal(19,6) | sì | | |
|
||||
| `gross_weight` | Decimal(19,6) | sì | | |
|
||||
| `stocked` | Bool | no | `false` | |
|
||||
| `warehouse_id` | Int64 | sì | | -> `warehouses` (Restrict) |
|
||||
| `minimum_stock` | Decimal(19,6) | sì | | |
|
||||
| `reorder_point` | Decimal(19,6) | sì | | |
|
||||
| `reorder_lot` | Decimal(19,6) | sì | | |
|
||||
| `price` | Decimal(19,6) | sì | | |
|
||||
| `standard_cost` | Decimal(19,6) | sì | | |
|
||||
| `last_cost` | Decimal(19,6) | sì | | |
|
||||
| `average_cost` | Decimal(19,6) | sì | | |
|
||||
| `revenue_account_code` | String(20) | sì | | |
|
||||
| `cost_account_code` | String(20) | sì | | |
|
||||
| `notes` | Text | 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_items_barcode` su `barcode`
|
||||
- indice `ix_items_category` su `category_id`
|
||||
- indice `ix_items_description` su `description`
|
||||
- indice unico `ux_items_code` su `code`
|
||||
|
||||
#### `jobs`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
@@ -1407,6 +1541,24 @@ Migrazioni applicate in ordine:
|
||||
|
||||
- indice unico `ux_party_fiscal_party` su `party_id`
|
||||
|
||||
#### `party_item_codes`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
|---|---|---|---|---|
|
||||
| `id` | Int64 | no | | chiave primaria, identity |
|
||||
| `party_id` | Int64 | no | | -> `parties` (Cascade) |
|
||||
| `item_id` | Int64 | no | | -> `items` (Cascade) |
|
||||
| `code` | String(40) | no | | |
|
||||
| `description` | 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 `ix_party_item_codes_item` su `item_id`
|
||||
- indice unico `ux_party_item_codes_party_code` su `party_id`, `code`
|
||||
|
||||
#### `party_purchase_terms`
|
||||
|
||||
| Colonna | Tipo | Null | Default | Note |
|
||||
@@ -1536,6 +1688,7 @@ Migrazioni applicate in ordine:
|
||||
| `updated_at` | DateTimeUtc | sì | | |
|
||||
| `updated_by` | String(100) | sì | | |
|
||||
| `row_version` | Int64 | no | `1` | |
|
||||
| `is_base` | Bool | no | `false` | |
|
||||
|
||||
- indice unico `ux_price_lists_code` su `code`
|
||||
|
||||
|
||||
Reference in new issue
Block a user