This commit is contained in:
2026-09-28 19:34:38 +05:30
parent 9706fcc520
commit 69d10975b3
2 changed files with 21 additions and 9 deletions

View File

@@ -560,8 +560,16 @@ export interface OrderRow {
*/
ordervalue?: number;
orderamount?: number;
/** Cash to collect on delivery. Shown only when > 0. */
collectionamt?: number;
/*
* `collectionamt` was declared here and read by the order drawer. It does not
* exist in Fiesta — `grep -rn "collectionamt" --include=*.go` returns nothing
* — so it showed a dash from the day it was written. Removed 2026-09-28.
*
* A type can describe a field the server has never sent, and nothing catches
* it: the optional marker makes `undefined` legal, and `?? 0` turns it into a
* plausible figure. Worth remembering before the next optional money field is
* added on the strength of a field name.
*/
deliverycharge?: number;
deliveryamt?: number;
paymenttype?: number;

View File

@@ -185,19 +185,23 @@ function Sheet({
label="Value"
value={value > 0 ? moneyExact(value) : detailAmount > 0 ? moneyExact(detailAmount) : '—'}
/>
{/* A delivery shows what the rider is paid. An order has no second
money figure worth the space: "Cash to collect" stood here and read
`collectionamt`, which Fiesta does not have — `grep --include=*.go`
finds nothing — so it was a dash on every order ever opened.
Nor can it be derived. Measured across 800 live orders spanning
three tenants and two regions, including 247 delivered ones,
`orders.paymenttype` is 42 on every row and `paymentstatus` is not
returned by `getorders` at all. Nothing in the data separates a cash
order from a prepaid one. */}
{job ? (
<Metric
label="Rider charge"
value={job.deliverycharges ? moneyExact(job.deliverycharges) : '—'}
isSmall
/>
) : (
<Metric
label="Cash to collect"
value={order?.collectionamt ? moneyExact(order.collectionamt) : '—'}
isSmall
/>
)}
) : null}
{/* Counted from the lines when the row carries no count. `itemcount`
and `quantity` are both routinely absent on the list read, which is
what made this a dash on an order that plainly had something in it. */}