Fix cash summary quantity bug; add Safe Count as own nav item

- Cash summary: derive total_quantity from total_amount/denomination_value
  so value_entered rows are counted (previously SUM(quantity) returned
  NULL for those rows)
- Safe Count: moved safe_cash out of Float Management tabs into its own
  /safe/* route with a dedicated sidebar entry (Vault icon)
- FloatManagement now only shows Petty Cash and Change Tin tabs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-01 21:36:19 +00:00
parent e6188fb337
commit 4ea5238e62
5 changed files with 25 additions and 7 deletions

View file

@ -193,7 +193,9 @@ export async function reportRoutes(app) {
if (!from || !to) return reply.status(400).send({ error: 'from and to required' })
const { rows } = await pool.query(
`SELECT d.denomination_value, SUM(d.quantity) AS total_quantity, SUM(d.total_amount) AS total_value
`SELECT d.denomination_value,
ROUND(SUM(d.total_amount) / NULLIF(d.denomination_value, 0)) AS total_quantity,
SUM(d.total_amount) AS total_value
FROM denominations d
JOIN cash_ups c ON d.cash_up_id = c.id
WHERE c.session_date >= $1 AND c.session_date <= $2 AND d.count_type = 'takings'