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: update costing/pricing with new times/rates

Brad Barbind99557724bf6
diff --git a/apps/carbon/app/modules/items/ui/Item/BillOfProcess.tsx b/apps/carbon/app/modules/items/ui/Item/BillOfProcess.tsx
index a1a2f2f580..813a383b4d 100644
--- a/apps/carbon/app/modules/items/ui/Item/BillOfProcess.tsx
+++ b/apps/carbon/app/modules/items/ui/Item/BillOfProcess.tsx
@@ -23,7 +23,7 @@ import { nanoid } from "nanoid";
import type { Dispatch, SetStateAction } from "react";
import { useCallback, useEffect, useState } from "react";
import { flushSync } from "react-dom";
-import { LuHammer, LuHardHat, LuSettings2, LuX } from "react-icons/lu";
+import { LuSettings2, LuX } from "react-icons/lu";
import type { z } from "zod";
import { DirectionAwareTabs } from "~/components/DirectionAwareTabs";
import {
@@ -42,7 +42,7 @@ import type { Item, SortableItemRenderProps } from "~/components/SortableList";
import { SortableList, SortableListItem } from "~/components/SortableList";
import { usePermissions, useUser } from "~/hooks";
import { useSupabase } from "~/lib/supabase";
-import { methodOperationOrders } from "~/modules/shared";
+import { TimeTypeIcon, methodOperationOrders } from "~/modules/shared";
import { path } from "~/utils/path";
import { methodOperationValidator } from "../../items.models";
@@ -75,14 +75,14 @@ function makeItem(operation: Operation): ItemWithData {
<HStack spacing={1}>
{operation.laborTime > 0 && (
<Badge variant="secondary">
- <LuHardHat className="h-3 w-3 mr-1" />
+ <TimeTypeIcon type="Labor" className="h-3 w-3 mr-1" />
{operation.laborTime} {operation.laborUnit}
</Badge>
)}
{operation.machineTime > 0 && (
<Badge variant="secondary">
- <LuHammer className="h-3 w-3 mr-1" />
+ <TimeTypeIcon type="Machine" className="h-3 w-3 mr-1" />
{operation.machineTime} {operation.machineUnit}
</Badge>
)}
diff --git a/apps/carbon/app/modules/sales/types.ts b/apps/carbon/app/modules/sales/types.ts
index 49630f0e1d..0483d7654c 100644
--- a/apps/carbon/app/modules/sales/types.ts
+++ b/apps/carbon/app/modules/sales/types.ts
@@ -23,30 +23,35 @@ import type {
} from "./sales.service";
export type Costs = {
- materialCost: number;
- partCost: number;
- toolCost: number;
- fixtureCost: number;
consumableCost: number;
- serviceCost: number;
+ fixtureCost: number;
laborCost: number;
- overheadCost: number;
+ laborHours: number;
+ machineCost: number;
+ machineHours: number;
+ materialCost: number;
outsideCost: number;
+ partCost: number;
+ serviceCost: number;
+ setupCost: number;
setupHours: number;
- productionHours: number;
+ toolCost: number;
};
export type CostEffects = {
+ consumableCost: QuantityEffect[];
+ fixtureCost: QuantityEffect[];
+ laborCost: QuantityEffect[];
+ laborHours: QuantityEffect[];
+ machineCost: QuantityEffect[];
+ machineHours: QuantityEffect[];
materialCost: QuantityEffect[];
+ outsideCost: QuantityEffect[];
partCost: QuantityEffect[];
- toolCost: QuantityEffect[];
- fixtureCost: QuantityEffect[];
- consumableCost: QuantityEffect[];
serviceCost: QuantityEffect[];
- laborCost: QuantityEffect[];
- overheadCost: QuantityEffect[];
+ setupCost: QuantityEffect[];
setupHours: QuantityEffect[];
- productionHours: QuantityEffect[];
+ toolCost: QuantityEffect[];
};
export type Customer = NonNullable<
diff --git a/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx b/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx
index ce2f53ac82..c18cea9d24 100644
--- a/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx
@@ -23,7 +23,7 @@ import { nanoid } from "nanoid";
import type { Dispatch, SetStateAction } from "react";
import { useCallback, useEffect, useState } from "react";
import { flushSync } from "react-dom";
-import { LuHammer, LuHardHat, LuSettings2, LuX } from "react-icons/lu";
+import { LuSettings2, LuX } from "react-icons/lu";
import type { z } from "zod";
import { DirectionAwareTabs } from "~/components/DirectionAwareTabs";
import {
@@ -43,7 +43,7 @@ import type { Item, SortableItemRenderProps } from "~/components/SortableList";
import { SortableList, SortableListItem } from "~/components/SortableList";
import { usePermissions, useRouteData, useUser } from "~/hooks";
import { useSupabase } from "~/lib/supabase";
-import { methodOperationOrders } from "~/modules/shared";
+import { TimeTypeIcon, methodOperationOrders } from "~/modules/shared";
import { path } from "~/utils/path";
import { quoteOperationValidator } from "../../sales.models";
import type { Quotation } from "../../types";
@@ -77,14 +77,14 @@ function makeItem(operation: Operation): ItemWithData {
<HStack spacing={1}>
{operation.laborTime > 0 && (
<Badge variant="secondary">
- <LuHardHat className="h-3 w-3 mr-1" />
+ <TimeTypeIcon type="Labor" className="h-3 w-3 mr-1" />
{operation.laborTime} {operation.laborUnit}
</Badge>
)}
{operation.machineTime > 0 && (
<Badge variant="secondary">
- <LuHammer className="h-3 w-3 mr-1" />
+ <TimeTypeIcon type="Machine" className="h-3 w-3 mr-1" />
{operation.machineTime} {operation.machineUnit}
</Badge>
)}
diff --git a/apps/carbon/app/modules/sales/ui/Quotes/QuoteLineCosting.tsx b/apps/carbon/app/modules/sales/ui/Quotes/QuoteLineCosting.tsx
index d4cca85f0c..b5d0cea113 100644
--- a/apps/carbon/app/modules/sales/ui/Quotes/QuoteLineCosting.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotes/QuoteLineCosting.tsx
@@ -22,7 +22,7 @@ import { useLocale } from "@react-aria/i18n";
import { useParams } from "@remix-run/react";
import { useMemo } from "react";
import { LuInfo } from "react-icons/lu";
-import { MethodItemTypeIcon } from "~/modules/shared";
+import { MethodItemTypeIcon, TimeTypeIcon } from "~/modules/shared";
import type { Costs } from "../../types";
const QuoteLineCosting = ({
@@ -280,10 +280,101 @@ const QuoteLineCosting = ({
<Tr>
<Td className="border-r border-border ">
<HStack className="w-full justify-between ">
- <span className="whitespace-nowrap">
- Total Labor &amp; Overhead
+ <span>Total Time Cost</span>
+ <Enumerable value="Time" />
+ </HStack>
+ </Td>
+ {quantityCosts.map(({ quantity, costs }, index) => {
+ const totalLaborCost =
+ costs.setupCost + costs.laborCost + costs.machineCost;
+
+ return (
+ <Td key={quantity.toString()}>
+ <VStack spacing={0}>
+ <span>
+ {totalLaborCost
+ ? formatter.format(totalLaborCost)
+ : formatter.format(0)}
+ </span>
+ <span className="text-muted-foreground text-xs">
+ {totalLaborCost && quantity > 0
+ ? formatter.format(totalLaborCost / quantity)
+ : formatter.format(0)}
+ </span>
+ </VStack>
+ </Td>
+ );
+ })}
+ </Tr>
+ <Tr>
+ <Td className="border-r border-border pl-10 ">
+ <HStack className="w-full justify-between ">
+ <span className="whitespace-nowrap flex items-center justify-start gap-2">
+ Setup Cost
+ </span>
+ <Badge variant="secondary">
+ <TimeTypeIcon type="Setup" />
+ </Badge>
+ </HStack>
+ </Td>
+ {quantityCosts.map(({ quantity, costs }) => {
+ return (
+ <Td key={quantity.toString()}>
+ <VStack spacing={0}>
+ <span>
+ {costs.setupCost
+ ? formatter.format(costs.setupCost)
+ : formatter.format(0)}
+ </span>
+ <span className="text-muted-foreground text-xs">
+ {costs.setupCost && quantity > 0
+ ? formatter.format(costs.setupCost / quantity)
+ : formatter.format(0)}
+ </span>
+ </VStack>
+ </Td>
+ );
+ })}
+ </Tr>
+ <Tr>
+ <Td className="border-r border-border pl-10 ">
+ <HStack className="w-full justify-between ">
+ <span className="whitespace-nowrap flex items-center justify-start gap-2">
+ Labor Cost
+ </span>
+ <Badge variant="secondary">
+ <TimeTypeIcon type="Labor" />
+ </Badge>
+ </HStack>
+ </Td>
+ {quantityCosts.map(({ quantity, costs }) => {
+ return (
+ <Td key={quantity.toString()}>
+ <VStack spacing={0}>
+ <span>
+ {costs.laborCost
+ ? formatter.format(costs.laborCost)
+ : formatter.format(0)}
+ </span>
+ <span className="text-muted-foreground text-xs">
+ {costs.laborCost && quantity > 0
+ ? formatter.format(costs.laborCost / quantity)
+ : formatter.format(0)}
+ </span>
+ </VStack>
+ </Td>
+ );
+ })}
+ </Tr>
+ <Tr>
+ <Td className="border-r border-border pl-10 ">
+ <HStack className="w-full justify-between ">
+ <span className="whitespace-nowrap flex items-center justify-start gap-2">
+ Machine Cost
</span>
- <Enumerable value="Labor" />
+ <Badge variant="secondary">
+ <TimeTypeIcon type="Machine" />
+ </Badge>
</HStack>
</Td>
{quantityCosts.map(({ quantity, costs }) => {
@@ -291,17 +382,13 @@ const QuoteLineCosting = ({
<Td key={quantity.toString()}>
<VStack spacing={0}>
<span>
- {costs.overheadCost
- ? formatter.format(
- costs.overheadCost + costs.laborCost
- )
+ {costs.machineCost
+ ? formatter.format(costs.machineCost)
: formatter.format(0)}
</span>
<span className="text-muted-foreground text-xs">
- {costs.overheadCost && quantity > 0
- ? formatter.format(
- (costs.overheadCost + costs.laborCost) / quantity
- )
+ {costs.machineCost && quantity > 0
+ ? formatter.format(costs.machineCost / quantity)
: formatter.format(0)}
</span>
</VStack>
@@ -351,8 +438,9 @@ const QuoteLineCosting = ({
costs.fixtureCost +
costs.consumableCost +
costs.serviceCost +
+ costs.setupCost +
costs.laborCost +
- costs.overheadCost +
+ costs.machineCost +
costs.outsideCost;
return (
<Td key={quantity.toString()}>
diff --git a/apps/carbon/app/modules/sales/ui/Quotes/QuoteLinePricing.tsx b/apps/carbon/app/modules/sales/ui/Quotes/QuoteLinePricing.tsx
index bcf8b228fd..af004f211b 100644
--- a/apps/carbon/app/modules/sales/ui/Quotes/QuoteLinePricing.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotes/QuoteLinePricing.tsx
@@ -181,7 +181,8 @@ const QuoteLinePricing = ({
costs.consumableCost +
costs.serviceCost +
costs.laborCost +
- costs.overheadCost +
+ costs.setupCost +
+ costs.machineCost +
costs.outsideCost) /
quantity;
return totalCost;
diff --git a/apps/carbon/app/modules/sales/ui/Quotes/useLineCosts.tsx b/apps/carbon/app/modules/sales/ui/Quotes/useLineCosts.tsx
index 2e4b1b8998..14e87e9496 100644
--- a/apps/carbon/app/modules/sales/ui/Quotes/useLineCosts.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotes/useLineCosts.tsx
@@ -9,16 +9,19 @@ import type {
} from "../../types";
const defaultEffects: CostEffects = {
+ consumableCost: [],
+ fixtureCost: [],
+ laborCost: [],
+ laborHours: [],
+ machineCost: [],
+ machineHours: [],
materialCost: [],
+ outsideCost: [],
partCost: [],
- toolCost: [],
- fixtureCost: [],
- consumableCost: [],
serviceCost: [],
- laborCost: [],
- overheadCost: [],
+ setupCost: [],
setupHours: [],
- productionHours: [],
+ toolCost: [],
};
type EnhancedTree = Tree<QuoteMethod & { operations?: QuotationOperation[] }>;
@@ -109,95 +112,178 @@ export function useLineCosts({
}
data.operations?.forEach((operation: QuotationOperation) => {
- if (operation.setupHours) {
- // setupHours don't depend on quantity
+ if (operation.setupTime) {
+ // normalize production standard to hours
+ let hoursPerUnit = 0;
+ let fixedHours = 0;
+ switch (operation.setupUnit) {
+ case "Total Hours":
+ fixedHours = operation.setupTime;
+ break;
+ case "Total Minutes":
+ fixedHours = operation.setupTime / 60;
+ break;
+ case "Hours/Piece":
+ hoursPerUnit = operation.setupTime;
+ break;
+ case "Hours/100 Pieces":
+ hoursPerUnit = operation.setupTime / 100;
+ break;
+ case "Hours/1000 Pieces":
+ hoursPerUnit = operation.setupTime / 1000;
+ break;
+
+ case "Minutes/Piece":
+ hoursPerUnit = operation.setupTime / 60;
+ break;
+ case "Minutes/100 Pieces":
+ hoursPerUnit = operation.setupTime / 100 / 60;
+ break;
+ case "Minutes/1000 Pieces":
+ hoursPerUnit = operation.setupTime / 1000 / 60;
+ break;
+ case "Pieces/Hour":
+ hoursPerUnit = 1 / operation.setupTime;
+ break;
+ case "Pieces/Minute":
+ hoursPerUnit = 1 / (operation.setupTime / 60);
+ break;
+ case "Seconds/Piece":
+ hoursPerUnit = operation.setupTime / 3600;
+ break;
+ default:
+ break;
+ }
+
effects.setupHours.push((quantity) => {
- return operation.setupHours;
+ return hoursPerUnit * quantity * data.quantity + fixedHours;
+ });
+
+ effects.setupCost.push((quantity) => {
+ return (
+ hoursPerUnit *
+ quantity *
+ data.quantity *
+ (operation.quotingRate ?? 0) +
+ fixedHours * (operation.quotingRate ?? 0)
+ );
});
- if (operation.quotingRate) {
- effects.overheadCost.push((quantity) => {
- return operation.setupHours * (operation.quotingRate ?? 0);
- });
- } else {
- effects.laborCost.push((quantity) => {
- return operation.setupHours * (operation.laborRate ?? 0);
- });
- effects.overheadCost.push((quantity) => {
- return operation.setupHours * (operation.overheadRate ?? 0);
- });
- }
}
- if (operation.productionStandard) {
+ if (operation.laborTime) {
// normalize production standard to hours
- let hoursPerProductionStandard = 0;
- switch (operation.standardFactor) {
+ let hoursPerUnit = 0;
+ let fixedHours = 0;
+ switch (operation.laborUnit) {
case "Total Hours":
+ fixedHours = operation.laborTime;
+ break;
+ case "Total Minutes":
+ fixedHours = operation.laborTime / 60;
+ break;
case "Hours/Piece":
- hoursPerProductionStandard = operation.productionStandard;
+ hoursPerUnit = operation.laborTime;
break;
case "Hours/100 Pieces":
- hoursPerProductionStandard = operation.productionStandard / 100;
+ hoursPerUnit = operation.laborTime / 100;
break;
case "Hours/1000 Pieces":
- hoursPerProductionStandard = operation.productionStandard / 1000;
+ hoursPerUnit = operation.laborTime / 1000;
break;
- case "Total Minutes":
+
case "Minutes/Piece":
- hoursPerProductionStandard = operation.productionStandard / 60;
+ hoursPerUnit = operation.laborTime / 60;
break;
case "Minutes/100 Pieces":
- hoursPerProductionStandard =
- operation.productionStandard / 100 / 60;
+ hoursPerUnit = operation.laborTime / 100 / 60;
break;
case "Minutes/1000 Pieces":
- hoursPerProductionStandard =
- operation.productionStandard / 1000 / 60;
+ hoursPerUnit = operation.laborTime / 1000 / 60;
break;
case "Pieces/Hour":
- hoursPerProductionStandard = 1 / operation.productionStandard;
+ hoursPerUnit = 1 / operation.laborTime;
break;
case "Pieces/Minute":
- hoursPerProductionStandard =
- 1 / (operation.productionStandard / 60);
+ hoursPerUnit = 1 / (operation.laborTime / 60);
break;
case "Seconds/Piece":
- hoursPerProductionStandard = operation.productionStandard / 3600;
+ hoursPerUnit = operation.laborTime / 3600;
break;
default:
break;
}
- effects.productionHours.push((quantity) => {
- return hoursPerProductionStandard * quantity * data.quantity;
+ effects.laborHours.push((quantity) => {
+ return hoursPerUnit * quantity * data.quantity + fixedHours;
});
- if (operation.quotingRate) {
- effects.overheadCost.push((quantity) => {
- return (
- hoursPerProductionStandard *
- quantity *
- data.quantity *
- (operation.quotingRate ?? 0)
- );
- });
- } else {
- effects.laborCost.push((quantity) => {
- return (
- hoursPerProductionStandard *
+
+ effects.laborCost.push((quantity) => {
+ return (
+ hoursPerUnit *
quantity *
data.quantity *
- (operation.laborRate ?? 0)
- );
- });
- effects.overheadCost.push((quantity) => {
- return (
- hoursPerProductionStandard *
+ (operation.quotingRate ?? 0) +
+ fixedHours * (operation.quotingRate ?? 0)
+ );
+ });
+ }
+
+ if (operation.machineTime) {
+ // normalize production standard to hours
+ let hoursPerUnit = 0;
+ let fixedHours = 0;
+ switch (operation.machineUnit) {
+ case "Total Hours":
+ fixedHours = operation.machineTime;
+ break;
+ case "Total Minutes":
+ fixedHours = operation.machineTime / 60;
+ break;
+ case "Hours/Piece":
+ hoursPerUnit = operation.machineTime;
+ break;
+ case "Hours/100 Pieces":
+ hoursPerUnit = operation.machineTime / 100;
+ break;
+ case "Hours/1000 Pieces":
+ hoursPerUnit = operation.machineTime / 1000;
+ break;
+
+ case "Minutes/Piece":
+ hoursPerUnit = operation.machineTime / 60;
+ break;
+ case "Minutes/100 Pieces":
+ hoursPerUnit = operation.machineTime / 100 / 60;
+ break;
+ case "Minutes/1000 Pieces":
+ hoursPerUnit = operation.machineTime / 1000 / 60;
+ break;
+ case "Pieces/Hour":
+ hoursPerUnit = 1 / operation.machineTime;
+ break;
+ case "Pieces/Minute":
+ hoursPerUnit = 1 / (operation.machineTime / 60);
+ break;
+ case "Seconds/Piece":
+ hoursPerUnit = operation.machineTime / 3600;
+ break;
+ default:
+ break;
+ }
+
+ effects.machineHours.push((quantity) => {
+ return hoursPerUnit * quantity * data.quantity + fixedHours;
+ });
+
+ effects.machineCost.push((quantity) => {
+ return (
+ hoursPerUnit *
quantity *
data.quantity *
- (operation.overheadRate ?? 0)
- );
- });
- }
+ (operation.quotingRate ?? 0) +
+ fixedHours * (operation.quotingRate ?? 0)
+ );
+ });
}
});
@@ -254,7 +340,12 @@ export function useLineCosts({
0
);
- const overheadCost = costEffects.overheadCost.reduce(
+ const setupCost = costEffects.setupCost.reduce(
+ (acc, effect) => acc + effect(quantity),
+ 0
+ );
+
+ const machineCost = costEffects.machineCost.reduce(
(acc, effect) => acc + effect(quantity),
0
);
@@ -264,7 +355,12 @@ export function useLineCosts({
0
);
- const productionHours = costEffects.productionHours.reduce(
+ const laborHours = costEffects.laborHours.reduce(
+ (acc, effect) => acc + effect(quantity),
+ 0
+ );
+
+ const machineHours = costEffects.machineHours.reduce(
(acc, effect) => acc + effect(quantity),
0
);
@@ -277,10 +373,12 @@ export function useLineCosts({
consumableCost,
serviceCost,
laborCost,
- overheadCost,
+ setupCost,
+ machineCost,
outsideCost: 0,
setupHours,
- productionHours,
+ laborHours,
+ machineHours,
};
},
[costEffects]
diff --git a/apps/carbon/app/modules/shared/ui/MethodIcon.tsx b/apps/carbon/app/modules/shared/ui/MethodIcon.tsx
index 91cada4c90..ce80ca07ce 100644
--- a/apps/carbon/app/modules/shared/ui/MethodIcon.tsx
+++ b/apps/carbon/app/modules/shared/ui/MethodIcon.tsx
@@ -2,7 +2,13 @@ import { cn } from "@carbon/react";
import { AiOutlinePartition } from "react-icons/ai";
import { FaCodePullRequest } from "react-icons/fa6";
import { HiSquares2X2 } from "react-icons/hi2";
-import { LuGrip, LuHammer, LuShoppingCart } from "react-icons/lu";
+import {
+ LuGrip,
+ LuHammer,
+ LuHardHat,
+ LuShoppingCart,
+ LuTimer,
+} from "react-icons/lu";
import { CiFries } from "react-icons/ci";
import { GiIBeam } from "react-icons/gi";
@@ -76,3 +82,22 @@ export const MethodIcon = ({
return <HiSquares2X2 className={cn("text-muted-foreground", className)} />;
};
+
+export const TimeTypeIcon = ({
+ type,
+ className,
+}: {
+ type: string;
+ className?: string;
+}) => {
+ switch (type) {
+ case "Setup":
+ return <LuTimer className={className} />;
+ case "Labor":
+ return <LuHardHat className={className} />;
+ case "Machine":
+ return <LuHammer className={className} />;
+ }
+
+ return <HiSquares2X2 className={cn("text-muted-foreground", className)} />;
+};
diff --git a/apps/carbon/app/modules/shared/ui/index.ts b/apps/carbon/app/modules/shared/ui/index.ts
index e5ace07958..cc66b9dc95 100644
--- a/apps/carbon/app/modules/shared/ui/index.ts
+++ b/apps/carbon/app/modules/shared/ui/index.ts
@@ -1,6 +1,11 @@
import CadModelUpload from "./CadModelUpload";
import { MethodBadge } from "./MethodBadge";
-import { MethodIcon, MethodItemTypeIcon, TrackingTypeIcon } from "./MethodIcon";
+import {
+ MethodIcon,
+ MethodItemTypeIcon,
+ TimeTypeIcon,
+ TrackingTypeIcon,
+} from "./MethodIcon";
import Notes from "./Notes";
import RealtimeDataProvider from "./RealtimeDataProvider";
@@ -11,5 +16,6 @@ export {
MethodItemTypeIcon,
Notes,
RealtimeDataProvider,
+ TimeTypeIcon,
TrackingTypeIcon,
};
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 0f964c2906..4ae02e5fc1 100644
--- a/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.details.tsx
+++ b/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.details.tsx
@@ -6,7 +6,11 @@ import { Fragment, useMemo } from "react";
import type { Tree } from "~/components/TreeView";
import { usePermissions, useRealtime, useRouteData } from "~/hooks";
import { CadModel } from "~/modules/items";
-import type { QuotationPrice, QuoteMethod } from "~/modules/sales";
+import type {
+ QuotationOperation,
+ QuotationPrice,
+ QuoteMethod,
+} from "~/modules/sales";
import {
getFilesByQuoteLineId,
getQuoteLine,
@@ -127,7 +131,7 @@ export default function QuoteLine() {
const getLineCosts = useLineCosts({
methodTree,
- operations,
+ operations: operations as QuotationOperation[],
unitCost: line.unitCost ?? 0,
});
diff --git a/packages/documents/src/pdf/QuotePDF.tsx b/packages/documents/src/pdf/QuotePDF.tsx
index e3b70ff89b..e77e207fc9 100644
--- a/packages/documents/src/pdf/QuotePDF.tsx
+++ b/packages/documents/src/pdf/QuotePDF.tsx
@@ -164,9 +164,9 @@ const QuotePDF = ({
)}
{Object.keys(additionalCharges).length > 0 && (
- <View style={styles.col}>
+ <View style={{ ...styles.col, marginTop: 10 }}>
<Text style={{ fontSize: 9, fontWeight: 700 }}>
- Additional Charges:
+ Additional Charges
</Text>
{Object.values(additionalCharges)
.sort((a, b) =>
@@ -186,7 +186,7 @@ const QuotePDF = ({
)}
</View>
<View style={styles.colSixty}>
- {line.quantity.map((quantity) => {
+ {line.quantity.map((quantity, index) => {
const prices = pricesByLine[line.id] ?? [];
const price = prices.find(
(price) => price.quantity === quantity
@@ -196,7 +196,7 @@ const QuotePDF = ({
(1 - (price?.discountPercent ?? 0) / 100);
const additionalCharge =
- additionalChargesByQuantity[quantity] ?? 0;
+ additionalChargesByQuantity[index] ?? 0;
return (
<View key={quantity} style={styles.row}>