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: complete shipped jobs

Brad Barbine261f5f74597
diff --git a/apps/erp/app/modules/inventory/ui/Shipments/ShipmentLines.tsx b/apps/erp/app/modules/inventory/ui/Shipments/ShipmentLines.tsx
index 1fa294829a..ba0d9ed366 100644
--- a/apps/erp/app/modules/inventory/ui/Shipments/ShipmentLines.tsx
+++ b/apps/erp/app/modules/inventory/ui/Shipments/ShipmentLines.tsx
@@ -372,7 +372,7 @@ function ShipmentLineItem({
>
<NumberInput
className="disabled:bg-transparent disabled:opacity-100 min-w-[100px]"
- isDisabled={isReadOnly || line.fulfillment?.type === "Job"}
+ isDisabled={isReadOnly || (line.fulfillment?.type === "Job" && line.requiresSerialTracking)}
size="sm"
min={0}
/>
diff --git a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx
index c2dbd757a0..3c5d24960b 100644
--- a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx
+++ b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceProperties.tsx
@@ -108,7 +108,9 @@ const PurchaseInvoiceProperties = () => {
const isDisabled =
!permissions.can("update", "purchasing") ||
- !["Draft", "To Review", "Overdue"].includes(routeData?.purchaseInvoice?.status ?? "");
+ !["Draft", "To Review", "Overdue"].includes(
+ routeData?.purchaseInvoice?.status ?? ""
+ );
return (
<VStack
diff --git a/apps/erp/app/modules/production/production.models.ts b/apps/erp/app/modules/production/production.models.ts
index 46d6dfd1c9..4e403d243d 100644
--- a/apps/erp/app/modules/production/production.models.ts
+++ b/apps/erp/app/modules/production/production.models.ts
@@ -41,6 +41,8 @@ export const jobStatus = [
"Paused",
"Completed",
"Cancelled",
+ "Overdue",
+ "Due Today",
] as const;
export const jobOperationStatus = [
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobHeader.tsx b/apps/erp/app/modules/production/ui/Jobs/JobHeader.tsx
index 91dbfa1a7f..ff4efc455f 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobHeader.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobHeader.tsx
@@ -6,7 +6,6 @@ import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuIcon,
- DropdownMenuItem,
DropdownMenuRadioGroup,
DropdownMenuRadioItem,
DropdownMenuSeparator,
@@ -107,9 +106,21 @@ const JobHeader = () => {
<span>{routeData?.job?.jobId}</span>
</Heading>
</Link>
- <JobStatus status={routeData?.job?.status} />
+ <JobStatus status={routeData?.job?.statusWithDueDate} />
</HStack>
<HStack>
+ {routeData?.job?.salesOrderId && routeData?.job.salesOrderLineId && (
+ <Button leftIcon={<RiProgress8Line />} variant="secondary" asChild>
+ <Link
+ to={path.to.salesOrderLine(
+ routeData?.job?.salesOrderId,
+ routeData?.job?.salesOrderLineId
+ )}
+ >
+ Sales Order
+ </Link>
+ </Button>
+ )}
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button
@@ -146,23 +157,6 @@ const JobHeader = () => {
</DropdownMenuRadioItem>
))}
</DropdownMenuRadioGroup>
- {routeData?.job?.salesOrderId &&
- routeData?.job.salesOrderLineId && (
- <>
- <DropdownMenuSeparator />
- <DropdownMenuItem asChild>
- <Link
- to={path.to.salesOrderLine(
- routeData?.job?.salesOrderId,
- routeData?.job?.salesOrderLineId
- )}
- >
- <DropdownMenuIcon icon={<RiProgress8Line />} />
- Sales Order
- </Link>
- </DropdownMenuItem>
- </>
- )}
</DropdownMenuContent>
</DropdownMenu>
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobStatus.tsx b/apps/erp/app/modules/production/ui/Jobs/JobStatus.tsx
index 3f41feaa24..a73d1d2e25 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobStatus.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobStatus.tsx
@@ -14,11 +14,14 @@ function JobStatus({ status }: JobStatusProps) {
case "In Progress":
return <Status color="blue">{status}</Status>;
case "Paused":
+ case "Due Today":
return <Status color="orange">{status}</Status>;
case "Completed":
return <Status color="green">{status}</Status>;
+ case "Overdue":
case "Cancelled":
return <Status color="red">{status}</Status>;
+
default:
return null;
}
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobsTable.tsx b/apps/erp/app/modules/production/ui/Jobs/JobsTable.tsx
index 787b826ab4..87666661d0 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobsTable.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobsTable.tsx
@@ -168,7 +168,7 @@ const JobsTable = memo(({ data, count, tags }: JobsTableProps) => {
},
},
{
- accessorKey: "status",
+ accessorKey: "statusWithDueDate",
header: "Status",
cell: (item) => {
const status = item.getValue<(typeof jobStatus)[number]>();
diff --git a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/usePurchaseOrder.ts b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/usePurchaseOrder.ts
index 3b773b2596..d3a4f89996 100644
--- a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/usePurchaseOrder.ts
+++ b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/usePurchaseOrder.ts
@@ -74,10 +74,16 @@ export const usePurchaseOrderRelatedDocuments = (
if (invoices.error) {
toast.error("Failed to load invoices");
} else {
- setInvoices(invoices.data?.map((invoice) => ({
- ...invoice,
- status: invoice.dateDue ? (!invoice.datePaid && new Date(invoice.dateDue) < new Date() ? "Overdue" : invoice.status) : invoice.status,
- })) ?? []);
+ setInvoices(
+ invoices.data?.map((invoice) => ({
+ ...invoice,
+ status: invoice.dateDue
+ ? !invoice.datePaid && new Date(invoice.dateDue) < new Date()
+ ? "Overdue"
+ : invoice.status
+ : invoice.status,
+ })) ?? []
+ );
}
},
[carbon]
diff --git a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrdersTable.tsx b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrdersTable.tsx
index ab8be68132..9e3cb397c2 100644
--- a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrdersTable.tsx
+++ b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrdersTable.tsx
@@ -150,6 +150,7 @@ const SalesOrdersTable = memo(({ data, count }: SalesOrdersTableProps) => {
methodType: "Buy" | "Make" | "Pick";
}[]) ?? [];
+ console.log({ jobs, lines });
if (
lines.length === 0 ||
lines.every((line) => line.methodType !== "Make")
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index b1ba4685ea..417b73caef 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -29888,9 +29888,11 @@ export type Database = {
jobs: {
Row: {
active: boolean | null;
+ actualTime: number | null;
assignee: string | null;
autodeskUrn: string | null;
companyId: string | null;
+ completedDate: string | null;
configuration: Json | null;
createdAt: string | null;
createdBy: string | null;
@@ -29899,6 +29901,7 @@ export type Database = {
deadlineType: Database["public"]["Enums"]["deadlineType"] | null;
description: string | null;
dueDate: string | null;
+ estimatedTime: number | null;
id: string | null;
itemId: string | null;
itemReadableId: string | null;
@@ -29923,6 +29926,7 @@ export type Database = {
quoteId: string | null;
quoteLineId: string | null;
quoteReadableId: string | null;
+ releasedDate: string | null;
replenishmentSystem:
| Database["public"]["Enums"]["itemReplenishmentSystem"]
| null;
@@ -29930,7 +29934,9 @@ export type Database = {
salesOrderLineId: string | null;
salesOrderReadableId: string | null;
scrapQuantity: number | null;
+ secondsToComplete: number | null;
status: Database["public"]["Enums"]["jobStatus"] | null;
+ statusWithDueDate: Database["public"]["Enums"]["jobStatus"] | null;
tags: string[] | null;
thumbnailPath: string | null;
unitOfMeasureCode: string | null;
@@ -33754,14 +33760,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey";
- columns: ["paymentCountryCode"];
+ columns: ["customerCountryCode"];
isOneToOne: false;
referencedRelation: "country";
referencedColumns: ["alpha2"];
},
{
foreignKeyName: "address_countryCode_fkey";
- columns: ["customerCountryCode"];
+ columns: ["paymentCountryCode"];
isOneToOne: false;
referencedRelation: "country";
referencedColumns: ["alpha2"];
@@ -33791,8 +33797,8 @@ export type Database = {
internalNotes: Json | null;
itemType: Database["public"]["Enums"]["itemType"] | null;
jobs: Json[] | null;
+ lines: Json[] | null;
locationId: string | null;
- locationName: string | null;
opportunityId: string | null;
orderDate: string | null;
orderTotal: number | null;
@@ -36932,7 +36938,9 @@ export type Database = {
| "In Progress"
| "Paused"
| "Completed"
- | "Cancelled";
+ | "Cancelled"
+ | "Overdue"
+ | "Due Today";
journalLineDocumentType:
| "Receipt"
| "Invoice"
@@ -36955,7 +36963,8 @@ export type Database = {
| "Resources"
| "Sales"
| "Settings"
- | "Users";
+ | "Users"
+ | "Quality";
month:
| "January"
| "February"
diff --git a/packages/database/supabase/functions/create-inventory-document/index.ts b/packages/database/supabase/functions/create-inventory-document/index.ts
index 6ff7645338..ff40b25a0c 100644
--- a/packages/database/supabase/functions/create-inventory-document/index.ts
+++ b/packages/database/supabase/functions/create-inventory-document/index.ts
@@ -515,7 +515,6 @@ serve(async (req: Request) => {
.from("job")
.select("*")
.eq("salesOrderId", salesOrderId)
- .eq("status", "Completed"),
]);
if (!salesOrder.data) throw new Error("Sales order not found");
@@ -541,7 +540,7 @@ serve(async (req: Request) => {
);
const hasShipment = !!shipment.data?.id;
-
+
// Group jobs by sales order line ID
const jobsBySalesOrderLine = (jobs.data || []).reduce<
Record<string, Database["public"]["Tables"]["job"]["Row"][]>
@@ -555,6 +554,8 @@ serve(async (req: Request) => {
return acc;
}, {});
+
+
const previouslyShippedQuantitiesByLine = (
salesOrderLines.data ?? []
).reduce<Record<string, number>>((acc, d) => {
@@ -620,6 +621,7 @@ serve(async (req: Request) => {
// Process each sales order line
for await (const salesOrderLine of salesOrderLines.data) {
+ console.log({salesOrderLine})
if (
!salesOrderLine.itemId ||
!salesOrderLine.saleQuantity ||
@@ -634,13 +636,17 @@ serve(async (req: Request) => {
const isBatch = batchItems.has(salesOrderLine.itemId);
if (salesOrderLine.methodType === "Make") {
+
for await (const job of jobsBySalesOrderLine[salesOrderLine.id] ??
[]) {
if (!salesOrderLine.itemId) return;
- const quantityAvailable =
- job.quantityComplete - job.quantityShipped;
- if (quantityAvailable > 0) {
+ const quantityAvailable = isSerial
+ ? Math.min(job.quantityComplete - job.quantityShipped, 0)
+ : job.quantity - job.quantityShipped;
+
+
+ if (!isSerial || (isSerial && quantityAvailable > 0)) {
const fulfillment = await trx
.insertInto("fulfillment")
.values({
@@ -670,8 +676,8 @@ serve(async (req: Request) => {
fulfillmentId,
itemId: salesOrderLine.itemId,
itemReadableId: salesOrderLine.itemReadableId,
- orderQuantity: quantityAvailable,
- outstandingQuantity: quantityAvailable,
+ orderQuantity: salesOrderLine.saleQuantity,
+ outstandingQuantity: salesOrderLine.quantityToSend ?? salesOrderLine.saleQuantity,
shippedQuantity: quantityAvailable,
requiresSerialTracking: isSerial,
requiresBatchTracking: isBatch,
@@ -843,8 +849,7 @@ serve(async (req: Request) => {
client
.from("job")
.select("*")
- .eq("salesOrderLineId", salesOrderLineId)
- .eq("status", "Completed"),
+ .eq("salesOrderLineId", salesOrderLineId),
]);
if (!salesOrder.data) throw new Error("Sales order not found");
@@ -917,9 +922,11 @@ serve(async (req: Request) => {
if (salesOrderLine.data.methodType === "Make") {
for await (const job of jobs.data ?? []) {
if (!salesOrderLine.data.itemId) return;
- const quantityAvailable =
- job.quantityComplete - job.quantityShipped;
- if (quantityAvailable > 0) {
+ const quantityAvailable = isSerial
+ ? Math.min(job.quantityComplete - job.quantityShipped, 0)
+ : job.quantity - job.quantityReceivedToInventory;
+
+ if (!isSerial || (isSerial && quantityAvailable > 0)) {
const fulfillment = await trx
.insertInto("fulfillment")
.values({
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index b1ba4685ea..417b73caef 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -29888,9 +29888,11 @@ export type Database = {
jobs: {
Row: {
active: boolean | null;
+ actualTime: number | null;
assignee: string | null;
autodeskUrn: string | null;
companyId: string | null;
+ completedDate: string | null;
configuration: Json | null;
createdAt: string | null;
createdBy: string | null;
@@ -29899,6 +29901,7 @@ export type Database = {
deadlineType: Database["public"]["Enums"]["deadlineType"] | null;
description: string | null;
dueDate: string | null;
+ estimatedTime: number | null;
id: string | null;
itemId: string | null;
itemReadableId: string | null;
@@ -29923,6 +29926,7 @@ export type Database = {
quoteId: string | null;
quoteLineId: string | null;
quoteReadableId: string | null;
+ releasedDate: string | null;
replenishmentSystem:
| Database["public"]["Enums"]["itemReplenishmentSystem"]
| null;
@@ -29930,7 +29934,9 @@ export type Database = {
salesOrderLineId: string | null;
salesOrderReadableId: string | null;
scrapQuantity: number | null;
+ secondsToComplete: number | null;
status: Database["public"]["Enums"]["jobStatus"] | null;
+ statusWithDueDate: Database["public"]["Enums"]["jobStatus"] | null;
tags: string[] | null;
thumbnailPath: string | null;
unitOfMeasureCode: string | null;
@@ -33754,14 +33760,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey";
- columns: ["paymentCountryCode"];
+ columns: ["customerCountryCode"];
isOneToOne: false;
referencedRelation: "country";
referencedColumns: ["alpha2"];
},
{
foreignKeyName: "address_countryCode_fkey";
- columns: ["customerCountryCode"];
+ columns: ["paymentCountryCode"];
isOneToOne: false;
referencedRelation: "country";
referencedColumns: ["alpha2"];
@@ -33791,8 +33797,8 @@ export type Database = {
internalNotes: Json | null;
itemType: Database["public"]["Enums"]["itemType"] | null;
jobs: Json[] | null;
+ lines: Json[] | null;
locationId: string | null;
- locationName: string | null;
opportunityId: string | null;
orderDate: string | null;
orderTotal: number | null;
@@ -36932,7 +36938,9 @@ export type Database = {
| "In Progress"
| "Paused"
| "Completed"
- | "Cancelled";
+ | "Cancelled"
+ | "Overdue"
+ | "Due Today";
journalLineDocumentType:
| "Receipt"
| "Invoice"
@@ -36955,7 +36963,8 @@ export type Database = {
| "Resources"
| "Sales"
| "Settings"
- | "Users";
+ | "Users"
+ | "Quality";
month:
| "January"
| "February"
diff --git a/packages/database/supabase/functions/post-shipment/index.ts b/packages/database/supabase/functions/post-shipment/index.ts
index 73e6daa174..c3887036aa 100644
--- a/packages/database/supabase/functions/post-shipment/index.ts
+++ b/packages/database/supabase/functions/post-shipment/index.ts
@@ -85,7 +85,7 @@ serve(async (req: Request) => {
.from("itemCost")
.select("itemId, itemPostingGroupId")
.in("itemId", itemIds),
- client.from("job").select("id, quantityShipped").in("id", jobIds),
+ client.from("job").select("id, quantity, quantityComplete, quantityShipped, status").in("id", jobIds),
]);
if (items.error) {
throw new Error("Failed to fetch items");
@@ -159,12 +159,16 @@ serve(async (req: Request) => {
// instead of the current DB value to avoid double counting
if (jobUpdates[jobId]) {
jobUpdates[jobId] = {
+ status: currentQuantityShipped + shipmentLine.shippedQuantity >= (currentJob?.quantity ?? 0) ? "Completed" : currentJob?.status,
+ quantityComplete: currentJob?.status === "Completed" ? currentJob?.quantityComplete : (currentJob?.quantityComplete ?? 0) + shipmentLine.shippedQuantity,
quantityShipped:
(jobUpdates[jobId]?.quantityShipped ?? 0) +
shipmentLine.shippedQuantity,
};
} else {
jobUpdates[jobId] = {
+ status: currentQuantityShipped + shipmentLine.shippedQuantity >= (currentJob?.quantity ?? 0) ? "Completed" : currentJob?.status,
+ quantityComplete: currentJob?.status === "Completed" ? currentJob?.quantityComplete : (currentJob?.quantityComplete ?? 0) + shipmentLine.shippedQuantity,
quantityShipped:
currentQuantityShipped + shipmentLine.shippedQuantity,
};
diff --git a/packages/database/supabase/migrations/20250326125851_overdue-jobs.sql b/packages/database/supabase/migrations/20250326125851_overdue-jobs.sql
new file mode 100644
index 0000000000..e4f351a36b
--- /dev/null
+++ b/packages/database/supabase/migrations/20250326125851_overdue-jobs.sql
@@ -0,0 +1,109 @@
+ALTER TYPE "jobStatus" ADD VALUE 'Overdue';
+ALTER TYPE "jobStatus" ADD VALUE 'Due Today';
+
+COMMIT;
+
+DROP VIEW IF EXISTS "salesOrders";
+CREATE OR REPLACE VIEW "salesOrders" WITH(SECURITY_INVOKER=true) AS
+ SELECT
+ s.*,
+ sl."thumbnailPath",
+ sl."itemType",
+ sl."orderTotal" + COALESCE(ss."shippingCost", 0) AS "orderTotal",
+ sl."jobs",
+ sl."lines",
+ st."name" AS "shippingTermName",
+ sp."paymentTermId",
+ ss."shippingMethodId",
+ ss."receiptRequestedDate",
+ ss."receiptPromisedDate",
+ ss."dropShipment",
+ ss."shippingCost"
+ FROM "salesOrder" s
+ LEFT JOIN (
+ SELECT
+ sol."salesOrderId",
+ MIN(CASE
+ WHEN i."thumbnailPath" IS NULL AND mu."thumbnailPath" IS NOT NULL THEN mu."thumbnailPath"
+ ELSE i."thumbnailPath"
+ END) AS "thumbnailPath",
+ SUM((1+COALESCE(sol."taxPercent", 0))*(COALESCE(sol."saleQuantity", 0)*(COALESCE(sol."unitPrice", 0)) + COALESCE(sol."shippingCost", 0) + COALESCE(sol."addOnCost", 0))) AS "orderTotal",
+ MIN(i."type") AS "itemType",
+ ARRAY_AGG(
+ CASE
+ WHEN j.id IS NOT NULL THEN json_build_object(
+ 'id', j.id,
+ 'jobId', j."jobId",
+ 'status', CASE
+ WHEN j."dueDate" IS NOT NULL AND j."dueDate" < CURRENT_DATE THEN 'Overdue'
+ WHEN j."dueDate" IS NOT NULL AND j."dueDate" = CURRENT_DATE THEN 'Due Today'
+ ELSE j."status"
+ END,
+ 'productionQuantity', j."productionQuantity",
+ 'quantityComplete', j."quantityComplete",
+ 'salesOrderLineId', sol.id,
+ 'assignee', j."assignee"
+ )
+ ELSE NULL
+ END
+ ) FILTER (WHERE j.id IS NOT NULL) AS "jobs",
+ ARRAY_AGG(
+ json_build_object(
+ 'id', sol.id,
+ 'methodType', sol."methodType",
+ 'saleQuantity', sol."saleQuantity"
+ )
+ ) AS "lines"
+ FROM "salesOrderLine" sol
+ LEFT JOIN "item" i
+ ON i."id" = sol."itemId"
+ LEFT JOIN "modelUpload" mu ON mu.id = i."modelUploadId"
+ LEFT JOIN "job" j ON j."salesOrderId" = sol."salesOrderId" AND j."salesOrderLineId" = sol."id"
+ GROUP BY sol."salesOrderId"
+ ) sl ON sl."salesOrderId" = s."id"
+ LEFT JOIN "salesOrderShipment" ss ON ss."id" = s."id"
+ LEFT JOIN "shippingTerm" st ON st."id" = ss."shippingTermId"
+ LEFT JOIN "salesOrderPayment" sp ON sp."id" = s."id";
+
+
+
+DROP VIEW IF EXISTS "jobs";
+CREATE OR REPLACE VIEW "jobs" WITH(SECURITY_INVOKER=true) AS
+WITH job_model AS (
+ SELECT
+ j.id AS job_id,
+ COALESCE(j."modelUploadId", i."modelUploadId") AS model_upload_id
+ FROM "job" j
+ INNER JOIN "item" i ON j."itemId" = i."id"
+)
+SELECT
+ j.*,
+ CASE
+ WHEN j."dueDate" IS NOT NULL AND j."dueDate" < CURRENT_DATE THEN 'Overdue'
+ WHEN j."dueDate" IS NOT NULL AND j."dueDate" = CURRENT_DATE THEN 'Due Today'
+ ELSE j."status"
+ END as "statusWithDueDate",
+ i.name,
+ i."readableId" as "itemReadableId",
+ i.type as "itemType",
+ i.name as "description",
+ i."itemTrackingType",
+ i.active,
+ i."replenishmentSystem",
+ mu.id as "modelId",
+ mu."autodeskUrn",
+ mu."modelPath",
+ CASE
+ WHEN i."thumbnailPath" IS NULL AND mu."thumbnailPath" IS NOT NULL THEN mu."thumbnailPath"
+ ELSE i."thumbnailPath"
+ END as "thumbnailPath",
+ mu."name" as "modelName",
+ mu."size" as "modelSize",
+ so."salesOrderId" as "salesOrderReadableId",
+ qo."quoteId" as "quoteReadableId"
+FROM "job" j
+INNER JOIN "item" i ON j."itemId" = i."id"
+LEFT JOIN job_model jm ON j.id = jm.job_id
+LEFT JOIN "modelUpload" mu ON mu.id = jm.model_upload_id
+LEFT JOIN "salesOrder" so on j."salesOrderId" = so.id
+LEFT JOIN "quote" qo ON j."quoteId" = qo.id;
\ No newline at end of file