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.

fix: accounting problems

Brad Barbin9f2fad481693
diff --git a/apps/carbon/app/components/Layout/Navigation/IconSidebar.tsx b/apps/carbon/app/components/Layout/Navigation/IconSidebar.tsx
index c49c9990fb..7e7ddb793d 100644
--- a/apps/carbon/app/components/Layout/Navigation/IconSidebar.tsx
+++ b/apps/carbon/app/components/Layout/Navigation/IconSidebar.tsx
@@ -3,12 +3,12 @@ import { Link, useMatches } from "@remix-run/react";
import { noop } from "@tanstack/react-table";
import { forwardRef, type AnchorHTMLAttributes } from "react";
import { BsFillHexagonFill } from "react-icons/bs";
+import { LuUserCircle } from "react-icons/lu";
import { z } from "zod";
import { useOptimisticLocation } from "~/hooks";
import type { Authenticated, NavItem } from "~/types";
import { path } from "~/utils/path";
import { useModules } from "./useModules";
-import { LuUserCircle } from "react-icons/lu";
export const ModuleHandle = z.object({
module: z.string(),
@@ -122,7 +122,7 @@ const NavigationIconLink = forwardRef<
"hover:bg-secondary active:",
`${
isActive
- ? "dark:bg-primary/10 bg-muted text-primary shadow-sm hover:text-primary hover:bg-primary/20 dark:shadow-inner"
+ ? "bg-primary/10 text-primary shadow-sm hover:text-primary hover:bg-primary/20 dark:shadow-inner"
: "hover:text-foreground"
}`,
"group/item",
diff --git a/apps/carbon/app/modules/accounting/accounting.service.ts b/apps/carbon/app/modules/accounting/accounting.service.ts
index 2ee4ddb0c9..60f0ce67dc 100644
--- a/apps/carbon/app/modules/accounting/accounting.service.ts
+++ b/apps/carbon/app/modules/accounting/accounting.service.ts
@@ -697,7 +697,7 @@ export async function updateFiscalYearSettings(
return client
.from("fiscalYearSettings")
.update(sanitize(fiscalYearSettings))
- .eq("id", fiscalYearSettings.companyId);
+ .eq("companyId", fiscalYearSettings.companyId);
}
export async function upsertAccount(
diff --git a/packages/database/supabase/functions/shared/get-accounting-period.ts b/packages/database/supabase/functions/shared/get-accounting-period.ts
index d2ee51becd..ff670b0ef2 100644
--- a/packages/database/supabase/functions/shared/get-accounting-period.ts
+++ b/packages/database/supabase/functions/shared/get-accounting-period.ts
@@ -30,7 +30,7 @@ const daysInMonths: Record<number, number> = {
export async function getCurrentAccountingPeriod<T>(
client: SupabaseClient<Database>,
- companyId: number,
+ companyId: string,
db: Kysely<DB>
) {
// const d = today(getLocalTimeZone());
diff --git a/packages/database/supabase/functions/shared/get-next-sequence.ts b/packages/database/supabase/functions/shared/get-next-sequence.ts
index bc6f8187c3..0ce7bf2ebc 100644
--- a/packages/database/supabase/functions/shared/get-next-sequence.ts
+++ b/packages/database/supabase/functions/shared/get-next-sequence.ts
@@ -5,7 +5,7 @@ import { interpolateSequenceDate } from "../lib/utils.ts";
export async function getNextSequence(
trx: Transaction<DB>,
tableName: string,
- companyId: number
+ companyId: string
) {
// get current purchase invoice sequence number
const sequence = await trx
diff --git a/packages/database/supabase/migrations/20230705033432_ledgers.sql b/packages/database/supabase/migrations/20230705033432_ledgers.sql
index 306d7da277..8f163f7364 100644
--- a/packages/database/supabase/migrations/20230705033432_ledgers.sql
+++ b/packages/database/supabase/migrations/20230705033432_ledgers.sql
@@ -21,8 +21,7 @@ CREATE TABLE "fiscalYearSettings" (
CONSTRAINT "fiscalYearSettings_pkey" PRIMARY KEY ("companyId"),
CONSTRAINT "fiscalYearSettings_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "company" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT "fiscalYearSettings_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE RESTRICT,
- CONSTRAINT "fiscalYear_id_unique" UNIQUE ("companyId")
+ CONSTRAINT "fiscalYearSettings_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user" ("id") ON DELETE RESTRICT
);
CREATE TYPE "accountingPeriodStatus" AS ENUM (
diff --git a/packages/react/src/Button.tsx b/packages/react/src/Button.tsx
index 8dd2975ff4..9024ac7713 100644
--- a/packages/react/src/Button.tsx
+++ b/packages/react/src/Button.tsx
@@ -15,7 +15,7 @@ export const buttonVariants = cva(
primary:
"bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm",
active:
- "dark:bg-primary/10 bg-muted text-primary hover:bg-primary/20 dark:shadow-inner",
+ "bg-primary/10 text-primary hover:bg-primary/20 dark:shadow-inner",
secondary:
"border border-input bg-background hover:bg-accent hover:text-accent-foreground",
solid: "bg-primary/25 text-accent-foreground hover:bg-primary/35",