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 ability to No Quote a quote line

Rob Carrington84cf2d25c50a
diff --git a/apps/carbon/app/modules/sales/sales.models.ts b/apps/carbon/app/modules/sales/sales.models.ts
index 71656fc7fc..872f481b2d 100644
--- a/apps/carbon/app/modules/sales/sales.models.ts
+++ b/apps/carbon/app/modules/sales/sales.models.ts
@@ -144,6 +144,7 @@ export const quoteLineValidator = z.object({
zfd.numeric(z.number().min(0.00001, { message: "Quantity is required" }))
),
modelUploadId: zfd.text(z.string().optional()),
+ noQuoteReason: zfd.text(z.string().optional()),
});
export const quoteMaterialValidator = z
diff --git a/apps/carbon/app/modules/sales/ui/Quotes/QuoteExplorer.tsx b/apps/carbon/app/modules/sales/ui/Quotes/QuoteExplorer.tsx
index 6930e19128..9d27f5e075 100644
--- a/apps/carbon/app/modules/sales/ui/Quotes/QuoteExplorer.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotes/QuoteExplorer.tsx
@@ -1,4 +1,5 @@
import {
+ Badge,
Button,
cn,
DropdownMenu,
@@ -61,7 +62,7 @@ export default function QuoteExplorer({ methods }: QuoteExplorerProps) {
itemReadableId: "",
locationId: quoteData?.quote?.locationId ?? defaults.locationId ?? "",
methodType: "Make" as const,
- status: "Draft" as const,
+ status: "Not Started" as const,
quantity: [1],
unitOfMeasureCode: "",
};
@@ -228,6 +229,19 @@ function QuoteLineItem({
</span>
</VStack>
</HStack>
+ <Badge
+ className={cn(
+ "text-xs bg-white border-2 px-2 py-1 w-[90px] text-center flex items-center justify-center ml-auto disabled:pointer-events-none",
+ line.status === "Not Started" &&
+ "text-orange-500 border-orange-500",
+ line.status === "In Progress" &&
+ "text-yellow-500 border-yellow-500",
+ line.status === "Complete" && "text-green-500 border-green-500",
+ line.status === "No Quote" && "text-red-500 border-red-500"
+ )}
+ >
+ {line.status}
+ </Badge>
<HStack spacing={0}>
{line.methodType === "Make" && permissions.can("update", "sales") && (
<IconButton
@@ -269,7 +283,8 @@ function QuoteLineItem({
</HStack>
{disclosure.isOpen &&
line.methodType === "Make" &&
- permissions.can("update", "sales") && (
+ permissions.can("update", "sales") &&
+ line.status !== "No Quote" && (
<VStack className="border-b border-border p-1">
<QuoteBoMExplorer methods={flattenedMethods} />
</VStack>
diff --git a/apps/carbon/app/modules/sales/ui/Quotes/QuoteLineForm.tsx b/apps/carbon/app/modules/sales/ui/Quotes/QuoteLineForm.tsx
index 76aeac021b..43883bfd55 100644
--- a/apps/carbon/app/modules/sales/ui/Quotes/QuoteLineForm.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotes/QuoteLineForm.tsx
@@ -21,7 +21,7 @@ import {
} from "@carbon/react";
import { useCarbon } from "@carbon/auth";
-import { ValidatedForm } from "@carbon/form";
+import { TextArea, ValidatedForm } from "@carbon/form";
import { useParams } from "@remix-run/react";
import { useState } from "react";
import { BsThreeDotsVertical } from "react-icons/bs";
@@ -327,6 +327,12 @@ const QuoteLineForm = ({
/>
<CustomFormFields table="quoteLine" />
+ {initialValues.status === "No Quote" && (
+ <TextArea
+ name="noQuoteReason"
+ label="No Quote Reason"
+ />
+ )}
</div>
<div className="flex gap-y-4">
<ArrayNumeric
diff --git a/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.details.tsx b/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.details.tsx
index e2a62d3955..0b710997bb 100644
--- a/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.details.tsx
+++ b/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.details.tsx
@@ -146,7 +146,7 @@ export default function QuoteLine() {
itemReadableId: line.itemReadableId ?? "",
methodType: line.methodType ?? "Make",
modelUploadId: line.modelUploadId ?? undefined,
- status: line.status ?? "Draft",
+ status: line.status ?? "Not Started",
quantity: line.quantity ?? [1],
unitOfMeasureCode: line.unitOfMeasureCode ?? "",
};
@@ -174,17 +174,19 @@ export default function QuoteLine() {
/>
</div>
<QuoteLineNotes line={line} />
- {line.methodType === "Make" && (
+ {line.methodType === "Make" && line.status !== "No Quote" && (
<QuoteLineCosting
quantities={line.quantity ?? [1]}
getLineCosts={getLineCosts}
/>
)}
- <QuoteLinePricing
- line={line}
- pricesByQuantity={pricesByQuantity}
- getLineCosts={getLineCosts}
- />
+ {line.status !== "No Quote" && (
+ <QuoteLinePricing
+ line={line}
+ pricesByQuantity={pricesByQuantity}
+ getLineCosts={getLineCosts}
+ />
+ )}
<Outlet />
</Fragment>
);
diff --git a/packages/database/src/swagger-docs-schema.ts b/packages/database/src/swagger-docs-schema.ts
index 1c2a77df7b..28f5ddde70 100644
--- a/packages/database/src/swagger-docs-schema.ts
+++ b/packages/database/src/swagger-docs-schema.ts
@@ -3,7 +3,7 @@ export default {
info: {
description: "",
title: "standard public schema",
- version: "12.0.2 (a4e00ff)",
+ version: "12.0.1 (cd38da5)",
},
host: "0.0.0.0:3000",
basePath: "/",
@@ -4677,6 +4677,9 @@ export default {
{
$ref: "#/parameters/rowFilter.jobOperation.quantityScrapped",
},
+ {
+ $ref: "#/parameters/rowFilter.jobOperation.quantityReworked",
+ },
{
$ref: "#/parameters/rowFilter.jobOperation.status",
},
@@ -4835,6 +4838,9 @@ export default {
{
$ref: "#/parameters/rowFilter.jobOperation.quantityScrapped",
},
+ {
+ $ref: "#/parameters/rowFilter.jobOperation.quantityReworked",
+ },
{
$ref: "#/parameters/rowFilter.jobOperation.status",
},
@@ -4947,6 +4953,9 @@ export default {
{
$ref: "#/parameters/rowFilter.jobOperation.quantityScrapped",
},
+ {
+ $ref: "#/parameters/rowFilter.jobOperation.quantityReworked",
+ },
{
$ref: "#/parameters/rowFilter.jobOperation.status",
},
@@ -6531,6 +6540,9 @@ export default {
{
$ref: "#/parameters/rowFilter.jobOperationsWithMakeMethods.quantityScrapped",
},
+ {
+ $ref: "#/parameters/rowFilter.jobOperationsWithMakeMethods.quantityReworked",
+ },
{
$ref: "#/parameters/rowFilter.jobOperationsWithMakeMethods.status",
},
@@ -13050,6 +13062,9 @@ export default {
{
$ref: "#/parameters/rowFilter.quoteLines.locationId",
},
+ {
+ $ref: "#/parameters/rowFilter.quoteLines.noQuoteReason",
+ },
{
$ref: "#/parameters/rowFilter.quoteLines.modelId",
},
@@ -30528,6 +30543,9 @@ export default {
{
$ref: "#/parameters/rowFilter.quoteLine.locationId",
},
+ {
+ $ref: "#/parameters/rowFilter.quoteLine.noQuoteReason",
+ },
{
$ref: "#/parameters/select",
},
@@ -30656,6 +30674,9 @@ export default {
{
$ref: "#/parameters/rowFilter.quoteLine.locationId",
},
+ {
+ $ref: "#/parameters/rowFilter.quoteLine.noQuoteReason",
+ },
{
$ref: "#/parameters/preferReturn",
},
@@ -30738,6 +30759,9 @@ export default {
{
$ref: "#/parameters/rowFilter.quoteLine.locationId",
},
+ {
+ $ref: "#/parameters/rowFilter.quoteLine.noQuoteReason",
+ },
{
$ref: "#/parameters/body.quoteLine",
},
@@ -31077,6 +31101,213 @@ export default {
tags: ["currency"],
},
},
+ "/productionEvent": {
+ get: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.jobOperationId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.type",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.startTime",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.endTime",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.duration",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.employeeId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.workCenterId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.companyId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.createdAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.createdBy",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.updatedAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.updatedBy",
+ },
+ {
+ $ref: "#/parameters/select",
+ },
+ {
+ $ref: "#/parameters/order",
+ },
+ {
+ $ref: "#/parameters/range",
+ },
+ {
+ $ref: "#/parameters/rangeUnit",
+ },
+ {
+ $ref: "#/parameters/offset",
+ },
+ {
+ $ref: "#/parameters/limit",
+ },
+ {
+ $ref: "#/parameters/preferCount",
+ },
+ ],
+ responses: {
+ "200": {
+ description: "OK",
+ schema: {
+ items: {
+ $ref: "#/definitions/productionEvent",
+ },
+ type: "array",
+ },
+ },
+ "206": {
+ description: "Partial Content",
+ },
+ },
+ tags: ["productionEvent"],
+ },
+ post: {
+ parameters: [
+ {
+ $ref: "#/parameters/body.productionEvent",
+ },
+ {
+ $ref: "#/parameters/select",
+ },
+ {
+ $ref: "#/parameters/preferPost",
+ },
+ ],
+ responses: {
+ "201": {
+ description: "Created",
+ },
+ },
+ tags: ["productionEvent"],
+ },
+ delete: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.jobOperationId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.type",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.startTime",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.endTime",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.duration",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.employeeId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.workCenterId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.companyId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.createdAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.createdBy",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.updatedAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.updatedBy",
+ },
+ {
+ $ref: "#/parameters/preferReturn",
+ },
+ ],
+ responses: {
+ "204": {
+ description: "No Content",
+ },
+ },
+ tags: ["productionEvent"],
+ },
+ patch: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.jobOperationId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.type",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.startTime",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.endTime",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.duration",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.employeeId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.workCenterId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.companyId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.createdAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.createdBy",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.updatedAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.productionEvent.updatedBy",
+ },
+ {
+ $ref: "#/parameters/body.productionEvent",
+ },
+ {
+ $ref: "#/parameters/preferReturn",
+ },
+ ],
+ responses: {
+ "204": {
+ description: "No Content",
+ },
+ },
+ tags: ["productionEvent"],
+ },
+ },
"/accounts": {
get: {
parameters: [
@@ -33822,6 +34053,63 @@ export default {
tags: ["(rpc) has_any_company_permission"],
},
},
+ "/rpc/get_job_operation_by_id": {
+ get: {
+ parameters: [
+ {
+ format: "text",
+ in: "query",
+ name: "operation_id",
+ required: true,
+ type: "string",
+ },
+ ],
+ produces: [
+ "application/json",
+ "application/vnd.pgrst.object+json;nulls=stripped",
+ "application/vnd.pgrst.object+json",
+ ],
+ responses: {
+ "200": {
+ description: "OK",
+ },
+ },
+ tags: ["(rpc) get_job_operation_by_id"],
+ },
+ post: {
+ parameters: [
+ {
+ in: "body",
+ name: "args",
+ required: true,
+ schema: {
+ properties: {
+ operation_id: {
+ format: "text",
+ type: "string",
+ },
+ },
+ required: ["operation_id"],
+ type: "object",
+ },
+ },
+ {
+ $ref: "#/parameters/preferParams",
+ },
+ ],
+ produces: [
+ "application/json",
+ "application/vnd.pgrst.object+json;nulls=stripped",
+ "application/vnd.pgrst.object+json",
+ ],
+ responses: {
+ "200": {
+ description: "OK",
+ },
+ },
+ tags: ["(rpc) get_job_operation_by_id"],
+ },
+ },
"/rpc/_xid_machine_id": {
get: {
produces: [
@@ -33980,6 +34268,74 @@ export default {
tags: ["(rpc) xid_encode"],
},
},
+ "/rpc/get_active_job_operations_by_employee": {
+ get: {
+ parameters: [
+ {
+ format: "text",
+ in: "query",
+ name: "employee_id",
+ required: true,
+ type: "string",
+ },
+ {
+ format: "text",
+ in: "query",
+ name: "company_id",
+ required: true,
+ type: "string",
+ },
+ ],
+ produces: [
+ "application/json",
+ "application/vnd.pgrst.object+json;nulls=stripped",
+ "application/vnd.pgrst.object+json",
+ ],
+ responses: {
+ "200": {
+ description: "OK",
+ },
+ },
+ tags: ["(rpc) get_active_job_operations_by_employee"],
+ },
+ post: {
+ parameters: [
+ {
+ in: "body",
+ name: "args",
+ required: true,
+ schema: {
+ properties: {
+ company_id: {
+ format: "text",
+ type: "string",
+ },
+ employee_id: {
+ format: "text",
+ type: "string",
+ },
+ },
+ required: ["employee_id", "company_id"],
+ type: "object",
+ },
+ },
+ {
+ $ref: "#/parameters/preferParams",
+ },
+ ],
+ produces: [
+ "application/json",
+ "application/vnd.pgrst.object+json;nulls=stripped",
+ "application/vnd.pgrst.object+json",
+ ],
+ responses: {
+ "200": {
+ description: "OK",
+ },
+ },
+ tags: ["(rpc) get_active_job_operations_by_employee"],
+ },
+ },
"/rpc/groups_query": {
get: {
parameters: [
@@ -35074,6 +35430,74 @@ export default {
tags: ["(rpc) get_method_tree"],
},
},
+ "/rpc/get_active_job_count": {
+ get: {
+ parameters: [
+ {
+ format: "text",
+ in: "query",
+ name: "employee_id",
+ required: true,
+ type: "string",
+ },
+ {
+ format: "text",
+ in: "query",
+ name: "company_id",
+ required: true,
+ type: "string",
+ },
+ ],
+ produces: [
+ "application/json",
+ "application/vnd.pgrst.object+json;nulls=stripped",
+ "application/vnd.pgrst.object+json",
+ ],
+ responses: {
+ "200": {
+ description: "OK",
+ },
+ },
+ tags: ["(rpc) get_active_job_count"],
+ },
+ post: {
+ parameters: [
+ {
+ in: "body",
+ name: "args",
+ required: true,
+ schema: {
+ properties: {
+ company_id: {
+ format: "text",
+ type: "string",
+ },
+ employee_id: {
+ format: "text",
+ type: "string",
+ },
+ },
+ required: ["employee_id", "company_id"],
+ type: "object",
+ },
+ },
+ {
+ $ref: "#/parameters/preferParams",
+ },
+ ],
+ produces: [
+ "application/json",
+ "application/vnd.pgrst.object+json;nulls=stripped",
+ "application/vnd.pgrst.object+json",
+ ],
+ responses: {
+ "200": {
+ description: "OK",
+ },
+ },
+ tags: ["(rpc) get_active_job_count"],
+ },
+ },
"/rpc/users_for_groups": {
get: {
parameters: [
@@ -35134,6 +35558,74 @@ export default {
tags: ["(rpc) users_for_groups"],
},
},
+ "/rpc/get_recent_job_operations_by_employee": {
+ get: {
+ parameters: [
+ {
+ format: "text",
+ in: "query",
+ name: "employee_id",
+ required: true,
+ type: "string",
+ },
+ {
+ format: "text",
+ in: "query",
+ name: "company_id",
+ required: true,
+ type: "string",
+ },
+ ],
+ produces: [
+ "application/json",
+ "application/vnd.pgrst.object+json;nulls=stripped",
+ "application/vnd.pgrst.object+json",
+ ],
+ responses: {
+ "200": {
+ description: "OK",
+ },
+ },
+ tags: ["(rpc) get_recent_job_operations_by_employee"],
+ },
+ post: {
+ parameters: [
+ {
+ in: "body",
+ name: "args",
+ required: true,
+ schema: {
+ properties: {
+ company_id: {
+ format: "text",
+ type: "string",
+ },
+ employee_id: {
+ format: "text",
+ type: "string",
+ },
+ },
+ required: ["employee_id", "company_id"],
+ type: "object",
+ },
+ },
+ {
+ $ref: "#/parameters/preferParams",
+ },
+ ],
+ produces: [
+ "application/json",
+ "application/vnd.pgrst.object+json;nulls=stripped",
+ "application/vnd.pgrst.object+json",
+ ],
+ responses: {
+ "200": {
+ description: "OK",
+ },
+ },
+ tags: ["(rpc) get_recent_job_operations_by_employee"],
+ },
+ },
},
definitions: {
purchaseInvoiceStatusHistory: {
@@ -37284,6 +37776,11 @@ export default {
format: "numeric",
type: "number",
},
+ quantityReworked: {
+ default: 0,
+ format: "numeric",
+ type: "number",
+ },
status: {
default: "Todo",
enum: [
@@ -38138,6 +38635,10 @@ export default {
format: "numeric",
type: "number",
},
+ quantityReworked: {
+ format: "numeric",
+ type: "number",
+ },
status: {
enum: [
"Canceled",
@@ -41238,6 +41739,10 @@ export default {
format: "text",
type: "string",
},
+ noQuoteReason: {
+ format: "text",
+ type: "string",
+ },
modelId: {
format: "text",
type: "string",
@@ -49234,6 +49739,10 @@ export default {
format: "text",
type: "string",
},
+ noQuoteReason: {
+ format: "text",
+ type: "string",
+ },
},
type: "object",
},
@@ -49429,6 +49938,88 @@ export default {
},
type: "object",
},
+ productionEvent: {
+ required: [
+ "id",
+ "jobOperationId",
+ "startTime",
+ "companyId",
+ "createdAt",
+ "createdBy",
+ ],
+ properties: {
+ id: {
+ default: "public.xid()",
+ description: "Note:\nThis is a Primary Key.<pk/>",
+ format: "text",
+ type: "string",
+ },
+ jobOperationId: {
+ description:
+ "Note:\nThis is a Foreign Key to `jobOperation.id`.<fk table='jobOperation' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ type: {
+ enum: ["Setup", "Labor", "Machine"],
+ format: 'public."productionEventType"',
+ type: "string",
+ },
+ startTime: {
+ default: "now()",
+ format: "timestamp with time zone",
+ type: "string",
+ },
+ endTime: {
+ format: "timestamp with time zone",
+ type: "string",
+ },
+ duration: {
+ format: "integer",
+ type: "integer",
+ },
+ employeeId: {
+ description:
+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ workCenterId: {
+ description:
+ "Note:\nThis is a Foreign Key to `workCenter.id`.<fk table='workCenter' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ companyId: {
+ description:
+ "Note:\nThis is a Foreign Key to `company.id`.<fk table='company' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ createdAt: {
+ default: "now()",
+ format: "timestamp with time zone",
+ type: "string",
+ },
+ createdBy: {
+ description:
+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ updatedAt: {
+ format: "timestamp with time zone",
+ type: "string",
+ },
+ updatedBy: {
+ description:
+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ },
+ type: "object",
+ },
accounts: {
properties: {
id: {
@@ -53184,6 +53775,13 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.jobOperation.quantityReworked": {
+ name: "quantityReworked",
+ required: false,
+ format: "numeric",
+ in: "query",
+ type: "string",
+ },
"rowFilter.jobOperation.status": {
name: "status",
required: false,
@@ -54273,6 +54871,13 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.jobOperationsWithMakeMethods.quantityReworked": {
+ name: "quantityReworked",
+ required: false,
+ format: "numeric",
+ in: "query",
+ type: "string",
+ },
"rowFilter.jobOperationsWithMakeMethods.status": {
name: "status",
required: false,
@@ -58345,6 +58950,13 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.quoteLines.noQuoteReason": {
+ name: "noQuoteReason",
+ required: false,
+ format: "text",
+ in: "query",
+ type: "string",
+ },
"rowFilter.quoteLines.modelId": {
name: "modelId",
required: false,
@@ -68777,6 +69389,13 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.quoteLine.noQuoteReason": {
+ name: "noQuoteReason",
+ required: false,
+ format: "text",
+ in: "query",
+ type: "string",
+ },
"body.jobMaterialWithMakeMethodId": {
name: "jobMaterialWithMakeMethodId",
description: "jobMaterialWithMakeMethodId",
@@ -69047,6 +69666,106 @@ export default {
in: "query",
type: "string",
},
+ "body.productionEvent": {
+ name: "productionEvent",
+ description: "productionEvent",
+ required: false,
+ in: "body",
+ schema: {
+ $ref: "#/definitions/productionEvent",
+ },
+ },
+ "rowFilter.productionEvent.id": {
+ name: "id",
+ required: false,
+ format: "text",
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.productionEvent.jobOperationId": {
+ name: "jobOperationId",
+ required: false,
+ format: "text",
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.productionEvent.type": {
+ name: "type",
+ required: false,
+ format: 'public."productionEventType"',
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.productionEvent.startTime": {
+ name: "startTime",
+ required: false,
+ format: "timestamp with time zone",
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.productionEvent.endTime": {
+ name: "endTime",
+ required: false,
+ format: "timestamp with time zone",
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.productionEvent.duration": {
+ name: "duration",
+ required: false,
+ format: "integer",
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.productionEvent.employeeId": {
+ name: "employeeId",
+ required: false,
+ format: "text",
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.productionEvent.workCenterId": {
+ name: "workCenterId",
+ required: false,
+ format: "text",
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.productionEvent.companyId": {
+ name: "companyId",
+ required: false,
+ format: "text",
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.productionEvent.createdAt": {
+ name: "createdAt",
+ required: false,
+ format: "timestamp with time zone",
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.productionEvent.createdBy": {
+ name: "createdBy",
+ required: false,
+ format: "text",
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.productionEvent.updatedAt": {
+ name: "updatedAt",
+ required: false,
+ format: "timestamp with time zone",
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.productionEvent.updatedBy": {
+ name: "updatedBy",
+ required: false,
+ format: "text",
+ in: "query",
+ type: "string",
+ },
"body.accounts": {
name: "accounts",
description: "accounts",
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index 5797d027b6..47f3fbc346 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -11503,7 +11503,8 @@ export type Database = {
startTime: string
type: Database["public"]["Enums"]["productionEventType"] | null
updatedAt: string | null
- updatedBy: string
+ updatedBy: string | null
+ workCenterId: string | null
}
Insert: {
companyId: string
@@ -11514,10 +11515,11 @@ export type Database = {
endTime?: string | null
id?: string
jobOperationId: string
- startTime: string
+ startTime?: string
type?: Database["public"]["Enums"]["productionEventType"] | null
updatedAt?: string | null
- updatedBy: string
+ updatedBy?: string | null
+ workCenterId?: string | null
}
Update: {
companyId?: string
@@ -11531,7 +11533,8 @@ export type Database = {
startTime?: string
type?: Database["public"]["Enums"]["productionEventType"] | null
updatedAt?: string | null
- updatedBy?: string
+ updatedBy?: string | null
+ workCenterId?: string | null
}
Relationships: [
{
@@ -11681,6 +11684,20 @@ export type Database = {
referencedRelation: "userDefaults"
referencedColumns: ["userId"]
},
+ {
+ foreignKeyName: "productionEvent_workCenterId_fkey"
+ columns: ["workCenterId"]
+ isOneToOne: false
+ referencedRelation: "workCenter"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "productionEvent_workCenterId_fkey"
+ columns: ["workCenterId"]
+ isOneToOne: false
+ referencedRelation: "workCenters"
+ referencedColumns: ["id"]
+ },
]
}
purchaseInvoice: {
@@ -14147,6 +14164,7 @@ export type Database = {
locationId: string | null
methodType: Database["public"]["Enums"]["methodType"]
modelUploadId: string | null
+ noQuoteReason: string | null
notes: Json | null
quantity: number[] | null
quoteId: string
@@ -14172,6 +14190,7 @@ export type Database = {
locationId?: string | null
methodType?: Database["public"]["Enums"]["methodType"]
modelUploadId?: string | null
+ noQuoteReason?: string | null
notes?: Json | null
quantity?: number[] | null
quoteId: string
@@ -14197,6 +14216,7 @@ export type Database = {
locationId?: string | null
methodType?: Database["public"]["Enums"]["methodType"]
modelUploadId?: string | null
+ noQuoteReason?: string | null
notes?: Json | null
quantity?: number[] | null
quoteId?: string
@@ -23586,6 +23606,7 @@ export type Database = {
overheadRate: number | null
processId: string | null
quantityComplete: number | null
+ quantityReworked: number | null
quantityScrapped: number | null
setupTime: number | null
setupUnit: Database["public"]["Enums"]["factor"] | null
@@ -25253,14 +25274,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["supplierCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["id"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["supplierCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["id"]
@@ -25599,6 +25620,7 @@ export type Database = {
modelPath: string | null
modelSize: number | null
modelUploadId: string | null
+ noQuoteReason: string | null
notes: Json | null
quantity: number[] | null
quoteId: string | null
diff --git a/packages/database/supabase/functions/convert/index.ts b/packages/database/supabase/functions/convert/index.ts
index 6e972239ca..9048de18a0 100644
--- a/packages/database/supabase/functions/convert/index.ts
+++ b/packages/database/supabase/functions/convert/index.ts
@@ -321,7 +321,7 @@ serve(async (req: Request) => {
locationId: salesRfq.data?.locationId,
expirationDate: salesRfq.data?.expirationDate,
salesPersonId: salesRfq.data?.createdBy,
- status: "Draft",
+ status: "Not Started",
externalNotes: salesRfq.data?.externalNotes,
internalNotes: salesRfq.data?.internalNotes,
companyId,
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index 5797d027b6..47f3fbc346 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -11503,7 +11503,8 @@ export type Database = {
startTime: string
type: Database["public"]["Enums"]["productionEventType"] | null
updatedAt: string | null
- updatedBy: string
+ updatedBy: string | null
+ workCenterId: string | null
}
Insert: {
companyId: string
@@ -11514,10 +11515,11 @@ export type Database = {
endTime?: string | null
id?: string
jobOperationId: string
- startTime: string
+ startTime?: string
type?: Database["public"]["Enums"]["productionEventType"] | null
updatedAt?: string | null
- updatedBy: string
+ updatedBy?: string | null
+ workCenterId?: string | null
}
Update: {
companyId?: string
@@ -11531,7 +11533,8 @@ export type Database = {
startTime?: string
type?: Database["public"]["Enums"]["productionEventType"] | null
updatedAt?: string | null
- updatedBy?: string
+ updatedBy?: string | null
+ workCenterId?: string | null
}
Relationships: [
{
@@ -11681,6 +11684,20 @@ export type Database = {
referencedRelation: "userDefaults"
referencedColumns: ["userId"]
},
+ {
+ foreignKeyName: "productionEvent_workCenterId_fkey"
+ columns: ["workCenterId"]
+ isOneToOne: false
+ referencedRelation: "workCenter"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "productionEvent_workCenterId_fkey"
+ columns: ["workCenterId"]
+ isOneToOne: false
+ referencedRelation: "workCenters"
+ referencedColumns: ["id"]
+ },
]
}
purchaseInvoice: {
@@ -14147,6 +14164,7 @@ export type Database = {
locationId: string | null
methodType: Database["public"]["Enums"]["methodType"]
modelUploadId: string | null
+ noQuoteReason: string | null
notes: Json | null
quantity: number[] | null
quoteId: string
@@ -14172,6 +14190,7 @@ export type Database = {
locationId?: string | null
methodType?: Database["public"]["Enums"]["methodType"]
modelUploadId?: string | null
+ noQuoteReason?: string | null
notes?: Json | null
quantity?: number[] | null
quoteId: string
@@ -14197,6 +14216,7 @@ export type Database = {
locationId?: string | null
methodType?: Database["public"]["Enums"]["methodType"]
modelUploadId?: string | null
+ noQuoteReason?: string | null
notes?: Json | null
quantity?: number[] | null
quoteId?: string
@@ -23586,6 +23606,7 @@ export type Database = {
overheadRate: number | null
processId: string | null
quantityComplete: number | null
+ quantityReworked: number | null
quantityScrapped: number | null
setupTime: number | null
setupUnit: Database["public"]["Enums"]["factor"] | null
@@ -25253,14 +25274,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["supplierCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["id"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["supplierCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["id"]
@@ -25599,6 +25620,7 @@ export type Database = {
modelPath: string | null
modelSize: number | null
modelUploadId: string | null
+ noQuoteReason: string | null
notes: Json | null
quantity: number[] | null
quoteId: string | null
diff --git a/packages/database/supabase/migrations/20240925203749_update-quote-line-status-enum.sql b/packages/database/supabase/migrations/20240925203749_update-quote-line-status-enum.sql
index 99195669ea..8c63b2784d 100644
--- a/packages/database/supabase/migrations/20240925203749_update-quote-line-status-enum.sql
+++ b/packages/database/supabase/migrations/20240925203749_update-quote-line-status-enum.sql
@@ -40,6 +40,9 @@ ALTER TYPE "newQuoteLineStatus" RENAME TO "quoteLineStatus";
ALTER TABLE "quoteLine"
ALTER COLUMN "status" SET DEFAULT 'Not Started';
+-- Update the quoteLine table to add the noQuoteReason column
+ALTER TABLE "quoteLine" ADD COLUMN "noQuoteReason" TEXT;
+
-- Recreate the quoteLines view
CREATE OR REPLACE VIEW "quoteLines" WITH(SECURITY_INVOKER=true) AS (
SELECT
@@ -83,4 +86,4 @@ CREATE OR REPLACE VIEW "quotes" WITH(SECURITY_INVOKER=true) AS
ON opp."quoteId" = q.id;
-- Commit the transaction
-COMMIT;
\ No newline at end of file
+COMMIT;
diff --git a/packages/documents/src/pdf/QuotePDF.tsx b/packages/documents/src/pdf/QuotePDF.tsx
index ac3736e310..a22f83d2c6 100644
--- a/packages/documents/src/pdf/QuotePDF.tsx
+++ b/packages/documents/src/pdf/QuotePDF.tsx
@@ -211,65 +211,83 @@ const QuotePDF = ({
</View>
)}
- {Object.keys(additionalCharges).length > 0 && (
- <View style={tw("mt-2.5")}>
- <Text style={tw("text-[9px] font-bold")}>
- Additional Charges
- </Text>
- {Object.values(additionalCharges)
- .sort((a, b) =>
- a.description.localeCompare(b.description)
- )
- .map((charge) => {
- return charge.description ? (
- <Text
- key={charge.description}
- style={tw("text-[9px] opacity-80")}
- >
- - {charge.description}
- </Text>
- ) : null;
- })}
- </View>
- )}
+ {line.status !== "No Quote" &&
+ Object.keys(additionalCharges).length > 0 && (
+ <View style={tw("mt-2.5")}>
+ <Text style={tw("text-[9px] font-bold")}>
+ Additional Charges
+ </Text>
+ {Object.values(additionalCharges)
+ .sort((a, b) =>
+ a.description.localeCompare(b.description)
+ )
+ .map((charge) => {
+ return charge.description ? (
+ <Text
+ key={charge.description}
+ style={tw("text-[9px] opacity-80")}
+ >
+ - {charge.description}
+ </Text>
+ ) : null;
+ })}
+ </View>
+ )}
</View>
<View style={tw("flex flex-col w-3/5 gap-2")}>
- {line.quantity.map((quantity, index) => {
- const prices = pricesByLine[line.id] ?? [];
- const price = prices.find(
- (price) => price.quantity === quantity
- );
- const netPrice =
- price?.unitPrice *
- (1 - (price?.discountPercent ?? 0) / 100);
+ {line.status !== "No Quote" ? (
+ line.quantity.map((quantity, index) => {
+ const prices = pricesByLine[line.id] ?? [];
+ const price = prices.find(
+ (price) => price.quantity === quantity
+ );
+ const netPrice =
+ price?.unitPrice *
+ (1 - (price?.discountPercent ?? 0) / 100);
- const additionalCharge =
- additionalChargesByQuantity[index] ?? 0;
+ const additionalCharge =
+ additionalChargesByQuantity[index] ?? 0;
- return (
- <View key={quantity} style={tw("flex flex-row")}>
- <Text style={tw("w-1/5 text-right")}>{quantity}</Text>
- <Text style={tw("w-1/5 text-right")}>
- {netPrice ? formatter.format(netPrice) : "-"}
- </Text>
- <Text style={tw("w-1/5 text-right")}>
- {additionalCharge
- ? formatter.format(additionalCharge)
- : "-"}
- </Text>
- <Text style={tw("w-1/5 text-right")}>
- {price ? `${price.leadTime} days` : "-"}
- </Text>
- <Text style={tw("w-1/5 text-right")}>
- {netPrice
- ? formatter.format(
- netPrice * quantity + additionalCharge
- )
- : "-"}
+ return (
+ <View key={quantity} style={tw("flex flex-row")}>
+ <Text style={tw("w-1/5 text-right")}>{quantity}</Text>
+ <Text style={tw("w-1/5 text-right")}>
+ {netPrice ? formatter.format(netPrice) : "-"}
+ </Text>
+ <Text style={tw("w-1/5 text-right")}>
+ {additionalCharge
+ ? formatter.format(additionalCharge)
+ : "-"}
+ </Text>
+ <Text style={tw("w-1/5 text-right")}>
+ {price ? `${price.leadTime} days` : "-"}
+ </Text>
+ <Text style={tw("w-1/5 text-right")}>
+ {netPrice
+ ? formatter.format(
+ netPrice * quantity + additionalCharge
+ )
+ : "-"}
+ </Text>
+ </View>
+ );
+ })
+ ) : (
+ <View>
+ <View style={tw("flex flex-row")}>
+ <Text style={tw("w-1/5 text-right font-bold")}>
+ No Quote
</Text>
+ <View style={tw("w-3/5 ml-auto")}>
+ {line.noQuoteReason && (
+ <Text style={tw("text-sm")}>
+ {line.noQuoteReason}
+ </Text>
+ )}
+ </View>
</View>
- );
- })}
+ </View>
+ )}
</View>
</View>
);