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(documents): itemize add-on prices on quote/order/invoice PDFs

sidgaikwad09c6a04ad9e2
diff --git a/packages/documents/src/pdf/blocks/LineItemsBlock.tsx b/packages/documents/src/pdf/blocks/LineItemsBlock.tsx
index 6820f4f955..a9872b2a5f 100644
--- a/packages/documents/src/pdf/blocks/LineItemsBlock.tsx
+++ b/packages/documents/src/pdf/blocks/LineItemsBlock.tsx
@@ -114,24 +114,52 @@ export function LineItemsBlock({
Tax & Fees
</Text>
{lineShippingCost > 0 && (
- <Text style={tw("text-[9px] text-gray-600")}>
- - Shipping
- </Text>
+ <View style={tw("flex flex-row justify-between")}>
+ <Text
+ style={tw("text-[9px] text-gray-600 flex-1 pr-2")}
+ >
+ - Shipping
+ </Text>
+ <Text style={tw("text-[9px] text-gray-600")}>
+ {numberFormatter.format(lineShippingCost)}
+ </Text>
+ </View>
)}
{lineAddOnCost > 0 && (
- <Text style={tw("text-[9px] text-gray-600")}>
- - Add-On
- </Text>
+ <View style={tw("flex flex-row justify-between")}>
+ <Text
+ style={tw("text-[9px] text-gray-600 flex-1 pr-2")}
+ >
+ - Add-On
+ </Text>
+ <Text style={tw("text-[9px] text-gray-600")}>
+ {numberFormatter.format(lineAddOnCost)}
+ </Text>
+ </View>
)}
{lineNonTaxableAddOnCost > 0 && (
- <Text style={tw("text-[9px] text-gray-600")}>
- - Non-Taxable Add-On
- </Text>
+ <View style={tw("flex flex-row justify-between")}>
+ <Text
+ style={tw("text-[9px] text-gray-600 flex-1 pr-2")}
+ >
+ - Non-Taxable Add-On
+ </Text>
+ <Text style={tw("text-[9px] text-gray-600")}>
+ {numberFormatter.format(lineNonTaxableAddOnCost)}
+ </Text>
+ </View>
)}
{lineTaxPercent > 0 && (
- <Text style={tw("text-[9px] text-gray-600")}>
- - Tax ({formatPercent(lineTaxPercent, locale)})
- </Text>
+ <View style={tw("flex flex-row justify-between")}>
+ <Text
+ style={tw("text-[9px] text-gray-600 flex-1 pr-2")}
+ >
+ - Tax ({formatPercent(lineTaxPercent, locale)})
+ </Text>
+ <Text style={tw("text-[9px] text-gray-600")}>
+ {numberFormatter.format(lineTaxAmount)}
+ </Text>
+ </View>
)}
</View>
)}
diff --git a/packages/documents/src/pdf/blocks/quote/LineItemsBlock.tsx b/packages/documents/src/pdf/blocks/quote/LineItemsBlock.tsx
index 61a22df1cd..7f33638182 100644
--- a/packages/documents/src/pdf/blocks/quote/LineItemsBlock.tsx
+++ b/packages/documents/src/pdf/blocks/quote/LineItemsBlock.tsx
@@ -190,9 +190,24 @@ export function LineItemsBlock({
Tax & Fees
</Text>
{(price?.convertedShippingCost ?? 0) > 0 && (
- <Text style={tw("text-[8px] text-gray-400")}>
- - Shipping
- </Text>
+ <View
+ style={tw("flex flex-row justify-between")}
+ >
+ <Text
+ style={tw(
+ "text-[8px] text-gray-400 flex-1 pr-2"
+ )}
+ >
+ - Shipping
+ </Text>
+ <Text
+ style={tw("text-[8px] text-gray-400")}
+ >
+ {numberFormatter.format(
+ price?.convertedShippingCost ?? 0
+ )}
+ </Text>
+ </View>
)}
{Object.values(additionalCharges)
.filter(
@@ -203,18 +218,51 @@ export function LineItemsBlock({
.sort((a, b) =>
a.description.localeCompare(b.description)
)
- .map((charge) => (
+ .map((charge) => {
+ let chargeAmount =
+ charge.amounts?.[quantity] ?? 0;
+ if (shouldConvertCurrency)
+ chargeAmount *= exchangeRate;
+ return (
+ <View
+ key={charge.description}
+ style={tw(
+ "flex flex-row justify-between"
+ )}
+ >
+ <Text
+ style={tw(
+ "text-[8px] text-gray-400 flex-1 pr-2"
+ )}
+ >
+ - {charge.description}
+ </Text>
+ <Text
+ style={tw("text-[8px] text-gray-400")}
+ >
+ {numberFormatter.format(chargeAmount)}
+ </Text>
+ </View>
+ );
+ })}
+ {taxPercent > 0 && (
+ <View
+ style={tw("flex flex-row justify-between")}
+ >
+ <Text
+ style={tw(
+ "text-[8px] text-gray-400 flex-1 pr-2"
+ )}
+ >
+ - Tax ({formatPercent(taxPercent, locale)}
+ )
+ </Text>
<Text
- key={charge.description}
style={tw("text-[8px] text-gray-400")}
>
- - {charge.description}
+ {numberFormatter.format(taxAmount)}
</Text>
- ))}
- {taxPercent > 0 && (
- <Text style={tw("text-[8px] text-gray-400")}>
- - Tax ({formatPercent(taxPercent, locale)})
- </Text>
+ </View>
)}
</View>
)}
diff --git a/packages/documents/src/pdf/blocks/salesOrder/LineItemsBlock.tsx b/packages/documents/src/pdf/blocks/salesOrder/LineItemsBlock.tsx
index cc0a8f4957..5c19edc7c0 100644
--- a/packages/documents/src/pdf/blocks/salesOrder/LineItemsBlock.tsx
+++ b/packages/documents/src/pdf/blocks/salesOrder/LineItemsBlock.tsx
@@ -114,24 +114,52 @@ export function LineItemsBlock({
Tax & Fees
</Text>
{lineShippingCost > 0 && (
- <Text style={tw("text-[9px] text-gray-600")}>
- - Shipping
- </Text>
+ <View style={tw("flex flex-row justify-between")}>
+ <Text
+ style={tw("text-[9px] text-gray-600 flex-1 pr-2")}
+ >
+ - Shipping
+ </Text>
+ <Text style={tw("text-[9px] text-gray-600")}>
+ {numberFormatter.format(lineShippingCost)}
+ </Text>
+ </View>
)}
{lineAddOnCost > 0 && (
- <Text style={tw("text-[9px] text-gray-600")}>
- - Add-On
- </Text>
+ <View style={tw("flex flex-row justify-between")}>
+ <Text
+ style={tw("text-[9px] text-gray-600 flex-1 pr-2")}
+ >
+ - Add-On
+ </Text>
+ <Text style={tw("text-[9px] text-gray-600")}>
+ {numberFormatter.format(lineAddOnCost)}
+ </Text>
+ </View>
)}
{lineNonTaxableAddOnCost > 0 && (
- <Text style={tw("text-[9px] text-gray-600")}>
- - Non-Taxable Add-On
- </Text>
+ <View style={tw("flex flex-row justify-between")}>
+ <Text
+ style={tw("text-[9px] text-gray-600 flex-1 pr-2")}
+ >
+ - Non-Taxable Add-On
+ </Text>
+ <Text style={tw("text-[9px] text-gray-600")}>
+ {numberFormatter.format(lineNonTaxableAddOnCost)}
+ </Text>
+ </View>
)}
{lineTaxPercent > 0 && (
- <Text style={tw("text-[9px] text-gray-600")}>
- - Tax ({formatPercent(lineTaxPercent, locale)})
- </Text>
+ <View style={tw("flex flex-row justify-between")}>
+ <Text
+ style={tw("text-[9px] text-gray-600 flex-1 pr-2")}
+ >
+ - Tax ({formatPercent(lineTaxPercent, locale)})
+ </Text>
+ <Text style={tw("text-[9px] text-gray-600")}>
+ {numberFormatter.format(lineTaxAmount)}
+ </Text>
+ </View>
)}
</View>
)}