Adds the company tables of SPEC 11.1 behind one generic service so that every table gets the same rules, history, cache and CSV import/export, plus the company profile, fiscal years with monthly lock and the base-data seeder. - 26 coded tables, exchange rates, company profile, fiscal years and periods: entities, maps and migrations 010-014 - TableService + TableCatalog: unique codes, per-table rules (VAT codes are checked by the fiscal pack), delete or disable when in use, single default, CSV export/import all-or-nothing, cache with cross-instance invalidation - CompanyProfileService (Italian identifiers through the pack), FiscalYearService with the date check used by every dated record - EcbRatesClient and the ECB rates system task; CsvReader - ISeeder/SeedRunner with the data version in company settings; base tables from the pack (IBaseTablesTemplate) and an embedded ISO country list Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
25f8a7ad30
commit
34e196424f
33 files changed
+6049
-3
No files matched your search
@@ -0,0 +1,83 @@
|
||||
using Khaemhat.Data.Migrations;
|
||||
using Khaemhat.Data.Schema;
|
||||
|
||||
namespace Khaemhat.Data.CompanyDatabase.Migrations;
|
||||
|
||||
/// <summary>The company data and the fiscal years with their periods (SPEC §11.1, mockup 075 and 052).</summary>
|
||||
[Migration(20261111_010, "create_company_profile")]
|
||||
public sealed class M20261111_010_CreateCompanyProfile : IMigration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void Up(ISchemaBuilder schema)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(schema);
|
||||
schema.CreateTable("company_profile", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("legal_name", 200).NotNull();
|
||||
t.String("fiscal_name", 200);
|
||||
t.String("vat_number", 28);
|
||||
t.String("tax_code", 16);
|
||||
t.String("rea_office", 2);
|
||||
t.String("rea_number", 20);
|
||||
t.Decimal("share_capital");
|
||||
t.String("shareholders", 2);
|
||||
t.String("liquidation_status", 2);
|
||||
t.String("address", 200);
|
||||
t.String("street_number", 8);
|
||||
t.String("postal_code", 10);
|
||||
t.String("city", 100);
|
||||
t.String("province_code", 2);
|
||||
t.String("address_country", 2);
|
||||
t.String("phone", 30);
|
||||
t.String("email", 254);
|
||||
t.String("pec", 254);
|
||||
t.String("website", 200);
|
||||
t.String("tax_regime", 4).NotNull();
|
||||
t.String("recipient_code", 7);
|
||||
t.Int64("logo_attachment_id");
|
||||
t.Int64("default_bank_account_id");
|
||||
t.String("currency_code", 3).NotNull();
|
||||
t.String("country", 2).NotNull();
|
||||
t.String("vat_periodicity", 40).NotNull();
|
||||
t.Decimal("pro_rata_percent").NotNull();
|
||||
t.Bool("cash_vat").NotNull().Default(false);
|
||||
t.Int32("fiscal_year_start_month").NotNull();
|
||||
t.String("transmitter_country", 2);
|
||||
t.String("transmitter_id", 28);
|
||||
t.String("intermediary_name", 200);
|
||||
t.String("intermediary_tax_code", 16);
|
||||
t.Text("footer_notes");
|
||||
t.AuditColumns();
|
||||
});
|
||||
|
||||
schema.CreateTable("fiscal_years", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("code", 10).NotNull();
|
||||
t.Date("start_date").NotNull();
|
||||
t.Date("end_date").NotNull();
|
||||
t.String("status", 40).NotNull();
|
||||
t.Int32("journal_first_page").NotNull();
|
||||
t.Int64("last_final_entry_number").NotNull();
|
||||
t.Date("last_final_entry_date");
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_fiscal_years_code", "code");
|
||||
t.Unique("ux_fiscal_years_start_date", "start_date");
|
||||
});
|
||||
|
||||
schema.CreateTable("fiscal_periods", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.Int64("fiscal_year_id").NotNull();
|
||||
t.Int32("number").NotNull();
|
||||
t.Date("start_date").NotNull();
|
||||
t.Date("end_date").NotNull();
|
||||
t.String("status", 40).NotNull();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_fiscal_periods_fiscal_year_id_number", "fiscal_year_id", "number");
|
||||
t.Index("ix_fiscal_periods_start_date", "start_date");
|
||||
t.ForeignKey("fk_fiscal_periods_fiscal_year", "fiscal_year_id", "fiscal_years", ReferentialAction.Cascade);
|
||||
});
|
||||
}
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
using Khaemhat.Data.Migrations;
|
||||
using Khaemhat.Data.Schema;
|
||||
|
||||
namespace Khaemhat.Data.CompanyDatabase.Migrations;
|
||||
|
||||
/// <summary>Countries, provinces, municipalities, currencies, exchange rates and units of measure (SPEC §11.1).</summary>
|
||||
[Migration(20261111_011, "create_geography_and_currencies")]
|
||||
public sealed class M20261111_011_CreateGeographyAndCurrencies : IMigration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void Up(ISchemaBuilder schema)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(schema);
|
||||
schema.CreateTable("countries", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("code", 2).NotNull();
|
||||
t.String("description", 100).NotNull();
|
||||
t.Bool("disabled").NotNull().Default(false);
|
||||
t.String("iso3", 3);
|
||||
t.Bool("eu_member").NotNull().Default(false);
|
||||
t.String("vat_prefix", 2);
|
||||
t.String("currency_code", 3);
|
||||
t.DemoColumn();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_countries_code", "code");
|
||||
});
|
||||
|
||||
schema.CreateTable("provinces", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("code", 2).NotNull();
|
||||
t.String("description", 100).NotNull();
|
||||
t.Bool("disabled").NotNull().Default(false);
|
||||
t.String("region", 60);
|
||||
t.DemoColumn();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_provinces_code", "code");
|
||||
});
|
||||
|
||||
schema.CreateTable("municipalities", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("code", 4).NotNull();
|
||||
t.String("description", 100).NotNull();
|
||||
t.Bool("disabled").NotNull().Default(false);
|
||||
t.String("province_code", 2).NotNull();
|
||||
t.String("region", 60);
|
||||
t.String("istat_code", 6);
|
||||
t.String("postal_codes", 400);
|
||||
t.DemoColumn();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_municipalities_code", "code");
|
||||
t.Index("ix_municipalities_description", "description");
|
||||
t.Index("ix_municipalities_province_code", "province_code");
|
||||
});
|
||||
|
||||
schema.CreateTable("currencies", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("code", 3).NotNull();
|
||||
t.String("description", 100).NotNull();
|
||||
t.Bool("disabled").NotNull().Default(false);
|
||||
t.String("symbol", 5);
|
||||
t.Int32("decimals").NotNull();
|
||||
t.DemoColumn();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_currencies_code", "code");
|
||||
});
|
||||
|
||||
schema.CreateTable("exchange_rates", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("currency_code", 3).NotNull();
|
||||
t.Date("rate_date").NotNull();
|
||||
t.Decimal("rate").NotNull();
|
||||
t.String("source", 10).NotNull();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_exchange_rates_currency_code_rate_date", "currency_code", "rate_date");
|
||||
});
|
||||
|
||||
schema.CreateTable("units_of_measure", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("code", 10).NotNull();
|
||||
t.String("description", 100).NotNull();
|
||||
t.Bool("disabled").NotNull().Default(false);
|
||||
t.Int32("decimals").NotNull();
|
||||
t.String("e_invoice_code", 10);
|
||||
t.DemoColumn();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_units_of_measure_code", "code");
|
||||
});
|
||||
}
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
using Khaemhat.Data.Migrations;
|
||||
using Khaemhat.Data.Schema;
|
||||
|
||||
namespace Khaemhat.Data.CompanyDatabase.Migrations;
|
||||
|
||||
/// <summary>VAT codes, payment methods and terms, bank accounts and salespeople (SPEC §11.1, mockup 076).</summary>
|
||||
[Migration(20261111_012, "create_tax_and_payment_tables")]
|
||||
public sealed class M20261111_012_CreateTaxAndPaymentTables : IMigration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void Up(ISchemaBuilder schema)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(schema);
|
||||
schema.CreateTable("tax_codes", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("code", 10).NotNull();
|
||||
t.String("description", 100).NotNull();
|
||||
t.Bool("disabled").NotNull().Default(false);
|
||||
t.Decimal("rate").NotNull();
|
||||
t.String("nature", 5);
|
||||
t.String("kind", 40).NotNull();
|
||||
t.String("exigibility", 40).NotNull();
|
||||
t.Decimal("non_deductible_percent").NotNull();
|
||||
t.String("legal_reference", 200);
|
||||
t.Date("valid_from");
|
||||
t.Date("valid_to");
|
||||
t.String("sales_account_code", 20);
|
||||
t.String("purchase_account_code", 20);
|
||||
t.DemoColumn();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_tax_codes_code", "code");
|
||||
});
|
||||
|
||||
schema.CreateTable("payment_methods", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("code", 10).NotNull();
|
||||
t.String("description", 100).NotNull();
|
||||
t.Bool("disabled").NotNull().Default(false);
|
||||
t.String("e_invoice_code", 4).NotNull();
|
||||
t.Bool("needs_bank").NotNull().Default(false);
|
||||
t.DemoColumn();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_payment_methods_code", "code");
|
||||
});
|
||||
|
||||
schema.CreateTable("payment_terms", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("code", 10).NotNull();
|
||||
t.String("description", 100).NotNull();
|
||||
t.Bool("disabled").NotNull().Default(false);
|
||||
t.Int64("payment_method_id");
|
||||
t.String("condition", 4).NotNull();
|
||||
t.Bool("vat_on_first_installment").NotNull().Default(false);
|
||||
t.DemoColumn();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_payment_terms_code", "code");
|
||||
t.ForeignKey("fk_payment_terms_payment_method", "payment_method_id", "payment_methods", ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
schema.CreateTable("payment_term_lines", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.Int64("payment_term_id").NotNull();
|
||||
t.Int32("number").NotNull();
|
||||
t.Int32("days").NotNull();
|
||||
t.Bool("end_of_month").NotNull().Default(false);
|
||||
t.Int32("fixed_day");
|
||||
t.Decimal("percent").NotNull();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_payment_term_lines_payment_term_id_number", "payment_term_id", "number");
|
||||
t.ForeignKey("fk_payment_term_lines_payment_term", "payment_term_id", "payment_terms", ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
schema.CreateTable("bank_accounts", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("code", 10).NotNull();
|
||||
t.String("description", 100).NotNull();
|
||||
t.Bool("disabled").NotNull().Default(false);
|
||||
t.String("bank_name", 100);
|
||||
t.String("iban", 34);
|
||||
t.String("bic", 11);
|
||||
t.String("sia_code", 5);
|
||||
t.String("cuc_code", 8);
|
||||
t.String("account_code", 20);
|
||||
t.Bool("is_default").NotNull().Default(false);
|
||||
t.DemoColumn();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_bank_accounts_code", "code");
|
||||
});
|
||||
|
||||
schema.CreateTable("salespeople", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("code", 10).NotNull();
|
||||
t.String("description", 100).NotNull();
|
||||
t.Bool("disabled").NotNull().Default(false);
|
||||
t.String("email", 254);
|
||||
t.String("phone", 30);
|
||||
t.Decimal("commission_percent").NotNull();
|
||||
t.Bool("enasarco").NotNull().Default(false);
|
||||
t.DemoColumn();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_salespeople_code", "code");
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
using Khaemhat.Data.Migrations;
|
||||
using Khaemhat.Data.Schema;
|
||||
|
||||
namespace Khaemhat.Data.CompanyDatabase.Migrations;
|
||||
|
||||
/// <summary>Carriers, transport tables, warehouse reasons and warehouses (SPEC §11.1).</summary>
|
||||
[Migration(20261111_013, "create_logistics_tables")]
|
||||
public sealed class M20261111_013_CreateLogisticsTables : IMigration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void Up(ISchemaBuilder schema)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(schema);
|
||||
schema.CreateTable("carriers", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("code", 10).NotNull();
|
||||
t.String("description", 100).NotNull();
|
||||
t.Bool("disabled").NotNull().Default(false);
|
||||
t.String("vat_number", 28);
|
||||
t.String("address", 200);
|
||||
t.String("city", 100);
|
||||
t.String("phone", 30);
|
||||
t.String("email", 254);
|
||||
t.String("register_number", 30);
|
||||
t.DemoColumn();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_carriers_code", "code");
|
||||
});
|
||||
|
||||
schema.CreateTable("shipping_terms", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("code", 10).NotNull();
|
||||
t.String("description", 100).NotNull();
|
||||
t.Bool("disabled").NotNull().Default(false);
|
||||
t.DemoColumn();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_shipping_terms_code", "code");
|
||||
});
|
||||
|
||||
schema.CreateTable("transport_means", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("code", 10).NotNull();
|
||||
t.String("description", 100).NotNull();
|
||||
t.Bool("disabled").NotNull().Default(false);
|
||||
t.DemoColumn();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_transport_means_code", "code");
|
||||
});
|
||||
|
||||
schema.CreateTable("goods_appearances", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("code", 10).NotNull();
|
||||
t.String("description", 100).NotNull();
|
||||
t.Bool("disabled").NotNull().Default(false);
|
||||
t.DemoColumn();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_goods_appearances_code", "code");
|
||||
});
|
||||
|
||||
schema.CreateTable("delivery_terms", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("code", 10).NotNull();
|
||||
t.String("description", 100).NotNull();
|
||||
t.Bool("disabled").NotNull().Default(false);
|
||||
t.DemoColumn();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_delivery_terms_code", "code");
|
||||
});
|
||||
|
||||
schema.CreateTable("transport_reasons", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("code", 10).NotNull();
|
||||
t.String("description", 100).NotNull();
|
||||
t.Bool("disabled").NotNull().Default(false);
|
||||
t.DemoColumn();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_transport_reasons_code", "code");
|
||||
});
|
||||
|
||||
schema.CreateTable("inventory_reasons", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("code", 10).NotNull();
|
||||
t.String("description", 100).NotNull();
|
||||
t.Bool("disabled").NotNull().Default(false);
|
||||
t.String("effect", 40).NotNull();
|
||||
t.Bool("affects_value").NotNull().Default(false);
|
||||
t.Bool("is_transfer").NotNull().Default(false);
|
||||
t.DemoColumn();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_inventory_reasons_code", "code");
|
||||
});
|
||||
|
||||
schema.CreateTable("warehouses", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("code", 10).NotNull();
|
||||
t.String("description", 100).NotNull();
|
||||
t.Bool("disabled").NotNull().Default(false);
|
||||
t.String("address", 200);
|
||||
t.String("city", 100);
|
||||
t.String("province_code", 2);
|
||||
t.Bool("is_default").NotNull().Default(false);
|
||||
t.DemoColumn();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_warehouses_code", "code");
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
using Khaemhat.Data.Migrations;
|
||||
using Khaemhat.Data.Schema;
|
||||
|
||||
namespace Khaemhat.Data.CompanyDatabase.Migrations;
|
||||
|
||||
/// <summary>Categories, price lists, discounts, numerators, document types, cost centres and jobs (SPEC §11.1).</summary>
|
||||
[Migration(20261111_014, "create_catalog_tables")]
|
||||
public sealed class M20261111_014_CreateCatalogTables : IMigration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void Up(ISchemaBuilder schema)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(schema);
|
||||
schema.CreateTable("item_categories", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("code", 20).NotNull();
|
||||
t.String("description", 100).NotNull();
|
||||
t.Bool("disabled").NotNull().Default(false);
|
||||
t.Int64("parent_id");
|
||||
t.Int32("level").NotNull();
|
||||
t.DemoColumn();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_item_categories_code", "code");
|
||||
t.ForeignKey("fk_item_categories_parent", "parent_id", "item_categories", ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
schema.CreateTable("party_categories", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("code", 10).NotNull();
|
||||
t.String("description", 100).NotNull();
|
||||
t.Bool("disabled").NotNull().Default(false);
|
||||
t.DemoColumn();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_party_categories_code", "code");
|
||||
});
|
||||
|
||||
schema.CreateTable("price_lists", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("code", 10).NotNull();
|
||||
t.String("description", 100).NotNull();
|
||||
t.Bool("disabled").NotNull().Default(false);
|
||||
t.String("currency_code", 3).NotNull();
|
||||
t.Bool("vat_included").NotNull().Default(false);
|
||||
t.Date("valid_from");
|
||||
t.Date("valid_to");
|
||||
t.Int64("base_price_list_id");
|
||||
t.Decimal("markup_percent").NotNull();
|
||||
t.Decimal("rounding_step").NotNull();
|
||||
t.DemoColumn();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_price_lists_code", "code");
|
||||
t.ForeignKey("fk_price_lists_base_price_list", "base_price_list_id", "price_lists", ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
schema.CreateTable("discount_policies", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("code", 10).NotNull();
|
||||
t.String("description", 100).NotNull();
|
||||
t.Bool("disabled").NotNull().Default(false);
|
||||
t.String("formula", 60).NotNull();
|
||||
t.DemoColumn();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_discount_policies_code", "code");
|
||||
});
|
||||
|
||||
schema.CreateTable("document_numerators", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("code", 10).NotNull();
|
||||
t.String("description", 100).NotNull();
|
||||
t.Bool("disabled").NotNull().Default(false);
|
||||
t.String("kind", 40).NotNull();
|
||||
t.String("section", 10);
|
||||
t.Int32("year").NotNull();
|
||||
t.String("prefix", 10);
|
||||
t.String("format", 60).NotNull();
|
||||
t.Int64("last_number").NotNull();
|
||||
t.Bool("gaps_allowed").NotNull().Default(false);
|
||||
t.DemoColumn();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_document_numerators_code_year", "code", "year");
|
||||
});
|
||||
|
||||
schema.CreateTable("document_types", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("code", 10).NotNull();
|
||||
t.String("description", 100).NotNull();
|
||||
t.Bool("disabled").NotNull().Default(false);
|
||||
t.String("kind", 40).NotNull();
|
||||
t.Int64("numerator_id");
|
||||
t.Int64("inventory_reason_id");
|
||||
t.String("e_invoice_type", 4);
|
||||
t.String("journal_template_code", 10);
|
||||
t.String("vat_register_code", 10);
|
||||
t.String("print_template", 60);
|
||||
t.DemoColumn();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_document_types_code", "code");
|
||||
t.ForeignKey("fk_document_types_inventory_reason", "inventory_reason_id", "inventory_reasons", ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
schema.CreateTable("cost_centers", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("code", 20).NotNull();
|
||||
t.String("description", 100).NotNull();
|
||||
t.Bool("disabled").NotNull().Default(false);
|
||||
t.Int64("parent_id");
|
||||
t.DemoColumn();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_cost_centers_code", "code");
|
||||
t.ForeignKey("fk_cost_centers_parent", "parent_id", "cost_centers", ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
schema.CreateTable("jobs", t =>
|
||||
{
|
||||
t.Id();
|
||||
t.String("code", 20).NotNull();
|
||||
t.String("description", 100).NotNull();
|
||||
t.Bool("disabled").NotNull().Default(false);
|
||||
t.Int64("party_id");
|
||||
t.Date("start_date");
|
||||
t.Date("end_date");
|
||||
t.String("status", 40).NotNull();
|
||||
t.DemoColumn();
|
||||
t.AuditColumns();
|
||||
t.Unique("ux_jobs_code", "code");
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,437 @@
|
||||
using Khaemhat.Core.Tables;
|
||||
using Khaemhat.Data.Mapping;
|
||||
|
||||
namespace Khaemhat.Data.CompanyDatabase;
|
||||
|
||||
/// <summary>Map of <see cref="CompanyProfile"/> to <c>company_profile</c>.</summary>
|
||||
public sealed class CompanyProfileMap : EntityMap<CompanyProfile>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public CompanyProfileMap()
|
||||
{
|
||||
ToTable("company_profile");
|
||||
Map(x => x.LegalName).MaxLength(200);
|
||||
Map(x => x.FiscalName).MaxLength(200);
|
||||
Map(x => x.VatNumber).MaxLength(28);
|
||||
Map(x => x.TaxCode).MaxLength(16);
|
||||
Map(x => x.ReaOffice).MaxLength(2);
|
||||
Map(x => x.ReaNumber).MaxLength(20);
|
||||
Map(x => x.Shareholders).MaxLength(2);
|
||||
Map(x => x.LiquidationStatus).MaxLength(2);
|
||||
Map(x => x.Address).MaxLength(200);
|
||||
Map(x => x.StreetNumber).MaxLength(8);
|
||||
Map(x => x.PostalCode).MaxLength(10);
|
||||
Map(x => x.City).MaxLength(100);
|
||||
Map(x => x.ProvinceCode).MaxLength(2);
|
||||
Map(x => x.AddressCountry).MaxLength(2);
|
||||
Map(x => x.Phone).MaxLength(30);
|
||||
Map(x => x.Email).MaxLength(254);
|
||||
Map(x => x.Pec).MaxLength(254);
|
||||
Map(x => x.Website).MaxLength(200);
|
||||
Map(x => x.TaxRegime).MaxLength(4);
|
||||
Map(x => x.RecipientCode).MaxLength(7);
|
||||
Map(x => x.CurrencyCode).MaxLength(3);
|
||||
Map(x => x.Country).MaxLength(2);
|
||||
Map(x => x.TransmitterCountry).MaxLength(2);
|
||||
Map(x => x.TransmitterId).MaxLength(28);
|
||||
Map(x => x.IntermediaryName).MaxLength(200);
|
||||
Map(x => x.IntermediaryTaxCode).MaxLength(16);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="FiscalYear"/> to <c>fiscal_years</c>.</summary>
|
||||
public sealed class FiscalYearMap : EntityMap<FiscalYear>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public FiscalYearMap()
|
||||
{
|
||||
ToTable("fiscal_years");
|
||||
Map(x => x.Code).MaxLength(10);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="FiscalPeriod"/> to <c>fiscal_periods</c>.</summary>
|
||||
public sealed class FiscalPeriodMap : EntityMap<FiscalPeriod>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public FiscalPeriodMap()
|
||||
{
|
||||
ToTable("fiscal_periods");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="Country"/> to <c>countries</c>.</summary>
|
||||
public sealed class CountryMap : EntityMap<Country>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public CountryMap()
|
||||
{
|
||||
ToTable("countries");
|
||||
Map(x => x.Code).MaxLength(2);
|
||||
Map(x => x.Description).MaxLength(100);
|
||||
Map(x => x.Iso3).MaxLength(3);
|
||||
Map(x => x.VatPrefix).MaxLength(2);
|
||||
Map(x => x.CurrencyCode).MaxLength(3);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="Province"/> to <c>provinces</c>.</summary>
|
||||
public sealed class ProvinceMap : EntityMap<Province>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public ProvinceMap()
|
||||
{
|
||||
ToTable("provinces");
|
||||
Map(x => x.Code).MaxLength(2);
|
||||
Map(x => x.Description).MaxLength(100);
|
||||
Map(x => x.Region).MaxLength(60);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="Municipality"/> to <c>municipalities</c>.</summary>
|
||||
public sealed class MunicipalityMap : EntityMap<Municipality>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public MunicipalityMap()
|
||||
{
|
||||
ToTable("municipalities");
|
||||
Map(x => x.Code).MaxLength(4);
|
||||
Map(x => x.Description).MaxLength(100);
|
||||
Map(x => x.ProvinceCode).MaxLength(2);
|
||||
Map(x => x.Region).MaxLength(60);
|
||||
Map(x => x.IstatCode).MaxLength(6);
|
||||
Map(x => x.PostalCodes).MaxLength(400);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="Currency"/> to <c>currencies</c>.</summary>
|
||||
public sealed class CurrencyMap : EntityMap<Currency>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public CurrencyMap()
|
||||
{
|
||||
ToTable("currencies");
|
||||
Map(x => x.Code).MaxLength(3);
|
||||
Map(x => x.Description).MaxLength(100);
|
||||
Map(x => x.Symbol).MaxLength(5);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="ExchangeRate"/> to <c>exchange_rates</c>.</summary>
|
||||
public sealed class ExchangeRateMap : EntityMap<ExchangeRate>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public ExchangeRateMap()
|
||||
{
|
||||
ToTable("exchange_rates");
|
||||
Map(x => x.CurrencyCode).MaxLength(3);
|
||||
Map(x => x.Source).MaxLength(10);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="UnitOfMeasure"/> to <c>units_of_measure</c>.</summary>
|
||||
public sealed class UnitOfMeasureMap : EntityMap<UnitOfMeasure>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public UnitOfMeasureMap()
|
||||
{
|
||||
ToTable("units_of_measure");
|
||||
Map(x => x.Code).MaxLength(10);
|
||||
Map(x => x.Description).MaxLength(100);
|
||||
Map(x => x.EInvoiceCode).MaxLength(10);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="TaxCode"/> to <c>tax_codes</c>.</summary>
|
||||
public sealed class TaxCodeMap : EntityMap<TaxCode>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public TaxCodeMap()
|
||||
{
|
||||
ToTable("tax_codes");
|
||||
Map(x => x.Code).MaxLength(10);
|
||||
Map(x => x.Description).MaxLength(100);
|
||||
Map(x => x.Nature).MaxLength(5);
|
||||
Map(x => x.LegalReference).MaxLength(200);
|
||||
Map(x => x.SalesAccountCode).MaxLength(20);
|
||||
Map(x => x.PurchaseAccountCode).MaxLength(20);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="PaymentMethod"/> to <c>payment_methods</c>.</summary>
|
||||
public sealed class PaymentMethodMap : EntityMap<PaymentMethod>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public PaymentMethodMap()
|
||||
{
|
||||
ToTable("payment_methods");
|
||||
Map(x => x.Code).MaxLength(10);
|
||||
Map(x => x.Description).MaxLength(100);
|
||||
Map(x => x.EInvoiceCode).MaxLength(4);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="PaymentTerm"/> to <c>payment_terms</c>.</summary>
|
||||
public sealed class PaymentTermMap : EntityMap<PaymentTerm>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public PaymentTermMap()
|
||||
{
|
||||
ToTable("payment_terms");
|
||||
Map(x => x.Code).MaxLength(10);
|
||||
Map(x => x.Description).MaxLength(100);
|
||||
Map(x => x.Condition).MaxLength(4);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="PaymentTermLine"/> to <c>payment_term_lines</c>.</summary>
|
||||
public sealed class PaymentTermLineMap : EntityMap<PaymentTermLine>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public PaymentTermLineMap()
|
||||
{
|
||||
ToTable("payment_term_lines");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="BankAccount"/> to <c>bank_accounts</c>.</summary>
|
||||
public sealed class BankAccountMap : EntityMap<BankAccount>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public BankAccountMap()
|
||||
{
|
||||
ToTable("bank_accounts");
|
||||
Map(x => x.Code).MaxLength(10);
|
||||
Map(x => x.Description).MaxLength(100);
|
||||
Map(x => x.BankName).MaxLength(100);
|
||||
Map(x => x.Iban).MaxLength(34);
|
||||
Map(x => x.Bic).MaxLength(11);
|
||||
Map(x => x.SiaCode).MaxLength(5);
|
||||
Map(x => x.CucCode).MaxLength(8);
|
||||
Map(x => x.AccountCode).MaxLength(20);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="Salesperson"/> to <c>salespeople</c>.</summary>
|
||||
public sealed class SalespersonMap : EntityMap<Salesperson>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public SalespersonMap()
|
||||
{
|
||||
ToTable("salespeople");
|
||||
Map(x => x.Code).MaxLength(10);
|
||||
Map(x => x.Description).MaxLength(100);
|
||||
Map(x => x.Email).MaxLength(254);
|
||||
Map(x => x.Phone).MaxLength(30);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="Carrier"/> to <c>carriers</c>.</summary>
|
||||
public sealed class CarrierMap : EntityMap<Carrier>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public CarrierMap()
|
||||
{
|
||||
ToTable("carriers");
|
||||
Map(x => x.Code).MaxLength(10);
|
||||
Map(x => x.Description).MaxLength(100);
|
||||
Map(x => x.VatNumber).MaxLength(28);
|
||||
Map(x => x.Address).MaxLength(200);
|
||||
Map(x => x.City).MaxLength(100);
|
||||
Map(x => x.Phone).MaxLength(30);
|
||||
Map(x => x.Email).MaxLength(254);
|
||||
Map(x => x.RegisterNumber).MaxLength(30);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="ShippingTerm"/> to <c>shipping_terms</c>.</summary>
|
||||
public sealed class ShippingTermMap : EntityMap<ShippingTerm>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public ShippingTermMap()
|
||||
{
|
||||
ToTable("shipping_terms");
|
||||
Map(x => x.Code).MaxLength(10);
|
||||
Map(x => x.Description).MaxLength(100);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="TransportMean"/> to <c>transport_means</c>.</summary>
|
||||
public sealed class TransportMeanMap : EntityMap<TransportMean>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public TransportMeanMap()
|
||||
{
|
||||
ToTable("transport_means");
|
||||
Map(x => x.Code).MaxLength(10);
|
||||
Map(x => x.Description).MaxLength(100);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="GoodsAppearance"/> to <c>goods_appearances</c>.</summary>
|
||||
public sealed class GoodsAppearanceMap : EntityMap<GoodsAppearance>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public GoodsAppearanceMap()
|
||||
{
|
||||
ToTable("goods_appearances");
|
||||
Map(x => x.Code).MaxLength(10);
|
||||
Map(x => x.Description).MaxLength(100);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="DeliveryTerm"/> to <c>delivery_terms</c>.</summary>
|
||||
public sealed class DeliveryTermMap : EntityMap<DeliveryTerm>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public DeliveryTermMap()
|
||||
{
|
||||
ToTable("delivery_terms");
|
||||
Map(x => x.Code).MaxLength(10);
|
||||
Map(x => x.Description).MaxLength(100);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="TransportReason"/> to <c>transport_reasons</c>.</summary>
|
||||
public sealed class TransportReasonMap : EntityMap<TransportReason>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public TransportReasonMap()
|
||||
{
|
||||
ToTable("transport_reasons");
|
||||
Map(x => x.Code).MaxLength(10);
|
||||
Map(x => x.Description).MaxLength(100);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="InventoryReason"/> to <c>inventory_reasons</c>.</summary>
|
||||
public sealed class InventoryReasonMap : EntityMap<InventoryReason>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public InventoryReasonMap()
|
||||
{
|
||||
ToTable("inventory_reasons");
|
||||
Map(x => x.Code).MaxLength(10);
|
||||
Map(x => x.Description).MaxLength(100);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="Warehouse"/> to <c>warehouses</c>.</summary>
|
||||
public sealed class WarehouseMap : EntityMap<Warehouse>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public WarehouseMap()
|
||||
{
|
||||
ToTable("warehouses");
|
||||
Map(x => x.Code).MaxLength(10);
|
||||
Map(x => x.Description).MaxLength(100);
|
||||
Map(x => x.Address).MaxLength(200);
|
||||
Map(x => x.City).MaxLength(100);
|
||||
Map(x => x.ProvinceCode).MaxLength(2);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="ItemCategory"/> to <c>item_categories</c>.</summary>
|
||||
public sealed class ItemCategoryMap : EntityMap<ItemCategory>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public ItemCategoryMap()
|
||||
{
|
||||
ToTable("item_categories");
|
||||
Map(x => x.Code).MaxLength(20);
|
||||
Map(x => x.Description).MaxLength(100);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="PartyCategory"/> to <c>party_categories</c>.</summary>
|
||||
public sealed class PartyCategoryMap : EntityMap<PartyCategory>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public PartyCategoryMap()
|
||||
{
|
||||
ToTable("party_categories");
|
||||
Map(x => x.Code).MaxLength(10);
|
||||
Map(x => x.Description).MaxLength(100);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="PriceList"/> to <c>price_lists</c>.</summary>
|
||||
public sealed class PriceListMap : EntityMap<PriceList>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public PriceListMap()
|
||||
{
|
||||
ToTable("price_lists");
|
||||
Map(x => x.Code).MaxLength(10);
|
||||
Map(x => x.Description).MaxLength(100);
|
||||
Map(x => x.CurrencyCode).MaxLength(3);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="DiscountPolicy"/> to <c>discount_policies</c>.</summary>
|
||||
public sealed class DiscountPolicyMap : EntityMap<DiscountPolicy>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public DiscountPolicyMap()
|
||||
{
|
||||
ToTable("discount_policies");
|
||||
Map(x => x.Code).MaxLength(10);
|
||||
Map(x => x.Description).MaxLength(100);
|
||||
Map(x => x.Formula).MaxLength(60);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="DocumentNumerator"/> to <c>document_numerators</c>.</summary>
|
||||
public sealed class DocumentNumeratorMap : EntityMap<DocumentNumerator>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public DocumentNumeratorMap()
|
||||
{
|
||||
ToTable("document_numerators");
|
||||
Map(x => x.Code).MaxLength(10);
|
||||
Map(x => x.Description).MaxLength(100);
|
||||
Map(x => x.Section).MaxLength(10);
|
||||
Map(x => x.Prefix).MaxLength(10);
|
||||
Map(x => x.Format).MaxLength(60);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="DocumentType"/> to <c>document_types</c>.</summary>
|
||||
public sealed class DocumentTypeMap : EntityMap<DocumentType>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public DocumentTypeMap()
|
||||
{
|
||||
ToTable("document_types");
|
||||
Map(x => x.Code).MaxLength(10);
|
||||
Map(x => x.Description).MaxLength(100);
|
||||
Map(x => x.EInvoiceType).MaxLength(4);
|
||||
Map(x => x.JournalTemplateCode).MaxLength(10);
|
||||
Map(x => x.VatRegisterCode).MaxLength(10);
|
||||
Map(x => x.PrintTemplate).MaxLength(60);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="CostCenter"/> to <c>cost_centers</c>.</summary>
|
||||
public sealed class CostCenterMap : EntityMap<CostCenter>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public CostCenterMap()
|
||||
{
|
||||
ToTable("cost_centers");
|
||||
Map(x => x.Code).MaxLength(20);
|
||||
Map(x => x.Description).MaxLength(100);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Map of <see cref="Job"/> to <c>jobs</c>.</summary>
|
||||
public sealed class JobMap : EntityMap<Job>
|
||||
{
|
||||
/// <summary>Creates the map.</summary>
|
||||
public JobMap()
|
||||
{
|
||||
ToTable("jobs");
|
||||
Map(x => x.Code).MaxLength(20);
|
||||
Map(x => x.Description).MaxLength(100);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user