summaryrefslogtreecommitdiff
path: root/lib/bidding/vendor/components/pr-items-pricing-table.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bidding/vendor/components/pr-items-pricing-table.tsx')
-rw-r--r--lib/bidding/vendor/components/pr-items-pricing-table.tsx23
1 files changed, 20 insertions, 3 deletions
diff --git a/lib/bidding/vendor/components/pr-items-pricing-table.tsx b/lib/bidding/vendor/components/pr-items-pricing-table.tsx
index 01885f7a..1dee7adb 100644
--- a/lib/bidding/vendor/components/pr-items-pricing-table.tsx
+++ b/lib/bidding/vendor/components/pr-items-pricing-table.tsx
@@ -39,6 +39,8 @@ interface PrItem {
materialDescription: string | null
quantity: string | null
quantityUnit: string | null
+ totalWeight: string | null
+ weightUnit: string | null
currency: string | null
requestedDeliveryDate: string | null
hasSpecDocument: boolean | null
@@ -221,11 +223,20 @@ export function PrItemsPricingTable({
if (q.prItemId === prItemId) {
const updated = { ...q, [field]: value }
- // 단가나 수량이 변경되면 금액 자동 계산
+ // 단가가 변경되면 금액 자동 계산 (수량 우선, 없으면 중량 사용)
if (field === 'bidUnitPrice') {
const prItem = prItems.find(item => item.id === prItemId)
- const quantity = parseFloat(prItem?.quantity || '1')
- updated.bidAmount = updated.bidUnitPrice * quantity
+ let multiplier = 1
+
+ if (prItem?.quantity && parseFloat(prItem.quantity) > 0) {
+ // 수량이 있으면 수량 기준
+ multiplier = parseFloat(prItem.quantity)
+ } else if (prItem?.totalWeight && parseFloat(prItem.totalWeight) > 0) {
+ // 수량이 없으면 중량 기준
+ multiplier = parseFloat(prItem.totalWeight)
+ }
+
+ updated.bidAmount = updated.bidUnitPrice * multiplier
}
return updated
@@ -273,6 +284,8 @@ export function PrItemsPricingTable({
<TableHead>자재내역</TableHead>
<TableHead>수량</TableHead>
<TableHead>단위</TableHead>
+ <TableHead>중량</TableHead>
+ <TableHead>중량단위</TableHead>
<TableHead>견적단가</TableHead>
<TableHead>견적금액</TableHead>
<TableHead>납품예정일</TableHead>
@@ -310,6 +323,10 @@ export function PrItemsPricingTable({
{item.quantity ? parseFloat(item.quantity).toLocaleString() : '-'}
</TableCell>
<TableCell>{item.quantityUnit || '-'}</TableCell>
+ <TableCell className="text-right">
+ {item.totalWeight ? parseFloat(item.totalWeight).toLocaleString() : '-'}
+ </TableCell>
+ <TableCell>{item.weightUnit || '-'}</TableCell>
<TableCell>
{readOnly ? (
<span className="font-medium">