Files
Khaemhat/docs/DATA-MODEL.md
T
Alby96andClaude Opus 5.5 fb12411404 feat: e-invoice services, SDI channels, inbox, polling and conservation (#74 #75 #76 #77 #79)
Adds the company tables of the electronic invoice and the services that drive them:
the builder turns an issued document into the FatturaPA model, the service generates,
checks and sends the file through the channel chosen by the routing rules (with a
fallback) and applies the SDI notifications to the e-invoice and its document. The
channel settings keep their secrets protected and out of the audit trail; a job reads
the PEC mailbox and the intermediaries every 15 minutes, storing supplier invoices in
the inbox and acknowledging a message only once all its files are kept. The inbox
registers received invoices through the purchase import, and the conservation export
packs a period with a SHA-256 index. A rejected invoice can now be corrected and
generated again; the courtesy PDF embeds the XML.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 12:20:59 +01:00

164 KiB

Modello dati

Stato: in corso · Revisione 2026-11-11 (M1) · Fonte: SPEC §5, §7, §8, §9, §11, §12, §13, §14, §21

Due parti. La sezione 8. Schema attuale è generata da scripts/gen-datamodel.sh leggendo le migrazioni: non si modifica a mano e un test fallisce se non è aggiornata. Le sezioni 3-4 sono la pianificazione ricavata dalla specifica: nomi e colonne sono indicativi e vengono confermati (o corretti) dalla migrazione che crea ciascuna tabella, milestone dopo milestone. I nomi di tabella contrassegnati con † non compaiono letteralmente in SPEC: sono derivati dal nome dell'entità di SPEC §21 secondo la convenzione snake_case plurale.

Documenti collegati: ARCHITECTURE.md · MODULES.md · API.md.


1. Convenzioni (SPEC §5.2)

1.1 Nomi e colonne comuni

  • Tabelle e colonne in snake_case. Tabelle del database di sistema con prefisso sys_.
  • Chiave primaria id BIGINT identity (su SQLite INTEGER PRIMARY KEY).
  • Colonne di audit su ogni tabella (sottintese nelle tabelle sotto): created_at, created_by, updated_at, updated_by.
  • row_version per l'optimistic locking: UPDATE … SET …, row_version = row_version + 1 WHERE id = @id AND row_version = @v; se nessuna riga è aggiornata il repository solleva ConcurrencyException (API: 409/412, vedi API.md).
  • is_demo (IDemoMarkable) sulle righe create dal seeder demo, per poterle rimuovere (SPEC §14).
  • Le chiavi esterne si chiamano <entità>_id (es. party_id, item_id, gl_account_id).
  • Nessun company_id nelle tabelle aziendali: l'isolamento è dato dal database (SPEC §1.4).

1.2 Tipi logici ColumnType e mappatura

ColumnType PostgreSQL SQLite Note
String(n) varchar(n) TEXT + CHECK (length(col) <= n) la lunghezza è imposta dal database su entrambi i motori
Text text TEXT
Int32 integer INTEGER
Int64 bigint INTEGER chiavi primarie ed esterne
Decimal(19,6) numeric(19,6) INTEGER scalato x10⁶ vedi §1.3
Bool boolean INTEGER + CHECK (col IN (0, 1))
Date date TEXT yyyy-MM-dd DateOnly in C#
DateTimeUtc timestamptz TEXT yyyy-MM-ddTHH:mm:ss.ffffffZ DateTime UTC al microsecondo su entrambi i motori; conversione a Europe/Rome solo in presentazione
Guid uuid TEXT
Bytes bytea BLOB
Json jsonb TEXT diff di audit, payload dei canali, dati di log

Le tabelle SQLite sono STRICT: un valore del tipo sbagliato è rifiutato invece di essere convertito. Le enumerazioni sono memorizzate per nome (String(40)), così un riordino dei valori in C# non altera i dati.

1.3 Decimali scalati su SQLite

SQLite non ha un tipo decimale esatto: i valori Decimal(19,6) sono memorizzati come interi moltiplicati per 10⁶ (SqliteDecimalConverter). Conseguenze per chi scrive query:

  • ISqlDialect.ToDbValue / FromDbValue convertono in scrittura e in lettura; i parametri passano già scalati;
  • l'arrotondamento al sesto decimale è half away from zero (1,2345675 diventa 1,234568), come numeric(19,6) su PostgreSQL; un valore oltre l'intervallo solleva OverflowException invece di essere troncato;
  • le somme in SQL (SUM, GROUP BY) operano sugli interi scalati e vengono riscalate in lettura: niente aritmetica in virgola mobile;
  • prodotti e divisioni fra due colonne decimali non vanno fatti in SQL su SQLite (il fattore di scala si moltiplica): si calcolano in C# con decimal o si usa un SqlFragment per dialetto;
  • intervallo utile: ±9,2 x 10¹² con 6 decimali, ampiamente sufficiente per importi e quantità di una PMI.

1.4 Mappe, query e accesso

  • Ogni entità ha una mappa XxxMap : EntityMap<Xxx> (tabella, colonne, chiave, indici, FK, conversioni); nessuna riflessione a runtime oltre la costruzione iniziale (MapRegistry).
  • Query.For<T>().Where(x => ...): uguaglianza, confronto, == null, Contains/StartsWith/EndsWith (LIKE senza distinzione di maiuscole e accenti compresi, con % e _ dell'utente protetti), lista.Contains(x.Col) (IN), &&/||/!, string.IsNullOrEmpty; il resto come SqlFragment parametrizzato. Un'espressione fuori da questo insieme solleva NotSupportedException, non viene valutata in memoria. Mai concatenare input utente in SQL: in SqlFragment.Of($"... {valore}") ogni valore interpolato diventa un parametro.
  • IRepository<T, TKey> compila le colonne di audit, imposta row_version = 1 all'inserimento e la incrementa a ogni modifica; IUnitOfWork.AcquireLockAsync(chiave) prende un lock di transazione (pg_advisory_xact_lock o il lock di scrittura di SQLite) per numeratori e chiusure.
  • SQLite: journal_mode=WAL; foreign_keys=ON; busy_timeout=5000; scritture serializzate da SqliteWriteLock.
  • PostgreSQL: pool separato per database (MaxPoolSize da impostazioni), statement_timeout per sessione, pg_advisory_xact_lock per numeratori, chiusure e scheduler.

2. Migrazioni (SPEC §5.3)

[Migration(20261013_001, "create_parties")]               // Target = MigrationTarget.Company se omesso
public sealed class M20261013_001_CreateParties : IMigration
{
    public void Up(ISchemaBuilder schema) { /* tabelle, colonne, indici, FK in forma neutra */ }
    public string? UpSql(ISqlDialect dialect) => null;     // SQL specifico del dialetto, se serve
}
Regola Dettaglio
Due cataloghi MigrationCatalog.ForSystem() (database di sistema) e MigrationCatalog.ForCompany(assembly dei moduli)
Versioni yyyymmdd_nnn (11 cifre, data valida, nnn da 001), uniche per modulo; schema_version(module, version, name, applied_at, checksum) in ogni database, checksum = SHA-256 delle istruzioni generate
Esecuzione MigrationRunner applica una migrazione per transazione sotto lock (più istanze che partono insieme non si pestano i piedi), è idempotente e restituisce un MigrationReport; la registrazione nella sezione di log Migrazioni arriva con il log (M2)
Checksum diverso una migrazione già applicata e poi modificata produce un avviso, non un errore: le migrazioni applicate non si cambiano, se ne scrive una nuova
Downgrade non supportato: se trova versioni applicate non note rifiuta di partire (MigrationException)
Avvio il sistema è migrato all'avvio; le aziende all'avvio (impostazione) o dal pannello (SPEC §12.1) in modalità manutenzione
Nuova migrazione scripts/new-migration.sh <system|company> <nome_snake_case> [cartella] [modulo]
Documentazione scripts/gen-datamodel.sh rigenera la sezione 8; --check verifica soltanto
Test obbligatorio tutte le migrazioni da zero su SQLite e PostgreSQL, schema_version coerente, riapplicazione senza effetti

3. Database di sistema (khaemhat_system)

Tabella Colonne principali Relazioni / note Entità
schema_version module, version, name, applied_at, checksum presente in ogni database —
sys_companies code, name (ragione sociale), engine, connection_string (cifrata), status (attiva/manutenzione/sola lettura/disattivata), is_default, notes registro letto da CompanyRegistry Company
sys_users username, email, level (SuperUser/Administrator), password_hash, totp_secret (cifrato), must_change_password, locked_until, disabled un solo SuperUser, non eliminabile SystemUser
sys_roles_templates code, name, permessi del modello copiati nelle aziende come roles —
sys_settings key, value, is_secret segreti cifrati con SecretProtector SystemSetting
sys_licenses licensee, instance_id, issued_at, expires_at, max_concurrent_users, max_companies, modules (Json), grace_period_days, raw licenza .khl firmata ECDSA P-256 License
sys_license_activations module_code, activation_code, activated_at, activated_by, expires_at, revoked_at storico attivazioni (mockup 080) LicenseActivation
sys_scheduled_tasks name, kind (backup/procedura/report/notifica/import-export/verifica/manutenzione), company_code, run_as, cron, time_zone, timeout, retries, parameters (Json), enabled, next_run_at definite dagli amministratori (mockup 083) ScheduledTask
sys_job_runs task_id →, started_at, ended_at, duration_ms, status, trace_id, message storico esecuzioni JobRun
sys_backup_policies scope (istanza/database), database, schedule, retention giornalieri/settimanali/mensili, targets, encrypt, verify, max_age_hours GFS BackupPolicy
sys_backup_sets database, kind (BackupKind), file_path, size, sha256, encrypted, status (BackupStatus), verified_at, copie remote BackupSet
sys_log at, level, section, source, message, exception, user, company, trace_id, request, entity, entity_id, data (Json) tabella grande; indici per data e sezione LogEntry
sys_security_audit at, actor, action, target, company, ip, data (Json) immutabile: login, permessi, licenze, backup, ripristini, database, manutenzione SecurityAuditEntry
sys_data_protection_keys friendly_name, xml chiavi DataProtection dei cookie DataProtectionKey
sys_api_keys prefix, key_hash (SHA-256), name, permissions, companies, expires_at, allowed_ips, last_used_at chiavi di istanza —
sys_notifications recipient →, kind, title, body, link, read_at notifiche agli amministratori SystemNotification
sys_sessions user_id →, token_hash, device, ip, created_at, last_seen_at, expires_at, revoked_at sessioni degli account di istanza SystemSession
sys_login_attempts † at, username, ip, success, reason rate limiting e blocco LoginAttempt

4. Database aziendale (khaemhat_<codice>)

4.1 Utenti, sicurezza e infrastruttura aziendale (CORE)

Tabella Colonne principali Relazioni / note Entità
company_profile riga singola: ragione sociale, denominazione fiscale, P.IVA, codice fiscale, REA, capitale sociale, socio unico, stato liquidazione, indirizzo, contatti, PEC, tax_regime (RF01…RF19), codice destinatario, IBAN predefinito, valuta, country (IT), periodicità IVA, pro-rata %, IVA per cassa, trasmittente/intermediario, note in calce logo come allegato; country sceglie il pacchetto fiscale CompanyProfile
users username, email, kind (Human/Technical), password_hash, totp_secret, flag (solo propri clienti, vede costi e margini, può esportare, può usare le API), expires_at, disabled User
roles code, name, is_template_copy copiati da sys_roles_templates, clonabili Role
role_permissions role_id →, permission codici modulo.entità.azione RolePermission
user_roles user_id →, role_id → UserRole
user_permission_overrides user_id →, permission, granted override per utente UserPermissionOverride
user_sessions user_id →, token_hash, device, ip, last_seen_at, expires_at, revoked_at UserSession
user_settings user_id →, key, value (Json) tema, accento, densità, menu, pagina iniziale, layout griglie, filtri UserSetting
dashboard_layouts † user_id → oppure role_id →, layout (Json) layout predefinito per ruolo DashboardLayout
api_keys prefix, key_hash, user_id → (utente tecnico), permissions, expires_at, allowed_ips, last_used_at ApiKey
notifications user_id →, kind, title, body, link, read_at Notification
attachments entity, entity_id, kind (uploaded/generated/einvoice/notification), file_name, mime, size, sha256, version, generated_by, user_id, at, locked, storage_path un allegato appartiene a un solo documento; cestino 30 giorni Attachment
audit_log entity, entity_id, action, user, at, diff (Json) tabella grande AuditEntry
settings key, value preferenze azienda e versione del pacchetto dati (IT 2026.2) —
code_rules † entity, mask, scope (globale/categoria/anno), allow_manual codici automatici (mockup 074) CodeRule
code_sequences rule_id →, scope_key, last_value assegnazione atomica CodeSequence

4.2 Azienda e tabelle di base (Company, CORE)

Tabella Colonne principali Relazioni / note
fiscal_years start_date, end_date, status (aperto/in chiusura/chiuso), prima pagina libro giornale, ultima registrazione definitiva
fiscal_periods fiscal_year_id →, start_date, end_date, kind (mese/trimestre), status (aperto/liquidato/bloccato) date ammesse solo in periodi aperti
countries codice ISO 3166-1, nome, is_eu, codice SDI (XXXXXXX per l'estero)
provinces sigla, nome, regione
municipalities nome, province_id →, CAP, codice catastale codice fiscale, compilazione da CAP
currencies, exchange_rates codice, decimali; currency_id →, data, cambio (BCE)
units_of_measure codice, descrizione, codice SDI
tax_codes codice, descrizione, aliquota, nature (N1…N7 con sotto-codici), riferimento normativo, esigibilità I/D/S, tipo, indetraibilità %, conti IVA →, validità mockup 076
payment_methods codice, descrizione, codice SDI MP01…MP23
payment_terms (+ payment_term_lines †) codice, descrizione, TP01/02/03; righe: rata, giorni, fine mese, giorno fisso, %, IVA sulla prima rata
bank_accounts IBAN, BIC, gl_account_id →, SIA/CUC
salespeople nome, provvigione, ENASARCO
carriers, shipping_terms, transport_means, goods_appearances, delivery_terms, transport_reasons codice, descrizione (Incoterms per delivery_terms)
document_numerators tipo, sezionale, anno, formato {prefix}/{anno}/{number:D6}, ultimo numero assegnazione atomica alla conferma; nessun buco per fatture, NC e registrazioni definitive
inventory_reasons codice, descrizione, effetti su giacenza/impegnato/ordinato
warehouses codice, descrizione, indirizzo
item_categories codice, descrizione, parent_id → (3 livelli)
party_categories codice, descrizione
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

4.3 Anagrafiche (Parties, CORE)

Tabella Colonne principali Relazioni / note
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 → (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, 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)

Ogni famiglia di documenti ha testata + _lines + _tax_summary + _installments (SPEC §11.3).

Tabella Contenuto Note
sale_quotations (+ _lines, sale_quotation_revisions †) preventivi/offerte con revisioni collegamento CRM
sale_orders (+ _lines, …) ordini clienti consegne, impegnato, CIG/CUP
sale_documents (+ _lines, _tax_summary, _installments) DDT, fatture (TD01…TD27), NC/ND, pro-forma, parcelle, autofatture
purchase_orders (+ _lines, …) ordini fornitori
purchase_documents (+ _lines, _tax_summary, _installments) DDT di carico, fatture di acquisto, NC fornitore, autofatture TD16-TD29 protocollo IVA
inventory_documents (+ _lines) documenti di magazzino
document_links riga destinazione → riga sorgente, quantità evasione ordine → DDT → fattura; residui

Testata (colonne principali comuni): tipo, sezionale, numero, data, anno, party_id →, destinazione →, riferimenti, valuta/cambio, listino →, pagamento →, metodo, banca →, agente →, deposito →, causale, status, flag (stampato, inviato, contabilizzato, scadenze generate, XML generato), totali (imponibile, imposta, totale, sconto piede, spese, bollo, ritenuta, cassa, netto), note, trasporto, is_demo, gl_entry_id →, protocollo IVA.

Righe: progressivo, tipo riga (LineType), item_id →, descrizione, UM, quantità, prezzo, sconti, formula sconto, tax_code_id →, imponibile, deposito →, consegna, evasa/residua, riga origine →, conto →, centro di costo →, commessa →, note, ordinamento.

Stati (DocumentStatus, EInvoiceStatus): Draft → Confirmed → (PartiallyFulfilled | Fulfilled) → Closed, Cancelled; fatture Draft → Issued → SdiGenerated → SdiSent → (SdiDelivered | SdiRejected | SdiNotDelivered).

4.6 Magazzino (Inventory, CORE)

Tabella Colonne principali Note
inventory_entries data, causale →, documento origine, deposito →, is_demo
inventory_entry_lines entry_id →, item_id →, deposito →, quantità, valore, effetti tabella grande
item_balances item_id →, warehouse_id →, giacenza (OnHand), impegnato (Committed), ordinato (OnOrder), in transito, valore medio aggiornata transazionalmente; disponibilità = giacenza - impegnato
stock_takes † (+ stock_take_lines †) inventario fisico: liste, conteggi, rettifiche mockup 038

4.7 Contabilità e IVA (Ledger, Vat, ACCT; Assets, ASSET; Intrastat, INTRA)

Tabella Colonne principali Note
gl_accounts codice MM.CC.SSS, descrizione, natura (AccountNature), tipo (AccountKind), parent_id →, voce CEE (art. 2424/2425), voce riclassificata, partitario clienti/fornitori, rilevante IVA, chiusura automatica, movimentabile, attivo piano standard PMI precaricato
gl_journal_templates (+ righe †) causale: codice, descrizione; righe con ruolo, dare/avere, registro IVA, genera partita causali di base FV, NCV, FA, …
gl_entries numero per esercizio, data registrazione, competenza, causale →, descrizione, documento origine, registro IVA → e protocollo, status (provvisoria/definitiva), periodo →, fonte, storno di → definitive immutabili
gl_entry_lines entry_id →, gl_account_id →, dare, avere, controparte →, centro di costo →, commessa →, partita →, valuta tabella grande
gl_entry_vat entry_id →, codice IVA →, imponibile, imposta, indetraibile
recurring_entry_templates † modelli di registrazione ricorrente
vat_registers tipo (vendite, acquisti, corrispettivi, vendite RC, acquisti RC, sezionali), codice, ultimo protocollo
vat_settlements (+ righe †) periodo, debito, credito, differita/per cassa, indetraibile, pro-rata, credito precedente, acconto, interessi, importo da versare, stato conferma che blocca il periodo
stamp_duty_entries † documento, importo, trimestre, addebito, versato mockup 060
withholding_taxes †, social_security_charges † ritenute operate/subite, casse previdenziali, ENASARCO mockup 047
fixed_asset_categories †, fixed_assets †, fixed_asset_movements † categorie con coefficienti, beni, acquisti/ammortamenti/dismissioni mockup 048
intrastat_declarations † (+ righe †) periodo, tipo (cessioni/acquisti, bis-quater), righe con NC8, natura transazione, consegna, trasporto mockup 049
accrual_deferrals † ratei e risconti
closing_runs † (+ closing_run_steps †) passi della chiusura esercizio mockup 050
financial_statement_lines † voci di bilancio CEE e riclassificati mockup 051

4.8 Scadenzario e tesoreria (Finance, FIN)

Tabella Colonne principali Note
open_items controparte →, documento, rata, scadenza, importo, pagato, residuo, metodo →, banca →, status (aperta/parziale/chiusa/insoluta/in distinta/contestata), registrazione →
payments (+ payment_lines †) incassi e pagamenti con righe su partite, abbuoni, differenze cambio, spese, storno registrazione automatica
remittances † (+ righe †) distinte RiBa, SDD, bonifici SEPA
sdd_mandates † mandati SDD core/B2B
bank_statements † (+ righe †), bank_match_rules † estratti conto importati, regole di abbinamento mockup 057
dunning_levels †, dunning_runs † (+ righe †) livelli 1-3, esecuzioni di sollecito mockup 056

4.9 Fatturazione elettronica (EInvoicing, EINV)

Tabella Colonne principali Note
e_invoices † documento →, direzione, nome file IT<PIVA>_<progressivo>.xml, formato (FPR12/FPA12/FSM10), stato, canale →, identificativo SDI XML come allegato locked
sdi_notifications † e_invoice_id →, tipo (RC, NS, MC, NE, DT, AT), data, esito, errori
e_invoice_inbox_files † file ricevuti (XML/P7M), stato di importazione inbox /data/inbox/sdi/<azienda>
sdi_channels † tipo (SdiChannelKind: Pec, SdiCoop, IntermediaryA, IntermediaryB), credenziali cifrate, stato mockup 059
sdi_routing_rules † condizione, canale →
conservation_packages † periodo, file, indice export per conservatore

4.10 CRM (Crm, CRM)

Tabella Colonne principali
crm_leads fonte, interesse, punteggio, responsabile, stato, conversione in cliente (party_id →)
crm_pipelines, crm_stages pipeline; fasi con ordine e probabilità
crm_opportunities fase →, probabilità, valore, ponderato, chiusura, responsabile, fonte, concorrenti, motivo perdita, preventivo →, ordine →
crm_activities tipo (chiamata/e-mail/riunione/attività/nota/visita), scadenza, esito, promemoria, collegamenti
crm_campaigns (+ membri †) tipo, segmento →, modello →, budget, costo, statistiche
crm_tickets priorità, stato, SLA, assegnatario, intervento → (Servizi), NC →
crm_email_templates, crm_segments modelli e-mail, segmenti

4.11 Servizi e canali (Services, SVC; Channels, CHAN)

Tabella Colonne principali
service_contracts † (+ righe †) cliente →, sede →, validità, rinnovo tacito, canone e periodicità, servizi inclusi, impianti e matricole
service_teams †, service_technicians † squadre, tecnici con costo orario
service_interventions † (+ righe †) tipo (programmato/a chiamata/garanzia), stato, pianificazione, ore e materiali, rapportino, firma
sales_channels tipo (generico o connettore dedicato), credenziali cifrate, cliente cassa →, sezionale, pagamento →, deposito →, mappature
channel_items, channel_customers corrispondenze articoli e clienti
channel_orders payload (Json), stato, ordine generato →

4.12 Automazioni (Automation, AUTO; Integrazioni, API)

Tabella Colonne principali
automation_rules † evento (AutomationTrigger), condizioni (Json), azioni (Json, AutomationActionKind), attiva, errori consecutivi
automation_runs † regola →, at, esito, trace id, messaggio
webhooks † URL, eventi, segreto HMAC (cifrato), attivo

5. Relazioni principali

parties ─┬─< party_addresses / party_contacts / party_bank_accounts
         ├── party_sales_terms / party_purchase_terms / party_fiscal
         ├─< sale_* / purchase_* (testate) ─< *_lines >── items
         │                                    └─< document_links (riga → riga)
         ├─< open_items >── payments (righe)
         └─< crm_leads (conversione) / crm_opportunities

sale_documents ──► gl_entries ─< gl_entry_lines >── gl_accounts
                       └─< gl_entry_vat >── tax_codes
inventory_entries ─< inventory_entry_lines ──► item_balances (item x warehouse)
qualunque documento ─< attachments (entity, entity_id)
qualunque modifica ──► audit_log

6. Tabelle grandi e partizionamento

Tabella Database Indici previsti
gl_entry_lines azienda esercizio/data, conto, partita
inventory_entry_lines azienda data, articolo x deposito
audit_log azienda entity/entity_id, data
sys_log sistema data, sezione, livello, trace_id, azienda
  • Su PostgreSQL il SchemaBuilder (PostgresPartitioning) predispone il partizionamento per anno, attivabile con una migrazione quando la tabella supera i 50 milioni di righe.
  • Su SQLite non c'è partizionamento: SQLite è previsto per test, demo, prova e archivi in sola lettura.
  • La retention di sys_log per livello (365/180/90/7 giorni) e la compattazione limitano la crescita del log.
  • Obiettivi di prestazione di riferimento (SPEC §18): bilancio di verifica su 2 M righe < 10 s, pagina log con 1 M righe < 1 s per filtro.

6.1 Misure di riferimento dello strato dati (M1)

PerformanceBaselineTests inserisce righe con tutti i tipi di colonna tramite IRepository in una sola transazione, poi le legge tutte e legge una pagina filtrata con il conteggio totale. Con KHAEMHAT_PERF=1 usa 100.000 righe, altrimenti 2.000 (prova di fumo, sempre eseguita anche in CI).

KHAEMHAT_PERF=1 scripts/test.sh --filter TestCategory=Performance --logger "console;verbosity=detailed"
Data Motore Macchina Inserimenti Lettura di tutte le righe Pagina filtrata + conteggio
2026-11-11 SQLite (file in memoria) Ryzen 5 2600X, Windows 11, .NET 10.0.403 100.000 in 5,6 s (circa 17.800/s) 0,9 s 17 ms

Le misure servono a riconoscere un peggioramento, non come soglia: il test non fallisce sui tempi. Le misure su PostgreSQL si aggiungono dal job postgres della CI alla chiusura della milestone.

7. Segreti nel database

Cifrati con AES-256-GCM e chiave derivata da KHAEMHAT_SECRET_KEY (SecretProtector): connection string delle aziende (sys_companies), password SMTP/PEC/S3/WebDAV (sys_settings), token degli intermediari e credenziali dei canali SDI (sdi_channels), credenziali dei canali e-commerce (sales_channels), segreti dei webhook. La rotazione avviene con KHAEMHAT_SECRET_KEY_NEW (SPEC §12.9). Gli hash (password, chiavi API) non sono cifrati ma irreversibili.

8. Schema attuale (generato)

Questa sezione è scritta da scripts/gen-datamodel.sh a partire dalle migrazioni presenti nel codice; il test DataModelDocumentTests fallisce se non è aggiornata. Comprende schema_version, presente in ogni database.

Database di sistema

Migrazioni applicate in ordine:

  • core 20261111001 create_sys_companies (M20261111_001_CreateSysCompanies)
  • core 20261111002 create_sys_settings (M20261111_002_CreateSysSettings)
  • core 20261111003 create_sys_users (M20261111_003_CreateSysUsers)
  • core 20261111004 create_sys_sessions (M20261111_004_CreateSysSessions)
  • core 20261111005 create_sys_roles_templates (M20261111_005_CreateSysRolesTemplates)
  • core 20261111006 create_sys_licenses (M20261111_006_CreateSysLicenses)
  • core 20261111007 create_sys_data_protection_keys (M20261111_007_CreateSysDataProtectionKeys)
  • core 20261111008 create_sys_log (M20261111_008_CreateSysLog)
  • core 20261111009 create_sys_security_audit (M20261111_009_CreateSysSecurityAudit)
  • core 20261111010 create_sys_scheduler (M20261111_010_CreateSysScheduler)
  • core 20261111011 create_sys_notifications (M20261111_011_CreateSysNotifications)
  • core 20261111012 create_sys_user_settings (M20261111_012_CreateSysUserSettings)
  • core 20261111013 create_sys_notification_reads (M20261111_013_CreateSysNotificationReads)

schema_version

Colonna Tipo Null Default Note
module String(50) no chiave primaria
version Int64 no chiave primaria
name String(200) no
applied_at DateTimeUtc no
checksum String(64) no

Chiave primaria: module, version.

sys_companies

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(20) no
name String(200) no
engine String(20) no
connection_string Text no
status String(40) no 'Active'
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 unico ux_sys_companies_code su code

sys_data_protection_keys

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
friendly_name String(200) no
xml Text 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 unico ux_sys_data_protection_keys_friendly_name su friendly_name

sys_job_locks

Colonna Tipo Null Default Note
id String(100) no chiave primaria
owner String(100) no
acquired_at DateTimeUtc no
expires_at DateTimeUtc no

sys_job_runs

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
task_code String(100) no
started_at DateTimeUtc no
finished_at DateTimeUtc sì
outcome String(40) no
attempt Int32 no 1
message Text sì
trace_id String(64) sì
  • indice ix_sys_job_runs_task_code_started_at su task_code, started_at

sys_license_activations

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
action String(40) no
source String(40) no
modules String(400) sì
outcome String(60) no
message 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

sys_licenses

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
source String(40) no
payload Text no
licensee String(200) sì
modules String(400) no
max_concurrent_users Int32 no 0
max_companies Int32 no 0
issued_at DateTimeUtc sì
expires_at DateTimeUtc sì
grace_period_days Int32 no 0
is_active Bool no true
created_at DateTimeUtc no
created_by String(100) sì
updated_at DateTimeUtc sì
updated_by String(100) sì
row_version Int64 no 1

sys_log

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
at DateTimeUtc no
level String(20) no
section String(40) no
source String(200) no
message Text no
exception Text sì
user_name String(100) sì
company_code String(20) sì
trace_id String(64) sì
request String(400) sì
entity String(100) sì
entity_id String(100) sì
data Json sì
  • indice ix_sys_log_at su at
  • indice ix_sys_log_section_at su section, at
  • indice ix_sys_log_trace_id su trace_id

sys_notification_reads

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
notification_id Int64 no
user_id Int64 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_sys_notification_reads_user_id su user_id
  • indice unico ux_sys_notification_reads_notification_user su notification_id, user_id

sys_notifications

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
recipient_user_id Int64 sì
category String(40) no
severity String(40) no
title String(200) no
body Text sì
link String(400) sì
read_at DateTimeUtc 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_sys_notifications_recipient_user_id su recipient_user_id

sys_roles_templates

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(50) no
name String(100) no
description Text sì
permissions Json no
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 unico ux_sys_roles_templates_code su code

sys_scheduled_tasks

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(100) no
name String(200) no
job_type String(100) no
company_code String(20) sì
cron String(100) no
time_zone String(64) no
timeout_seconds Int32 no 600
max_retries Int32 no 0
is_enabled Bool no true
is_system Bool no false
parameters Json sì
last_run_at DateTimeUtc sì
next_run_at DateTimeUtc sì
last_outcome 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_sys_scheduled_tasks_code su code

sys_security_audit

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
at DateTimeUtc no
action String(100) no
user_name String(100) sì
company_code String(20) sì
ip_address String(64) sì
target String(200) sì
details Json sì
previous_hash String(64) no
hash String(64) no
  • indice ix_sys_security_audit_at su at

sys_sessions

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
token_hash String(64) no
user_id Int64 no -> sys_users (Cascade)
state String(40) no
company_code String(20) sì
ip_address String(64) sì
user_agent String(400) sì
persistent Bool no false
last_seen_at DateTimeUtc no
expires_at DateTimeUtc no
revoked_at DateTimeUtc sì
revoked_reason 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_sys_sessions_user_id su user_id
  • indice unico ux_sys_sessions_token_hash su token_hash

sys_settings

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
key String(200) no
value Text sì
is_secret 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_sys_settings_key su key

sys_user_settings

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
user_id Int64 no
key String(200) no
value 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 unico ux_sys_user_settings_user_id_key su user_id, key

sys_users

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
user_name String(100) no
display_name String(200) no
email String(254) sì
level String(40) no
password_hash String(200) sì
password_history Json sì
password_changed_at DateTimeUtc sì
must_change_password Bool no false
temporary_password_expires_at DateTimeUtc sì
failed_login_count Int32 no 0
locked_until DateTimeUtc sì
totp_secret Text sì
totp_enabled Bool no false
totp_last_step Int64 sì
totp_recovery_codes Json sì
recovery_token_hash String(64) sì
recovery_token_expires_at DateTimeUtc sì
is_active Bool no true
last_login_at DateTimeUtc sì
linked_company_code String(20) sì
linked_user_id Int64 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_sys_users_user_name su user_name

Database aziendale

Migrazioni applicate in ordine:

  • core 20261111001 create_users (M20261111_001_CreateUsers)
  • core 20261111002 create_user_sessions (M20261111_002_CreateUserSessions)
  • core 20261111003 create_roles (M20261111_003_CreateRoles)
  • core 20261111004 create_audit_log (M20261111_004_CreateAuditLog)
  • core 20261111005 create_notifications (M20261111_005_CreateNotifications)
  • core 20261111006 create_user_settings (M20261111_006_CreateUserSettings)
  • core 20261111007 create_attachments (M20261111_007_CreateAttachments)
  • core 20261111008 create_company_settings (M20261111_008_CreateCompanySettings)
  • core 20261111009 create_notification_reads (M20261111_009_CreateNotificationReads)
  • core 20261111010 create_company_profile (M20261111_010_CreateCompanyProfile)
  • core 20261111011 create_geography_and_currencies (M20261111_011_CreateGeographyAndCurrencies)
  • core 20261111012 create_tax_and_payment_tables (M20261111_012_CreateTaxAndPaymentTables)
  • 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)
  • core 20261112002 create_items (M20261112_002_CreateItems)
  • core 20261112003 create_documents (M20261112_003_CreateDocuments)
  • core 20261113001 create_inventory (M20261113_001_CreateInventory)
  • core 20261113002 create_ledger (M20261113_002_CreateLedger)
  • core 20261113003 create_treasury (M20261113_003_CreateTreasury)
  • core 20261113004 create_einvoicing (M20261113_004_CreateEInvoicing)

attachments

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
entity String(100) no
entity_id Int64 no
kind String(40) no
name String(255) no
mime String(150) no
size Int64 no
sha256 String(64) no
version Int32 no
version_key String(300) no
generated_by String(100) sì
storage_key String(60) no
user_name String(100) sì
locked Bool no false
deleted_at DateTimeUtc 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_attachments_deleted_at su deleted_at
  • indice ix_attachments_entity_entity_id su entity, entity_id
  • indice unico ux_attachments_entity_entity_id_version_key_version su entity, entity_id, version_key, version

audit_log

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
at DateTimeUtc no
entity String(100) no
entity_id String(100) no
action String(20) no
user_name String(100) sì
diff Json sì
trace_id String(64) sì
  • indice ix_audit_log_at su at
  • indice ix_audit_log_entity_entity_id su entity, entity_id

bank_accounts

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(10) no
description String(100) no
disabled Bool no false
bank_name String(100) sì
iban String(34) sì
bic String(11) sì
sia_code String(5) sì
cuc_code String(8) sì
account_code String(20) sì
is_default 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
creditor_id String(35) sì
  • indice unico ux_bank_accounts_code su code

bank_match_rules

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
name String(100) no
pattern String(100) no
direction String(40) no
account_id Int64 no -> gl_accounts (Restrict)
template_code String(10) sì
entry_description String(200) sì
disabled Bool no false
uses Int32 no 0
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

bank_statement_lines

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
statement_id Int64 no -> bank_statements (Cascade)
bank_account_id Int64 no
booking_date Date no
value_date Date sì
amount Decimal(19,6) no 0
description String(500) no
reference String(60) sì
counterparty_name String(140) sì
counterparty_iban String(34) sì
bank_code String(40) sì
fingerprint String(64) no
status String(40) no
match_kind String(40) no
confidence Int32 no 0
proposal String(300) sì
targets String(300) sì
party_id Int64 sì
rule_id Int64 sì
payment_id Int64 sì
gl_entry_id Int64 sì
matched_at DateTimeUtc sì
matched_by String(100) 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_bank_statement_lines_date su bank_account_id, booking_date
  • indice ix_bank_statement_lines_statement su statement_id
  • indice unico ux_bank_statement_lines_fingerprint su bank_account_id, fingerprint

bank_statements

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
bank_account_id Int64 no -> bank_accounts (Restrict)
format String(40) no
file_name String(200) sì
from_date Date no
to_date Date no
opening_balance Decimal(19,6) sì
closing_balance Decimal(19,6) sì
movement_count Int32 no 0
attachment_id Int64 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_bank_statements_account su bank_account_id, to_date

carriers

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(10) no
description String(100) no
disabled Bool no false
vat_number String(28) sì
address String(200) sì
city String(100) sì
phone String(30) sì
email String(254) sì
register_number String(30) 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 unico ux_carriers_code su code

code_sequences

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
key String(100) no
last_value Int64 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 unico ux_code_sequences_key su key

company_profile

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
legal_name String(200) no
fiscal_name String(200) sì
vat_number String(28) sì
tax_code String(16) sì
rea_office String(2) sì
rea_number String(20) sì
share_capital Decimal(19,6) sì
shareholders String(2) sì
liquidation_status String(2) sì
address String(200) sì
street_number String(8) sì
postal_code String(10) sì
city String(100) sì
province_code String(2) sì
address_country String(2) sì
phone String(30) sì
email String(254) sì
pec String(254) sì
website String(200) sì
tax_regime String(4) no
recipient_code String(7) sì
logo_attachment_id Int64 sì
default_bank_account_id Int64 sì
currency_code String(3) no
country String(2) no
vat_periodicity String(40) no
pro_rata_percent Decimal(19,6) no
cash_vat Bool no false
fiscal_year_start_month Int32 no
transmitter_country String(2) sì
transmitter_id String(28) sì
intermediary_name String(200) sì
intermediary_tax_code String(16) sì
footer_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

company_settings

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
key String(200) no
value 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 unico ux_company_settings_key su key

cost_centers

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(20) no
description String(100) no
disabled Bool no false
parent_id Int64 sì -> cost_centers (Restrict)
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 unico ux_cost_centers_code su code

countries

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(2) no
description String(100) no
disabled Bool no false
iso3 String(3) sì
eu_member Bool no false
vat_prefix String(2) sì
currency_code String(3) 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 unico ux_countries_code su code

currencies

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(3) no
description String(100) no
disabled Bool no false
symbol String(5) sì
decimals Int32 no
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 unico ux_currencies_code su code

delivery_terms

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(10) no
description String(100) no
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 unico ux_delivery_terms_code su code

discount_policies

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(10) no
description String(100) no
disabled Bool no false
formula String(60) no
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 unico ux_discount_policies_code su code

document_installments

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
family String(40) no
document_id Int64 no
number Int32 no
due_date Date no
amount Decimal(19,6) no
payment_method_id Int64 sì -> payment_methods (Restrict)
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_installments_document su family, document_id
  • indice ix_document_installments_due su due_date
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
id Int64 no chiave primaria, identity
code String(10) no
description String(100) no
disabled Bool no false
kind String(40) no
section String(10) sì
year Int32 no
prefix String(10) sì
format String(60) no
last_number Int64 no
gaps_allowed 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
last_date Date sì
  • indice unico ux_document_numerators_code_year su code, year

document_tax_summaries

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
family String(40) no
document_id Int64 no
tax_code_id Int64 sì -> tax_codes (Restrict)
rate Decimal(19,6) no
nature String(10) sì
exigibility String(40) no
non_deductible_percent Decimal(19,6) no 0
legal_reference String(100) sì
taxable Decimal(19,6) no
tax Decimal(19,6) no
non_deductible_tax Decimal(19,6) 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_document_tax_summaries_document su family, document_id

document_types

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(10) no
description String(100) no
disabled Bool no false
kind String(40) no
numerator_id Int64 sì
inventory_reason_id Int64 sì -> inventory_reasons (Restrict)
e_invoice_type String(4) sì
journal_template_code String(10) sì
vat_register_code String(10) sì
print_template String(60) 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
document_kind String(40) sì
  • indice unico ux_document_types_code su code

dunning_letters

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
party_id Int64 no -> parties (Restrict)
level Int32 no
sent_on Date no
channel String(60) no
recipients String(300) sì
subject String(200) no
item_count Int32 no 0
overdue_amount Decimal(19,6) no 0
interest Decimal(19,6) no 0
status String(40) no
attachment_id Int64 sì
mail_id Int64 sì
sent_by String(100) 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_dunning_letters_party su party_id, sent_on

dunning_levels

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
level Int32 no
days_after_due Int32 no
name String(100) no
subject String(200) no
body Text no
channel String(60) no
charge_interest Bool no false
action String(40) no
automatic 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_dunning_levels_level su level

e_invoice_channels

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(20) no
enabled Bool no false
paused Bool no false
mailbox String(254) sì
smtp_host String(200) sì
smtp_port Int32 no 465
imap_host String(200) sì
imap_port Int32 no 993
tls Bool no true
user_name String(254) sì
protected_password Text sì
exchange_address String(254) sì
archive_folder String(100) sì
endpoint String(300) sì
protected_certificate Text sì
protected_certificate_password Text sì
protected_api_key Text sì
test_environment Bool no false
last_check_at DateTimeUtc sì
last_check_ok Bool sì
last_check_message String(1000) sì
last_poll_at DateTimeUtc sì
last_poll_message String(1000) sì
last_poll_failed 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 unico ux_e_invoice_channels_code su code

e_invoice_conservation

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
from_date Date no
to_date Date no
file_count Int32 no 0
file_name String(100) no
hash String(64) no
size Int64 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

e_invoice_inbox

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
file_name String(100) no
hash String(64) no
content Bytes no
metadata_file_name String(100) sì
metadata Bytes sì
exchange_id String(40) sì
received_at DateTimeUtc no
channel_code String(20) sì
supplier_vat String(30) sì
supplier_name String(200) sì
document_type String(10) sì
number String(40) sì
document_date Date sì
total_amount Decimal(19,6) sì
party_id Int64 sì
status String(40) no
purchase_document_id Int64 sì
error String(500) 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_e_invoice_inbox_file su file_name
  • indice ix_e_invoice_inbox_status su status, received_at
  • indice unico ux_e_invoice_inbox_hash su hash

e_invoice_notifications

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
e_invoice_id Int64 sì -> e_invoices (Cascade)
code String(4) no
file_name String(100) no
invoice_file_name String(100) sì
exchange_id String(40) sì
received_at DateTimeUtc no
outcome String(10) sì
description String(1000) sì
errors Text sì
channel_code String(20) sì
content Bytes no
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_e_invoice_notifications_invoice su e_invoice_id
  • indice unico ux_e_invoice_notifications_file su file_name

e_invoice_routing

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
position Int32 no 0
condition String(40) no
value String(40) sì
channel_code String(20) no
fallback_channel_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

e_invoices

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
family String(40) no
document_id Int64 no
kind String(40) no
document_number String(40) sì
document_date Date no
party_id Int64 sì
document_type String(10) no
file_name String(60) no
progressive Int64 no
format String(10) no
recipient_code String(7) sì
recipient_pec String(254) sì
total_amount Decimal(19,6) no 0
status String(40) no
channel_code String(20) sì
exchange_id String(40) sì
message_id String(200) sì
generated_at DateTimeUtc no
sent_at DateTimeUtc sì
last_notification_at DateTimeUtc sì
last_message String(1000) sì
send_attempts Int32 no 0
content Bytes no
superseded 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_e_invoices_document su family, document_id
  • indice ix_e_invoices_exchange su exchange_id
  • indice ix_e_invoices_status su superseded, status
  • indice unico ux_e_invoices_file su file_name

exchange_rates

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
currency_code String(3) no
rate_date Date no
rate Decimal(19,6) no
source String(10) 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 unico ux_exchange_rates_currency_code_rate_date su currency_code, rate_date

fiscal_periods

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
fiscal_year_id Int64 no -> fiscal_years (Cascade)
number Int32 no
start_date Date no
end_date Date no
status String(40) 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_fiscal_periods_start_date su start_date
  • indice unico ux_fiscal_periods_fiscal_year_id_number su fiscal_year_id, number

fiscal_years

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(10) no
start_date Date no
end_date Date no
status String(40) no
journal_first_page Int32 no
last_final_entry_number Int64 no
last_final_entry_date 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 unico ux_fiscal_years_code su code
  • indice unico ux_fiscal_years_start_date su start_date

gl_accounts

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(20) no
description String(100) no
disabled Bool no false
level Int32 no 1
parent_id Int64 sì -> gl_accounts (Restrict)
nature String(40) no
type String(40) no
statement_line String(20) sì
reclassification String(20) sì
sub_ledger Bool no false
vat_relevant Bool no false
closes_automatically Bool no true
postable 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_gl_accounts_parent su parent_id
  • indice unico ux_gl_accounts_code su code

gl_entries

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
year Int32 no
number Int64 sì
entry_number String(20) sì
journal_number Int64 sì
entry_date Date no
competence_date Date sì
journal_template_id Int64 sì -> gl_journal_templates (Restrict)
template_code String(10) sì
description String(200) no
status String(40) no
source String(40) no
source_family String(40) sì
source_document_id Int64 sì
source_kind String(40) sì
document_number String(30) sì
document_date Date sì
party_id Int64 sì -> parties (Restrict)
vat_register_id Int64 sì -> vat_registers (Restrict)
vat_protocol Int64 sì
vat_date Date sì
reversal_of_id Int64 sì
reversed_by_id Int64 sì
total_debit Decimal(19,6) no 0
total_credit Decimal(19,6) no 0
finalized_at DateTimeUtc sì
finalized_by String(100) sì
notes String(500) 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_gl_entries_date su entry_date, number
  • indice ix_gl_entries_register su vat_register_id, vat_date
  • indice ix_gl_entries_source su source_family, source_document_id
  • indice ix_gl_entries_status su status, entry_date
  • indice unico ux_gl_entries_number su year, number

gl_entry_lines

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
entry_id Int64 no -> gl_entries (Cascade)
line_number Int32 no
entry_date Date no
status String(40) no
account_id Int64 no -> gl_accounts (Restrict)
party_id Int64 sì -> parties (Restrict)
description String(200) sì
debit Decimal(19,6) no 0
credit Decimal(19,6) no 0
cost_center_id Int64 sì
job_id Int64 sì
open_item_id Int64 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_gl_entry_lines_account su account_id, entry_date
  • indice ix_gl_entry_lines_cost_center su cost_center_id, entry_date
  • indice ix_gl_entry_lines_entry su entry_id
  • indice ix_gl_entry_lines_party su party_id, account_id, entry_date

gl_entry_vat

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
entry_id Int64 no -> gl_entries (Cascade)
line_number Int32 no
vat_register_id Int64 no -> vat_registers (Restrict)
register_kind String(40) no
vat_date Date no
status String(40) no
tax_code_id Int64 sì
rate Decimal(19,6) no 0
nature String(10) sì
exigibility String(40) no
taxable Decimal(19,6) no 0
tax Decimal(19,6) no 0
non_deductible_tax Decimal(19,6) 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_gl_entry_vat_entry su entry_id
  • indice ix_gl_entry_vat_register su vat_register_id, vat_date

gl_journal_template_lines

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
journal_template_id Int64 no -> gl_journal_templates (Cascade)
sort_order Int32 no 0
role String(40) no
side String(40) no
account_id Int64 sì -> gl_accounts (Restrict)
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_gl_journal_template_lines_template su journal_template_id

gl_journal_templates

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(10) no
description String(100) no
disabled Bool no false
area String(40) no
vat_register_code String(10) sì
opens_items Bool no false
reverses 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 unico ux_gl_journal_templates_code su code

gl_open_items

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
direction String(40) no
party_id Int64 no -> parties (Restrict)
account_id Int64 no -> gl_accounts (Restrict)
entry_id Int64 no -> gl_entries (Cascade)
source_family String(40) sì
source_document_id Int64 sì
document_number String(30) sì
document_date Date no
installment Int32 no 1
due_date Date no
amount Decimal(19,6) no 0
paid_amount Decimal(19,6) no 0
payment_method_id Int64 sì
closed 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
status String(40) no 'Open'
disputed Bool no false
bank_account_id Int64 sì
remittance_id Int64 sì
unpaid_count Int32 no 0
parent_id Int64 sì
dunning_level Int32 no 0
last_dunning_date Date sì
notes String(200) sì
  • indice ix_gl_open_items_due su closed, due_date
  • indice ix_gl_open_items_entry su entry_id
  • indice ix_gl_open_items_party su party_id, closed, due_date
  • indice ix_gl_open_items_schedule su direction, status, due_date

gl_recurring_entries

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
description String(200) no
model_entry_id Int64 no -> gl_entries (Restrict)
frequency String(40) no
next_date Date no
end_date Date sì
last_entry_id Int64 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_gl_recurring_entries_next su disabled, next_date

goods_appearances

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(10) no
description String(100) no
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 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ì
withholding_excluded Bool no false
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
prices_include_tax Bool no false
footer_discount_amount Decimal(19,6) no 0
exigibility String(40) sì
split_payment Bool no false
stamp_duty_charged Bool no false
withholding_rate Decimal(19,6) sì
withholding_base_percent Decimal(19,6) no 100
withholding_type String(4) sì
withholding_reason String(2) sì
social_security_fund String(4) sì
social_security_rate Decimal(19,6) sì
social_security_tax_code_id Int64 sì -> tax_codes (Restrict)
social_security_withheld Bool no false
enasarco_rate Decimal(19,6) sì
enasarco_amount Decimal(19,6) no 0
cig String(15) sì
cup String(15) sì
transport_by String(40) sì
related_document_id Int64 sì -> inventory_documents (Restrict)
related_number String(30) sì
related_date Date sì
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
to_warehouse_id Int64 sì
vat_date Date sì
  • 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_entries

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
entry_date Date no
source_family String(40) sì
source_document_id Int64 sì
source_kind String(40) sì
source_number String(30) sì
inventory_reason_id Int64 sì -> inventory_reasons (Restrict)
party_id Int64 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_entries_date su entry_date
  • indice ix_inventory_entries_source su source_family, source_document_id

inventory_entry_lines

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
entry_id Int64 no -> inventory_entries (Cascade)
entry_date Date no
item_id Int64 no -> items (Restrict)
warehouse_id Int64 no -> warehouses (Restrict)
quantity Decimal(19,6) no
valued Bool no false
unit_cost Decimal(19,6) no 0
value Decimal(19,6) no 0
source_line_id Int64 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_entry_lines_entry su entry_id
  • indice ix_inventory_entry_lines_item su item_id, entry_date
  • indice ix_inventory_entry_lines_warehouse su warehouse_id, item_id

inventory_reasons

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(10) no
description String(100) no
disabled Bool no false
effect String(40) no
affects_value Bool no false
is_transfer 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 unico ux_inventory_reasons_code su code

item_balances

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
item_id Int64 no -> items (Cascade)
warehouse_id Int64 no -> warehouses (Restrict)
on_hand Decimal(19,6) no 0
committed Decimal(19,6) no 0
ordered Decimal(19,6) no 0
in_transit Decimal(19,6) no 0
average_cost Decimal(19,6) no 0
value Decimal(19,6) no 0
last_cost Decimal(19,6) sì
last_load_date Date sì
last_unload_date 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_balances_warehouse su warehouse_id
  • indice unico ux_item_balances_item_warehouse su item_id, warehouse_id

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
id Int64 no chiave primaria, identity
code String(20) no
description String(100) no
disabled Bool no false
parent_id Int64 sì -> item_categories (Restrict)
level Int32 no
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 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
id Int64 no chiave primaria, identity
code String(20) no
description String(100) no
disabled Bool no false
party_id Int64 sì
start_date Date sì
end_date Date sì
status String(40) no
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 unico ux_jobs_code su code

municipalities

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(4) no
description String(100) no
disabled Bool no false
province_code String(2) no
region String(60) sì
istat_code String(6) sì
postal_codes String(400) 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_municipalities_description su description
  • indice ix_municipalities_province_code su province_code
  • indice unico ux_municipalities_code su code

notification_reads

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
notification_id Int64 no
user_id Int64 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_notification_reads_user_id su user_id
  • indice unico ux_notification_reads_notification_user su notification_id, user_id

notifications

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
recipient_user_id Int64 sì
category String(40) no
severity String(40) no
title String(200) no
body Text sì
link String(400) sì
read_at DateTimeUtc 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_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
id Int64 no chiave primaria, identity
code String(10) no
description String(100) no
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 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_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
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
excluded_month1 Int32 sì
excluded_month2 Int32 sì
excluded_months_day Int32 sì
  • indice unico ux_party_sales_terms_party su party_id

payment_lines

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
payment_id Int64 no -> payments (Cascade)
open_item_id Int64 no -> gl_open_items (Restrict)
amount Decimal(19,6) no 0
allowance Decimal(19,6) no 0
exchange_difference Decimal(19,6) 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_payment_lines_item su open_item_id
  • indice ix_payment_lines_payment su payment_id

payment_methods

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(10) no
description String(100) no
disabled Bool no false
e_invoice_code String(4) no
needs_bank 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 unico ux_payment_methods_code su code

payment_term_lines

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
payment_term_id Int64 no -> payment_terms (Cascade)
number Int32 no
days Int32 no
end_of_month Bool no false
fixed_day Int32 sì
percent 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 unico ux_payment_term_lines_payment_term_id_number su payment_term_id, number

payment_terms

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(10) no
description String(100) no
disabled Bool no false
payment_method_id Int64 sì -> payment_methods (Restrict)
condition String(4) no
vat_on_first_installment 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 unico ux_payment_terms_code su code

payments

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
direction String(40) no
party_id Int64 no -> parties (Restrict)
payment_date Date no
payment_method_id Int64 sì
bank_account_id Int64 sì
account_id Int64 sì
amount Decimal(19,6) no 0
allowance_amount Decimal(19,6) no 0
exchange_difference Decimal(19,6) no 0
fees Decimal(19,6) no 0
reference String(60) sì
template_code String(10) sì
notes String(500) sì
origin String(40) no
remittance_id Int64 sì -> remittances (Restrict)
statement_line_id Int64 sì
gl_entry_id Int64 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_payments_date su direction, payment_date
  • indice ix_payments_party su party_id, payment_date

price_lists

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(10) no
description String(100) no
disabled Bool no false
currency_code String(3) no
vat_included Bool no false
valid_from Date sì
valid_to Date sì
base_price_list_id Int64 sì -> price_lists (Restrict)
markup_percent Decimal(19,6) no
rounding_step Decimal(19,6) no
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
is_base Bool no false
  • indice unico ux_price_lists_code su code

provinces

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(2) no
description String(100) no
disabled Bool no false
region String(60) 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 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ì
withholding_excluded Bool no false
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
prices_include_tax Bool no false
footer_discount_amount Decimal(19,6) no 0
exigibility String(40) sì
split_payment Bool no false
stamp_duty_charged Bool no false
withholding_rate Decimal(19,6) sì
withholding_base_percent Decimal(19,6) no 100
withholding_type String(4) sì
withholding_reason String(2) sì
social_security_fund String(4) sì
social_security_rate Decimal(19,6) sì
social_security_tax_code_id Int64 sì -> tax_codes (Restrict)
social_security_withheld Bool no false
enasarco_rate Decimal(19,6) sì
enasarco_amount Decimal(19,6) no 0
cig String(15) sì
cup String(15) sì
transport_by String(40) sì
related_document_id Int64 sì -> purchase_documents (Restrict)
related_number String(30) sì
related_date Date sì
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
to_warehouse_id Int64 sì
vat_date Date sì
  • 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ì
withholding_excluded Bool no false
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
prices_include_tax Bool no false
footer_discount_amount Decimal(19,6) no 0
exigibility String(40) sì
split_payment Bool no false
stamp_duty_charged Bool no false
withholding_rate Decimal(19,6) sì
withholding_base_percent Decimal(19,6) no 100
withholding_type String(4) sì
withholding_reason String(2) sì
social_security_fund String(4) sì
social_security_rate Decimal(19,6) sì
social_security_tax_code_id Int64 sì -> tax_codes (Restrict)
social_security_withheld Bool no false
enasarco_rate Decimal(19,6) sì
enasarco_amount Decimal(19,6) no 0
cig String(15) sì
cup String(15) sì
transport_by String(40) sì
related_document_id Int64 sì -> purchase_orders (Restrict)
related_number String(30) sì
related_date Date sì
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
to_warehouse_id Int64 sì
vat_date Date sì
  • 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

remittance_lines

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
remittance_id Int64 no -> remittances (Cascade)
open_item_id Int64 no -> gl_open_items (Restrict)
party_id Int64 no
amount Decimal(19,6) no 0
due_date Date no
iban String(34) sì
mandate_id Int64 sì -> sdd_mandates (Restrict)
end_to_end_id String(35) sì
status String(40) no
unpaid_on Date sì
unpaid_fees Decimal(19,6) no 0
unpaid_entry_id Int64 sì
payment_id Int64 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_remittance_lines_item su open_item_id
  • indice ix_remittance_lines_remittance su remittance_id

remittances

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
year Int32 no
number Int32 no
kind String(40) no
bank_account_id Int64 no -> bank_accounts (Restrict)
presentation_date Date no
due_until Date no
advance Bool no false
status String(40) no
total_amount Decimal(19,6) no 0
item_count Int32 no 0
message_id String(35) sì
attachment_id Int64 sì
file_name String(100) sì
gl_entry_id Int64 sì
credited_on Date sì
credit_entry_id Int64 sì
notes String(500) 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 unico ux_remittances_number su year, number

role_permissions

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
role_id Int64 no -> roles (Cascade)
permission String(100) 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 unico ux_role_permissions_role_id_permission su role_id, permission

roles

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(50) no
name String(100) no
description Text sì
is_predefined Bool no false
template_code String(50) 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_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ì
withholding_excluded Bool no false
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
prices_include_tax Bool no false
footer_discount_amount Decimal(19,6) no 0
exigibility String(40) sì
split_payment Bool no false
stamp_duty_charged Bool no false
withholding_rate Decimal(19,6) sì
withholding_base_percent Decimal(19,6) no 100
withholding_type String(4) sì
withholding_reason String(2) sì
social_security_fund String(4) sì
social_security_rate Decimal(19,6) sì
social_security_tax_code_id Int64 sì -> tax_codes (Restrict)
social_security_withheld Bool no false
enasarco_rate Decimal(19,6) sì
enasarco_amount Decimal(19,6) no 0
cig String(15) sì
cup String(15) sì
transport_by String(40) sì
related_document_id Int64 sì -> sale_documents (Restrict)
related_number String(30) sì
related_date Date sì
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
to_warehouse_id Int64 sì
vat_date Date sì
  • 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ì
withholding_excluded Bool no false
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
prices_include_tax Bool no false
footer_discount_amount Decimal(19,6) no 0
exigibility String(40) sì
split_payment Bool no false
stamp_duty_charged Bool no false
withholding_rate Decimal(19,6) sì
withholding_base_percent Decimal(19,6) no 100
withholding_type String(4) sì
withholding_reason String(2) sì
social_security_fund String(4) sì
social_security_rate Decimal(19,6) sì
social_security_tax_code_id Int64 sì -> tax_codes (Restrict)
social_security_withheld Bool no false
enasarco_rate Decimal(19,6) sì
enasarco_amount Decimal(19,6) no 0
cig String(15) sì
cup String(15) sì
transport_by String(40) sì
related_document_id Int64 sì -> sale_orders (Restrict)
related_number String(30) sì
related_date Date sì
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
to_warehouse_id Int64 sì
vat_date Date sì
  • 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ì
withholding_excluded Bool no false
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
prices_include_tax Bool no false
footer_discount_amount Decimal(19,6) no 0
exigibility String(40) sì
split_payment Bool no false
stamp_duty_charged Bool no false
withholding_rate Decimal(19,6) sì
withholding_base_percent Decimal(19,6) no 100
withholding_type String(4) sì
withholding_reason String(2) sì
social_security_fund String(4) sì
social_security_rate Decimal(19,6) sì
social_security_tax_code_id Int64 sì -> tax_codes (Restrict)
social_security_withheld Bool no false
enasarco_rate Decimal(19,6) sì
enasarco_amount Decimal(19,6) no 0
cig String(15) sì
cup String(15) sì
transport_by String(40) sì
related_document_id Int64 sì -> sale_quotations (Restrict)
related_number String(30) sì
related_date Date sì
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
to_warehouse_id Int64 sì
vat_date Date sì
  • 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
id Int64 no chiave primaria, identity
code String(10) no
description String(100) no
disabled Bool no false
email String(254) sì
phone String(30) sì
commission_percent Decimal(19,6) no
enasarco 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 unico ux_salespeople_code su code

schema_version

Colonna Tipo Null Default Note
module String(50) no chiave primaria
version Int64 no chiave primaria
name String(200) no
applied_at DateTimeUtc no
checksum String(64) no

Chiave primaria: module, version.

sdd_mandates

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
party_id Int64 no -> parties (Restrict)
reference String(35) no
signature_date Date no
scheme String(40) no
iban String(34) no
bic String(11) sì
one_off Bool no false
last_collection_date Date sì
revoked Bool no false
notes 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_sdd_mandates_party su party_id
  • indice unico ux_sdd_mandates_reference su reference

shipping_terms

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(10) no
description String(100) no
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 unico ux_shipping_terms_code su code

stock_take_lines

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
stock_take_id Int64 no -> stock_takes (Cascade)
item_id Int64 no -> items (Restrict)
book_quantity Decimal(19,6) no 0
counted_quantity Decimal(19,6) sì
unit_cost Decimal(19,6) no 0
notes String(200) 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 unico ux_stock_take_lines_item su stock_take_id, item_id

stock_takes

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
take_date Date no
warehouse_id Int64 no -> warehouses (Restrict)
description String(100) no
category_id Int64 sì -> item_categories (Restrict)
status String(40) no
adjustment_document_id Int64 sì
loss_document_id Int64 sì
posted_at DateTimeUtc sì
posted_by String(100) sì
notes Text 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_stock_takes_date su take_date

tax_codes

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(10) no
description String(100) no
disabled Bool no false
rate Decimal(19,6) no
nature String(5) sì
kind String(40) no
exigibility String(40) no
non_deductible_percent Decimal(19,6) no
legal_reference String(200) sì
valid_from Date sì
valid_to Date sì
sales_account_code String(20) sì
purchase_account_code String(20) 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 unico ux_tax_codes_code su code

tax_payments

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
due_date Date no
payment_code String(10) no
reference_year Int32 no
reference_period String(10) sì
description String(200) no
amount Decimal(19,6) no 0
source String(40) no
source_id Int64 sì
paid_on Date sì
bank_account_id Int64 sì
gl_entry_id Int64 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_tax_payments_due su due_date
  • indice ix_tax_payments_source su source, source_id

transport_means

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(10) no
description String(100) no
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 unico ux_transport_means_code su code

transport_reasons

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(10) no
description String(100) no
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 unico ux_transport_reasons_code su code

units_of_measure

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(10) no
description String(100) no
disabled Bool no false
decimals Int32 no
e_invoice_code String(10) 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 unico ux_units_of_measure_code su code

user_permission_overrides

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
user_id Int64 no -> users (Cascade)
permission String(100) no
allowed Bool 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 unico ux_user_permission_overrides_user_id_permission su user_id, permission

user_roles

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
user_id Int64 no -> users (Cascade)
role_id Int64 no -> roles (Cascade)
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_user_roles_user_id_role_id su user_id, role_id

user_sessions

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
token_hash String(64) no
user_id Int64 no -> users (Cascade)
state String(40) no
company_code String(20) sì
ip_address String(64) sì
user_agent String(400) sì
persistent Bool no false
last_seen_at DateTimeUtc no
expires_at DateTimeUtc no
revoked_at DateTimeUtc sì
revoked_reason 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_user_sessions_user_id su user_id
  • indice unico ux_user_sessions_token_hash su token_hash

user_settings

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
user_id Int64 no
key String(200) no
value 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 unico ux_user_settings_user_id_key su user_id, key

users

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
user_name String(100) no
display_name String(200) no
email String(254) sì
kind String(40) no
password_hash String(200) sì
password_history Json sì
password_changed_at DateTimeUtc sì
must_change_password Bool no false
temporary_password_expires_at DateTimeUtc sì
failed_login_count Int32 no 0
locked_until DateTimeUtc sì
totp_secret Text sì
totp_enabled Bool no false
totp_required Bool no false
totp_last_step Int64 sì
totp_recovery_codes Json sì
recovery_token_hash String(64) sì
recovery_token_expires_at DateTimeUtc sì
is_active Bool no true
last_login_at DateTimeUtc sì
own_customers_only Bool no false
can_see_costs Bool no false
can_export Bool no false
can_use_api 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_users_user_name su user_name

vat_register_prints

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
vat_register_id Int64 no -> vat_registers (Cascade)
year Int32 no
from_date Date no
to_date Date no
first_page Int32 no
last_page Int32 no
attachment_id Int64 sì
printed_at DateTimeUtc no
printed_by 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_vat_register_prints_register su vat_register_id, year

vat_registers

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(10) no
description String(100) no
disabled Bool no false
kind String(40) no
reverse_charge Bool no false
print_year Int32 sì
last_page Int32 no 0
last_printed_date Date 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 unico ux_vat_registers_code su code

vat_settlement_lines

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
settlement_id Int64 no -> vat_settlements (Cascade)
vat_register_id Int64 no -> vat_registers (Restrict)
register_kind String(40) no
documents Int32 no 0
taxable Decimal(19,6) no 0
tax Decimal(19,6) no 0
non_deductible_tax Decimal(19,6) no 0
deferred_tax Decimal(19,6) 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_vat_settlement_lines_settlement su settlement_id

vat_settlements

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
year Int32 no
number Int32 no
periodicity String(40) no
start_date Date no
end_date Date no
settlement_date Date no
status String(40) no
sales_tax Decimal(19,6) no 0
purchase_tax Decimal(19,6) no 0
non_deductible_tax Decimal(19,6) no 0
deferred_tax Decimal(19,6) no 0
pro_rata_percent Decimal(19,6) no 100
previous_credit Decimal(19,6) no 0
previous_debit Decimal(19,6) no 0
advance_paid Decimal(19,6) no 0
interest_percent Decimal(19,6) no 0
interest Decimal(19,6) no 0
amount_due Decimal(19,6) no 0
credit_carried Decimal(19,6) no 0
debit_carried Decimal(19,6) no 0
payment_code String(10) sì
due_date Date sì
gl_entry_id Int64 sì
tax_payment_id Int64 sì
confirmed_at DateTimeUtc sì
confirmed_by String(100) 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 unico ux_vat_settlements_period su year, periodicity, number

warehouses

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
code String(10) no
description String(100) no
disabled Bool no false
address String(200) sì
city String(100) sì
province_code String(2) sì
is_default 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 unico ux_warehouses_code su code

withholdings

Colonna Tipo Null Default Note
id Int64 no chiave primaria, identity
direction String(40) no
source_family String(40) no
source_document_id Int64 no
document_number String(30) sì
document_date Date no
party_id Int64 no -> parties (Restrict)
withholding_type String(10) sì
reason String(10) sì
taxable Decimal(19,6) no 0
social_security_fund String(10) sì
social_security_amount Decimal(19,6) no 0
rate Decimal(19,6) no 0
base_percent Decimal(19,6) no 100
amount Decimal(19,6) no 0
payment_code String(10) sì
invoice_paid_on Date sì
status String(40) no
tax_payment_id Int64 sì
gl_entry_id Int64 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_withholdings_source su source_family, source_document_id
  • indice ix_withholdings_status su direction, status, invoice_paid_on