Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
refactor: migrations for multi-tenant - batch 10
Brad Barbin904a41c3ba13
diff --git a/apps/carbon/app/routes/onboarding+/company.tsx b/apps/carbon/app/routes/onboarding+/company.tsxindex de886e07ae..a3db1287da 100644--- a/apps/carbon/app/routes/onboarding+/company.tsx+++ b/apps/carbon/app/routes/onboarding+/company.tsx@@ -113,6 +113,12 @@ export async function action({ request }: ActionFunctionArgs) {throw new Error("Fatal: failed to get company ID");}+ const seed = await seedCompany(supabaseClient, companyId);+ if (seed.error) {+ logger.error(seed.error);+ throw new Error("Fatal: failed to seed company");+ }+const locationInsert = await upsertLocation(supabaseClient, {...data,name: "Headquarters",@@ -131,13 +137,12 @@ export async function action({ request }: ActionFunctionArgs) {throw new Error("Fatal: failed to get location ID");}- const [userToCompany, job, seed] = await Promise.all([+ const [userToCompany, job] = await Promise.all([addUserToCompany(supabaseClient, userId, companyId),insertEmployeeJob(supabaseClient, {id: userId,locationId,}),- seedCompany(supabaseClient, companyId),]);if (userToCompany.error) {@@ -149,11 +154,6 @@ export async function action({ request }: ActionFunctionArgs) {logger.error(job.error);throw new Error("Fatal: failed to insert job");}-- if (seed.error) {- logger.error(seed.error);- throw new Error("Fatal: failed to seed company");- }}throw redirect(next, {diff --git a/packages/database/supabase/functions/lib/seed.ts b/packages/database/supabase/functions/lib/seed.tsnew file mode 100644index 0000000000..ad478c49a5--- /dev/null+++ b/packages/database/supabase/functions/lib/seed.ts@@ -0,0 +1,2063 @@+export const customerStatuses = [+ "Active",+ "Inactive",+ "Lead",+ "On Hold",+ "Cancelled",+];++export const supplierStauses = ["Active", "Inactive", "Pending", "Rejected"];++export const paymentTerms = [+ {+ name: "Net 15",+ daysDue: 15,+ calculationMethod: "Net",+ daysDiscount: 0,+ discountPercentage: 0,+ createdBy: "system",+ },+ {+ name: "Net 30",+ daysDue: 30,+ calculationMethod: "Net",+ daysDiscount: 0,+ discountPercentage: 0,+ createdBy: "system",+ },+ {+ name: "Net 60",+ daysDue: 60,+ calculationMethod: "Net",+ daysDiscount: 0,+ discountPercentage: 0,+ createdBy: "system",+ },+ {+ name: "1% 10 Net 30",+ daysDue: 30,+ calculationMethod: "Net",+ daysDiscount: 10,+ discountPercentage: 1,+ createdBy: "system",+ },+ {+ name: "2% 10 Net 30",+ daysDue: 30,+ calculationMethod: "Net",+ daysDiscount: 10,+ discountPercentage: 2,+ createdBy: "system",+ },+ {+ name: "COD",+ daysDue: 0,+ calculationMethod: "Net",+ daysDiscount: 0,+ discountPercentage: 0,+ createdBy: "system",+ },+ {+ name: "Net EOM 10th",+ daysDue: 10,+ calculationMethod: "End of Month",+ daysDiscount: 0,+ discountPercentage: 0,+ createdBy: "system",+ },+];++export const unitOfMeasures = [+ {+ name: "Each",+ code: "EA",+ createdBy: "system",+ },+ {+ name: "Case",+ code: "CS",+ createdBy: "system",+ },+ {+ name: "Pack",+ code: "PK",+ createdBy: "system",+ },+ {+ name: "Pallet",+ code: "PL",+ createdBy: "system",+ },+ {+ name: "Roll",+ code: "RL",+ createdBy: "system",+ },+ {+ name: "Box",+ code: "BX",+ createdBy: "system",+ },+ {+ name: "Bag",+ code: "BG",+ createdBy: "system",+ },+ {+ name: "Drum",+ code: "DR",+ createdBy: "system",+ },+ {+ name: "Gallon",+ code: "GL",+ createdBy: "system",+ },+ {+ name: "Liter",+ code: "LT",+ createdBy: "system",+ },+ {+ name: "Ounce",+ code: "OZ",+ createdBy: "system",+ },+ {+ name: "Pound",+ code: "LB",+ createdBy: "system",+ },+ {+ name: "Ton",+ code: "TN",+ createdBy: "system",+ },+ {+ name: "Yard",+ code: "YD",+ createdBy: "system",+ },+ {+ name: "Meter",+ code: "MT",+ createdBy: "system",+ },+];++export const sequences = [+ {+ table: "purchaseOrder",+ name: "Purchase Order",+ prefix: "PO",+ suffix: null,+ next: 0,+ size: 6,+ step: 1,+ },+ {+ table: "purchaseInvoice",+ name: "Purchase Invoice",+ prefix: "AP",+ suffix: null,+ next: 0,+ size: 6,+ step: 1,+ },+ {+ table: "receipt",+ name: "Receipt",+ prefix: "RE",+ suffix: null,+ next: 0,+ size: 6,+ step: 1,+ },+ {+ table: "salesOrder",+ name: "Sales Order",+ prefix: "SO",+ suffix: null,+ next: 0,+ size: 6,+ step: 1,+ },+ {+ table: "salesInvoice",+ name: "Sales Invoice",+ prefix: "AR",+ suffix: null,+ next: 0,+ size: 6,+ step: 1,+ },+ {+ table: "requestForQuote",+ name: "Request For Quote",+ prefix: "RFQ",+ suffix: null,+ next: 0,+ size: 6,+ step: 1,+ },+];++export const currencies = [+ {+ name: "US Dollar",+ code: "USD",+ symbol: "$",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Canadian Dollar",+ code: "CAD",+ symbol: "CA$",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Euro",+ code: "EUR",+ symbol: "€",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "United Arab Emirates Dirham",+ code: "AED",+ symbol: "AED",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Afghan Afghani",+ code: "AFN",+ symbol: "Af",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Albanian Lek",+ code: "ALL",+ symbol: "ALL",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Armenian Dram",+ code: "AMD",+ symbol: "AMD",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Argentine Peso",+ code: "ARS",+ symbol: "AR$",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Australian Dollar",+ code: "AUD",+ symbol: "AU$",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Azerbaijani Manat",+ code: "AZN",+ symbol: "man.",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Bosnia-Herzegovina Convertible Mark",+ code: "BAM",+ symbol: "KM",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Bangladeshi Taka",+ code: "BDT",+ symbol: "Tk",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Bulgarian Lev",+ code: "BGN",+ symbol: "BGN",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Bahraini Dinar",+ code: "BHD",+ symbol: "BD",+ exchangeRate: 1,+ decimalPlaces: 3,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Burundian Franc",+ code: "BIF",+ symbol: "FBu",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Brunei Dollar",+ code: "BND",+ symbol: "BN$",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Bolivian Boliviano",+ code: "BOB",+ symbol: "Bs",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Brazilian Real",+ code: "BRL",+ symbol: "R$",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Botswanan Pula",+ code: "BWP",+ symbol: "BWP",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Belarusian Ruble",+ code: "BYN",+ symbol: "Br",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Belize Dollar",+ code: "BZD",+ symbol: "BZ$",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Congolese Franc",+ code: "CDF",+ symbol: "CDF",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Swiss Franc",+ code: "CHF",+ symbol: "CHF",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Chilean Peso",+ code: "CLP",+ symbol: "CL$",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Chinese Yuan",+ code: "CNY",+ symbol: "CN¥",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Colombian Peso",+ code: "COP",+ symbol: "CO$",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Costa Rican Colón",+ code: "CRC",+ symbol: "₡",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Cape Verdean Escudo",+ code: "CVE",+ symbol: "CV$",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Czech Republic Koruna",+ code: "CZK",+ symbol: "Kč",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Djiboutian Franc",+ code: "DJF",+ symbol: "Fdj",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Danish Krone",+ code: "DKK",+ symbol: "Dkr",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Dominican Peso",+ code: "DOP",+ symbol: "RD$",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Algerian Dinar",+ code: "DZD",+ symbol: "DA",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Egyptian Pound",+ code: "EGP",+ symbol: "EGP",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Eritrean Nakfa",+ code: "ERN",+ symbol: "Nfk",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Ethiopian Birr",+ code: "ETB",+ symbol: "Br",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "British Pound Sterling",+ code: "GBP",+ symbol: "£",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Georgian Lari",+ code: "GEL",+ symbol: "GEL",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Ghanaian Cedi",+ code: "GHS",+ symbol: "GH₵",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Guinean Franc",+ code: "GNF",+ symbol: "FG",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Guatemalan Quetzal",+ code: "GTQ",+ symbol: "GTQ",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Hong Kong Dollar",+ code: "HKD",+ symbol: "HK$",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Honduran Lempira",+ code: "HNL",+ symbol: "HNL",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Croatian Kuna",+ code: "HRK",+ symbol: "kn",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Hungarian Forint",+ code: "HUF",+ symbol: "Ft",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Indonesian Rupiah",+ code: "IDR",+ symbol: "Rp",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Israeli New Sheqel",+ code: "ILS",+ symbol: "₪",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Indian Rupee",+ code: "INR",+ symbol: "Rs",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Iraqi Dinar",+ code: "IQD",+ symbol: "IQD",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Iranian Rial",+ code: "IRR",+ symbol: "IRR",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Icelandic Króna",+ code: "ISK",+ symbol: "Ikr",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Jamaican Dollar",+ code: "JMD",+ symbol: "J$",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Jordanian Dinar",+ code: "JOD",+ symbol: "JD",+ exchangeRate: 1,+ decimalPlaces: 3,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Japanese Yen",+ code: "JPY",+ symbol: "¥",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Kenyan Shilling",+ code: "KES",+ symbol: "Ksh",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Cambodian Riel",+ code: "KHR",+ symbol: "KHR",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Comorian Franc",+ code: "KMF",+ symbol: "CF",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "South Korean Won",+ code: "KRW",+ symbol: "₩",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Kuwaiti Dinar",+ code: "KWD",+ symbol: "KD",+ exchangeRate: 1,+ decimalPlaces: 3,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Kazakhstani Tenge",+ code: "KZT",+ symbol: "KZT",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Lebanese Pound",+ code: "LBP",+ symbol: "L.L",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Sri Lankan Rupee",+ code: "LKR",+ symbol: "SLRs",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Lithuanian Litas",+ code: "LTL",+ symbol: "Lt",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Latvian Lats",+ code: "LVL",+ symbol: "Ls",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Libyan Dinar",+ code: "LYD",+ symbol: "LD",+ exchangeRate: 1,+ decimalPlaces: 3,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Moroccan Dirham",+ code: "MAD",+ symbol: "MAD",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Moldovan Leu",+ code: "MDL",+ symbol: "MDL",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Malagasy Ariary",+ code: "MGA",+ symbol: "MGA",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Macedonian Denar",+ code: "MKD",+ symbol: "MKD",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Myanma Kyat",+ code: "MMK",+ symbol: "MMK",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Macanese Pataca",+ code: "MOP",+ symbol: "MOP$",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Mauritian Rupee",+ code: "MUR",+ symbol: "MURs",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Mexican Peso",+ code: "MXN",+ symbol: "MX$",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Malaysian Ringgit",+ code: "MYR",+ symbol: "RM",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Mozambican Metical",+ code: "MZN",+ symbol: "MTn",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Namibian Dollar",+ code: "NAD",+ symbol: "N$",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Nigerian Naira",+ code: "NGN",+ symbol: "₦",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Nicaraguan Córdoba",+ code: "NIO",+ symbol: "C$",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Norwegian Krone",+ code: "NOK",+ symbol: "Nkr",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Nepalese Rupee",+ code: "NPR",+ symbol: "NPRs",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "New Zealand Dollar",+ code: "NZD",+ symbol: "NZ$",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Omani Rial",+ code: "OMR",+ symbol: "OMR",+ exchangeRate: 1,+ decimalPlaces: 3,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Panamanian Balboa",+ code: "PAB",+ symbol: "B/.",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Peruvian Nuevo Sol",+ code: "PEN",+ symbol: "S/.",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Philippine Peso",+ code: "PHP",+ symbol: "₱",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Pakistani Rupee",+ code: "PKR",+ symbol: "PKRs",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Polish Zloty",+ code: "PLN",+ symbol: "zł",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Paraguayan Guarani",+ code: "PYG",+ symbol: "₲",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Qatari Rial",+ code: "QAR",+ symbol: "QR",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Romanian Leu",+ code: "RON",+ symbol: "RON",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Serbian Dinar",+ code: "RSD",+ symbol: "din.",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Russian Ruble",+ code: "RUB",+ symbol: "RUB",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Rwandan Franc",+ code: "RWF",+ symbol: "RWF",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Saudi Riyal",+ code: "SAR",+ symbol: "SR",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Sudanese Pound",+ code: "SDG",+ symbol: "SDG",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Swedish Krona",+ code: "SEK",+ symbol: "Skr",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Singapore Dollar",+ code: "SGD",+ symbol: "S$",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Somali Shilling",+ code: "SOS",+ symbol: "Ssh",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Syrian Pound",+ code: "SYP",+ symbol: "SY£",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Thai Baht",+ code: "THB",+ symbol: "฿",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Tunisian Dinar",+ code: "TND",+ symbol: "DT",+ exchangeRate: 1,+ decimalPlaces: 3,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Tongan Paʻanga",+ code: "TOP",+ symbol: "T$",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Turkish Lira",+ code: "TRY",+ symbol: "TL",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Trinidad and Tobago Dollar",+ code: "TTD",+ symbol: "TT$",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "New Taiwan Dollar",+ code: "TWD",+ symbol: "NT$",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Tanzanian Shilling",+ code: "TZS",+ symbol: "TSh",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Ukrainian Hryvnia",+ code: "UAH",+ symbol: "₴",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Ugandan Shilling",+ code: "UGX",+ symbol: "USh",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Uruguayan Peso",+ code: "UYU",+ symbol: "$U",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Uzbekistan Som",+ code: "UZS",+ symbol: "UZS",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Venezuelan Bolívar",+ code: "VEF",+ symbol: "Bs.F",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Vietnamese Dong",+ code: "VND",+ symbol: "₫",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "CFA Franc BEAC",+ code: "XAF",+ symbol: "FCFA",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "CFA Franc BCEAO",+ code: "XOF",+ symbol: "CFA",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Yemeni Rial",+ code: "YER",+ symbol: "YR",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "South African Rand",+ code: "ZAR",+ symbol: "R",+ exchangeRate: 1,+ decimalPlaces: 2,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Zambian Kwacha",+ code: "ZMK",+ symbol: "ZK",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+ {+ name: "Zimbabwean Dollar",+ code: "ZWL",+ symbol: "ZWL$",+ exchangeRate: 1,+ decimalPlaces: 0,+ isBaseCurrency: false,+ createdBy: "system",+ },+];++export const accountCategories = [+ {+ category: "Bank",+ class: "Asset",+ incomeBalance: "Balance Sheet",+ createdBy: "system",+ },+ {+ category: "Accounts Receivable",+ class: "Asset",+ incomeBalance: "Balance Sheet",+ createdBy: "system",+ },+ {+ category: "Inventory",+ class: "Asset",+ incomeBalance: "Balance Sheet",+ createdBy: "system",+ },+ {+ category: "Other Current Asset",+ class: "Asset",+ incomeBalance: "Balance Sheet",+ createdBy: "system",+ },+ {+ category: "Fixed Asset",+ class: "Asset",+ incomeBalance: "Balance Sheet",+ createdBy: "system",+ },+ {+ category: "Accumulated Depreciation",+ class: "Asset",+ incomeBalance: "Balance Sheet",+ createdBy: "system",+ },+ {+ category: "Other Asset",+ class: "Asset",+ incomeBalance: "Balance Sheet",+ createdBy: "system",+ },+ {+ category: "Accounts Payable",+ class: "Liability",+ incomeBalance: "Balance Sheet",+ createdBy: "system",+ },+ {+ category: "Other Current Liability",+ class: "Liability",+ incomeBalance: "Balance Sheet",+ createdBy: "system",+ },+ {+ category: "Long Term Liability",+ class: "Liability",+ incomeBalance: "Balance Sheet",+ createdBy: "system",+ },+ {+ category: "Equity - No Close",+ class: "Equity",+ incomeBalance: "Balance Sheet",+ createdBy: "system",+ },+ {+ category: "Equity - Close",+ class: "Equity",+ incomeBalance: "Balance Sheet",+ createdBy: "system",+ },+ {+ category: "Retained Earnings",+ class: "Equity",+ incomeBalance: "Balance Sheet",+ createdBy: "system",+ },+ {+ category: "Income",+ class: "Revenue",+ incomeBalance: "Income Statement",+ createdBy: "system",+ },+ {+ category: "Cost of Goods Sold",+ class: "Expense",+ incomeBalance: "Income Statement",+ createdBy: "system",+ },+ {+ category: "Expense",+ class: "Expense",+ incomeBalance: "Income Statement",+ createdBy: "system",+ },+ {+ category: "Other Income",+ class: "Expense",+ incomeBalance: "Income Statement",+ createdBy: "system",+ },+ {+ category: "Other Expense",+ class: "Expense",+ incomeBalance: "Income Statement",+ createdBy: "system",+ },+];++export const accounts = [+ {+ number: "10000",+ name: "Income Statement",+ type: "Begin Total",+ accountCategory: "Income",+ incomeBalance: "Income Statement",+ class: null,+ directPosting: false,+ createdBy: "system",+ },+ {+ number: "11000",+ name: "Revenue",+ type: "Begin Total",+ accountCategory: "Income",+ incomeBalance: "Income Statement",+ class: "Revenue",+ directPosting: false,+ createdBy: "system",+ },+ {+ number: "11210",+ name: "Sales",+ type: "Posting",+ accountCategory: "Income",+ incomeBalance: "Income Statement",+ class: "Revenue",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "11600",+ name: "Sales Discounts",+ type: "Posting",+ accountCategory: "Income",+ incomeBalance: "Income Statement",+ class: "Revenue",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "19999",+ name: "Revenue, Total",+ type: "End Total",+ accountCategory: "Income",+ incomeBalance: "Income Statement",+ class: "Revenue",+ directPosting: false,+ createdBy: "system",+ },+ {+ number: "20000",+ name: "Costs of Goods Sold",+ type: "Begin Total",+ accountCategory: "Cost of Goods Sold",+ incomeBalance: "Income Statement",+ class: "Expense",+ directPosting: false,+ createdBy: "system",+ },+ {+ number: "21210",+ name: "Cost of Goods Sold",+ type: "Posting",+ accountCategory: "Cost of Goods Sold",+ incomeBalance: "Income Statement",+ class: "Expense",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "21410",+ name: "Purchases",+ type: "Posting",+ accountCategory: "Cost of Goods Sold",+ incomeBalance: "Income Statement",+ class: "Expense",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "21590",+ name: "Direct Cost Applied",+ type: "Posting",+ accountCategory: "Cost of Goods Sold",+ incomeBalance: "Income Statement",+ class: "Expense",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "21600",+ name: "Overhead Applied",+ type: "Posting",+ accountCategory: "Cost of Goods Sold",+ incomeBalance: "Income Statement",+ class: "Expense",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "21610",+ name: "Purchase Variance",+ type: "Posting",+ accountCategory: "Cost of Goods Sold",+ incomeBalance: "Income Statement",+ class: "Expense",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "21700",+ name: "Inventory Adjustment",+ type: "Posting",+ accountCategory: "Cost of Goods Sold",+ incomeBalance: "Income Statement",+ class: "Expense",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "24999",+ name: "Costs of Goods Sold, Total",+ type: "End Total",+ accountCategory: "Expense",+ incomeBalance: "Income Statement",+ class: "Expense",+ directPosting: false,+ createdBy: "system",+ },+ {+ number: "25000",+ name: "Direct Capacity Cost",+ type: "Begin Total",+ accountCategory: "Expense",+ incomeBalance: "Income Statement",+ class: "Expense",+ directPosting: false,+ createdBy: "system",+ },+ {+ number: "25705",+ name: "Material Variance",+ type: "Posting",+ accountCategory: "Expense",+ incomeBalance: "Income Statement",+ class: "Expense",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "25710",+ name: "Capacity Variance",+ type: "Posting",+ accountCategory: "Expense",+ incomeBalance: "Income Statement",+ class: "Expense",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "25720",+ name: "Overhead Accounts",+ type: "Posting",+ accountCategory: "Expense",+ incomeBalance: "Income Statement",+ class: "Expense",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "47045",+ name: "Maintenance Expense",+ type: "Posting",+ accountCategory: "Expense",+ incomeBalance: "Income Statement",+ class: "Expense",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "49999",+ name: "Direct Capacity Cost, Total",+ type: "End Total",+ accountCategory: "Expense",+ incomeBalance: "Income Statement",+ class: "Expense",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "50000",+ name: "Depreciation of Fixed Assets",+ type: "Begin Total",+ accountCategory: "Other Expense",+ incomeBalance: "Income Statement",+ class: "Expense",+ directPosting: false,+ createdBy: "system",+ },+ {+ number: "50015",+ name: "Depreciation Expense",+ type: "Posting",+ accountCategory: "Other Expense",+ incomeBalance: "Income Statement",+ class: "Expense",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "50040",+ name: "Gains and Losses on Disposal",+ type: "Posting",+ accountCategory: "Other Expense",+ incomeBalance: "Income Statement",+ class: "Expense",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "50045",+ name: "Service Charge Account",+ type: "Posting",+ accountCategory: "Other Expense",+ incomeBalance: "Income Statement",+ class: "Expense",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "50999",+ name: "Depreciation of Fixed Assets, Total",+ type: "End Total",+ accountCategory: "Other Expense",+ incomeBalance: "Income Statement",+ class: "Expense",+ directPosting: false,+ createdBy: "system",+ },+ {+ number: "51000",+ name: "Interest",+ type: "Begin Total",+ accountCategory: "Other Expense",+ incomeBalance: "Income Statement",+ class: "Expense",+ directPosting: false,+ createdBy: "system",+ },+ {+ number: "51110",+ name: "Interest Account",+ type: "Posting",+ accountCategory: "Other Expense",+ incomeBalance: "Income Statement",+ class: "Expense",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "51115",+ name: "Supplier Payment Discounts",+ type: "Posting",+ accountCategory: "Other Expense",+ incomeBalance: "Income Statement",+ class: "Expense",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "51120",+ name: "Customer Payment Discounts",+ type: "Posting",+ accountCategory: "Other Expense",+ incomeBalance: "Income Statement",+ class: "Expense",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "51235",+ name: "Rounding Account",+ type: "Posting",+ accountCategory: "Other Expense",+ incomeBalance: "Income Statement",+ class: "Expense",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "51999",+ name: "Interest, Total",+ type: "End Total",+ accountCategory: "Other Expense",+ incomeBalance: "Income Statement",+ class: "Expense",+ directPosting: false,+ createdBy: "system",+ },+ {+ number: "79999",+ name: "Income Statement, Total",+ type: "Total",+ accountCategory: "Income",+ incomeBalance: "Income Statement",+ class: null,+ directPosting: false,+ createdBy: "system",+ },+ {+ number: "80000",+ name: "Balance Sheet",+ type: "Begin Total",+ incomeBalance: "Balance Sheet",+ accountCategory: null,+ directPosting: false,+ createdBy: "system",+ },+ {+ number: "80001",+ name: "Assets",+ type: "Begin Total",+ accountCategory: null,+ incomeBalance: "Balance Sheet",+ class: "Asset",+ directPosting: false,+ createdBy: "system",+ },+ {+ number: "81000",+ name: "Fixed Assets",+ type: "Begin Total",+ accountCategory: null,+ incomeBalance: "Balance Sheet",+ class: "Asset",+ directPosting: false,+ createdBy: "system",+ },+ {+ number: "81010",+ name: "Fixed Asset Acquisition Cost",+ type: "Posting",+ accountCategory: "Fixed Asset",+ incomeBalance: "Balance Sheet",+ class: "Asset",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "81015",+ name: "Fixed Asset Acquisition Cost on Disposal",+ type: "Posting",+ accountCategory: "Fixed Asset",+ incomeBalance: "Balance Sheet",+ class: "Asset",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "81020",+ name: "Accumulated Depreciation",+ type: "Posting",+ accountCategory: "Accumulated Depreciation",+ incomeBalance: "Balance Sheet",+ class: "Asset",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "81030",+ name: "Fixed Asset Acquisition Depreciation on Disposal",+ type: "Posting",+ accountCategory: "Accumulated Depreciation",+ incomeBalance: "Balance Sheet",+ class: "Asset",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "81999",+ name: "Fixed Assets, Total",+ type: "End Total",+ accountCategory: null,+ incomeBalance: "Balance Sheet",+ class: "Asset",+ directPosting: false,+ createdBy: "system",+ },+ {+ number: "83000",+ name: "Current Assets",+ type: "Begin Total",+ accountCategory: null,+ incomeBalance: "Balance Sheet",+ class: "Asset",+ directPosting: false,+ createdBy: "system",+ },+ {+ number: "83105",+ name: "Inventory",+ type: "Posting",+ accountCategory: "Inventory",+ incomeBalance: "Balance Sheet",+ class: "Asset",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "83120",+ name: "Inventory Interim",+ type: "Posting",+ accountCategory: "Inventory",+ incomeBalance: "Balance Sheet",+ class: "Asset",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "83125",+ name: "Work In Progress (WIP)",+ type: "Posting",+ accountCategory: "Inventory",+ incomeBalance: "Balance Sheet",+ class: "Asset",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "85005",+ name: "Receivables",+ type: "Posting",+ accountCategory: "Accounts Receivable",+ incomeBalance: "Balance Sheet",+ class: "Asset",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "85020",+ name: "Inventory Invoiced Not Received",+ type: "Posting",+ accountCategory: "Accounts Receivable",+ incomeBalance: "Balance Sheet",+ class: "Asset",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "86005",+ name: "Bank - Cash",+ type: "Posting",+ accountCategory: "Bank",+ incomeBalance: "Balance Sheet",+ class: "Asset",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "86010",+ name: "Bank - Local Currency",+ type: "Posting",+ accountCategory: "Bank",+ incomeBalance: "Balance Sheet",+ class: "Asset",+ directPosting: false,+ createdBy: "system",+ },+ {+ number: "86015",+ name: "Bank - Foreign Currency",+ type: "Posting",+ accountCategory: "Bank",+ incomeBalance: "Balance Sheet",+ class: "Asset",+ directPosting: false,+ createdBy: "system",+ },+ {+ number: "87999",+ name: "Current Assets, Total",+ type: "End Total",+ accountCategory: null,+ incomeBalance: "Balance Sheet",+ class: "Asset",+ directPosting: false,+ createdBy: "system",+ },+ {+ number: "89999",+ name: "Assets, Total",+ type: "End Total",+ accountCategory: null,+ incomeBalance: "Balance Sheet",+ class: "Asset",+ directPosting: false,+ createdBy: "system",+ },+ {+ number: "90000",+ name: "Liabilities",+ type: "Begin Total",+ accountCategory: null,+ incomeBalance: "Balance Sheet",+ class: "Liability",+ directPosting: false,+ createdBy: "system",+ },+ {+ number: "92210",+ name: "Customer Prepayments",+ type: "Posting",+ accountCategory: "Other Current Liability",+ incomeBalance: "Balance Sheet",+ class: "Liability",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "93005",+ name: "Payables",+ type: "Posting",+ accountCategory: "Accounts Payable",+ incomeBalance: "Balance Sheet",+ class: "Liability",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "93010",+ name: "Inventory Received Not Invoiced",+ type: "Posting",+ accountCategory: "Other Current Liability",+ incomeBalance: "Balance Sheet",+ class: "Liability",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "93110",+ name: "Inventory Shipped Not Invoiced",+ type: "Posting",+ accountCategory: "Other Current Liability",+ incomeBalance: "Balance Sheet",+ class: "Liability",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "94100",+ name: "Sales Tax Payable",+ type: "Posting",+ accountCategory: "Other Current Liability",+ incomeBalance: "Balance Sheet",+ class: "Liability",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "94110",+ name: "Purchase Tax Payable",+ type: "Posting",+ accountCategory: "Other Current Liability",+ incomeBalance: "Balance Sheet",+ class: "Liability",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "94115",+ name: "Reverse Charge Tax Payable",+ type: "Posting",+ accountCategory: "Other Current Liability",+ incomeBalance: "Balance Sheet",+ class: "Liability",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "94999",+ name: "Liabilities, Total",+ type: "End Total",+ accountCategory: null,+ incomeBalance: "Balance Sheet",+ class: "Liability",+ directPosting: false,+ createdBy: "system",+ },+ {+ number: "95000",+ name: "Equity",+ type: "Begin Total",+ accountCategory: null,+ incomeBalance: "Balance Sheet",+ class: "Equity",+ directPosting: false,+ createdBy: "system",+ },+ {+ number: "95010",+ name: "Retained Earnings",+ type: "Posting",+ accountCategory: "Retained Earnings",+ incomeBalance: "Balance Sheet",+ class: "Equity",+ directPosting: false,+ createdBy: "system",+ },+ {+ number: "96010",+ name: "Owner Equity",+ type: "Posting",+ accountCategory: "Equity - No Close",+ incomeBalance: "Balance Sheet",+ class: "Equity",+ directPosting: true,+ createdBy: "system",+ },+ {+ number: "96999",+ name: "Equity, Total",+ type: "End Total",+ accountCategory: null,+ incomeBalance: "Balance Sheet",+ class: "Equity",+ directPosting: false,+ createdBy: "system",+ },+ {+ number: "99999",+ name: "Balance Sheet, Total",+ type: "Total",+ accountCategory: null,+ incomeBalance: "Balance Sheet",+ class: null,+ directPosting: false,+ createdBy: "system",+ },+];++const accountDefaults = {+ salesAccount: "11210",+ salesDiscountAccount: "11600",+ costOfGoodsSoldAccount: "21210",+ purchaseAccount: "21410",+ directCostAppliedAccount: "21590",+ overheadCostAppliedAccount: "21600",+ purchaseVarianceAccount: "21610",+ inventoryAdjustmentVarianceAccount: "21700",+ materialVarianceAccount: "25705",+ capacityVarianceAccount: "25710",+ overheadAccount: "25720",+ maintenanceAccount: "47045",+ assetDepreciationExpenseAccount: "50015",+ assetGainsAndLossesAccount: "50040",+ serviceChargeAccount: "50045",+ interestAccount: "51110",+ supplierPaymentDiscountAccount: "51115",+ customerPaymentDiscountAccount: "51120",+ roundingAccount: "51235",+ assetAquisitionCostAccount: "81010",+ assetAquisitionCostOnDisposalAccount: "81015",+ accumulatedDepreciationAccount: "81020",+ accumulatedDepreciationOnDisposalAccount: "81030",+ inventoryAccount: "83105",+ inventoryInterimAccrualAccount: "83120",+ workInProgressAccount: "83125",+ receivablesAccount: "85005",+ inventoryInvoicedNotReceivedAccount: "85020",+ bankCashAccount: "86005",+ bankLocalCurrencyAccount: "86010",+ bankForeignCurrencyAccount: "86015",+ prepaymentAccount: "92210",+ payablesAccount: "93005",+ inventoryReceivedNotInvoicedAccount: "93010",+ inventoryShippedNotInvoicedAccount: "93110",+ salesTaxPayableAccount: "94100",+ purchaseTaxPayableAccount: "94110",+ reverseChargeSalesTaxPayableAccount: "94115",+ retainedEarningsAccount: "95010",+};diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.tsindex 420621b60b..0690980d04 100644--- a/packages/database/supabase/functions/lib/types.ts+++ b/packages/database/supabase/functions/lib/types.ts@@ -37,6 +37,7 @@ export type Database = {ability: {Row: {active: boolean+ companyId: numbercreatedAt: stringcreatedBy: stringcurve: Json@@ -48,6 +49,7 @@ export type Database = {}Insert: {active?: boolean+ companyId: numbercreatedAt?: stringcreatedBy: stringcurve?: Json@@ -59,6 +61,7 @@ export type Database = {}Update: {active?: boolean+ companyId?: numbercreatedAt?: stringcreatedBy?: stringcurve?: Json@@ -69,6 +72,13 @@ export type Database = {updatedBy?: string | null}Relationships: [+ {+ foreignKeyName: "abilities_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "abilities_createdBy_fkey"columns: ["createdBy"]@@ -133,6 +143,7 @@ export type Database = {accountSubcategoryId: string | nullactive: booleanclass: Database["public"]["Enums"]["glAccountClass"] | null+ companyId: numberconsolidatedRate:| Database["public"]["Enums"]["glConsolidatedRate"]| null@@ -153,6 +164,7 @@ export type Database = {accountSubcategoryId?: string | nullactive?: booleanclass?: Database["public"]["Enums"]["glAccountClass"] | null+ companyId: numberconsolidatedRate?:| Database["public"]["Enums"]["glConsolidatedRate"]| null@@ -173,6 +185,7 @@ export type Database = {accountSubcategoryId?: string | nullactive?: booleanclass?: Database["public"]["Enums"]["glAccountClass"] | null+ companyId?: numberconsolidatedRate?:| Database["public"]["Enums"]["glConsolidatedRate"]| null@@ -203,6 +216,13 @@ export type Database = {referencedRelation: "accountCategory"referencedColumns: ["id"]},+ {+ foreignKeyName: "account_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "account_createdBy_fkey"columns: ["createdBy"]@@ -265,6 +285,7 @@ export type Database = {Row: {category: stringclass: Database["public"]["Enums"]["glAccountClass"]+ companyId: numbercreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -276,6 +297,7 @@ export type Database = {Insert: {category: stringclass: Database["public"]["Enums"]["glAccountClass"]+ companyId: numbercreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -287,6 +309,7 @@ export type Database = {Update: {category?: stringclass?: Database["public"]["Enums"]["glAccountClass"]+ companyId?: numbercreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -296,6 +319,13 @@ export type Database = {updatedBy?: string | null}Relationships: [+ {+ foreignKeyName: "accountCategory_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "accountCategory_createdBy_fkey"columns: ["createdBy"]@@ -1532,6 +1562,7 @@ export type Database = {contractor: {Row: {active: boolean+ companyId: numbercreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -1542,6 +1573,7 @@ export type Database = {}Insert: {active?: boolean+ companyId: numbercreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -1552,6 +1584,7 @@ export type Database = {}Update: {active?: boolean+ companyId?: numbercreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -1561,6 +1594,13 @@ export type Database = {updatedBy?: string | null}Relationships: [+ {+ foreignKeyName: "contractor_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "contractor_createdBy_fkey"columns: ["createdBy"]@@ -1774,30 +1814,73 @@ export type Database = {}crew: {Row: {+ companyId: number+ createdAt: string+ createdBy: stringcrewLeaderId: string | nulldescription: string | nullgroupId: stringid: stringname: string+ updatedAt: string | null+ updatedBy: string | nullworkCellId: string | null}Insert: {+ companyId: number+ createdAt?: string+ createdBy: stringcrewLeaderId?: string | nulldescription?: string | nullgroupId: stringid?: stringname: string+ updatedAt?: string | null+ updatedBy?: string | nullworkCellId?: string | null}Update: {+ companyId?: number+ createdAt?: string+ createdBy?: stringcrewLeaderId?: string | nulldescription?: string | nullgroupId?: stringid?: stringname?: string+ updatedAt?: string | null+ updatedBy?: string | nullworkCellId?: string | null}Relationships: [+ {+ foreignKeyName: "crew_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "crew_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "crew_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "crew_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },{foreignKeyName: "crew_crewLeaderId_fkey"columns: ["crewLeaderId"]@@ -1833,6 +1916,34 @@ export type Database = {referencedRelation: "group"referencedColumns: ["id"]},+ {+ foreignKeyName: "crew_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "crew_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "crew_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "crew_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },{foreignKeyName: "crew_workCellId_fkey"columns: ["workCellId"]@@ -1882,6 +1993,7 @@ export type Database = {Row: {active: booleancode: string+ companyId: numbercreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -1897,6 +2009,7 @@ export type Database = {Insert: {active?: booleancode: string+ companyId: numbercreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -1912,6 +2025,7 @@ export type Database = {Update: {active?: booleancode?: string+ companyId?: numbercreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -1925,6 +2039,13 @@ export type Database = {updatedBy?: string | null}Relationships: [+ {+ foreignKeyName: "currency_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "currency_updatedBy_fkey"columns: ["updatedBy"]@@ -2971,6 +3092,7 @@ export type Database = {}department: {Row: {+ companyId: numbercreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -2981,6 +3103,7 @@ export type Database = {updatedBy: string | null}Insert: {+ companyId: numbercreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -2991,6 +3114,7 @@ export type Database = {updatedBy?: string | null}Update: {+ companyId?: numbercreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -3001,6 +3125,13 @@ export type Database = {updatedBy?: string | null}Relationships: [+ {+ foreignKeyName: "department_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "department_parentDepartmentId_fkey"columns: ["parentDepartmentId"]@@ -3746,6 +3877,7 @@ export type Database = {Row: {active: booleanactiveDate: string | null+ companyId: numbercreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -3763,6 +3895,7 @@ export type Database = {Insert: {active?: booleanactiveDate?: string | null+ companyId: numbercreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -3780,6 +3913,7 @@ export type Database = {Update: {active?: booleanactiveDate?: string | null+ companyId?: numbercreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -3795,6 +3929,13 @@ export type Database = {workCellId?: string | null}Relationships: [+ {+ foreignKeyName: "equipment_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "equipment_createdBy_fkey"columns: ["createdBy"]@@ -3898,6 +4039,7 @@ export type Database = {equipmentType: {Row: {active: boolean+ companyId: numbercreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -3911,6 +4053,7 @@ export type Database = {}Insert: {active?: boolean+ companyId: numbercreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -3924,6 +4067,7 @@ export type Database = {}Update: {active?: boolean+ companyId?: numbercreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -3936,6 +4080,13 @@ export type Database = {updatedBy?: string | null}Relationships: [+ {+ foreignKeyName: "equipmentType_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "equipmentType_createdBy_fkey"columns: ["createdBy"]@@ -4124,6 +4275,7 @@ export type Database = {}holiday: {Row: {+ companyId: numbercreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -4135,6 +4287,7 @@ export type Database = {year: number | null}Insert: {+ companyId: numbercreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -4146,6 +4299,7 @@ export type Database = {year?: number | null}Update: {+ companyId?: numbercreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -4157,6 +4311,13 @@ export type Database = {year?: number | null}Relationships: [+ {+ foreignKeyName: "holiday_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "holiday_createdBy_fkey"columns: ["createdBy"]@@ -4525,6 +4686,7 @@ export type Database = {note: {Row: {active: boolean+ companyId: numbercreatedAt: stringcreatedBy: stringdocumentId: string@@ -4535,6 +4697,7 @@ export type Database = {}Insert: {active?: boolean+ companyId: numbercreatedAt?: stringcreatedBy: stringdocumentId: string@@ -4545,6 +4708,7 @@ export type Database = {}Update: {active?: boolean+ companyId?: numbercreatedAt?: stringcreatedBy?: stringdocumentId?: string@@ -4554,6 +4718,13 @@ export type Database = {updatedAt?: string | null}Relationships: [+ {+ foreignKeyName: "notes_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "notes_createdBy_fkey"columns: ["createdBy"]@@ -4792,6 +4963,7 @@ export type Database = {}partCost: {Row: {+ companyId: numbercostingMethod: Database["public"]["Enums"]["partCostingMethod"]costIsAdjusted: booleancreatedAt: string@@ -4804,6 +4976,7 @@ export type Database = {updatedBy: string | null}Insert: {+ companyId: numbercostingMethod: Database["public"]["Enums"]["partCostingMethod"]costIsAdjusted?: booleancreatedAt?: string@@ -4816,6 +4989,7 @@ export type Database = {updatedBy?: string | null}Update: {+ companyId?: numbercostingMethod?: Database["public"]["Enums"]["partCostingMethod"]costIsAdjusted?: booleancreatedAt?: string@@ -4828,6 +5002,13 @@ export type Database = {updatedBy?: string | null}Relationships: [+ {+ foreignKeyName: "partCost_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "partCost_partId_fkey"columns: ["partId"]@@ -4910,6 +5091,7 @@ export type Database = {partGroup: {Row: {active: boolean+ companyId: numbercreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -4921,6 +5103,7 @@ export type Database = {}Insert: {active?: boolean+ companyId: numbercreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -4932,6 +5115,7 @@ export type Database = {}Update: {active?: boolean+ companyId?: numbercreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -4942,6 +5126,13 @@ export type Database = {updatedBy?: string | null}Relationships: [+ {+ foreignKeyName: "partGroup_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "partGroup_createdBy_fkey"columns: ["createdBy"]@@ -5258,6 +5449,7 @@ export type Database = {Row: {abilityId: stringactive: boolean+ companyId: numbercreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -5269,6 +5461,7 @@ export type Database = {Insert: {abilityId: stringactive?: boolean+ companyId: numbercreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -5280,6 +5473,7 @@ export type Database = {Update: {abilityId?: stringactive?: boolean+ companyId?: numbercreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -5296,6 +5490,13 @@ export type Database = {referencedRelation: "ability"referencedColumns: ["id"]},+ {+ foreignKeyName: "partner_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "partner_createdBy_fkey"columns: ["createdBy"]@@ -5729,6 +5930,7 @@ export type Database = {partSupplier: {Row: {active: boolean+ companyId: numberconversionFactor: numbercreatedAt: stringcreatedBy: string@@ -5745,6 +5947,7 @@ export type Database = {}Insert: {active?: boolean+ companyId: numberconversionFactor?: numbercreatedAt?: stringcreatedBy: string@@ -5761,6 +5964,7 @@ export type Database = {}Update: {active?: boolean+ companyId?: numberconversionFactor?: numbercreatedAt?: stringcreatedBy?: string@@ -5776,6 +5980,13 @@ export type Database = {updatedBy?: string | null}Relationships: [+ {+ foreignKeyName: "partSupplier_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "partSupplier_createdBy_fkey"columns: ["createdBy"]@@ -5974,10 +6185,10 @@ export type Database = {},{foreignKeyName: "partUnitSalePrice_currencyCode_fkey"- columns: ["currencyCode"]+ columns: ["currencyCode", "companyId"]isOneToOne: falsereferencedRelation: "currency"- referencedColumns: ["code"]+ referencedColumns: ["code", "companyId"]},{foreignKeyName: "partUnitSalePrice_partId_fkey"@@ -6808,6 +7019,7 @@ export type Database = {Row: {assignee: string | nullbalance: number+ companyId: numbercreatedAt: stringcreatedBy: stringcurrencyCode: string@@ -6836,6 +7048,7 @@ export type Database = {Insert: {assignee?: string | nullbalance?: number+ companyId: numbercreatedAt?: stringcreatedBy: stringcurrencyCode: string@@ -6864,6 +7077,7 @@ export type Database = {Update: {assignee?: string | nullbalance?: number+ companyId?: numbercreatedAt?: stringcreatedBy?: stringcurrencyCode?: string@@ -6918,6 +7132,13 @@ export type Database = {referencedRelation: "userDefaults"referencedColumns: ["userId"]},+ {+ foreignKeyName: "purchaseInvoice_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "purchaseInvoice_createdBy_fkey"columns: ["createdBy"]@@ -6948,10 +7169,10 @@ export type Database = {},{foreignKeyName: "purchaseInvoice_currencyCode_fkey"- columns: ["currencyCode"]+ columns: ["currencyCode", "companyId"]isOneToOne: falsereferencedRelation: "currency"- referencedColumns: ["code"]+ referencedColumns: ["code", "companyId"]},{foreignKeyName: "purchaseInvoice_invoiceSupplierContactId_fkey"@@ -7211,10 +7432,10 @@ export type Database = {},{foreignKeyName: "purchaseInvoiceLines_currencyCode_fkey"- columns: ["currencyCode"]+ columns: ["currencyCode", "companyId"]isOneToOne: falsereferencedRelation: "currency"- referencedColumns: ["code"]+ referencedColumns: ["code", "companyId"]},{foreignKeyName: "purchaseInvoiceLines_inventoryUnitOfMeasureCode_fkey"@@ -7543,6 +7764,7 @@ export type Database = {assignee: string | nullclosedAt: string | nullclosedBy: string | null+ companyId: numbercreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -7564,6 +7786,7 @@ export type Database = {assignee?: string | nullclosedAt?: string | nullclosedBy?: string | null+ companyId: numbercreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -7585,6 +7808,7 @@ export type Database = {assignee?: string | nullclosedAt?: string | nullclosedBy?: string | null+ companyId?: numbercreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -7659,6 +7883,13 @@ export type Database = {referencedRelation: "userDefaults"referencedColumns: ["userId"]},+ {+ foreignKeyName: "purchaseOrder_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "purchaseOrder_createdBy_fkey"columns: ["createdBy"]@@ -7768,6 +7999,7 @@ export type Database = {}purchaseOrderDelivery: {Row: {+ companyId: numbercustomerId: string | nullcustomerLocationId: string | nullcustomFields: Json | null@@ -7785,6 +8017,7 @@ export type Database = {updatedBy: string | null}Insert: {+ companyId: numbercustomerId?: string | nullcustomerLocationId?: string | nullcustomFields?: Json | null@@ -7802,6 +8035,7 @@ export type Database = {updatedBy?: string | null}Update: {+ companyId?: numbercustomerId?: string | nullcustomerLocationId?: string | nullcustomFields?: Json | null@@ -8251,6 +8485,7 @@ export type Database = {}purchaseOrderPayment: {Row: {+ companyId: numbercurrencyCode: stringcustomFields: Json | nullid: string@@ -8263,6 +8498,7 @@ export type Database = {updatedBy: string | null}Insert: {+ companyId: numbercurrencyCode?: stringcustomFields?: Json | nullid: string@@ -8275,6 +8511,7 @@ export type Database = {updatedBy?: string | null}Update: {+ companyId?: numbercurrencyCode?: stringcustomFields?: Json | nullid?: string@@ -8289,10 +8526,10 @@ export type Database = {Relationships: [{foreignKeyName: "purchaseOrderPayment_currencyCode_fkey"- columns: ["currencyCode"]+ columns: ["currencyCode", "companyId"]isOneToOne: falsereferencedRelation: "currency"- referencedColumns: ["code"]+ referencedColumns: ["code", "companyId"]},{foreignKeyName: "purchaseOrderPayment_id_fkey"@@ -8523,6 +8760,7 @@ export type Database = {}purchasePayment: {Row: {+ companyId: numbercreatedAt: stringcreatedBy: stringcurrencyCode: string@@ -8537,6 +8775,7 @@ export type Database = {updatedBy: string | null}Insert: {+ companyId: numbercreatedAt?: stringcreatedBy: stringcurrencyCode: string@@ -8551,6 +8790,7 @@ export type Database = {updatedBy?: string | null}Update: {+ companyId?: numbercreatedAt?: stringcreatedBy?: stringcurrencyCode?: string@@ -8565,6 +8805,13 @@ export type Database = {updatedBy?: string | null}Relationships: [+ {+ foreignKeyName: "purchasePayment_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "purchasePayment_createdBy_fkey"columns: ["createdBy"]@@ -8595,10 +8842,10 @@ export type Database = {},{foreignKeyName: "purchasePayment_currencyCode_fkey"- columns: ["currencyCode"]+ columns: ["currencyCode", "companyId"]isOneToOne: falsereferencedRelation: "currency"- referencedColumns: ["code"]+ referencedColumns: ["code", "companyId"]},{foreignKeyName: "purchasePayment_supplierId_fkey"@@ -10851,6 +11098,7 @@ export type Database = {assignee: string | nullclosedAt: string | nullclosedBy: string | null+ companyId: numbercreatedAt: stringcreatedBy: stringcustomerContactId: string | null@@ -10872,6 +11120,7 @@ export type Database = {assignee?: string | nullclosedAt?: string | nullclosedBy?: string | null+ companyId: numbercreatedAt?: stringcreatedBy: stringcustomerContactId?: string | null@@ -10893,6 +11142,7 @@ export type Database = {assignee?: string | nullclosedAt?: string | nullclosedBy?: string | null+ companyId?: numbercreatedAt?: stringcreatedBy?: stringcustomerContactId?: string | null@@ -10967,6 +11217,13 @@ export type Database = {referencedRelation: "userDefaults"referencedColumns: ["userId"]},+ {+ foreignKeyName: "salesOrder_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "salesOrder_createdBy_fkey"columns: ["createdBy"]@@ -11365,6 +11622,7 @@ export type Database = {}salesOrderPayment: {Row: {+ companyId: numbercurrencyCode: stringcustomFields: Json | nullid: string@@ -11377,6 +11635,7 @@ export type Database = {updatedBy: string | null}Insert: {+ companyId: numbercurrencyCode?: stringcustomFields?: Json | nullid: string@@ -11389,6 +11648,7 @@ export type Database = {updatedBy?: string | null}Update: {+ companyId?: numbercurrencyCode?: stringcustomFields?: Json | nullid?: string@@ -11401,12 +11661,19 @@ export type Database = {updatedBy?: string | null}Relationships: [+ {+ foreignKeyName: "salesOrderPayment_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "salesOrderPayment_currencyCode_fkey"- columns: ["currencyCode"]+ columns: ["currencyCode", "companyId"]isOneToOne: falsereferencedRelation: "currency"- referencedColumns: ["code"]+ referencedColumns: ["code", "companyId"]},{foreignKeyName: "salesOrderPayment_id_fkey"@@ -11469,6 +11736,7 @@ export type Database = {salesOrderShipment: {Row: {assignee: string | null+ companyId: numbercustomerId: string | nullcustomerLocationId: string | nullcustomFields: Json | null@@ -11489,6 +11757,7 @@ export type Database = {}Insert: {assignee?: string | null+ companyId: numbercustomerId?: string | nullcustomerLocationId?: string | nullcustomFields?: Json | null@@ -11509,6 +11778,7 @@ export type Database = {}Update: {assignee?: string | null+ companyId?: numbercustomerId?: string | nullcustomerLocationId?: string | nullcustomFields?: Json | null@@ -11556,6 +11826,13 @@ export type Database = {referencedRelation: "userDefaults"referencedColumns: ["userId"]},+ {+ foreignKeyName: "salesOrderShipment_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "salesOrderShipment_customerId_fkey"columns: ["customerId"]@@ -12251,6 +12528,7 @@ export type Database = {shelf: {Row: {active: boolean+ companyId: numbercreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -12262,6 +12540,7 @@ export type Database = {}Insert: {active?: boolean+ companyId: numbercreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -12273,6 +12552,7 @@ export type Database = {}Update: {active?: boolean+ companyId?: numbercreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -12283,6 +12563,13 @@ export type Database = {warehouseId?: string | null}Relationships: [+ {+ foreignKeyName: "shelf_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "shelf_createdBy_fkey"columns: ["createdBy"]@@ -14404,6 +14691,7 @@ export type Database = {warehouse: {Row: {active: boolean+ companyId: numbercreatedAt: stringcreatedBy: stringid: string@@ -14419,6 +14707,7 @@ export type Database = {}Insert: {active?: boolean+ companyId: numbercreatedAt?: stringcreatedBy: stringid?: string@@ -14434,6 +14723,7 @@ export type Database = {}Update: {active?: boolean+ companyId?: numbercreatedAt?: stringcreatedBy?: stringid?: string@@ -14448,6 +14738,13 @@ export type Database = {updatedBy?: string | null}Relationships: [+ {+ foreignKeyName: "warehouse_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "warehouse_createdBy_fkey"columns: ["createdBy"]@@ -14538,6 +14835,7 @@ export type Database = {Row: {active: booleanactiveDate: string | null+ companyId: numbercreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -14554,6 +14852,7 @@ export type Database = {Insert: {active?: booleanactiveDate?: string | null+ companyId: numbercreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -14570,6 +14869,7 @@ export type Database = {Update: {active?: booleanactiveDate?: string | null+ companyId?: numbercreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -14584,6 +14884,41 @@ export type Database = {workCellTypeId?: string}Relationships: [+ {+ foreignKeyName: "workCell_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "workCell_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "workCell_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "workCell_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "workCell_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },{foreignKeyName: "workCell_departmentId_fkey"columns: ["departmentId"]@@ -14619,6 +14954,34 @@ export type Database = {referencedRelation: "salesOrders"referencedColumns: ["locationId"]},+ {+ foreignKeyName: "workCell_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "workCell_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "workCell_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "workCell_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },{foreignKeyName: "workCell_workCellTypeId_fkey"columns: ["workCellTypeId"]@@ -14631,6 +14994,7 @@ export type Database = {workCellType: {Row: {active: boolean+ companyId: numbercreatedAt: stringcreatedBy: stringcustomFields: Json | null@@ -14647,6 +15011,7 @@ export type Database = {}Insert: {active?: boolean+ companyId: numbercreatedAt?: stringcreatedBy: stringcustomFields?: Json | null@@ -14663,6 +15028,7 @@ export type Database = {}Update: {active?: boolean+ companyId?: numbercreatedAt?: stringcreatedBy?: stringcustomFields?: Json | null@@ -14678,6 +15044,13 @@ export type Database = {updatedBy?: string | null}Relationships: [+ {+ foreignKeyName: "workCellType_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "workCellType_createdBy_fkey"columns: ["createdBy"]@@ -14749,6 +15122,7 @@ export type Database = {Row: {category: string | nullclass: Database["public"]["Enums"]["glAccountClass"] | null+ companyId: number | nullcreatedAt: string | nullcreatedBy: string | nullcustomFields: Json | null@@ -14761,6 +15135,7 @@ export type Database = {Insert: {category?: string | nullclass?: Database["public"]["Enums"]["glAccountClass"] | null+ companyId?: number | nullcreatedAt?: string | nullcreatedBy?: string | nullcustomFields?: Json | null@@ -14773,6 +15148,7 @@ export type Database = {Update: {category?: string | nullclass?: Database["public"]["Enums"]["glAccountClass"] | null+ companyId?: number | nullcreatedAt?: string | nullcreatedBy?: string | nullcustomFields?: Json | null@@ -14783,6 +15159,13 @@ export type Database = {updatedBy?: string | null}Relationships: [+ {+ foreignKeyName: "accountCategory_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "accountCategory_createdBy_fkey"columns: ["createdBy"]@@ -14849,6 +15232,7 @@ export type Database = {accountSubcategoryId: string | nullactive: boolean | nullclass: Database["public"]["Enums"]["glAccountClass"] | null+ companyId: number | nullconsolidatedRate:| Database["public"]["Enums"]["glConsolidatedRate"]| null@@ -14871,6 +15255,7 @@ export type Database = {accountSubcategoryId?: string | nullactive?: boolean | nullclass?: Database["public"]["Enums"]["glAccountClass"] | null+ companyId?: number | nullconsolidatedRate?:| Database["public"]["Enums"]["glConsolidatedRate"]| null@@ -14893,6 +15278,7 @@ export type Database = {accountSubcategoryId?: string | nullactive?: boolean | nullclass?: Database["public"]["Enums"]["glAccountClass"] | null+ companyId?: number | nullconsolidatedRate?:| Database["public"]["Enums"]["glConsolidatedRate"]| null@@ -14923,6 +15309,13 @@ export type Database = {referencedRelation: "accountCategories"referencedColumns: ["id"]},+ {+ foreignKeyName: "account_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "account_createdBy_fkey"columns: ["createdBy"]@@ -14985,6 +15378,7 @@ export type Database = {Row: {abilityIds: string[] | nullactive: boolean | null+ companyId: number | nullcustomFields: Json | nullemail: string | nullfirstName: string | null@@ -14995,6 +15389,13 @@ export type Database = {supplierName: string | null}Relationships: [+ {+ foreignKeyName: "contractor_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "contractor_id_fkey"columns: ["supplierContactId"]@@ -15427,6 +15828,7 @@ export type Database = {abilityName: string | nullactive: boolean | nullcity: string | null+ companyId: number | nullcreatedAt: string | nullcreatedBy: string | nullcustomFields: Json | null@@ -15447,6 +15849,13 @@ export type Database = {referencedRelation: "ability"referencedColumns: ["id"]},+ {+ foreignKeyName: "partner_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "partner_createdBy_fkey"columns: ["createdBy"]@@ -15780,13 +16189,6 @@ export type Database = {referencedRelation: "userDefaults"referencedColumns: ["userId"]},- {- foreignKeyName: "purchaseInvoice_currencyCode_fkey"- columns: ["currencyCode"]- isOneToOne: false- referencedRelation: "currency"- referencedColumns: ["code"]- },{foreignKeyName: "purchaseInvoice_invoiceSupplierId_fkey"columns: ["invoiceSupplierId"]@@ -16168,6 +16570,7 @@ export type Database = {assignee: string | nullclosedAt: string | nullclosedBy: string | null+ companyId: number | nullcreatedAt: string | nullcreatedBy: string | nullcustomFields: Json | null@@ -16251,6 +16654,13 @@ export type Database = {referencedRelation: "userDefaults"referencedColumns: ["userId"]},+ {+ foreignKeyName: "purchaseOrder_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "purchaseOrder_createdBy_fkey"columns: ["createdBy"]@@ -16360,10 +16770,19 @@ export type Database = {}purchaseOrderSuppliers: {Row: {+ companyId: number | nullid: string | nullname: string | null}- Relationships: []+ Relationships: [+ {+ foreignKeyName: "supplier_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },+ ]}quoteCustomerDetails: {Row: {@@ -17049,10 +17468,19 @@ export type Database = {}salesOrderCustomers: {Row: {+ companyId: number | nullid: string | nullname: string | null}- Relationships: []+ Relationships: [+ {+ foreignKeyName: "customer_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },+ ]}salesOrderLines: {Row: {@@ -17253,6 +17681,7 @@ export type Database = {closedBy: string | nullclosedByAvatar: string | nullclosedByFullName: string | null+ companyId: number | nullcreatedAt: string | nullcreatedBy: string | nullcreatedByAvatar: string | null@@ -17341,6 +17770,13 @@ export type Database = {referencedRelation: "userDefaults"referencedColumns: ["userId"]},+ {+ foreignKeyName: "salesOrder_companyId_fkey"+ columns: ["companyId"]+ isOneToOne: false+ referencedRelation: "company"+ referencedColumns: ["id"]+ },{foreignKeyName: "salesOrder_createdBy_fkey"columns: ["createdBy"]@@ -17987,6 +18423,13 @@ export type Database = {users: Json}[]}+ has_any_company_permission: {+ Args: {+ claim: string+ company: string+ }+ Returns: boolean+ }has_company_permission: {Args: {claim: stringdiff --git a/packages/database/supabase/functions/seed-company/index.ts b/packages/database/supabase/functions/seed-company/index.tsindex d95cb4281e..4c32651e44 100644--- a/packages/database/supabase/functions/seed-company/index.ts+++ b/packages/database/supabase/functions/seed-company/index.ts@@ -2,6 +2,16 @@ import { serve } from "https://deno.land/[email protected]/http/server.ts";import { DB, getConnectionPool, getDatabaseClient } from "../lib/database.ts";import { corsHeaders } from "../lib/headers.ts";+import {+ accountCategories,+ accounts,+ currencies,+ customerStatuses,+ paymentTerms,+ sequences,+ supplierStauses,+ unitOfMeasures,+} from "../lib/seed.ts";import { getSupabaseServiceRole } from "../lib/supabase.ts";const pool = getConnectionPool(1);@@ -18,244 +28,87 @@ serve(async (req: Request) => {const client = getSupabaseServiceRole(req.headers.get("Authorization"));await db.transaction().execute(async (trx) => {- const supplierStauses = ["Active", "Inactive", "Pending", "Rejected"].map(- (name) => ({ name, companyId, createdBy: "system" })- );- await trx.insertInto("supplierStatus").values(supplierStauses).execute();+ // supplier status+ await trx+ .insertInto("supplierStatus")+ .values(+ supplierStauses.map((name) => ({+ name,+ companyId,+ createdBy: "system",+ }))+ )+ .execute();- const customerStauses = [- "Active",- "Inactive",- "Lead",- "On Hold",- "Cancelled",- ].map((name) => ({ name, companyId, createdBy: "system" }));- await trx.insertInto("customerStatus").values(customerStauses).execute();+ // customer status+ await trx+ .insertInto("customerStatus")+ .values(+ customerStatuses.map((name) => ({+ name,+ companyId,+ createdBy: "system",+ }))+ )+ .execute();- const paymentTerms = [- {- name: "Net 15",- daysDue: 15,- calculationMethod: "Net",- daysDiscount: 0,- discountPercentage: 0,- companyId,- createdBy: "system",- },- {- name: "Net 30",- daysDue: 30,- calculationMethod: "Net",- daysDiscount: 0,- discountPercentage: 0,- companyId,- createdBy: "system",- },- {- name: "Net 60",- daysDue: 60,- calculationMethod: "Net",- daysDiscount: 0,- discountPercentage: 0,- companyId,- createdBy: "system",- },- {- name: "1% 10 Net 30",- daysDue: 30,- calculationMethod: "Net",- daysDiscount: 10,- discountPercentage: 1,- companyId,- createdBy: "system",- },- {- name: "2% 10 Net 30",- daysDue: 30,- calculationMethod: "Net",- daysDiscount: 10,- discountPercentage: 2,- companyId,- createdBy: "system",- },- {- name: "COD",- daysDue: 0,- calculationMethod: "Net",- daysDiscount: 0,- discountPercentage: 0,- companyId,- createdBy: "system",- },- {- name: "Net EOM 10th",- daysDue: 10,- calculationMethod: "End of Month",- daysDiscount: 0,- discountPercentage: 0,- companyId,- createdBy: "system",- },- ];- await trx.insertInto("paymentTerm").values(paymentTerms).execute();+ // payment terms+ await trx+ .insertInto("paymentTerm")+ .values(paymentTerms.map((pt) => ({ ...pt, companyId })))+ .execute();- const unitOfMeasures = [- {- name: "Each",- code: "EA",- companyId,- createdBy: "system",- },- {- name: "Case",- code: "CS",- companyId,- createdBy: "system",- },- {- name: "Pack",- code: "PK",- companyId,- createdBy: "system",- },- {- name: "Pallet",- code: "PL",- companyId,- createdBy: "system",- },- {- name: "Roll",- code: "RL",- companyId,- createdBy: "system",- },- {- name: "Box",- code: "BX",- companyId,- createdBy: "system",- },- {- name: "Bag",- code: "BG",- companyId,- createdBy: "system",- },- {- name: "Drum",- code: "DR",- companyId,- createdBy: "system",- },- {- name: "Gallon",- code: "GL",- companyId,- createdBy: "system",- },- {- name: "Liter",- code: "LT",- companyId,- createdBy: "system",- },- {- name: "Ounce",- code: "OZ",- companyId,- createdBy: "system",- },- {- name: "Pound",- code: "LB",- companyId,- createdBy: "system",- },- {- name: "Ton",- code: "TN",- companyId,- createdBy: "system",- },- {- name: "Yard",- code: "YD",- companyId,- createdBy: "system",- },- {- name: "Meter",- code: "MT",- companyId,- createdBy: "system",- },- ];- await trx.insertInto("unitOfMeasure").values(unitOfMeasures).execute();+ await trx+ .insertInto("unitOfMeasure")+ .values(unitOfMeasures.map((uom) => ({ ...uom, companyId })))+ .execute();- const sequences = [- {- table: "purchaseOrder",- name: "Purchase Order",- prefix: "PO",- suffix: null,- next: 0,- size: 6,- step: 1,- companyId,- },- {- table: "purchaseInvoice",- name: "Purchase Invoice",- prefix: "AP",- suffix: null,- next: 0,- size: 6,- step: 1,- companyId,- },- {- table: "receipt",- name: "Receipt",- prefix: "RE",- suffix: null,- next: 0,- size: 6,- step: 1,- companyId,- },- {- table: "salesOrder",- name: "Sales Order",- prefix: "SO",- suffix: null,- next: 0,- size: 6,- step: 1,- companyId,- },- {- table: "salesInvoice",- name: "Sales Invoice",- prefix: "AR",- suffix: null,- next: 0,- size: 6,- step: 1,- companyId,- },- {- table: "requestForQuote",- name: "Request For Quote",- prefix: "RFQ",- suffix: null,- next: 0,- size: 6,- step: 1,- companyId,- },- ];- await trx.insertInto("sequence").values(sequences).execute();+ await trx+ .insertInto("sequence")+ .values(sequences.map((s) => ({ ...s, companyId })))+ .execute();++ await trx+ .insertInto("currency")+ .values(currencies.map((c) => ({ ...c, companyId })))+ .execute();++ const accountCategoriesWithIds = await trx+ .insertInto("accountCategory")+ .values(accountCategories.map((ac) => ({ ...ac, companyId })))+ .returning(["id", "category"])+ .execute();++ const accountCategoriesByName = accountCategoriesWithIds.reduce<+ Record<string, string>+ >((acc, { id, category }) => {+ acc[category] = id;+ return acc;+ }, {});++ const getCategoryId = (category: string) =>+ accountCategoriesByName[category];++ await trx+ .insertInto("account")+ .values(+ accounts.map(({ accountCategory, ...a }) => ({+ ...a,+ companyId,+ accountCategoryId: getCategoryId(a.category),+ }))+ )+ .execute();++ await trx+ .insertInto("accountDefault")+ .values([+ {+ ...accountDefaults,+ companyId,+ },+ ])+ .execute();});return new Response(diff --git a/packages/database/supabase/migrations/20230123004206_claims.sql b/packages/database/supabase/migrations/20230123004206_claims.sqlindex d8efe2481d..e6ee805563 100644--- a/packages/database/supabase/migrations/20230123004206_claims.sql+++ b/packages/database/supabase/migrations/20230123004206_claims.sql@@ -123,6 +123,24 @@ CREATE OR REPLACE FUNCTION has_company_permission(claim text, company integer) REND;$$;+CREATE OR REPLACE FUNCTION has_any_company_permission(claim text, company text) RETURNS "bool"+ LANGUAGE "plpgsql" SECURITY DEFINER SET search_path = public+ AS $$+ DECLARE+ claim_value integer[];+ BEGIN++ SELECT jsonb_to_integer_array(coalesce(raw_app_meta_data->claim, '[]')) INTO claim_value FROM auth.users WHERE id = auth.uid();+ IF claim_value IS NULL THEN+ return false;+ ELSIF array_length(claim_value) > 0 THEN+ return true;+ ELSE+ return false;+ END IF;+ END;+$$;+CREATE OR REPLACE FUNCTION get_claims(uid uuid) RETURNS "jsonb"LANGUAGE "plpgsql" SECURITY DEFINER SET search_path = publicAS $$diff --git a/packages/database/supabase/migrations/20230123004316_users.sql b/packages/database/supabase/migrations/20230123004316_users.sqlindex 4c2b26b75e..d78ff7fdf0 100644--- a/packages/database/supabase/migrations/20230123004316_users.sql+++ b/packages/database/supabase/migrations/20230123004316_users.sql@@ -22,3 +22,6 @@ ALTER TABLE "user" ENABLE ROW LEVEL SECURITY;CREATE POLICY "Claims admin can view/modify users" ON "user" FOR ALL USING (is_claims_admin());CREATE POLICY "Users can modify themselves" ON "user" FOR UPDATE WITH CHECK (auth.uid() = id::uuid);CREATE POLICY "Anyone that's authenticated can view users" ON "user" FOR SELECT USING (auth.role() = 'authenticated');++INSERT INTO "user" ("id", "email", "firstName", "lastName")+VALUES ('system', '[email protected]', 'System', 'Operation');diff --git a/packages/database/supabase/migrations/20230330024715_accounts.sql b/packages/database/supabase/migrations/20230330024715_accounts.sqlindex f3b6947240..eb94dbb077 100644--- a/packages/database/supabase/migrations/20230330024715_accounts.sql+++ b/packages/database/supabase/migrations/20230330024715_accounts.sql@@ -22,7 +22,6 @@ CREATE TABLE "currency" ();CREATE INDEX "currency_code_idx" ON "currency" ("code");-CREATE INDEX "currency_companyId_idx" ON "currency" ("companyId");ALTER TABLE "currency" ENABLE ROW LEVEL SECURITY;@@ -260,8 +259,8 @@ CREATE TABLE "account" ("customFields" JSONB,CONSTRAINT "account_pkey" PRIMARY KEY ("id"),- CONSTRAINT "account_number_key" UNIQUE ("number"),- CONSTRAINT "account_name_key" UNIQUE ("name"),+ CONSTRAINT "account_number_key" UNIQUE ("number", "companyId"),+ CONSTRAINT "account_name_key" UNIQUE ("name", "companyId"),CONSTRAINT "account_accountCategoryId_fkey" FOREIGN KEY ("accountCategoryId") REFERENCES "accountCategory"("id"),CONSTRAINT "account_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "company"("id"),CONSTRAINT "account_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "user"("id"),diff --git a/packages/database/supabase/migrations/20230510035345_purchasing.sql b/packages/database/supabase/migrations/20230510035345_purchasing.sqlindex d4d6596955..425e6793f9 100644--- a/packages/database/supabase/migrations/20230510035345_purchasing.sql+++ b/packages/database/supabase/migrations/20230510035345_purchasing.sql@@ -81,6 +81,7 @@ CREATE TABLE "shippingMethod" ("carrierAccountId" TEXT,"trackingUrl" TEXT,"active" BOOLEAN NOT NULL DEFAULT TRUE,+ "companyId" INTEGER NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),"createdBy" TEXT NOT NULL,"updatedAt" TIMESTAMP WITH TIME ZONE,@@ -89,13 +90,14 @@ CREATE TABLE "shippingMethod" (CONSTRAINT "shippingMethod_pkey" PRIMARY KEY ("id"),CONSTRAINT "shippingMethod_name_key" UNIQUE ("name"),- CONSTRAINT "shippingMethod_carrierAccountId_fkey" FOREIGN KEY ("carrierAccountId") REFERENCES "account" ("number") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "shippingMethod_carrierAccountId_fkey" FOREIGN KEY ("carrierAccountId", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "shippingMethod_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "company" ("id") ON DELETE CASCADE ON UPDATE CASCADE,CONSTRAINT "shippingMethod_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "user" ("id") ON DELETE RESTRICT,CONSTRAINT "shippingMethod_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE RESTRICT);-CREATE INDEX "shippingMethod_name_idx" ON "shippingMethod" ("name");-+CREATE INDEX "shippingMethod_name_idx" ON "shippingMethod" ("name", "companyId");+CREATE INDEX "shippingMethod_companyId_idx" ON "shippingMethod" ("companyId");CREATE POLICY "Certain employees can view shipping methods" ON "shippingMethod"FOR SELECT@@ -297,7 +299,7 @@ CREATE TABLE "purchaseOrderLine" (CONSTRAINT "purchaseOrderLine_purchaseOrderId_fkey" FOREIGN KEY ("purchaseOrderId") REFERENCES "purchaseOrder" ("id") ON DELETE CASCADE,CONSTRAINT "purchaseOrderLine_partId_fkey" FOREIGN KEY ("partId") REFERENCES "part" ("id") ON DELETE CASCADE ON UPDATE CASCADE,CONSTRAINT "purchaseOrderLine_serviceId_fkey" FOREIGN KEY ("serviceId") REFERENCES "service" ("id") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "purchaseOrderLine_accountNumber_fkey" FOREIGN KEY ("accountNumber") REFERENCES "account" ("number") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "purchaseOrderLine_accountNumber_fkey" FOREIGN KEY ("accountNumber", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE CASCADE ON UPDATE CASCADE,-- TODO: Add assetId foreign keyCONSTRAINT "purchaseOrderLine_shelfId_fkey" FOREIGN KEY ("shelfId", "locationId") REFERENCES "shelf" ("id", "locationId") ON DELETE CASCADE,CONSTRAINT "purchaseOrderLine_inventoryUnitOfMeasureCode_fkey" FOREIGN KEY ("inventoryUnitOfMeasureCode", "companyId") REFERENCES "unitOfMeasure" ("code", "companyId") ON DELETE CASCADE ON UPDATE CASCADE,@@ -307,6 +309,7 @@ CREATE TABLE "purchaseOrderLine" ();CREATE INDEX "purchaseOrderLine_purchaseOrderId_idx" ON "purchaseOrderLine" ("purchaseOrderId");+CREATE INDEX "purchaseOrderLine_companyId_idx" ON "purchaseOrderLine" ("companyId");ALTER publication supabase_realtime ADD TABLE "purchaseOrderLine";diff --git a/packages/database/supabase/migrations/20230525025310_sequences.sql b/packages/database/supabase/migrations/20230525025310_sequences.sqlindex 64eb695ed8..9d92db27d9 100644--- a/packages/database/supabase/migrations/20230525025310_sequences.sql+++ b/packages/database/supabase/migrations/20230525025310_sequences.sql@@ -22,7 +22,7 @@ CREATE TABLE "sequence" ("updatedAt" TIMESTAMP WITH TIME ZONE,"updatedBy" TEXT,- CONSTRAINT "sequence_pkey" PRIMARY KEY ("id"),+ CONSTRAINT "sequence_pkey" PRIMARY KEY ("id", "companyId"),CONSTRAINT "sequence_next_check" CHECK ("next" >= 0),CONSTRAINT "sequence_size_check" CHECK ("size" >= 1),CONSTRAINT "sequence_step_check" CHECK ("step" >= 1),diff --git a/packages/database/supabase/migrations/20230705033432_ledgers.sql b/packages/database/supabase/migrations/20230705033432_ledgers.sqlindex b55a1a788d..2ec70f2a90 100644--- a/packages/database/supabase/migrations/20230705033432_ledgers.sql+++ b/packages/database/supabase/migrations/20230705033432_ledgers.sql@@ -104,14 +104,17 @@ CREATE TABLE "journalLine" ("journalLineReference" TEXT NOT NULL,"documentLineReference" TEXT,"accrual" BOOLEAN NOT NULL DEFAULT false,+ "companyId" INTEGER NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),"customFields" JSONB,CONSTRAINT "journalLine_pkey" PRIMARY KEY ("id"),- CONSTRAINT "journalLine_accountNumber_fkey" FOREIGN KEY ("accountNumber") REFERENCES "account"("number") ON UPDATE CASCADE ON DELETE SET NULL+ CONSTRAINT "journalLine_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "company" ("id") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "journalLine_accountNumber_fkey" FOREIGN KEY ("accountNumber", "companyId") REFERENCES "account"("number", "companyId") ON UPDATE CASCADE ON DELETE SET NULL);-CREATE INDEX "journalLine_accountNumber_idx" ON "journalLine" ("accountNumber");+CREATE INDEX "journalLine_accountNumber_idx" ON "journalLine" ("accountNumber", "companyId");+CREATE INDEX "journalLine_companyId_idx" ON "journalLine" ("companyId");ALTER TABLE "journalLine" ENABLE ROW LEVEL SECURITY;diff --git a/packages/database/supabase/migrations/20230820020844_posting-groups.sql b/packages/database/supabase/migrations/20230820020844_posting-groups.sqlindex 39486b4b3a..17ba499c4e 100644--- a/packages/database/supabase/migrations/20230820020844_posting-groups.sql+++ b/packages/database/supabase/migrations/20230820020844_posting-groups.sql@@ -1,5 +1,5 @@CREATE TABLE "accountDefault" (- "id" BOOLEAN NOT NULL DEFAULT TRUE,+ "companyId" INTEGER NOT NULL,-- income statement-- revenue"salesAccount" TEXT NOT NULL,@@ -63,66 +63,63 @@ CREATE TABLE "accountDefault" (- CONSTRAINT "accountDefault_pkey" PRIMARY KEY ("id"),- -- this is a hack to make sure that this table only ever has one row- CONSTRAINT "accountDefault_id_check" CHECK ("id" = TRUE),- CONSTRAINT "accountDefault_id_unique" UNIQUE ("id"),- CONSTRAINT "accountDefault_salesAccount_fkey" FOREIGN KEY ("salesAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_salesDiscountAccount_fkey" FOREIGN KEY ("salesDiscountAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_costOfGoodsSoldAccount_fkey" FOREIGN KEY ("costOfGoodsSoldAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_purchaseAccount_fkey" FOREIGN KEY ("purchaseAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_directCostAppliedAccount_fkey" FOREIGN KEY ("directCostAppliedAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_overheadCostAppliedAccount_fkey" FOREIGN KEY ("overheadCostAppliedAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_purchaseVarianceAccount_fkey" FOREIGN KEY ("purchaseVarianceAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_inventoryAdjustmentVarianceAccount_fkey" FOREIGN KEY ("inventoryAdjustmentVarianceAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_materialVarianceAccount_fkey" FOREIGN KEY ("materialVarianceAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_capacityVarianceAccount_fkey" FOREIGN KEY ("capacityVarianceAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_overheadAccount_fkey" FOREIGN KEY ("overheadAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_maintenanceAccount_fkey" FOREIGN KEY ("maintenanceAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_assetDepreciationExpenseAccount_fkey" FOREIGN KEY ("assetDepreciationExpenseAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_assetGainsAndLossesAccount_fkey" FOREIGN KEY ("assetGainsAndLossesAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_serviceChargeAccount_fkey" FOREIGN KEY ("serviceChargeAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_interestAccount_fkey" FOREIGN KEY ("interestAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_supplierPaymentDiscountAccount_fkey" FOREIGN KEY ("supplierPaymentDiscountAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_customerPaymentDiscountAccount_fkey" FOREIGN KEY ("customerPaymentDiscountAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_roundingAccount_fkey" FOREIGN KEY ("roundingAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_aquisitionCostAccount_fkey" FOREIGN KEY ("assetAquisitionCostAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_aquisitionCostOnDisposalAccount_fkey" FOREIGN KEY ("assetAquisitionCostOnDisposalAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_accumulatedDepreciationAccount_fkey" FOREIGN KEY ("accumulatedDepreciationAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_accumulatedDepreciationOnDisposalAccount_fkey" FOREIGN KEY ("accumulatedDepreciationOnDisposalAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_inventoryAccount_fkey" FOREIGN KEY ("inventoryAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_inventoryInterimAccrualAccount_fkey" FOREIGN KEY ("inventoryInterimAccrualAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_workInProgressAccount_fkey" FOREIGN KEY ("workInProgressAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_receivablesAccount_fkey" FOREIGN KEY ("receivablesAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_inventoryShippedNotInvoicedAccount_fkey" FOREIGN KEY ("inventoryShippedNotInvoicedAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_bankCashAccount_fkey" FOREIGN KEY ("bankCashAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_bankLocalCurrencyAccount_fkey" FOREIGN KEY ("bankLocalCurrencyAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_bankForeignCurrencyAccount_fkey" FOREIGN KEY ("bankForeignCurrencyAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_prepaymentAccount_fkey" FOREIGN KEY ("prepaymentAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_payablesAccount_fkey" FOREIGN KEY ("payablesAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_inventoryReceivedNotInvoicedAccount_fkey" FOREIGN KEY ("inventoryReceivedNotInvoicedAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_salesTaxPayableAccount_fkey" FOREIGN KEY ("salesTaxPayableAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_reverseChargeSalesTaxPayableAccount_fkey" FOREIGN KEY ("reverseChargeSalesTaxPayableAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_purchaseTaxPayableAccount_fkey" FOREIGN KEY ("purchaseTaxPayableAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "accountDefault_retainedEarningsAccount_fkey" FOREIGN KEY ("retainedEarningsAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_pkey" PRIMARY KEY ("companyId"),+ CONSTRAINT "accountDefault_fkey" FOREIGN KEY ("companyId") REFERENCES "company"("id") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_salesAccount_fkey" FOREIGN KEY ("salesAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_salesDiscountAccount_fkey" FOREIGN KEY ("salesDiscountAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_costOfGoodsSoldAccount_fkey" FOREIGN KEY ("costOfGoodsSoldAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_purchaseAccount_fkey" FOREIGN KEY ("purchaseAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_directCostAppliedAccount_fkey" FOREIGN KEY ("directCostAppliedAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_overheadCostAppliedAccount_fkey" FOREIGN KEY ("overheadCostAppliedAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_purchaseVarianceAccount_fkey" FOREIGN KEY ("purchaseVarianceAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_inventoryAdjustmentVarianceAccount_fkey" FOREIGN KEY ("inventoryAdjustmentVarianceAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_materialVarianceAccount_fkey" FOREIGN KEY ("materialVarianceAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_capacityVarianceAccount_fkey" FOREIGN KEY ("capacityVarianceAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_overheadAccount_fkey" FOREIGN KEY ("overheadAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_maintenanceAccount_fkey" FOREIGN KEY ("maintenanceAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_assetDepreciationExpenseAccount_fkey" FOREIGN KEY ("assetDepreciationExpenseAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_assetGainsAndLossesAccount_fkey" FOREIGN KEY ("assetGainsAndLossesAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_serviceChargeAccount_fkey" FOREIGN KEY ("serviceChargeAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_interestAccount_fkey" FOREIGN KEY ("interestAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_supplierPaymentDiscountAccount_fkey" FOREIGN KEY ("supplierPaymentDiscountAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_customerPaymentDiscountAccount_fkey" FOREIGN KEY ("customerPaymentDiscountAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_roundingAccount_fkey" FOREIGN KEY ("roundingAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_aquisitionCostAccount_fkey" FOREIGN KEY ("assetAquisitionCostAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_aquisitionCostOnDisposalAccount_fkey" FOREIGN KEY ("assetAquisitionCostOnDisposalAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_accumulatedDepreciationAccount_fkey" FOREIGN KEY ("accumulatedDepreciationAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_accumulatedDepreciationOnDisposalAccount_fkey" FOREIGN KEY ("accumulatedDepreciationOnDisposalAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_inventoryAccount_fkey" FOREIGN KEY ("inventoryAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_inventoryInterimAccrualAccount_fkey" FOREIGN KEY ("inventoryInterimAccrualAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_workInProgressAccount_fkey" FOREIGN KEY ("workInProgressAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_receivablesAccount_fkey" FOREIGN KEY ("receivablesAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_inventoryShippedNotInvoicedAccount_fkey" FOREIGN KEY ("inventoryShippedNotInvoicedAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_bankCashAccount_fkey" FOREIGN KEY ("bankCashAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_bankLocalCurrencyAccount_fkey" FOREIGN KEY ("bankLocalCurrencyAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_bankForeignCurrencyAccount_fkey" FOREIGN KEY ("bankForeignCurrencyAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_prepaymentAccount_fkey" FOREIGN KEY ("prepaymentAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_payablesAccount_fkey" FOREIGN KEY ("payablesAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_inventoryReceivedNotInvoicedAccount_fkey" FOREIGN KEY ("inventoryReceivedNotInvoicedAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_salesTaxPayableAccount_fkey" FOREIGN KEY ("salesTaxPayableAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_reverseChargeSalesTaxPayableAccount_fkey" FOREIGN KEY ("reverseChargeSalesTaxPayableAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_purchaseTaxPayableAccount_fkey" FOREIGN KEY ("purchaseTaxPayableAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "accountDefault_retainedEarningsAccount_fkey" FOREIGN KEY ("retainedEarningsAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,CONSTRAINT "accountDefault_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE RESTRICT ON UPDATE CASCADE);ALTER TABLE "accountDefault" ENABLE ROW LEVEL SECURITY;-CREATE POLICY "Employees with accounting_view can view account defaults" ON "accountDefault"FOR SELECTUSING (- coalesce(get_my_claim('accounting_view')::boolean,false)- AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ has_role('employee') AND+ has_company_permission('accounting_view', "companyId"));CREATE POLICY "Employees with accounting_update can update account defaults" ON "accountDefault"FOR UPDATEUSING (- coalesce(get_my_claim('accounting_update')::boolean, false) = true- AND (get_my_claim('role'::text)) = '"employee"'::jsonb+ has_role('employee') AND+ has_company_permission('accounting_update', "companyId"));@@ -145,30 +142,32 @@ CREATE TABLE "postingGroupInventory" ("inventoryAdjustmentVarianceAccount" TEXT NOT NULL,"materialVarianceAccount" TEXT NOT NULL,"capacityVarianceAccount" TEXT NOT NULL,+ "companyId" INTEGER NOT NULL,"updatedBy" TEXT,CONSTRAINT "postingGroupInventory_pkey" PRIMARY KEY ("id"),CONSTRAINT "postingGroupInventory_id_partGroupId_locationId_key" UNIQUE ("partGroupId", "locationId"),CONSTRAINT "postingGroupInventory_partGroupId_fkey" FOREIGN KEY ("partGroupId") REFERENCES "partGroup" ("id") ON DELETE CASCADE ON UPDATE CASCADE,CONSTRAINT "postingGroupInventory_locationId_fkey" FOREIGN KEY ("locationId") REFERENCES "location" ("id") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "postingGroupInventory_costOfGoodsSoldAccount_fkey" FOREIGN KEY ("costOfGoodsSoldAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "postingGroupInventory_inventoryAccount_fkey" FOREIGN KEY ("inventoryAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "postingGroupInventory_inventoryInterimAccrualAccount_fkey" FOREIGN KEY ("inventoryInterimAccrualAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "postingGroupInventory_inventoryReceivedNotInvoicedAccount_fkey" FOREIGN KEY ("inventoryReceivedNotInvoicedAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "postingGroupInventory_inventoryInvoicedNotReceivedAccount_fkey" FOREIGN KEY ("inventoryInvoicedNotReceivedAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "postingGroupInventory_inventoryShippedNotInvoicedAccount_fkey" FOREIGN KEY ("inventoryShippedNotInvoicedAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "postingGroupInventory_workInProgressAccount_fkey" FOREIGN KEY ("workInProgressAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "postingGroupInventory_directCostAppliedAccount_fkey" FOREIGN KEY ("directCostAppliedAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "postingGroupInventory_overheadCostAppliedAccount_fkey" FOREIGN KEY ("overheadCostAppliedAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "postingGroupInventory_purchaseVarianceAccount_fkey" FOREIGN KEY ("purchaseVarianceAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "postingGroupInventory_inventoryAdjustmentVarianceAccount_fkey" FOREIGN KEY ("inventoryAdjustmentVarianceAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "postingGroupInventory_materialVarianceAccount_fkey" FOREIGN KEY ("materialVarianceAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "postingGroupInventory_capacityVarianceAccount_fkey" FOREIGN KEY ("capacityVarianceAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "postingGroupInventory_overheadAccount_fkey" FOREIGN KEY ("overheadAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_costOfGoodsSoldAccount_fkey" FOREIGN KEY ("costOfGoodsSoldAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_inventoryAccount_fkey" FOREIGN KEY ("inventoryAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_inventoryInterimAccrualAccount_fkey" FOREIGN KEY ("inventoryInterimAccrualAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_inventoryReceivedNotInvoicedAccount_fkey" FOREIGN KEY ("inventoryReceivedNotInvoicedAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_inventoryInvoicedNotReceivedAccount_fkey" FOREIGN KEY ("inventoryInvoicedNotReceivedAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_inventoryShippedNotInvoicedAccount_fkey" FOREIGN KEY ("inventoryShippedNotInvoicedAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_workInProgressAccount_fkey" FOREIGN KEY ("workInProgressAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_directCostAppliedAccount_fkey" FOREIGN KEY ("directCostAppliedAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_overheadCostAppliedAccount_fkey" FOREIGN KEY ("overheadCostAppliedAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_purchaseVarianceAccount_fkey" FOREIGN KEY ("purchaseVarianceAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_inventoryAdjustmentVarianceAccount_fkey" FOREIGN KEY ("inventoryAdjustmentVarianceAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_materialVarianceAccount_fkey" FOREIGN KEY ("materialVarianceAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_capacityVarianceAccount_fkey" FOREIGN KEY ("capacityVarianceAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupInventory_overheadAccount_fkey" FOREIGN KEY ("overheadAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,CONSTRAINT "postingGroupInventory_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE CASCADE);CREATE INDEX "postingGroupInventory_partGroupId_locationId_idx" ON "postingGroupInventory" ("partGroupId", "locationId");+CREATE INDEX "postingGroupInventory_companyId_idx" ON "postingGroupInventory" ("companyId");ALTER TABLE "postingGroupInventory" ENABLE ROW LEVEL SECURITY;@@ -197,22 +196,25 @@ CREATE TABLE "postingGroupPurchasing" ("purchaseCreditAccount" TEXT NOT NULL,"purchasePrepaymentAccount" TEXT NOT NULL,"purchaseTaxPayableAccount" TEXT NOT NULL,+ "companyId" INTEGER NOT NULL,"updatedBy" TEXT,CONSTRAINT "postingGroupPurchasing_pkey" PRIMARY KEY ("id"),CONSTRAINT "postingGroupPurchasing_id_supplierTypeId_partGroupId_key" UNIQUE ("supplierTypeId", "partGroupId"),CONSTRAINT "postingGroupPurchasing_partGroupId_fkey" FOREIGN KEY ("partGroupId") REFERENCES "partGroup" ("id") ON DELETE CASCADE ON UPDATE CASCADE,CONSTRAINT "postingGroupPurchasing_supplierTypeId_fkey" FOREIGN KEY ("supplierTypeId") REFERENCES "supplierType" ("id") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "postingGroupPurchasing_payablesAccount_fkey" FOREIGN KEY ("payablesAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "postingGroupPurchasing_purchaseAccount_fkey" FOREIGN KEY ("purchaseAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "postingGroupPurchasing_purchaseDiscountAccount_fkey" FOREIGN KEY ("purchaseDiscountAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "postingGroupPurchasing_purchaseCreditAccount_fkey" FOREIGN KEY ("purchaseCreditAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "postingGroupPurchasing_purchasePrepaymentAccount_fkey" FOREIGN KEY ("purchasePrepaymentAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "postingGroupPurchasing_purchaseTaxPayableAccount_fkey" FOREIGN KEY ("purchaseTaxPayableAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupPurchasing_payablesAccount_fkey" FOREIGN KEY ("payablesAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupPurchasing_purchaseAccount_fkey" FOREIGN KEY ("purchaseAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupPurchasing_purchaseDiscountAccount_fkey" FOREIGN KEY ("purchaseDiscountAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupPurchasing_purchaseCreditAccount_fkey" FOREIGN KEY ("purchaseCreditAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupPurchasing_purchasePrepaymentAccount_fkey" FOREIGN KEY ("purchasePrepaymentAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupPurchasing_purchaseTaxPayableAccount_fkey" FOREIGN KEY ("purchaseTaxPayableAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupPurchasing_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "company" ("id") ON DELETE CASCADE ON UPDATE CASCADE,CONSTRAINT "postingGroupPurchasing_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE CASCADE);CREATE INDEX "postingGroupPurchasing_partGroupId_supplierTypeId_idx" ON "postingGroupPurchasing" ("partGroupId", "supplierTypeId");+CREATE INDEX "postingGroupPurchasing_companyId_idx" ON "postingGroupPurchasing" ("companyId");ALTER TABLE "postingGroupPurchasing" ENABLE ROW LEVEL SECURITY;@@ -240,22 +242,25 @@ CREATE TABLE "postingGroupSales" ("salesCreditAccount" TEXT NOT NULL,"salesPrepaymentAccount" TEXT NOT NULL,"salesTaxPayableAccount" TEXT NOT NULL,+ "companyId" INTEGER NOT NULL,"updatedBy" TEXT,CONSTRAINT "postingGroupSales_pkey" PRIMARY KEY ("id"),CONSTRAINT "postingGroupSales_id_customerTypeId_partGroupId_key" UNIQUE ("customerTypeId", "partGroupId"),CONSTRAINT "postingGroupSales_partGroupId_fkey" FOREIGN KEY ("partGroupId") REFERENCES "partGroup" ("id") ON DELETE CASCADE ON UPDATE CASCADE,CONSTRAINT "postingGroupSales_customerTypeId_fkey" FOREIGN KEY ("customerTypeId") REFERENCES "customerType" ("id") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "postingGroupSales_receivablesAccount_fkey" FOREIGN KEY ("receivablesAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "postingGroupSales_salesAccount_fkey" FOREIGN KEY ("salesAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "postingGroupSales_salesDiscountAccount_fkey" FOREIGN KEY ("salesDiscountAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "postingGroupSales_salesCreditAccount_fkey" FOREIGN KEY ("salesCreditAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "postingGroupSales_salesPrepaymentAccount_fkey" FOREIGN KEY ("salesPrepaymentAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,- CONSTRAINT "postingGroupSales_salesTaxPayableAccount_fkey" FOREIGN KEY ("salesTaxPayableAccount") REFERENCES "account" ("number") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupSales_receivablesAccount_fkey" FOREIGN KEY ("receivablesAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupSales_salesAccount_fkey" FOREIGN KEY ("salesAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupSales_salesDiscountAccount_fkey" FOREIGN KEY ("salesDiscountAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupSales_salesCreditAccount_fkey" FOREIGN KEY ("salesCreditAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupSales_salesPrepaymentAccount_fkey" FOREIGN KEY ("salesPrepaymentAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupSales_salesTaxPayableAccount_fkey" FOREIGN KEY ("salesTaxPayableAccount", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE RESTRICT ON UPDATE CASCADE,+ CONSTRAINT "postingGroupSales_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "company" ("id") ON DELETE CASCADE ON UPDATE CASCADE,CONSTRAINT "postingGroupSales_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE CASCADE);CREATE INDEX "postingGroupSales_partGroupId_customerTypeId_idx" ON "postingGroupSales" ("partGroupId", "customerTypeId");+CREATE INDEX "postingGroupSales_companyId_idx" ON "postingGroupSales" ("companyId");CREATE POLICY "Employees with accounting_view can view sales posting groups" ON "postingGroupSales"FOR SELECTdiff --git a/packages/database/supabase/migrations/20230924004608_accounts-payable.sql b/packages/database/supabase/migrations/20230924004608_accounts-payable.sqlindex df5ac2eb80..c7f22fc282 100644--- a/packages/database/supabase/migrations/20230924004608_accounts-payable.sql+++ b/packages/database/supabase/migrations/20230924004608_accounts-payable.sql@@ -192,7 +192,7 @@ CREATE TABLE "purchaseInvoiceLine" (CONSTRAINT "purchaseInvoiceLines_serviceId_fkey" FOREIGN KEY ("serviceId") REFERENCES "service" ("id") ON UPDATE CASCADE ON DELETE RESTRICT,CONSTRAINT "purchaseInvoiceLines_locationId_fkey" FOREIGN KEY ("locationId") REFERENCES "location" ("id") ON UPDATE CASCADE ON DELETE RESTRICT,CONSTRAINT "purchaseInvoiceLines_shelfId_fkey" FOREIGN KEY ("shelfId", "locationId") REFERENCES "shelf" ("id", "locationId") ON DELETE SET NULL ON UPDATE CASCADE,- CONSTRAINT "purchaseInvoiceLines_accountNumber_fkey" FOREIGN KEY ("accountNumber") REFERENCES "account" ("number") ON UPDATE CASCADE ON DELETE RESTRICT,+ CONSTRAINT "purchaseInvoiceLines_accountNumber_fkey" FOREIGN KEY ("accountNumber", "companyId") REFERENCES "account" ("number", "companyId") ON UPDATE CASCADE ON DELETE RESTRICT,-- CONSTRAINT "purchaseInvoiceLines_assetId_fkey" FOREIGN KEY ("assetId") REFERENCES "fixedAsset" ("id") ON UPDATE CASCADE ON DELETE RESTRICT,CONSTRAINT "purchaseInvoiceLines_currencyCode_fkey" FOREIGN KEY ("currencyCode", "companyId") REFERENCES "currency" ("code", "companyId") ON UPDATE CASCADE ON DELETE RESTRICT,CONSTRAINT "purchaseInvoiceLines_inventoryUnitOfMeasureCode_fkey" FOREIGN KEY ("inventoryUnitOfMeasureCode", "companyId") REFERENCES "unitOfMeasure" ("code", "companyId") ON UPDATE CASCADE ON DELETE SET NULL,diff --git a/packages/database/supabase/migrations/20240412224648_sales-orders.sql b/packages/database/supabase/migrations/20240412224648_sales-orders.sqlindex e2d4d80fe7..26c4c22d8e 100644--- a/packages/database/supabase/migrations/20240412224648_sales-orders.sql+++ b/packages/database/supabase/migrations/20240412224648_sales-orders.sql@@ -128,7 +128,7 @@ CREATE TABLE "salesOrderLine" (CONSTRAINT "salesOrderLine_salesOrderId_fkey" FOREIGN KEY ("salesOrderId") REFERENCES "salesOrder" ("id") ON DELETE CASCADE,CONSTRAINT "salesOrderLine_partId_fkey" FOREIGN KEY ("partId") REFERENCES "part" ("id") ON DELETE CASCADE ON UPDATE CASCADE,CONSTRAINT "salesOrderLine_serviceId_fkey" FOREIGN KEY ("serviceId") REFERENCES "service" ("id") ON DELETE CASCADE ON UPDATE CASCADE,- CONSTRAINT "salesOrderLine_accountNumber_fkey" FOREIGN KEY ("accountNumber") REFERENCES "account" ("number") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "salesOrderLine_accountNumber_fkey" FOREIGN KEY ("accountNumber", "companyId") REFERENCES "account" ("number", "companyId") ON DELETE CASCADE ON UPDATE CASCADE,-- TODO: Add assetId foreign keyCONSTRAINT "salesOrderLine_shelfId_fkey" FOREIGN KEY ("shelfId", "locationId") REFERENCES "shelf" ("id", "locationId") ON DELETE CASCADE,CONSTRAINT "salesOrderLine_unitOfMeasureCode_fkey" FOREIGN KEY ("unitOfMeasureCode", "companyId") REFERENCES "unitOfMeasure" ("code", "companyId") ON DELETE CASCADE ON UPDATE CASCADE,@@ -136,6 +136,8 @@ CREATE TABLE "salesOrderLine" (CONSTRAINT "salesOrderLine_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE RESTRICT);+CREATE INDEX "salesOrderLine_invoiceId_idx" ON "salesOrderLine" ("salesOrderId");+ALTER publication supabase_realtime ADD TABLE "salesOrderLine";CREATE TABLE "salesOrderPayment" (diff --git a/packages/database/supabase/seed.sql b/packages/database/supabase/seed.sqlindex c96c075ab1..59f6f419c7 100644--- a/packages/database/supabase/seed.sql+++ b/packages/database/supabase/seed.sql@@ -1,140 +1,140 @@-- users-INSERT INTO "user" ("id", "email", "firstName", "lastName")-VALUES ('system', '[email protected]', 'System', 'Operation');+-- INSERT INTO "user" ("id", "email", "firstName", "lastName")+-- VALUES ('system', '[email protected]', 'System', 'Operation');-- theme-INSERT INTO "theme" (- "theme",- "updatedBy"-) VALUES (- 'zinc',- 'system'-);+-- INSERT INTO "theme" (+-- "theme",+-- "updatedBy"+-- ) VALUES (+-- 'zinc',+-- 'system'+-- );-- currencies-INSERT INTO "currency" ("name", "code", "symbol", "exchangeRate", "decimalPlaces", "isBaseCurrency", "createdBy")-VALUES- ('US Dollar', 'USD', '$', 1, 2, TRUE, 'system'),- ('Canadian Dollar', 'CAD', 'CA$', 1, 2, FALSE, 'system'),- ('Euro', 'EUR', '€', 1, 2, FALSE, 'system'),- ('United Arab Emirates Dirham', 'AED', 'AED', 1, 2, FALSE, 'system'),- ('Afghan Afghani', 'AFN', 'Af', 1, 0, FALSE, 'system'),- ('Albanian Lek', 'ALL', 'ALL', 1, 0, FALSE, 'system'),- ('Armenian Dram', 'AMD', 'AMD', 1, 0, FALSE, 'system'),- ('Argentine Peso', 'ARS', 'AR$', 1, 2, FALSE, 'system'),- ('Australian Dollar', 'AUD', 'AU$', 1, 2, FALSE, 'system'),- ('Azerbaijani Manat', 'AZN', 'man.', 1, 2, FALSE, 'system'),- ('Bosnia-Herzegovina Convertible Mark', 'BAM', 'KM', 1, 2, FALSE, 'system'),- ('Bangladeshi Taka', 'BDT', 'Tk', 1, 2, FALSE, 'system'),- ('Bulgarian Lev', 'BGN', 'BGN', 1, 2, FALSE, 'system'),- ('Bahraini Dinar', 'BHD', 'BD', 1, 3, FALSE, 'system'),- ('Burundian Franc', 'BIF', 'FBu', 1, 0, FALSE, 'system'),- ('Brunei Dollar', 'BND', 'BN$', 1, 2, FALSE, 'system'),- ('Bolivian Boliviano', 'BOB', 'Bs', 1, 2, FALSE, 'system'),- ('Brazilian Real', 'BRL', 'R$', 1, 2, FALSE, 'system'),- ('Botswanan Pula', 'BWP', 'BWP', 1, 2, FALSE, 'system'),- ('Belarusian Ruble', 'BYN', 'Br', 1, 2, FALSE, 'system'),- ('Belize Dollar', 'BZD', 'BZ$', 1, 2, FALSE, 'system'),- ('Congolese Franc', 'CDF', 'CDF', 1, 2, FALSE, 'system'),- ('Swiss Franc', 'CHF', 'CHF', 1, 2, FALSE, 'system'),- ('Chilean Peso', 'CLP', 'CL$', 1, 0, FALSE, 'system'),- ('Chinese Yuan', 'CNY', 'CN¥', 1, 2, FALSE, 'system'),- ('Colombian Peso', 'COP', 'CO$', 1, 0, FALSE, 'system'),- ('Costa Rican Colón', 'CRC', '₡', 1, 0, FALSE, 'system'),- ('Cape Verdean Escudo', 'CVE', 'CV$', 1, 2, FALSE, 'system'),- ('Czech Republic Koruna', 'CZK', 'Kč', 1, 2, FALSE, 'system'),- ('Djiboutian Franc', 'DJF', 'Fdj', 1, 0, FALSE, 'system'),- ('Danish Krone', 'DKK', 'Dkr', 1, 2, FALSE, 'system'),- ('Dominican Peso', 'DOP', 'RD$', 1, 2, FALSE, 'system'),- ('Algerian Dinar', 'DZD', 'DA', 1, 2, FALSE, 'system'),- ('Egyptian Pound', 'EGP', 'EGP', 1, 2, FALSE, 'system'),- ('Eritrean Nakfa', 'ERN', 'Nfk', 1, 2, FALSE, 'system'),- ('Ethiopian Birr', 'ETB', 'Br', 1, 2, FALSE, 'system'),- ('British Pound Sterling', 'GBP', '£', 1, 2, FALSE, 'system'),- ('Georgian Lari', 'GEL', 'GEL', 1, 2, FALSE, 'system'),- ('Ghanaian Cedi', 'GHS', 'GH₵', 1, 2, FALSE, 'system'),- ('Guinean Franc', 'GNF', 'FG', 1, 0, FALSE, 'system'),- ('Guatemalan Quetzal', 'GTQ', 'GTQ', 1, 2, FALSE, 'system'),- ('Hong Kong Dollar', 'HKD', 'HK$', 1, 2, FALSE, 'system'),- ('Honduran Lempira', 'HNL', 'HNL', 1, 2, FALSE, 'system'),- ('Croatian Kuna', 'HRK', 'kn', 1, 2, FALSE, 'system'),- ('Hungarian Forint', 'HUF', 'Ft', 1, 0, FALSE, 'system'),- ('Indonesian Rupiah', 'IDR', 'Rp', 1, 0, FALSE, 'system'),- ('Israeli New Sheqel', 'ILS', '₪', 1, 2, FALSE, 'system'),- ('Indian Rupee', 'INR', 'Rs', 1, 2, FALSE, 'system'),- ('Iraqi Dinar', 'IQD', 'IQD', 1, 0, FALSE, 'system'),- ('Iranian Rial', 'IRR', 'IRR', 1, 0, FALSE, 'system'),- ('Icelandic Króna', 'ISK', 'Ikr', 1, 0, FALSE, 'system'),- ('Jamaican Dollar', 'JMD', 'J$', 1, 2, FALSE, 'system'),- ('Jordanian Dinar', 'JOD', 'JD', 1, 3, FALSE, 'system'),- ('Japanese Yen', 'JPY', '¥', 1, 0, FALSE, 'system'),- ('Kenyan Shilling', 'KES', 'Ksh', 1, 2, FALSE, 'system'),- ('Cambodian Riel', 'KHR', 'KHR', 1, 2, FALSE, 'system'),- ('Comorian Franc', 'KMF', 'CF', 1, 0, FALSE, 'system'),- ('South Korean Won', 'KRW', '₩', 1, 0, FALSE, 'system'),- ('Kuwaiti Dinar', 'KWD', 'KD', 1, 3, FALSE, 'system'),- ('Kazakhstani Tenge', 'KZT', 'KZT', 1, 2, FALSE, 'system'),- ('Lebanese Pound', 'LBP', 'L.L.', 1, 0, FALSE, 'system'),- ('Sri Lankan Rupee', 'LKR', 'SLRs', 1, 2, FALSE, 'system'),- ('Lithuanian Litas', 'LTL', 'Lt', 1, 2, FALSE, 'system'),- ('Latvian Lats', 'LVL', 'Ls', 1, 2, FALSE, 'system'),- ('Libyan Dinar', 'LYD', 'LD', 1, 3, FALSE, 'system'),- ('Moroccan Dirham', 'MAD', 'MAD', 1, 2, FALSE, 'system'),- ('Moldovan Leu', 'MDL', 'MDL', 1, 2, FALSE, 'system'),- ('Malagasy Ariary', 'MGA', 'MGA', 1, 0, FALSE, 'system'),- ('Macedonian Denar', 'MKD', 'MKD', 1, 2, FALSE, 'system'),- ('Myanma Kyat', 'MMK', 'MMK', 1, 0, FALSE, 'system'),- ('Macanese Pataca', 'MOP', 'MOP$', 1, 2, FALSE, 'system'),- ('Mauritian Rupee', 'MUR', 'MURs', 1, 0, FALSE, 'system'),- ('Mexican Peso', 'MXN', 'MX$', 1, 2, FALSE, 'system'),- ('Malaysian Ringgit', 'MYR', 'RM', 1, 2, FALSE, 'system'),- ('Mozambican Metical', 'MZN', 'MTn', 1, 2, FALSE, 'system'),- ('Namibian Dollar', 'NAD', 'N$', 1, 2, FALSE, 'system'),- ('Nigerian Naira', 'NGN', '₦', 1, 2, FALSE, 'system'),- ('Nicaraguan Córdoba', 'NIO', 'C$', 1, 2, FALSE, 'system'),- ('Norwegian Krone', 'NOK', 'Nkr', 1, 2, FALSE, 'system'),- ('Nepalese Rupee', 'NPR', 'NPRs', 1, 2, FALSE, 'system'),- ('New Zealand Dollar', 'NZD', 'NZ$', 1, 2, FALSE, 'system'),- ('Omani Rial', 'OMR', 'OMR', 1, 3, FALSE, 'system'),- ('Panamanian Balboa', 'PAB', 'B/.', 1, 2, FALSE, 'system'),- ('Peruvian Nuevo Sol', 'PEN', 'S/.', 1, 2, FALSE, 'system'),- ('Philippine Peso', 'PHP', '₱', 1, 2, FALSE, 'system'),- ('Pakistani Rupee', 'PKR', 'PKRs', 1, 0, FALSE, 'system'),- ('Polish Zloty', 'PLN', 'zł', 1, 2, FALSE, 'system'),- ('Paraguayan Guarani', 'PYG', '₲', 1, 0, FALSE, 'system'),- ('Qatari Rial', 'QAR', 'QR', 1, 2, FALSE, 'system'),- ('Romanian Leu', 'RON', 'RON', 1, 2, FALSE, 'system'),- ('Serbian Dinar', 'RSD', 'din.', 1, 0, FALSE, 'system'),- ('Russian Ruble', 'RUB', 'RUB', 1, 2, FALSE, 'system'),- ('Rwandan Franc', 'RWF', 'RWF', 1, 0, FALSE, 'system'),- ('Saudi Riyal', 'SAR', 'SR', 1, 2, FALSE, 'system'),- ('Sudanese Pound', 'SDG', 'SDG', 1, 2, FALSE, 'system'),- ('Swedish Krona', 'SEK', 'Skr', 1, 2, FALSE, 'system'),- ('Singapore Dollar', 'SGD', 'S$', 1, 2, FALSE, 'system'),- ('Somali Shilling', 'SOS', 'Ssh', 1, 0, FALSE, 'system'),- ('Syrian Pound', 'SYP', 'SY£', 1, 0, FALSE, 'system'),- ('Thai Baht', 'THB', '฿', 1, 2, FALSE, 'system'),- ('Tunisian Dinar', 'TND', 'DT', 1, 3, FALSE, 'system'),- ('Tongan Paʻanga', 'TOP', 'T$', 1, 2, FALSE, 'system'),- ('Turkish Lira', 'TRY', 'TL', 1, 2, FALSE, 'system'),- ('Trinidad and Tobago Dollar', 'TTD', 'TT$', 1, 2, FALSE, 'system'),- ('New Taiwan Dollar', 'TWD', 'NT$', 1, 2, FALSE, 'system'),- ('Tanzanian Shilling', 'TZS', 'TSh', 1, 0, FALSE, 'system'),- ('Ukrainian Hryvnia', 'UAH', '₴', 1, 2, FALSE, 'system'),- ('Ugandan Shilling', 'UGX', 'USh', 1, 0, FALSE, 'system'),- ('Uruguayan Peso', 'UYU', '$U', 1, 2, FALSE, 'system'),- ('Uzbekistan Som', 'UZS', 'UZS', 1, 0, FALSE, 'system'),- ('Venezuelan Bolívar', 'VEF', 'Bs.F.', 1, 2, FALSE, 'system'),- ('Vietnamese Dong', 'VND', '₫', 1, 0, FALSE, 'system'),- ('CFA Franc BEAC', 'XAF', 'FCFA', 1, 0, FALSE, 'system'),- ('CFA Franc BCEAO', 'XOF', 'CFA', 1, 0, FALSE, 'system'),- ('Yemeni Rial', 'YER', 'YR', 1, 0, FALSE, 'system'),- ('South African Rand', 'ZAR', 'R', 1, 2, FALSE, 'system'),- ('Zambian Kwacha', 'ZMK', 'ZK', 1, 0, FALSE, 'system'),- ('Zimbabwean Dollar', 'ZWL', 'ZWL$', 1, 0, FALSE, 'system');+-- INSERT INTO "currency" ("name", "code", "symbol", "exchangeRate", "decimalPlaces", "isBaseCurrency", "createdBy")+-- VALUES+-- ('US Dollar', 'USD', '$', 1, 2, TRUE, 'system'),+-- ('Canadian Dollar', 'CAD', 'CA$', 1, 2, FALSE, 'system'),+-- ('Euro', 'EUR', '€', 1, 2, FALSE, 'system'),+-- ('United Arab Emirates Dirham', 'AED', 'AED', 1, 2, FALSE, 'system'),+-- ('Afghan Afghani', 'AFN', 'Af', 1, 0, FALSE, 'system'),+-- ('Albanian Lek', 'ALL', 'ALL', 1, 0, FALSE, 'system'),+-- ('Armenian Dram', 'AMD', 'AMD', 1, 0, FALSE, 'system'),+-- ('Argentine Peso', 'ARS', 'AR$', 1, 2, FALSE, 'system'),+-- ('Australian Dollar', 'AUD', 'AU$', 1, 2, FALSE, 'system'),+-- ('Azerbaijani Manat', 'AZN', 'man.', 1, 2, FALSE, 'system'),+-- ('Bosnia-Herzegovina Convertible Mark', 'BAM', 'KM', 1, 2, FALSE, 'system'),+-- ('Bangladeshi Taka', 'BDT', 'Tk', 1, 2, FALSE, 'system'),+-- ('Bulgarian Lev', 'BGN', 'BGN', 1, 2, FALSE, 'system'),+-- ('Bahraini Dinar', 'BHD', 'BD', 1, 3, FALSE, 'system'),+-- ('Burundian Franc', 'BIF', 'FBu', 1, 0, FALSE, 'system'),+-- ('Brunei Dollar', 'BND', 'BN$', 1, 2, FALSE, 'system'),+-- ('Bolivian Boliviano', 'BOB', 'Bs', 1, 2, FALSE, 'system'),+-- ('Brazilian Real', 'BRL', 'R$', 1, 2, FALSE, 'system'),+-- ('Botswanan Pula', 'BWP', 'BWP', 1, 2, FALSE, 'system'),+-- ('Belarusian Ruble', 'BYN', 'Br', 1, 2, FALSE, 'system'),+-- ('Belize Dollar', 'BZD', 'BZ$', 1, 2, FALSE, 'system'),+-- ('Congolese Franc', 'CDF', 'CDF', 1, 2, FALSE, 'system'),+-- ('Swiss Franc', 'CHF', 'CHF', 1, 2, FALSE, 'system'),+-- ('Chilean Peso', 'CLP', 'CL$', 1, 0, FALSE, 'system'),+-- ('Chinese Yuan', 'CNY', 'CN¥', 1, 2, FALSE, 'system'),+-- ('Colombian Peso', 'COP', 'CO$', 1, 0, FALSE, 'system'),+-- ('Costa Rican Colón', 'CRC', '₡', 1, 0, FALSE, 'system'),+-- ('Cape Verdean Escudo', 'CVE', 'CV$', 1, 2, FALSE, 'system'),+-- ('Czech Republic Koruna', 'CZK', 'Kč', 1, 2, FALSE, 'system'),+-- ('Djiboutian Franc', 'DJF', 'Fdj', 1, 0, FALSE, 'system'),+-- ('Danish Krone', 'DKK', 'Dkr', 1, 2, FALSE, 'system'),+-- ('Dominican Peso', 'DOP', 'RD$', 1, 2, FALSE, 'system'),+-- ('Algerian Dinar', 'DZD', 'DA', 1, 2, FALSE, 'system'),+-- ('Egyptian Pound', 'EGP', 'EGP', 1, 2, FALSE, 'system'),+-- ('Eritrean Nakfa', 'ERN', 'Nfk', 1, 2, FALSE, 'system'),+-- ('Ethiopian Birr', 'ETB', 'Br', 1, 2, FALSE, 'system'),+-- ('British Pound Sterling', 'GBP', '£', 1, 2, FALSE, 'system'),+-- ('Georgian Lari', 'GEL', 'GEL', 1, 2, FALSE, 'system'),+-- ('Ghanaian Cedi', 'GHS', 'GH₵', 1, 2, FALSE, 'system'),+-- ('Guinean Franc', 'GNF', 'FG', 1, 0, FALSE, 'system'),+-- ('Guatemalan Quetzal', 'GTQ', 'GTQ', 1, 2, FALSE, 'system'),+-- ('Hong Kong Dollar', 'HKD', 'HK$', 1, 2, FALSE, 'system'),+-- ('Honduran Lempira', 'HNL', 'HNL', 1, 2, FALSE, 'system'),+-- ('Croatian Kuna', 'HRK', 'kn', 1, 2, FALSE, 'system'),+-- ('Hungarian Forint', 'HUF', 'Ft', 1, 0, FALSE, 'system'),+-- ('Indonesian Rupiah', 'IDR', 'Rp', 1, 0, FALSE, 'system'),+-- ('Israeli New Sheqel', 'ILS', '₪', 1, 2, FALSE, 'system'),+-- ('Indian Rupee', 'INR', 'Rs', 1, 2, FALSE, 'system'),+-- ('Iraqi Dinar', 'IQD', 'IQD', 1, 0, FALSE, 'system'),+-- ('Iranian Rial', 'IRR', 'IRR', 1, 0, FALSE, 'system'),+-- ('Icelandic Króna', 'ISK', 'Ikr', 1, 0, FALSE, 'system'),+-- ('Jamaican Dollar', 'JMD', 'J$', 1, 2, FALSE, 'system'),+-- ('Jordanian Dinar', 'JOD', 'JD', 1, 3, FALSE, 'system'),+-- ('Japanese Yen', 'JPY', '¥', 1, 0, FALSE, 'system'),+-- ('Kenyan Shilling', 'KES', 'Ksh', 1, 2, FALSE, 'system'),+-- ('Cambodian Riel', 'KHR', 'KHR', 1, 2, FALSE, 'system'),+-- ('Comorian Franc', 'KMF', 'CF', 1, 0, FALSE, 'system'),+-- ('South Korean Won', 'KRW', '₩', 1, 0, FALSE, 'system'),+-- ('Kuwaiti Dinar', 'KWD', 'KD', 1, 3, FALSE, 'system'),+-- ('Kazakhstani Tenge', 'KZT', 'KZT', 1, 2, FALSE, 'system'),+-- ('Lebanese Pound', 'LBP', 'L.L.', 1, 0, FALSE, 'system'),+-- ('Sri Lankan Rupee', 'LKR', 'SLRs', 1, 2, FALSE, 'system'),+-- ('Lithuanian Litas', 'LTL', 'Lt', 1, 2, FALSE, 'system'),+-- ('Latvian Lats', 'LVL', 'Ls', 1, 2, FALSE, 'system'),+-- ('Libyan Dinar', 'LYD', 'LD', 1, 3, FALSE, 'system'),+-- ('Moroccan Dirham', 'MAD', 'MAD', 1, 2, FALSE, 'system'),+-- ('Moldovan Leu', 'MDL', 'MDL', 1, 2, FALSE, 'system'),+-- ('Malagasy Ariary', 'MGA', 'MGA', 1, 0, FALSE, 'system'),+-- ('Macedonian Denar', 'MKD', 'MKD', 1, 2, FALSE, 'system'),+-- ('Myanma Kyat', 'MMK', 'MMK', 1, 0, FALSE, 'system'),+-- ('Macanese Pataca', 'MOP', 'MOP$', 1, 2, FALSE, 'system'),+-- ('Mauritian Rupee', 'MUR', 'MURs', 1, 0, FALSE, 'system'),+-- ('Mexican Peso', 'MXN', 'MX$', 1, 2, FALSE, 'system'),+-- ('Malaysian Ringgit', 'MYR', 'RM', 1, 2, FALSE, 'system'),+-- ('Mozambican Metical', 'MZN', 'MTn', 1, 2, FALSE, 'system'),+-- ('Namibian Dollar', 'NAD', 'N$', 1, 2, FALSE, 'system'),+-- ('Nigerian Naira', 'NGN', '₦', 1, 2, FALSE, 'system'),+-- ('Nicaraguan Córdoba', 'NIO', 'C$', 1, 2, FALSE, 'system'),+-- ('Norwegian Krone', 'NOK', 'Nkr', 1, 2, FALSE, 'system'),+-- ('Nepalese Rupee', 'NPR', 'NPRs', 1, 2, FALSE, 'system'),+-- ('New Zealand Dollar', 'NZD', 'NZ$', 1, 2, FALSE, 'system'),+-- ('Omani Rial', 'OMR', 'OMR', 1, 3, FALSE, 'system'),+-- ('Panamanian Balboa', 'PAB', 'B/.', 1, 2, FALSE, 'system'),+-- ('Peruvian Nuevo Sol', 'PEN', 'S/.', 1, 2, FALSE, 'system'),+-- ('Philippine Peso', 'PHP', '₱', 1, 2, FALSE, 'system'),+-- ('Pakistani Rupee', 'PKR', 'PKRs', 1, 0, FALSE, 'system'),+-- ('Polish Zloty', 'PLN', 'zł', 1, 2, FALSE, 'system'),+-- ('Paraguayan Guarani', 'PYG', '₲', 1, 0, FALSE, 'system'),+-- ('Qatari Rial', 'QAR', 'QR', 1, 2, FALSE, 'system'),+-- ('Romanian Leu', 'RON', 'RON', 1, 2, FALSE, 'system'),+-- ('Serbian Dinar', 'RSD', 'din.', 1, 0, FALSE, 'system'),+-- ('Russian Ruble', 'RUB', 'RUB', 1, 2, FALSE, 'system'),+-- ('Rwandan Franc', 'RWF', 'RWF', 1, 0, FALSE, 'system'),+-- ('Saudi Riyal', 'SAR', 'SR', 1, 2, FALSE, 'system'),+-- ('Sudanese Pound', 'SDG', 'SDG', 1, 2, FALSE, 'system'),+-- ('Swedish Krona', 'SEK', 'Skr', 1, 2, FALSE, 'system'),+-- ('Singapore Dollar', 'SGD', 'S$', 1, 2, FALSE, 'system'),+-- ('Somali Shilling', 'SOS', 'Ssh', 1, 0, FALSE, 'system'),+-- ('Syrian Pound', 'SYP', 'SY£', 1, 0, FALSE, 'system'),+-- ('Thai Baht', 'THB', '฿', 1, 2, FALSE, 'system'),+-- ('Tunisian Dinar', 'TND', 'DT', 1, 3, FALSE, 'system'),+-- ('Tongan Paʻanga', 'TOP', 'T$', 1, 2, FALSE, 'system'),+-- ('Turkish Lira', 'TRY', 'TL', 1, 2, FALSE, 'system'),+-- ('Trinidad and Tobago Dollar', 'TTD', 'TT$', 1, 2, FALSE, 'system'),+-- ('New Taiwan Dollar', 'TWD', 'NT$', 1, 2, FALSE, 'system'),+-- ('Tanzanian Shilling', 'TZS', 'TSh', 1, 0, FALSE, 'system'),+-- ('Ukrainian Hryvnia', 'UAH', '₴', 1, 2, FALSE, 'system'),+-- ('Ugandan Shilling', 'UGX', 'USh', 1, 0, FALSE, 'system'),+-- ('Uruguayan Peso', 'UYU', '$U', 1, 2, FALSE, 'system'),+-- ('Uzbekistan Som', 'UZS', 'UZS', 1, 0, FALSE, 'system'),+-- ('Venezuelan Bolívar', 'VEF', 'Bs.F.', 1, 2, FALSE, 'system'),+-- ('Vietnamese Dong', 'VND', '₫', 1, 0, FALSE, 'system'),+-- ('CFA Franc BEAC', 'XAF', 'FCFA', 1, 0, FALSE, 'system'),+-- ('CFA Franc BCEAO', 'XOF', 'CFA', 1, 0, FALSE, 'system'),+-- ('Yemeni Rial', 'YER', 'YR', 1, 0, FALSE, 'system'),+-- ('South African Rand', 'ZAR', 'R', 1, 2, FALSE, 'system'),+-- ('Zambian Kwacha', 'ZMK', 'ZK', 1, 0, FALSE, 'system'),+-- ('Zimbabwean Dollar', 'ZWL', 'ZWL$', 1, 0, FALSE, 'system');-- attribute types@@ -189,333 +189,335 @@ VALUES-- account categories-INSERT INTO public."accountCategory" (id, category, class, "incomeBalance", "createdBy")-VALUES- ('cjgo71si60lg1aoj5p40', 'Bank', 'Asset', 'Balance Sheet', 'system'),- ('cjgo71si60lg1aoj5p4g', 'Accounts Receivable', 'Asset', 'Balance Sheet', 'system'),- ('cjgo71si60lg1aoj5p50', 'Inventory', 'Asset', 'Balance Sheet', 'system'),- ('cjgo71si60lg1aoj5p5g', 'Other Current Asset', 'Asset', 'Balance Sheet', 'system'),- ('cjgo71si60lg1aoj5p60', 'Fixed Asset', 'Asset', 'Balance Sheet', 'system'),- ('cjgo71si60lg1aoj5p6g', 'Accumulated Depreciation', 'Asset', 'Balance Sheet', 'system'),- ('cjgo71si60lg1aoj5p70', 'Other Asset', 'Asset', 'Balance Sheet', 'system'),- ('cjgo71si60lg1aoj5p7g', 'Accounts Payable', 'Liability', 'Balance Sheet', 'system'),- ('cjgo71si60lg1aoj5p80', 'Other Current Liability', 'Liability', 'Balance Sheet', 'system'),- ('cjgo71si60lg1aoj5p8g', 'Long Term Liability', 'Liability', 'Balance Sheet', 'system'),- ('cjgo71si60lg1aoj5p90', 'Equity - No Close', 'Equity', 'Balance Sheet', 'system'),- ('cjgo71si60lg1aoj5p9g', 'Equity - Close', 'Equity', 'Balance Sheet', 'system'),- ('cjgo71si60lg1aoj5pa0', 'Retained Earnings', 'Equity', 'Balance Sheet', 'system'),- ('cjgo71si60lg1aoj5pag', 'Income', 'Revenue', 'Income Statement', 'system'),- ('cjgo71si60lg1aoj5pb0', 'Cost of Goods Sold', 'Expense', 'Income Statement', 'system'),- ('cjgo71si60lg1aoj5pbg', 'Expense', 'Expense', 'Income Statement', 'system'),- ('cjgo71si60lg1aoj5pc0', 'Other Income', 'Expense', 'Income Statement', 'system'),- ('cjgo71si60lg1aoj5pcg', 'Other Expense', 'Expense', 'Income Statement', 'system');+-- INSERT INTO public."accountCategory" (id, category, class, "incomeBalance", "createdBy")+-- VALUES+-- ('Bank', 'Bank', 'Asset', 'Balance Sheet', 'system'),+-- ('Accounts Receivable', 'Accounts Receivable', 'Asset', 'Balance Sheet', 'system'),+-- ('Inventory', 'Inventory', 'Asset', 'Balance Sheet', 'system'),+-- ('Other Current Asset', 'Other Current Asset', 'Asset', 'Balance Sheet', 'system'),+-- ('Fixed Asset', 'Fixed Asset', 'Asset', 'Balance Sheet', 'system'),+-- ('Accumulated Depreciation', 'Accumulated Depreciation', 'Asset', 'Balance Sheet', 'system'),+-- ('Other Asset', 'Other Asset', 'Asset', 'Balance Sheet', 'system'),+-- ('Accounts Payable', 'Accounts Payable', 'Liability', 'Balance Sheet', 'system'),+-- ('Other Current Liability', 'Other Current Liability', 'Liability', 'Balance Sheet', 'system'),+-- ('Long Term Liability', 'Long Term Liability', 'Liability', 'Balance Sheet', 'system'),+-- ('Equity - No Close', 'Equity - No Close', 'Equity', 'Balance Sheet', 'system'),+-- ('Equity - Close', 'Equity - Close', 'Equity', 'Balance Sheet', 'system'),+-- ('Retained Earnings', 'Retained Earnings', 'Equity', 'Balance Sheet', 'system'),+-- ('Income', 'Income', 'Revenue', 'Income Statement', 'system'),+-- ('Cost of Goods Sold', 'Cost of Goods Sold', 'Expense', 'Income Statement', 'system'),+-- ('Expense', 'Expense', 'Expense', 'Income Statement', 'system'),+-- ('Other Income', 'Other Income', 'Expense', 'Income Statement', 'system'),+-- ('Other Expense', 'Other Expense', 'Expense', 'Income Statement', 'system');-- accounts-INSERT INTO public.account- (number, name, type, "accountCategoryId", "accountSubcategoryId", "incomeBalance", "class", "consolidatedRate", "directPosting", active, "createdBy")-VALUES- ('10000', 'Income Statement', 'Begin Total', 'cjgo71si60lg1aoj5pag', NULL, 'Income Statement', null, 'Average', false, true, 'system'),- ('11000', 'Revenue', 'Begin Total', 'cjgo71si60lg1aoj5pag', NULL, 'Income Statement', 'Revenue', 'Average', false, true, 'system'),- ('11210', 'Sales', 'Posting', 'cjgo71si60lg1aoj5pag', NULL, 'Income Statement', 'Revenue', 'Average', true, true, 'system'),- ('11600', 'Sales Discounts', 'Posting', 'cjgo71si60lg1aoj5pag', NULL, 'Income Statement', 'Revenue', 'Average', true, true, 'system'),- ('19999', 'Revenue, Total', 'End Total', 'cjgo71si60lg1aoj5pag', NULL, 'Income Statement', 'Revenue', 'Average', false, true, 'system'),- ('20000', 'Costs of Goods Sold', 'Begin Total', 'cjgo71si60lg1aoj5pb0', NULL, 'Income Statement', 'Expense', 'Average', false, true, 'system'),- ('21210', 'Cost of Goods Sold', 'Posting', 'cjgo71si60lg1aoj5pb0', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),- ('21410', 'Purchases', 'Posting', 'cjgo71si60lg1aoj5pb0', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),- ('21590', 'Direct Cost Applied', 'Posting', 'cjgo71si60lg1aoj5pb0', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),- ('21600', 'Overhead Applied', 'Posting', 'cjgo71si60lg1aoj5pb0', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),- ('21610', 'Purchase Variance', 'Posting', 'cjgo71si60lg1aoj5pb0', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),- ('21700', 'Inventory Adjustment', 'Posting', 'cjgo71si60lg1aoj5pb0', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),- ('24999', 'Costs of Goods Sold, Total', 'End Total', 'cjgo71si60lg1aoj5pbg', NULL, 'Income Statement', 'Expense', 'Average', false, true, 'system'),- ('25000', 'Direct Capacity Cost', 'Begin Total', 'cjgo71si60lg1aoj5pbg', NULL, 'Income Statement', 'Expense', 'Average', false, true, 'system'),- ('25705', 'Material Variance', 'Posting', 'cjgo71si60lg1aoj5pbg', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),- ('25710', 'Capacity Variance', 'Posting', 'cjgo71si60lg1aoj5pbg', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),- ('25720', 'Overhead Accounts', 'Posting', 'cjgo71si60lg1aoj5pbg', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),- ('47045', 'Maintenance Expense', 'Posting', 'cjgo71si60lg1aoj5pbg', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),- ('49999', 'Direct Capacity Cost, Total', 'End Total', 'cjgo71si60lg1aoj5pbg', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),- ('50000', 'Depreciation of Fixed Assets', 'Begin Total', 'cjgo71si60lg1aoj5pcg', NULL, 'Income Statement', 'Expense', 'Average', false, true, 'system'),- ('50015', 'Depreciation Expense', 'Posting', 'cjgo71si60lg1aoj5pcg', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),- ('50040', 'Gains and Losses on Disposal', 'Posting', 'cjgo71si60lg1aoj5pcg', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),- ('50045', 'Service Charge Account', 'Posting', 'cjgo71si60lg1aoj5pcg', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),- ('50999', 'Depreciation of Fixed Assets, Total', 'End Total', 'cjgo71si60lg1aoj5pcg', NULL, 'Income Statement', 'Expense', 'Average', false, true, 'system'),- ('51000', 'Interest', 'Begin Total', 'cjgo71si60lg1aoj5pcg', NULL, 'Income Statement', 'Expense', 'Average', false, true, 'system'),- ('51110', 'Interest Account', 'Posting', 'cjgo71si60lg1aoj5pcg', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),- ('51115', 'Supplier Payment Discounts', 'Posting', 'cjgo71si60lg1aoj5pcg', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),- ('51120', 'Customer Payment Discounts', 'Posting', 'cjgo71si60lg1aoj5pcg', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),- ('51235', 'Rounding Account', 'Posting', 'cjgo71si60lg1aoj5pcg', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),- ('51999', 'Interest, Total', 'End Total', 'cjgo71si60lg1aoj5pcg', NULL, 'Income Statement', 'Expense', 'Average', false, true, 'system'),- ('79999', 'Income Statement, Total', 'Total', 'cjgo71si60lg1aoj5pag', NULL, 'Income Statement', null, 'Average', false, true, 'system'),- ('80000', 'Balance Sheet', 'Begin Total', NULL, NULL, 'Balance Sheet', null, 'Average', false, true, 'system'),- ('80001', 'Assets', 'Begin Total', NULL, NULL, 'Balance Sheet', 'Asset', 'Average', false, true, 'system'),- ('81000', 'Fixed Assets', 'Begin Total', NULL, NULL, 'Balance Sheet', 'Asset', 'Average', false, true, 'system'),- ('81010', 'Fixed Asset Acquisition Cost', 'Posting', 'cjgo71si60lg1aoj5p60', NULL, 'Balance Sheet', 'Asset', 'Average', true, true, 'system'),- ('81015', 'Fixed Asset Acquisition Cost on Disposal', 'Posting', 'cjgo71si60lg1aoj5p60', NULL, 'Balance Sheet', 'Asset','Average', true, true, 'system'),- ('81020', 'Accumulated Depreciation', 'Posting', 'cjgo71si60lg1aoj5p6g', NULL, 'Balance Sheet', 'Asset', 'Average', true, true, 'system'),- ('81030', 'Fixed Asset Acquisition Depreciation on Disposal', 'Posting', 'cjgo71si60lg1aoj5p6g', NULL, 'Balance Sheet', 'Asset', 'Average', true, true, 'system'),- ('81999', 'Fixed Assets, Total', 'End Total', NULL, NULL, 'Balance Sheet', 'Asset', 'Average', false, true, 'system'),- ('83000', 'Current Assets', 'Begin Total', NULL, NULL, 'Balance Sheet', 'Asset', 'Average', false, true, 'system'),- ('83105', 'Inventory', 'Posting', 'cjgo71si60lg1aoj5p50', NULL, 'Balance Sheet', 'Asset', 'Average', true, true, 'system'),- ('83120', 'Inventory Interim', 'Posting', 'cjgo71si60lg1aoj5p50', NULL, 'Balance Sheet', 'Asset', 'Average', true, true, 'system'),- ('83125', 'Work In Progress (WIP)', 'Posting', 'cjgo71si60lg1aoj5p50', NULL, 'Balance Sheet', 'Asset', 'Average', true, true, 'system'),- ('85005', 'Receivables', 'Posting', 'cjgo71si60lg1aoj5p4g', NULL, 'Balance Sheet', 'Asset', 'Average', true, true, 'system'),- ('85020', 'Inventory Invoiced Not Received', 'Posting', 'cjgo71si60lg1aoj5p4g', NULL, 'Balance Sheet', 'Asset', 'Average', true, true, 'system'),- ('86005', 'Bank - Cash', 'Posting', 'cjgo71si60lg1aoj5p40', NULL, 'Balance Sheet', 'Asset', 'Average', true, true, 'system'),- ('86010', 'Bank - Local Currency', 'Posting', 'cjgo71si60lg1aoj5p40', NULL, 'Balance Sheet', 'Asset', 'Average', false, true, 'system'),- ('86015', 'Bank - Foreign Currency', 'Posting', 'cjgo71si60lg1aoj5p40', NULL, 'Balance Sheet', 'Asset', 'Average', false, true, 'system'),- ('87999', 'Current Assets, Total', 'End Total', NULL, NULL, 'Balance Sheet', 'Asset', 'Average', false, true, 'system'),- ('89999', 'Assets, Total', 'End Total', NULL, NULL, 'Balance Sheet', 'Asset', 'Average', false, true, 'system'),- ('90000', 'Liabilities', 'Begin Total', NULL, NULL, 'Balance Sheet', 'Liability', 'Average', false, true, 'system'),- ('92210', 'Customer Prepayments', 'Posting', 'cjgo71si60lg1aoj5p80', NULL, 'Balance Sheet', 'Liability', 'Average', true, true, 'system'),- ('93005', 'Payables', 'Posting', 'cjgo71si60lg1aoj5p7g', NULL, 'Balance Sheet', 'Liability', 'Average', true, true, 'system'),- ('93010', 'Inventory Received Not Invoiced', 'Posting', 'cjgo71si60lg1aoj5p80', NULL, 'Balance Sheet', 'Liability', 'Average', true, true, 'system'),- ('93110', 'Inventory Shipped Not Invoiced', 'Posting', 'cjgo71si60lg1aoj5p80', NULL, 'Balance Sheet', 'Liability', 'Average', true, true, 'system'),- ('94100', 'Sales Tax Payable', 'Posting', 'cjgo71si60lg1aoj5p80', NULL, 'Balance Sheet', 'Liability', 'Average', true, true, 'system'),- ('94110', 'Purchase Tax Payable', 'Posting', 'cjgo71si60lg1aoj5p80', NULL, 'Balance Sheet', 'Liability', 'Average', true, true, 'system'),- ('94115', 'Reverse Charge Tax Payable', 'Posting', 'cjgo71si60lg1aoj5p80', NULL, 'Balance Sheet', 'Liability', 'Average', true, true, 'system'),- ('94999', 'Liabilities, Total', 'End Total', NULL, NULL, 'Balance Sheet', 'Liability', 'Average', false, true, 'system'),- ('95000', 'Equity', 'Begin Total', NULL, NULL, 'Balance Sheet', 'Equity', 'Average', false, true, 'system'),- ('95010', 'Retained Earnings', 'Posting', 'cjgo71si60lg1aoj5pa0', NULL, 'Balance Sheet', 'Equity', 'Average', false, true, 'system'),- ('96010', 'Owner Equity', 'Posting', 'cjgo71si60lg1aoj5p90', NULL, 'Balance Sheet', 'Equity', 'Average', true, true, 'system'),- ('96999', 'Equity, Total', 'End Total', NULL, NULL, 'Balance Sheet', 'Equity', 'Average', false, true, 'system'),- ('99999', 'Balance Sheet, Total', 'Total', NULL, NULL, 'Balance Sheet', null, 'Average', false, true, 'system');- INSERT INTO public."accountDefault" (- "id",- "salesAccount",- "salesDiscountAccount",- "costOfGoodsSoldAccount",- "purchaseAccount",- "directCostAppliedAccount",- "overheadCostAppliedAccount",- "purchaseVarianceAccount",- "inventoryAdjustmentVarianceAccount",- "materialVarianceAccount",- "capacityVarianceAccount",- "overheadAccount",- "maintenanceAccount",- "assetDepreciationExpenseAccount",- "assetGainsAndLossesAccount",- "serviceChargeAccount",- "interestAccount",- "supplierPaymentDiscountAccount",- "customerPaymentDiscountAccount",- "roundingAccount",- "assetAquisitionCostAccount",- "assetAquisitionCostOnDisposalAccount",- "accumulatedDepreciationAccount",- "accumulatedDepreciationOnDisposalAccount",- "inventoryAccount",- "inventoryInterimAccrualAccount",- "workInProgressAccount",- "receivablesAccount",- "inventoryInvoicedNotReceivedAccount",- "bankCashAccount",- "bankLocalCurrencyAccount",- "bankForeignCurrencyAccount",- "prepaymentAccount",- "payablesAccount",- "inventoryReceivedNotInvoicedAccount",- "inventoryShippedNotInvoicedAccount",- "salesTaxPayableAccount",- "purchaseTaxPayableAccount",- "reverseChargeSalesTaxPayableAccount",- "retainedEarningsAccount",- "updatedBy"- ) VALUES (- true,- '11210',- '11600',- '21210',- '21410',- '21590',- '21600',- '21610',- '21700',- '25705',- '25710',- '25720',- '47045',- '50015',- '50040',- '50045',- '51110',- '51115',- '51120',- '51235',- '81010',- '81015',- '81020',- '81030',- '83105',- '83120',- '83125',- '85005',- '85020',- '86005',- '86010',- '86015',- '92210',- '93005',- '93010',- '93110',- '94100',- '94110',- '94115',- '95010',- 'system'- );+-- INSERT INTO public.account+-- (number, name, type, "accountCategoryId", "accountSubcategoryId", "incomeBalance", "class", "consolidatedRate", "directPosting", active, "createdBy")+-- VALUES+ -- ('10000', 'Income Statement', 'Begin Total', 'Income', NULL, 'Income Statement', null, 'Average', false, true, 'system'),+ -- ('11000', 'Revenue', 'Begin Total', 'Income', NULL, 'Income Statement', 'Revenue', 'Average', false, true, 'system'),+ -- ('11210', 'Sales', 'Posting', 'Income', NULL, 'Income Statement', 'Revenue', 'Average', true, true, 'system'),+ -- ('11600', 'Sales Discounts', 'Posting', 'Income', NULL, 'Income Statement', 'Revenue', 'Average', true, true, 'system'),+ -- ('19999', 'Revenue, Total', 'End Total', 'Income', NULL, 'Income Statement', 'Revenue', 'Average', false, true, 'system'),+ -- ('20000', 'Costs of Goods Sold', 'Begin Total', 'Cost of Goods Sold', NULL, 'Income Statement', 'Expense', 'Average', false, true, 'system'),+ -- ('21210', 'Cost of Goods Sold', 'Posting', 'Cost of Goods Sold', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),+ -- ('21410', 'Purchases', 'Posting', 'Cost of Goods Sold', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),+ -- ('21590', 'Direct Cost Applied', 'Posting', 'Cost of Goods Sold', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),+ -- ('21600', 'Overhead Applied', 'Posting', 'Cost of Goods Sold', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),+ -- ('21610', 'Purchase Variance', 'Posting', 'Cost of Goods Sold', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),+ -- ('21700', 'Inventory Adjustment', 'Posting', 'Cost of Goods Sold', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),+ -- ('24999', 'Costs of Goods Sold, Total', 'End Total', 'Expense', NULL, 'Income Statement', 'Expense', 'Average', false, true, 'system'),+ -- ('25000', 'Direct Capacity Cost', 'Begin Total', 'Expense', NULL, 'Income Statement', 'Expense', 'Average', false, true, 'system'),+ -- ('25705', 'Material Variance', 'Posting', 'Expense', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),+ -- ('25710', 'Capacity Variance', 'Posting', 'Expense', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),+ -- ('25720', 'Overhead Accounts', 'Posting', 'Expense', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),+ -- ('47045', 'Maintenance Expense', 'Posting', 'Expense', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),+ -- ('49999', 'Direct Capacity Cost, Total', 'End Total', 'Expense', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),+ -- ('50000', 'Depreciation of Fixed Assets', 'Begin Total', 'Other Expense', NULL, 'Income Statement', 'Expense', 'Average', false, true, 'system'),+ -- ('50015', 'Depreciation Expense', 'Posting', 'Other Expense', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),+ -- ('50040', 'Gains and Losses on Disposal', 'Posting', 'Other Expense', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),+ -- ('50045', 'Service Charge Account', 'Posting', 'Other Expense', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),+ -- ('50999', 'Depreciation of Fixed Assets, Total', 'End Total', 'Other Expense', NULL, 'Income Statement', 'Expense', 'Average', false, true, 'system'),+ -- ('51000', 'Interest', 'Begin Total', 'Other Expense', NULL, 'Income Statement', 'Expense', 'Average', false, true, 'system'),+ -- ('51110', 'Interest Account', 'Posting', 'Other Expense', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),+ -- ('51115', 'Supplier Payment Discounts', 'Posting', 'Other Expense', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),+ -- ('51120', 'Customer Payment Discounts', 'Posting', 'Other Expense', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),+ -- ('51235', 'Rounding Account', 'Posting', 'Other Expense', NULL, 'Income Statement', 'Expense', 'Average', true, true, 'system'),+ -- ('51999', 'Interest, Total', 'End Total', 'Other Expense', NULL, 'Income Statement', 'Expense', 'Average', false, true, 'system'),+ -- ('79999', 'Income Statement, Total', 'Total', 'Income', NULL, 'Income Statement', null, 'Average', false, true, 'system'),+ -- ('80000', 'Balance Sheet', 'Begin Total', NULL, NULL, 'Balance Sheet', null, 'Average', false, true, 'system'),+ -- ('80001', 'Assets', 'Begin Total', NULL, NULL, 'Balance Sheet', 'Asset', 'Average', false, true, 'system'),+ -- ('81000', 'Fixed Assets', 'Begin Total', NULL, NULL, 'Balance Sheet', 'Asset', 'Average', false, true, 'system'),+ -- ('81010', 'Fixed Asset Acquisition Cost', 'Posting', 'Fixed Asset', NULL, 'Balance Sheet', 'Asset', 'Average', true, true, 'system'),+ -- ('81015', 'Fixed Asset Acquisition Cost on Disposal', 'Posting', 'Fixed Asset', NULL, 'Balance Sheet', 'Asset','Average', true, true, 'system'),+ -- ('81020', 'Accumulated Depreciation', 'Posting', 'Accumulated Depreciation', NULL, 'Balance Sheet', 'Asset', 'Average', true, true, 'system'),+ -- ('81030', 'Fixed Asset Acquisition Depreciation on Disposal', 'Posting', 'Accumulated Depreciation', NULL, 'Balance Sheet', 'Asset', 'Average', true, true, 'system'),+ -- ('81999', 'Fixed Assets, Total', 'End Total', NULL, NULL, 'Balance Sheet', 'Asset', 'Average', false, true, 'system'),+ -- ('83000', 'Current Assets', 'Begin Total', NULL, NULL, 'Balance Sheet', 'Asset', 'Average', false, true, 'system'),+ -- ('83105', 'Inventory', 'Posting', 'Inventory', NULL, 'Balance Sheet', 'Asset', 'Average', true, true, 'system'),+ -- ('83120', 'Inventory Interim', 'Posting', 'Inventory', NULL, 'Balance Sheet', 'Asset', 'Average', true, true, 'system'),+ -- ('83125', 'Work In Progress (WIP)', 'Posting', 'Inventory', NULL, 'Balance Sheet', 'Asset', 'Average', true, true, 'system'),+ -- ('85005', 'Receivables', 'Posting', 'Accounts Receivable', NULL, 'Balance Sheet', 'Asset', 'Average', true, true, 'system'),+ -- ('85020', 'Inventory Invoiced Not Received', 'Posting', 'Accounts Receivable', NULL, 'Balance Sheet', 'Asset', 'Average', true, true, 'system'),+ -- ('86005', 'Bank - Cash', 'Posting', 'Bank', NULL, 'Balance Sheet', 'Asset', 'Average', true, true, 'system'),+ -- ('86010', 'Bank - Local Currency', 'Posting', 'Bank', NULL, 'Balance Sheet', 'Asset', 'Average', false, true, 'system'),+ -- ('86015', 'Bank - Foreign Currency', 'Posting', 'Bank', NULL, 'Balance Sheet', 'Asset', 'Average', false, true, 'system'),+ -- ('87999', 'Current Assets, Total', 'End Total', NULL, NULL, 'Balance Sheet', 'Asset', 'Average', false, true, 'system'),+ -- ('89999', 'Assets, Total', 'End Total', NULL, NULL, 'Balance Sheet', 'Asset', 'Average', false, true, 'system'),+ -- ('90000', 'Liabilities', 'Begin Total', NULL, NULL, 'Balance Sheet', 'Liability', 'Average', false, true, 'system'),+ -- ('92210', 'Customer Prepayments', 'Posting', 'Other Current Liability', NULL, 'Balance Sheet', 'Liability', 'Average', true, true, 'system'),+ -- ('93005', 'Payables', 'Posting', 'Accounts Payable', NULL, 'Balance Sheet', 'Liability', 'Average', true, true, 'system'),+ -- ('93010', 'Inventory Received Not Invoiced', 'Posting', 'Other Current Liability', NULL, 'Balance Sheet', 'Liability', 'Average', true, true, 'system'),+ -- ('93110', 'Inventory Shipped Not Invoiced', 'Posting', 'Other Current Liability', NULL, 'Balance Sheet', 'Liability', 'Average', true, true, 'system'),+ -- ('94100', 'Sales Tax Payable', 'Posting', 'Other Current Liability', NULL, 'Balance Sheet', 'Liability', 'Average', true, true, 'system'),+ -- ('94110', 'Purchase Tax Payable', 'Posting', 'Other Current Liability', NULL, 'Balance Sheet', 'Liability', 'Average', true, true, 'system'),+ -- ('94115', 'Reverse Charge Tax Payable', 'Posting', 'Other Current Liability', NULL, 'Balance Sheet', 'Liability', 'Average', true, true, 'system'),+ -- ('94999', 'Liabilities, Total', 'End Total', NULL, NULL, 'Balance Sheet', 'Liability', 'Average', false, true, 'system'),+ -- ('95000', 'Equity', 'Begin Total', NULL, NULL, 'Balance Sheet', 'Equity', 'Average', false, true, 'system'),+ -- ('95010', 'Retained Earnings', 'Posting', 'Retained Earnings', NULL, 'Balance Sheet', 'Equity', 'Average', false, true, 'system'),+ -- ('96010', 'Owner Equity', 'Posting', 'Equity - No Close', NULL, 'Balance Sheet', 'Equity', 'Average', true, true, 'system'),+ -- ('96999', 'Equity, Total', 'End Total', NULL, NULL, 'Balance Sheet', 'Equity', 'Average', false, true, 'system'),+ -- ('99999', 'Balance Sheet, Total', 'Total', NULL, NULL, 'Balance Sheet', null, 'Average', false, true, 'system');+-- INSERT INTO public."accountDefault" (+-- "id",+-- "salesAccount",+-- "salesDiscountAccount",+-- "costOfGoodsSoldAccount",+-- "purchaseAccount",+-- "directCostAppliedAccount",+-- "overheadCostAppliedAccount",+-- "purchaseVarianceAccount",+-- "inventoryAdjustmentVarianceAccount",+-- "materialVarianceAccount",+-- "capacityVarianceAccount",+-- "overheadAccount",+-- "maintenanceAccount",+-- "assetDepreciationExpenseAccount",+-- "assetGainsAndLossesAccount",+-- "serviceChargeAccount",+-- "interestAccount",+-- "supplierPaymentDiscountAccount",+-- "customerPaymentDiscountAccount",+-- "roundingAccount",+-- "assetAquisitionCostAccount",+-- "assetAquisitionCostOnDisposalAccount",+-- "accumulatedDepreciationAccount",+-- "accumulatedDepreciationOnDisposalAccount",+-- "inventoryAccount",+-- "inventoryInterimAccrualAccount",+-- "workInProgressAccount",+-- "receivablesAccount",+-- "inventoryInvoicedNotReceivedAccount",+-- "bankCashAccount",+-- "bankLocalCurrencyAccount",+-- "bankForeignCurrencyAccount",+-- "prepaymentAccount",+-- "payablesAccount",+-- "inventoryReceivedNotInvoicedAccount",+-- "inventoryShippedNotInvoicedAccount",+-- "salesTaxPayableAccount",+-- "purchaseTaxPayableAccount",+-- "reverseChargeSalesTaxPayableAccount",+-- "retainedEarningsAccount",+-- -- "updatedBy"+-- -- ) VALUES (+-- true,+-- '11210',+-- '11600',+-- '21210',+-- '21410',+-- '21590',+-- '21600',+-- '21610',+-- '21700',+-- '25705',+-- '25710',+-- '25720',+-- '47045',+-- '50015',+-- '50040',+-- '50045',+-- '51110',+-- '51115',+-- '51120',+-- '51235',+-- '81010',+-- '81015',+-- '81020',+-- '81030',+-- '83105',+-- '83120',+-- '83125',+-- '85005',+-- '85020',+-- '86005',+-- '86010',+-- '86015',+-- '92210',+-- '93005',+-- '93010',+-- '93110',+-- '94100',+-- '94110',+-- '94115',+-- '95010',+-- 'system'+-- );-INSERT INTO "postingGroupInventory" (- "partGroupId",- "costOfGoodsSoldAccount",- "inventoryAccount",- "inventoryInterimAccrualAccount",- "inventoryReceivedNotInvoicedAccount",- "inventoryInvoicedNotReceivedAccount",- "inventoryShippedNotInvoicedAccount",- "workInProgressAccount",- "directCostAppliedAccount",- "overheadCostAppliedAccount",- "purchaseVarianceAccount",- "inventoryAdjustmentVarianceAccount",- "materialVarianceAccount",- "capacityVarianceAccount",- "overheadAccount"-) SELECT- NULL,- "costOfGoodsSoldAccount",- "inventoryAccount",- "inventoryInterimAccrualAccount",- "inventoryReceivedNotInvoicedAccount",- "inventoryInvoicedNotReceivedAccount",- "inventoryShippedNotInvoicedAccount",- "workInProgressAccount",- "directCostAppliedAccount",- "overheadCostAppliedAccount",- "purchaseVarianceAccount",- "inventoryAdjustmentVarianceAccount",- "materialVarianceAccount",- "capacityVarianceAccount",- "overheadAccount"-FROM "accountDefault" WHERE "id" = true;+-- TODO: resume here-INSERT INTO "postingGroupPurchasing" (- "partGroupId",- "supplierTypeId",- "payablesAccount",- "purchaseAccount",- "purchaseDiscountAccount",- "purchaseCreditAccount",- "purchasePrepaymentAccount",- "purchaseTaxPayableAccount",- "updatedBy"-) SELECT- NULL,- NULL,- "payablesAccount",- "purchaseAccount",- "purchaseAccount",- "purchaseAccount",- "prepaymentAccount",- "purchaseTaxPayableAccount",- 'system'-FROM "accountDefault" WHERE "id" = true;+-- INSERT INTO "postingGroupInventory" (+-- "partGroupId",+-- "costOfGoodsSoldAccount",+-- "inventoryAccount",+-- "inventoryInterimAccrualAccount",+-- "inventoryReceivedNotInvoicedAccount",+-- "inventoryInvoicedNotReceivedAccount",+-- "inventoryShippedNotInvoicedAccount",+-- "workInProgressAccount",+-- "directCostAppliedAccount",+-- "overheadCostAppliedAccount",+-- "purchaseVarianceAccount",+-- "inventoryAdjustmentVarianceAccount",+-- "materialVarianceAccount",+-- "capacityVarianceAccount",+-- "overheadAccount"+-- ) SELECT+-- NULL,+-- "costOfGoodsSoldAccount",+-- "inventoryAccount",+-- "inventoryInterimAccrualAccount",+-- "inventoryReceivedNotInvoicedAccount",+-- "inventoryInvoicedNotReceivedAccount",+-- "inventoryShippedNotInvoicedAccount",+-- "workInProgressAccount",+-- "directCostAppliedAccount",+-- "overheadCostAppliedAccount",+-- "purchaseVarianceAccount",+-- "inventoryAdjustmentVarianceAccount",+-- "materialVarianceAccount",+-- "capacityVarianceAccount",+-- "overheadAccount"+-- FROM "accountDefault" WHERE "id" = true;-INSERT INTO "postingGroupSales" (- "partGroupId",- "customerTypeId",- "receivablesAccount",- "salesAccount",- "salesDiscountAccount",- "salesCreditAccount",- "salesPrepaymentAccount",- "salesTaxPayableAccount",- "updatedBy"-) SELECT- NULL,- NULL,- "receivablesAccount",- "salesAccount",- "salesDiscountAccount",- "salesAccount",- "prepaymentAccount",- "salesTaxPayableAccount",- 'system'-FROM "accountDefault" WHERE "id" = true;+-- INSERT INTO "postingGroupPurchasing" (+-- "partGroupId",+-- "supplierTypeId",+-- "payablesAccount",+-- "purchaseAccount",+-- "purchaseDiscountAccount",+-- "purchaseCreditAccount",+-- "purchasePrepaymentAccount",+-- "purchaseTaxPayableAccount",+-- "updatedBy"+-- ) SELECT+-- NULL,+-- NULL,+-- "payablesAccount",+-- "purchaseAccount",+-- "purchaseAccount",+-- "purchaseAccount",+-- "prepaymentAccount",+-- "purchaseTaxPayableAccount",+-- 'system'+-- FROM "accountDefault" WHERE "id" = true;-INSERT INTO "fiscalYearSettings" (- "startMonth",- "taxStartMonth",- "updatedBy"-) VALUES (- 'January',- 'January',- 'system'-);+-- INSERT INTO "postingGroupSales" (+-- "partGroupId",+-- "customerTypeId",+-- "receivablesAccount",+-- "salesAccount",+-- "salesDiscountAccount",+-- "salesCreditAccount",+-- "salesPrepaymentAccount",+-- "salesTaxPayableAccount",+-- "updatedBy"+-- ) SELECT+-- NULL,+-- NULL,+-- "receivablesAccount",+-- "salesAccount",+-- "salesDiscountAccount",+-- "salesAccount",+-- "prepaymentAccount",+-- "salesTaxPayableAccount",+-- 'system'+-- FROM "accountDefault" WHERE "id" = true;--- custom fields+-- INSERT INTO "fiscalYearSettings" (+-- "startMonth",+-- "taxStartMonth",+-- "updatedBy"+-- ) VALUES (+-- 'January',+-- 'January',+-- 'system'+-- );-INSERT INTO "customFieldTable" ("table", "name", "module")-VALUES-('account', 'Account', 'Accounting'),-('accountCategory', 'Account Category', 'Accounting'),-('accountSubcategory', 'Account Subcategory', 'Accounting'),-('contractor', 'Contractor', 'Resources'),-('currency', 'Currency', 'Accounting'),-('customer', 'Customer', 'Sales'),-('customerContact', 'Customer Contact', 'Sales'),-('customerLocation', 'Customer Location', 'Sales'),-('customerStatus', 'Customer Status', 'Sales'),-('customerType', 'Customer Type', 'Sales'),-('department', 'Department', 'Resources'),-('employeeJob', 'Employee Job', 'Resources'),-('equipment', 'Equipment', 'Resources'),-('equipmentType', 'Equipment Type', 'Resources'),-('holiday', 'Holiday', 'Resources'),-('journal', 'Journal', 'Accounting'),-('journalLine', 'Journal Line', 'Accounting'),-('location', 'Location', 'Resources'),-('part', 'Part', 'Parts'),-('partCost', 'Part Cost', 'Parts'),-('partGroup', 'Part Group', 'Parts'),-('partInventory', 'Part Inventory', 'Parts'),-('partPlanning', 'Part Planning', 'Parts'),-('partReplenishment', 'Part Replenishment', 'Parts'),-('partSupplier', 'Part Supplier', 'Parts'),-('partUnitSalePrice', 'Part Unit Sale Price', 'Parts'),-('partner', 'Partner', 'Resources'),-('paymentTerm', 'Payment Term', 'Accounting'),-('purchaseInvoice', 'Purchase Invoice', 'Invoicing'),-('purchaseInvoiceLine', 'Purchase Invoice Line', 'Invoicing'),-('purchasePayment', 'Purchase Invoice Payment', 'Invoicing'),-('purchaseOrder', 'Purchase Order', 'Purchasing'),-('purchaseOrderDelivery', 'Purchase Order Delivery', 'Purchasing'),-('purchaseOrderLine', 'Purchase Order Line', 'Purchasing'),-('purchaseOrderPayment', 'Purchase Order Payment', 'Purchasing'),-('quote', 'Quote', 'Sales'),-('quoteAssembly', 'Quote Assembly', 'Sales'),-('quoteLine', 'Quote Line', 'Sales'),-('quoteMaterial', 'Quote Material', 'Sales'),-('quoteOperation', 'Quote Operation', 'Sales'),-('receipt', 'Receipt', 'Inventory'),-('requestForQuote', 'RFQ', 'Purchasing'),-('requestForQuoteLine', 'RFQ Line', 'Purchasing'),-('requestForQuoteSupplier', 'RFQ Supplier', 'Purchasing'),-('service', 'Service', 'Parts'),-('serviceSupplier', 'Service Supplier', 'Parts'),-('shelf', 'Shelf', 'Inventory'),-('shift', 'Shift', 'Resources'),-('shippingMethod', 'Shipping Method', 'Inventory'),-('shippingTerm', 'Shipping Term', 'Accounting'),-('supplier', 'Supplier', 'Purchasing'),-('supplierContact', 'Supplier Contact', 'Purchasing'),-('supplierLocation', 'Supplier Location', 'Purchasing'),-('supplierPayment', 'Supplier Payment', 'Purchasing'),-('supplierShipping', 'Supplier Shipping', 'Purchasing'),-('supplierStatus', 'Supplier Status', 'Purchasing'),-('supplierType', 'Supplier Type', 'Purchasing'),-('unitOfMeasure', 'Unit of Measure', 'Inventory'),-('workCell', 'Work Cell', 'Resources'),-('workCellType', 'Work Cell Type', 'Resources');+-- -- custom fields++-- INSERT INTO "customFieldTable" ("table", "name", "module")+-- VALUES+-- ('account', 'Account', 'Accounting'),+-- ('accountCategory', 'Account Category', 'Accounting'),+-- ('accountSubcategory', 'Account Subcategory', 'Accounting'),+-- ('contractor', 'Contractor', 'Resources'),+-- ('currency', 'Currency', 'Accounting'),+-- ('customer', 'Customer', 'Sales'),+-- ('customerContact', 'Customer Contact', 'Sales'),+-- ('customerLocation', 'Customer Location', 'Sales'),+-- ('customerStatus', 'Customer Status', 'Sales'),+-- ('customerType', 'Customer Type', 'Sales'),+-- ('department', 'Department', 'Resources'),+-- ('employeeJob', 'Employee Job', 'Resources'),+-- ('equipment', 'Equipment', 'Resources'),+-- ('equipmentType', 'Equipment Type', 'Resources'),+-- ('holiday', 'Holiday', 'Resources'),+-- ('journal', 'Journal', 'Accounting'),+-- ('journalLine', 'Journal Line', 'Accounting'),+-- ('location', 'Location', 'Resources'),+-- ('part', 'Part', 'Parts'),+-- ('partCost', 'Part Cost', 'Parts'),+-- ('partGroup', 'Part Group', 'Parts'),+-- ('partInventory', 'Part Inventory', 'Parts'),+-- ('partPlanning', 'Part Planning', 'Parts'),+-- ('partReplenishment', 'Part Replenishment', 'Parts'),+-- ('partSupplier', 'Part Supplier', 'Parts'),+-- ('partUnitSalePrice', 'Part Unit Sale Price', 'Parts'),+-- ('partner', 'Partner', 'Resources'),+-- ('paymentTerm', 'Payment Term', 'Accounting'),+-- ('purchaseInvoice', 'Purchase Invoice', 'Invoicing'),+-- ('purchaseInvoiceLine', 'Purchase Invoice Line', 'Invoicing'),+-- ('purchasePayment', 'Purchase Invoice Payment', 'Invoicing'),+-- ('purchaseOrder', 'Purchase Order', 'Purchasing'),+-- ('purchaseOrderDelivery', 'Purchase Order Delivery', 'Purchasing'),+-- ('purchaseOrderLine', 'Purchase Order Line', 'Purchasing'),+-- ('purchaseOrderPayment', 'Purchase Order Payment', 'Purchasing'),+-- ('quote', 'Quote', 'Sales'),+-- ('quoteAssembly', 'Quote Assembly', 'Sales'),+-- ('quoteLine', 'Quote Line', 'Sales'),+-- ('quoteMaterial', 'Quote Material', 'Sales'),+-- ('quoteOperation', 'Quote Operation', 'Sales'),+-- ('receipt', 'Receipt', 'Inventory'),+-- ('requestForQuote', 'RFQ', 'Purchasing'),+-- ('requestForQuoteLine', 'RFQ Line', 'Purchasing'),+-- ('requestForQuoteSupplier', 'RFQ Supplier', 'Purchasing'),+-- ('service', 'Service', 'Parts'),+-- ('serviceSupplier', 'Service Supplier', 'Parts'),+-- ('shelf', 'Shelf', 'Inventory'),+-- ('shift', 'Shift', 'Resources'),+-- ('shippingMethod', 'Shipping Method', 'Inventory'),+-- ('shippingTerm', 'Shipping Term', 'Accounting'),+-- ('supplier', 'Supplier', 'Purchasing'),+-- ('supplierContact', 'Supplier Contact', 'Purchasing'),+-- ('supplierLocation', 'Supplier Location', 'Purchasing'),+-- ('supplierPayment', 'Supplier Payment', 'Purchasing'),+-- ('supplierShipping', 'Supplier Shipping', 'Purchasing'),+-- ('supplierStatus', 'Supplier Status', 'Purchasing'),+-- ('supplierType', 'Supplier Type', 'Purchasing'),+-- ('unitOfMeasure', 'Unit of Measure', 'Inventory'),+-- ('workCell', 'Work Cell', 'Resources'),+-- ('workCellType', 'Work Cell Type', 'Resources');