e2e changes
This commit is contained in:
@@ -92,8 +92,11 @@ export function ConsolePage() {
|
||||
onlineOrders: order.orders,
|
||||
cancelled: order.cancelled,
|
||||
delivered: order.delivered,
|
||||
counterRevenue: pos?.grosssales ?? 0,
|
||||
counterBills: pos?.billcount ?? 0,
|
||||
// Both routes to a counter sale — a till that synced, and a till
|
||||
// that was offline whose day was imported as OFFLINE-tagged orders.
|
||||
// See the note in the Store Admin console, which had the same gap.
|
||||
counterRevenue: (pos?.grosssales ?? 0) + order.counterRevenue,
|
||||
counterBills: (pos?.billcount ?? 0) + order.counterOrders,
|
||||
health: summariseBranch(posHealth[index]?.data ?? [], now),
|
||||
pendingRequests: (requests.data ?? []).filter(
|
||||
(entry) => entry.locationid === branch.locationid,
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useMemo } from 'react';
|
||||
import type { DateRange } from '@/api/insights';
|
||||
import { useOrders } from '@/queries/hooks';
|
||||
import type { PosSalesSummary } from '@/api/types';
|
||||
import { isCounterSale } from '@/features/store-admin/branchStats';
|
||||
|
||||
/**
|
||||
* The day-by-day series behind the chart and the donut.
|
||||
@@ -63,6 +64,20 @@ export function useConsoleSeries(
|
||||
const amount = amountOf(order);
|
||||
const isCancelled = String(order.orderstatus ?? '').toLowerCase() === 'cancelled';
|
||||
|
||||
// A counter bill imported from a till sheet is in `orders` like any
|
||||
// other row, tagged OFFLINE by the backend, and counting it here put
|
||||
// the shop's counter takings on the app line of this chart and in the
|
||||
// "Online Sales" figure above it. The POS loop below adds the tills
|
||||
// that synced; these are the same money arriving the other way.
|
||||
if (isCounterSale(order)) {
|
||||
if (day && !isCancelled) {
|
||||
const row = at(day);
|
||||
row.counter += amount;
|
||||
row.counterBills += 1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
onlineOrders += 1;
|
||||
if (isCancelled) cancelled += 1;
|
||||
else onlineRevenue += amount;
|
||||
|
||||
Reference in New Issue
Block a user