removed files

This commit is contained in:
2026-08-28 11:03:56 +05:30
parent bf4dc4e888
commit 9f64b42f8a
13 changed files with 291 additions and 76 deletions

View File

@@ -27,6 +27,7 @@ import {
orderQuantity,
orderValue,
statusColor,
billedAtMs,
syncLagMs,
type StatusKey,
} from '../orderStatus';
@@ -114,7 +115,11 @@ export function SalesPage() {
.toLowerCase()
.includes(term),
)
.sort((a, b) => (b.bill.billedat ?? '').localeCompare(a.bill.billedat ?? ''));
/* Sorted on the recovered instant, not the raw stamp. A string compare
put the one terminal that sends correct UTC five and a half hours
adrift of the rest, so newest-first was newest-first only within a
terminal. */
.sort((a, b) => (billedAtMs(b.bill) ?? 0) - (billedAtMs(a.bill) ?? 0));
}, [billPages, branchIds, branches, keyword]);
/** Counts for the tab strip, from the unfiltered set. */
@@ -753,6 +758,8 @@ function BillsTable({
restarting its series would collide. */}
{rows.map(({ bill, branch }) => {
const lag = syncLagMs(bill);
// The recovered instant, not the stamp — see `billedAtMs`.
const billedAt = billedAtMs(bill);
return (
<tr key={bill.terminalorderid ?? `${branch}:${bill.posorderid}`}>
<Td>
@@ -773,7 +780,7 @@ function BillsTable({
</Secondary>
</Td>
<Td isMuted>
{clockOf(bill.billedat)}
{clockOf(billedAt ?? bill.billedat)}
</Td>
{showBranch ? (
<Td isMuted>
@@ -824,10 +831,16 @@ function stamp(value: string | undefined): string {
return `${parsed.toLocaleDateString('en-IN', { day: '2-digit', month: 'short' })}, ${clockOf(value)}`;
}
function clockOf(value: string | undefined): string {
if (!value) return '—';
/**
* Takes an epoch too, so a bill can pass the instant `billedAtMs` recovered
* rather than the stamp it arrived with. Formatting the raw `billedat` shifted
* an already-wrong time by another +05:30 and put a 17:17 sale on the row at
* 22:47 — two bugs compounding into a plausible-looking number.
*/
function clockOf(value: string | number | undefined): string {
if (value === undefined || value === '') return '—';
const parsed = new Date(value);
if (Number.isNaN(parsed.getTime())) return value;
if (Number.isNaN(parsed.getTime())) return String(value);
return parsed.toLocaleTimeString('en-IN', {
hour: '2-digit',
minute: '2-digit',