feat: 倉庫業務屬性、庫存成本追蹤與採購單功能更新
1. 倉庫管理:新增業務類型 (Owned/External/Customer) 與車牌資訊與司機欄位。 2. 庫存管理:實作成本追蹤 (unit_cost, total_value),更新列表與撥補單顯示。 3. 採購單:新增採購日期 (order_date),調整欄位名稱與順序。 4. 前端優化:更新相關 TS Type 定義與 UI 顯示。
This commit is contained in:
@@ -41,11 +41,11 @@ export function PurchaseOrderItemsTable({
|
||||
<TableHeader>
|
||||
<TableRow className="bg-gray-50 hover:bg-gray-50">
|
||||
<TableHead className="w-[20%] text-left">商品名稱</TableHead>
|
||||
<TableHead className="w-[10%] text-left">數量</TableHead>
|
||||
<TableHead className="w-[10%] text-left">採購數量</TableHead>
|
||||
<TableHead className="w-[12%] text-left">單位</TableHead>
|
||||
<TableHead className="w-[12%] text-left">換算基本單位</TableHead>
|
||||
<TableHead className="w-[15%] text-left">小計</TableHead>
|
||||
<TableHead className="w-[15%] text-left">單價 / 基本單位</TableHead>
|
||||
<TableHead className="w-[15%] text-left">小計</TableHead>
|
||||
{!isReadOnly && <TableHead className="w-[5%]"></TableHead>}
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
@@ -146,7 +146,30 @@ export function PurchaseOrderItemsTable({
|
||||
</div>
|
||||
</TableCell>
|
||||
|
||||
{/* 總金額 (主要輸入欄位) */}
|
||||
{/* 換算採購單價 / 基本單位 (顯示換算結果 - SWAPPED HERE) */}
|
||||
<TableCell className="text-left">
|
||||
<div className="flex flex-col">
|
||||
<div className="text-gray-500 font-medium text-sm">
|
||||
{formatCurrency(convertedUnitPrice)} / {item.base_unit_name || "個"}
|
||||
</div>
|
||||
{convertedUnitPrice > 0 && item.previousPrice && item.previousPrice > 0 && (
|
||||
<>
|
||||
{convertedUnitPrice > item.previousPrice && (
|
||||
<p className="text-[10px] text-amber-600 font-medium animate-pulse">
|
||||
⚠️ 高於上次: {formatCurrency(item.previousPrice)}
|
||||
</p>
|
||||
)}
|
||||
{convertedUnitPrice < item.previousPrice && (
|
||||
<p className="text-[10px] text-green-600 font-medium">
|
||||
📉 低於上次: {formatCurrency(item.previousPrice)}
|
||||
</p>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</TableCell>
|
||||
|
||||
{/* 總金額 (主要輸入欄位 - SWAPPED HERE) */}
|
||||
<TableCell className="text-left">
|
||||
{isReadOnly ? (
|
||||
<span className="font-bold text-primary">{formatCurrency(item.subtotal)}</span>
|
||||
@@ -178,29 +201,6 @@ export function PurchaseOrderItemsTable({
|
||||
)}
|
||||
</TableCell>
|
||||
|
||||
{/* 換算採購單價 / 基本單位 (顯示換算結果) */}
|
||||
<TableCell className="text-left">
|
||||
<div className="flex flex-col">
|
||||
<div className="text-gray-500 font-medium text-sm">
|
||||
{formatCurrency(convertedUnitPrice)} / {item.base_unit_name || "個"}
|
||||
</div>
|
||||
{convertedUnitPrice > 0 && item.previousPrice && item.previousPrice > 0 && (
|
||||
<>
|
||||
{convertedUnitPrice > item.previousPrice && (
|
||||
<p className="text-[10px] text-amber-600 font-medium animate-pulse">
|
||||
⚠️ 高於上次: {formatCurrency(item.previousPrice)}
|
||||
</p>
|
||||
)}
|
||||
{convertedUnitPrice < item.previousPrice && (
|
||||
<p className="text-[10px] text-green-600 font-medium">
|
||||
📉 低於上次: {formatCurrency(item.previousPrice)}
|
||||
</p>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</TableCell>
|
||||
|
||||
{/* 刪除按鈕 */}
|
||||
{!isReadOnly && onRemoveItem && (
|
||||
<TableCell className="text-center">
|
||||
|
||||
Reference in New Issue
Block a user