fix(reporting): resize trend chart and repair closures detail

This commit is contained in:
Deploy
2026-08-25 22:24:11 +02:00
parent ae42bae61e
commit f76591518e
15 changed files with 68 additions and 60 deletions

View File

@@ -699,13 +699,11 @@ export async function registerPosRoutes(app: FastifyInstance, deps: PosRouteDeps
),
pool.query<{ method_code: string; method_name: string; total: string; count: string }>(
`SELECT pm.code AS method_code, pm.label AS method_name,
COALESCE(SUM(pt.amount_cents), 0)::bigint AS total,
COALESCE(SUM(rpl.amount_cents), 0)::bigint AS total,
COUNT(*)::int AS count
FROM payments_transactions pt
JOIN orders_orders o ON o.id = pt.order_id
LEFT JOIN pos_payment_methods pm ON pm.id::text = pt.provider_event_id
AND pm.store_id = o.store_id
WHERE o.cash_session_id = $1 AND o.source = 'pos' AND pt.status = 'succeeded'
FROM reporting_payment_lines rpl
LEFT JOIN pos_payment_methods pm ON pm.id = rpl.payment_method_id
WHERE rpl.cash_session_id = $1 AND rpl.status = 'payment'
GROUP BY pm.code, pm.label`,
[id],
),
@@ -771,13 +769,11 @@ export async function registerPosRoutes(app: FastifyInstance, deps: PosRouteDeps
),
pool.query<{ method_code: string; method_name: string; total: string; count: string }>(
`SELECT pm.code AS method_code, pm.label AS method_name,
COALESCE(SUM(pt.amount_cents), 0)::bigint AS total,
COALESCE(SUM(rpl.amount_cents), 0)::bigint AS total,
COUNT(*)::int AS count
FROM payments_transactions pt
JOIN orders_orders o ON o.id = pt.order_id
LEFT JOIN pos_payment_methods pm ON pm.id::text = pt.provider_event_id
AND pm.store_id = o.store_id
WHERE o.cash_session_id = $1 AND o.source = 'pos' AND pt.status = 'succeeded'
FROM reporting_payment_lines rpl
LEFT JOIN pos_payment_methods pm ON pm.id = rpl.payment_method_id
WHERE rpl.cash_session_id = $1 AND rpl.status = 'payment'
GROUP BY pm.code, pm.label`,
[id],
),