diff --git a/frontend/src/pages/FloatManagement.tsx b/frontend/src/pages/FloatManagement.tsx index 3da201a..3135ff0 100644 --- a/frontend/src/pages/FloatManagement.tsx +++ b/frontend/src/pages/FloatManagement.tsx @@ -237,7 +237,10 @@ export function FloatCountForm({ type }: { type: CountType }) { }).catch(() => {}) }, [type]) - const totalCounted = denoms.reduce((s, d) => s + d.value * (denomQtys[d.value] ?? 0), 0) + function unitVal(d: { value: number }) { + return type === 'change_tin' ? (BAG_VALUES[d.value] ?? d.value) : d.value + } + const totalCounted = denoms.reduce((s, d) => s + unitVal(d) * (denomQtys[d.value] ?? 0), 0) const totalReceipts = receipts.reduce((s, r) => s + (parseFloat(r.amount) || 0), 0) const targetAmount = type === 'petty_cash' ? pettyTarget : type === 'change_tin' ? Object.entries(changeTinTargets).reduce((s, [, v]) => s + (v || 0), 0) @@ -252,7 +255,7 @@ export function FloatCountForm({ type }: { type: CountType }) { try { const denominations = denoms.filter(d => (denomQtys[d.value] ?? 0) > 0).map(d => ({ denomination: d.value, quantity: denomQtys[d.value] ?? 0, bag_quantity: 0, - total: d.value * (denomQtys[d.value] ?? 0), + total: unitVal(d) * (denomQtys[d.value] ?? 0), })) const result = await api.post<{ count_id: number }>('/floats/save', { count_type: type, @@ -308,10 +311,15 @@ export function FloatCountForm({ type }: { type: CountType }) {