Skip to content

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.

feat: add enumerables to tables in accounting module

Brad Barbin22fd9f817bb4
diff --git a/apps/carbon/app/modules/accounting/accounting.service.ts b/apps/carbon/app/modules/accounting/accounting.service.ts
index 442d0f0eb2..c69db1cecd 100644
--- a/apps/carbon/app/modules/accounting/accounting.service.ts
+++ b/apps/carbon/app/modules/accounting/accounting.service.ts
@@ -186,6 +186,8 @@ export async function getAccountCategories(
}
query = setGenericQueryFilters(query, args, [
+ { column: "incomeBalance", ascending: true },
+ { column: "class", ascending: true },
{ column: "category", ascending: true },
]);
return query;
diff --git a/apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoriesTable.tsx b/apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoriesTable.tsx
index 31ae837610..5b220a418a 100644
--- a/apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoriesTable.tsx
+++ b/apps/carbon/app/modules/accounting/ui/AccountCategories/AccountCategoriesTable.tsx
@@ -1,5 +1,6 @@
import {
Button,
+ Enumerable,
Hyperlink,
MenuIcon,
MenuItem,
@@ -56,12 +57,12 @@ const AccountCategoriesTable = memo(
{
header: "Income/Balance",
accessorKey: "incomeBalance",
- cell: (item) => item.getValue(),
+ cell: (item) => <Enumerable value={item.getValue<string>()} />,
},
{
header: "Class",
accessorKey: "class",
- cell: (item) => item.getValue(),
+ cell: (item) => <Enumerable value={item.getValue<string>()} />,
},
{
diff --git a/apps/carbon/app/modules/accounting/ui/AccountDefaults/AccountDefaultsForm.tsx b/apps/carbon/app/modules/accounting/ui/AccountDefaults/AccountDefaultsForm.tsx
index 6f4cde812a..17f61f7499 100644
--- a/apps/carbon/app/modules/accounting/ui/AccountDefaults/AccountDefaultsForm.tsx
+++ b/apps/carbon/app/modules/accounting/ui/AccountDefaults/AccountDefaultsForm.tsx
@@ -68,7 +68,7 @@ const AccountDefaultsForm = ({
<VStack spacing={8}>
<Card>
<CardHeader>
- <CardTitle>Revenue</CardTitle>
+ <CardTitle>Income Statement</CardTitle>
</CardHeader>
<CardContent>
<div className="grid gap-y-4 gap-x-8 grid-cols-1 md:grid-cols-2">
@@ -82,15 +82,7 @@ const AccountDefaultsForm = ({
label="Sales Discounts"
options={incomeStatementAccountOptions}
/>
- </div>
- </CardContent>
- </Card>
- <Card>
- <CardHeader>
- <CardTitle>Expenses</CardTitle>
- </CardHeader>
- <CardContent>
- <div className="grid gap-y-4 gap-x-8 grid-cols-1 md:grid-cols-2">
+
<Select
name="costOfGoodsSoldAccount"
label="Cost of Goods Sold"
@@ -142,15 +134,7 @@ const AccountDefaultsForm = ({
label="Maintenance Expense"
options={incomeStatementAccountOptions}
/>
- </div>
- </CardContent>
- </Card>
- <Card>
- <CardHeader>
- <CardTitle>Fixed Assets</CardTitle>
- </CardHeader>
- <CardContent>
- <div className="grid gap-y-4 gap-x-8 grid-cols-1 md:grid-cols-2">
+
<Select
name="assetDepreciationExpenseAccount"
label="Depreciation Expense"
@@ -166,15 +150,6 @@ const AccountDefaultsForm = ({
label="Service Charges"
options={incomeStatementAccountOptions}
/>
- </div>
- </CardContent>
- </Card>
- <Card>
- <CardHeader>
- <CardTitle>Interest</CardTitle>
- </CardHeader>
- <CardContent>
- <div className="grid gap-y-4 gap-x-8 grid-cols-1 md:grid-cols-2">
<Select
name="interestAccount"
label="Interest"
@@ -204,7 +179,7 @@ const AccountDefaultsForm = ({
<VStack spacing={8}>
<Card>
<CardHeader>
- <CardTitle>Current Assets</CardTitle>
+ <CardTitle>Balance Sheet</CardTitle>
</CardHeader>
<CardContent>
<div className="grid gap-y-4 gap-x-8 grid-cols-1 md:grid-cols-2">
@@ -249,15 +224,7 @@ const AccountDefaultsForm = ({
label="Bank - Foreign Currency"
options={balanceSheetAccountOptions}
/>
- </div>
- </CardContent>
- </Card>
- <Card>
- <CardHeader>
- <CardTitle>Fixed Assets</CardTitle>
- </CardHeader>
- <CardContent>
- <div className="grid gap-y-4 gap-x-8 grid-cols-1 md:grid-cols-2">
+
<Select
name="assetAquisitionCostAccount"
label="Asset Aquisition Cost"
@@ -278,15 +245,7 @@ const AccountDefaultsForm = ({
label="Accumulated Depreciation on Disposal"
options={balanceSheetAccountOptions}
/>
- </div>
- </CardContent>
- </Card>
- <Card>
- <CardHeader>
- <CardTitle>Liabilities</CardTitle>
- </CardHeader>
- <CardContent>
- <div className="grid gap-y-4 gap-x-8 grid-cols-1 md:grid-cols-2">
+
<Select
name="prepaymentAccount"
label="Prepayments"
@@ -322,15 +281,7 @@ const AccountDefaultsForm = ({
label="Reverse Charge Sales Tax"
options={balanceSheetAccountOptions}
/>
- </div>
- </CardContent>
- </Card>
- <Card>
- <CardHeader>
- <CardTitle>Equity</CardTitle>
- </CardHeader>
- <CardContent>
- <div className="grid gap-y-4 gap-x-8 grid-cols-1 md:grid-cols-2">
+
<Select
name="retainedEarningsAccount"
label="Retained Earnings"
diff --git a/apps/carbon/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTable.tsx b/apps/carbon/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTable.tsx
index 93bfd33a6c..0aacbff25f 100644
--- a/apps/carbon/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTable.tsx
+++ b/apps/carbon/app/modules/accounting/ui/ChartOfAccounts/ChartOfAccountsTable.tsx
@@ -1,4 +1,11 @@
-import { Button, Checkbox, HStack, Hyperlink, cn } from "@carbon/react";
+import {
+ Button,
+ Checkbox,
+ Enumerable,
+ HStack,
+ Hyperlink,
+ cn,
+} from "@carbon/react";
import { Link as RemixLink, useNavigate } from "@remix-run/react";
import type { ColumnDef } from "@tanstack/react-table";
import { memo, useMemo } from "react";
@@ -98,12 +105,12 @@ const ChartOfAccountsTable = memo(({ data }: ChartOfAccountsTableProps) => {
{
accessorKey: "incomeBalance",
header: "Income/Balance",
- cell: (item) => item.getValue(),
+ cell: (item) => <Enumerable value={item.getValue<string>()} />,
},
{
accessorKey: "type",
header: "Account Type",
- cell: (item) => item.getValue(),
+ cell: (item) => <Enumerable value={item.getValue<string>()} />,
},
{
acessorKey: "totaling",
@@ -113,12 +120,12 @@ const ChartOfAccountsTable = memo(({ data }: ChartOfAccountsTableProps) => {
{
accessorKey: "accountCategory",
header: "Account Category",
- cell: (item) => item.getValue(),
+ cell: (item) => <Enumerable value={item.getValue<string>()} />,
},
{
accessorKey: "accountSubCategory",
header: "Account Subcategory",
- cell: (item) => item.getValue(),
+ cell: (item) => <Enumerable value={item.getValue<string>()} />,
},
{
accessorKey: "directPosting",
diff --git a/apps/carbon/app/modules/accounting/ui/PaymentTerms/PaymentTermsTable.tsx b/apps/carbon/app/modules/accounting/ui/PaymentTerms/PaymentTermsTable.tsx
index f4de506388..d34ce91963 100644
--- a/apps/carbon/app/modules/accounting/ui/PaymentTerms/PaymentTermsTable.tsx
+++ b/apps/carbon/app/modules/accounting/ui/PaymentTerms/PaymentTermsTable.tsx
@@ -1,4 +1,4 @@
-import { Hyperlink, MenuIcon, MenuItem } from "@carbon/react";
+import { Enumerable, Hyperlink, MenuIcon, MenuItem } from "@carbon/react";
import { useNavigate } from "@remix-run/react";
import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo } from "react";
@@ -48,7 +48,7 @@ const PaymentTermsTable = memo(({ data, count }: PaymentTermsTableProps) => {
{
accessorKey: "calculationMethod",
header: "Calculation Method",
- cell: (item) => item.getValue(),
+ cell: (item) => <Enumerable value={item.getValue<string>()} />,
},
];
}, [navigate]);
diff --git a/apps/carbon/app/modules/accounting/ui/PostingGroups/InventoryPostingGroupsTable.tsx b/apps/carbon/app/modules/accounting/ui/PostingGroups/InventoryPostingGroupsTable.tsx
index 91bdd5c314..faf353126d 100644
--- a/apps/carbon/app/modules/accounting/ui/PostingGroups/InventoryPostingGroupsTable.tsx
+++ b/apps/carbon/app/modules/accounting/ui/PostingGroups/InventoryPostingGroupsTable.tsx
@@ -1,3 +1,4 @@
+import { Enumerable } from "@carbon/react";
import type { ColumnDef } from "@tanstack/react-table";
import { useMemo } from "react";
import { Table } from "~/components";
@@ -47,15 +48,26 @@ const InventoryPostingGroupsTable = ({
{
id: "partGroup",
header: "Part Group",
- cell: ({ row }) =>
- partGroups.find((group) => group.id === row.original.partGroupId)
- ?.name,
+ cell: ({ row }) => (
+ <Enumerable
+ value={
+ partGroups.find((group) => group.id === row.original.partGroupId)
+ ?.name ?? null
+ }
+ />
+ ),
},
{
id: "location",
header: "Location",
- cell: ({ row }) =>
- locations.find((type) => type.id === row.original.locationId)?.name,
+ cell: ({ row }) => (
+ <Enumerable
+ value={
+ locations.find((type) => type.id === row.original.locationId)
+ ?.name ?? null
+ }
+ />
+ ),
},
{
accessorKey: "costOfGoodsSoldAccount",
diff --git a/apps/carbon/app/modules/accounting/ui/PostingGroups/PurchasingPostingGroupsTable.tsx b/apps/carbon/app/modules/accounting/ui/PostingGroups/PurchasingPostingGroupsTable.tsx
index 1e0248b960..e793e0723f 100644
--- a/apps/carbon/app/modules/accounting/ui/PostingGroups/PurchasingPostingGroupsTable.tsx
+++ b/apps/carbon/app/modules/accounting/ui/PostingGroups/PurchasingPostingGroupsTable.tsx
@@ -1,3 +1,4 @@
+import { Enumerable } from "@carbon/react";
import type { ColumnDef } from "@tanstack/react-table";
import { useMemo } from "react";
import { Table } from "~/components";
@@ -47,16 +48,27 @@ const PurchasingPostingGroupsTable = ({
{
id: "partGroup",
header: "Part Group",
- cell: ({ row }) =>
- partGroups.find((group) => group.id === row.original.partGroupId)
- ?.name,
+ cell: ({ row }) => (
+ <Enumerable
+ value={
+ partGroups.find((group) => group.id === row.original.partGroupId)
+ ?.name ?? null
+ }
+ />
+ ),
},
{
id: "supplierType",
header: "Supplier Type",
- cell: ({ row }) =>
- supplierTypes.find((type) => type.id === row.original.supplierTypeId)
- ?.name,
+ cell: ({ row }) => (
+ <Enumerable
+ value={
+ supplierTypes.find(
+ (type) => type.id === row.original.supplierTypeId
+ )?.name ?? null
+ }
+ />
+ ),
},
{
accessorKey: "payablesAccount",
diff --git a/apps/carbon/app/modules/accounting/ui/PostingGroups/SalesPostingGroupsTable.tsx b/apps/carbon/app/modules/accounting/ui/PostingGroups/SalesPostingGroupsTable.tsx
index 080a5705b3..baccd18967 100644
--- a/apps/carbon/app/modules/accounting/ui/PostingGroups/SalesPostingGroupsTable.tsx
+++ b/apps/carbon/app/modules/accounting/ui/PostingGroups/SalesPostingGroupsTable.tsx
@@ -1,3 +1,4 @@
+import { Enumerable } from "@carbon/react";
import type { ColumnDef } from "@tanstack/react-table";
import { useMemo } from "react";
import { Table } from "~/components";
@@ -44,16 +45,27 @@ const SalesPostingGroupsTable = ({
{
id: "partGroup",
header: "Part Group",
- cell: ({ row }) =>
- partGroups.find((group) => group.id === row.original.partGroupId)
- ?.name,
+ cell: ({ row }) => (
+ <Enumerable
+ value={
+ partGroups.find((group) => group.id === row.original.partGroupId)
+ ?.name ?? null
+ }
+ />
+ ),
},
{
id: "customerType",
header: "Customer Type",
- cell: ({ row }) =>
- customerTypes.find((type) => type.id === row.original.customerTypeId)
- ?.name,
+ cell: ({ row }) => (
+ <Enumerable
+ value={
+ customerTypes.find(
+ (type) => type.id === row.original.customerTypeId
+ )?.name ?? null
+ }
+ />
+ ),
},
{
accessorKey: "receivablesAccount",