9e4cb851ff9d1a6473c3bbec1d35a34d57dc629e
Two calculation defects that leave a day out of balance, plus the first tests to cover sales summaries. Tips: get-tip joins through :sales-order/charges, so it only sees tips that settled on a tender. A return-only order has no tender — it carries the reversal on :sales-order/tip, which nothing read — so the day credited a tip that had been handed back. Now additive: tendered tips plus the tips on orders that have no tender at all. Deliberately not a swap, because where an order does have a tender the tender is the correct source; real orders exist whose tender carries a tip their :sales-order/tip does not (auto-gratuity booked as a service charge, wallet tips missing from the net amounts), and reading the order would drop them. Service charges: nothing reads :sales-order/service-charge. The charge is collected inside the card tender but no line credits it, so every order carrying one leaves the day short by exactly that amount. Both signs count — a returned catering fee arrives as a negative service charge and is subtracted back out of :sales-order/returns, so dropping negatives would lose the reversal. The vendor gate is load-bearing: ezCater service charges are commission deducted from the restaurant rather than collected from the diner, and crediting those makes the day worse. It matches on :sales-order/vendor where that is set and falls back to the external id prefix where it is not — whole eras of Square orders carry no vendor attribute at all, and a gate on vendor alone would have silently credited nothing. Service charges stay behind the per-client "summary-service-charges" flag, and the account they map to (49000 Service Income) needs accounting sign-off before that flag is enabled anywhere. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Description
No description provided
Languages
Clojure
91%
CSS
4.2%
Sass
2.3%
HTML
1.2%
HCL
0.4%
Other
0.7%