diff --git a/frontend/src/pages/DailyCashUp.tsx b/frontend/src/pages/DailyCashUp.tsx index ae6a1c2..e63d743 100644 --- a/frontend/src/pages/DailyCashUp.tsx +++ b/frontend/src/pages/DailyCashUp.tsx @@ -26,7 +26,7 @@ function initMachines(): CardMachine[] { } function denomTotal(denoms: Denomination[]) { - return denoms.reduce((s, d) => s + d.total_amount, 0) + return denoms.reduce((s, d) => s + (Number(d.total_amount) || 0), 0) } interface Props { user: User } @@ -70,7 +70,12 @@ export function DailyCashUp({ user: _user }: Props) { s => s.count_type === ct && parseFloat(String(s.denomination_value)) === d.value ) return saved - ? { ...saved, denomination_value: d.value } + ? { + ...saved, + denomination_value: d.value, + total_amount: parseFloat(String(saved.total_amount)) || 0, + value_entered: saved.value_entered != null ? parseFloat(String(saved.value_entered)) : null, + } : { count_type: ct, denomination_type: d.type, denomination_value: d.value, quantity: null, value_entered: null, total_amount: 0 } })