Commit Graph

347 Commits

Author SHA1 Message Date
66b0b611e4 stuff 2026-05-18 18:29:44 -07:00
a156ac99fe tries sales changes 2026-05-18 15:38:07 -07:00
31179278e4 Adds a more actionable view 2026-05-17 08:16:11 -07:00
cc31d8849b Feat/Complete Sales Summaries (#5)
## Summary

Completes the automatic sales summary pipeline end-to-end: the `sales-summaries-v2` job now calculates aggregate totals, preserves manual adjustments, and automatically posts balanced journal entries to the ledger.

## What Changed

**New Datomic transaction function** (`upsert-sales-summary-ledger`)
- Transforms detailed `sales-summary-item`s into aggregated `journal-entry` lines grouped by account and ledger side
- Handles the full upsert: posts a new journal entry for summaries with mapped accounts, or retracts the orphaned entry if items no longer qualify

**Enhanced `sales-summaries-v2` job**
- Calculates and stores 13 aggregate total attributes (card/cash/food-app/gift-card payments, refunds, fees, discounts, tax, tip, returns, unknown, net)
- Preserves manual items (`manual? true`) during recalculation — only auto-calculated items are replaced

**Ledger reconciliation**
- `reconcile-ledger` now queries for sales summaries missing journal entries and repairs them via `:upsert-sales-summary-ledger`, alongside existing invoice and transaction repairs

**Schema**
- Added 13 `total-*` attributes on `sales-summary` (all `db.type/double`, no history)
- Registered the new transaction function in `tx.clj` and `datomic.clj`

**Admin UI cleanup**
- Resolved "clientize" and HTMX `client-id` TODOs in the sales summaries admin page
- `new-summary-item` now correctly passes `client-id` via `hx-vals`
- Removed stale TODO comments and placeholder code

## Files Changed (8)

| File | Purpose |
|------|---------|
| `iol_ion/.../upsert_sales_summary_ledger.clj` | New Datomic tx function |
| `iol_ion/.../tx.clj` | Register new tx function |
| `resources/schema.edn` | 13 new `total-*` attributes |
| `src/.../datomic.clj` | Load new tx namespace |
| `src/.../jobs/sales_summaries.clj` | Aggregate totals + manual item preservation |
| `src/.../ledger.clj` | Sales summary repair in `reconcile-ledger` |
| `src/.../ssr/admin/sales_summaries.clj` | UI TODO cleanup |
| `docs/plans/...plan.md` | Implementation plan document |

Co-authored-by: Bryce <bryce@integreatconsult.com>
Reviewed-on: #5
Co-authored-by: Bryce <bryce@brycecovertoperations.com>
Co-committed-by: Bryce <bryce@brycecovertoperations.com>
2026-05-16 00:16:44 -07:00
01329bbdf5 Disallows chatgpt for emailed invoices. 2025-03-25 21:26:40 -07:00
581033001b Adds the ability to filter down to unbalanced 2025-03-11 21:07:51 -07:00
d078fb8a15 Makes better warning/errors 2025-02-03 21:06:28 -08:00
ca7a08452c Makes A&J Produce findable. 2025-01-17 20:53:17 -08:00
ce759acab4 Adds memo field 2024-12-29 21:52:53 -08:00
a0bfeb51a7 dates should be inclusive. 2024-12-16 22:30:18 -08:00
da2702f9e8 Supports more 2024-12-16 21:55:06 -08:00
b7826ad6ce uses the periods that are actually used. 2024-12-12 09:49:52 -08:00
aaeafae871 dates work again 2024-12-11 22:51:17 -08:00
717e89c799 Unpay autopays 2024-12-11 15:00:58 -08:00
98dcdb5a55 cleans stuff up. 2024-11-23 21:13:15 -08:00
a4a40fc9c2 applying feedback 2024-11-20 09:48:07 -08:00
18172df3f8 Periods selector 2024-11-14 22:26:43 -08:00
c860032eaf merged. 2024-11-14 21:14:03 -08:00
d119e01857 Adds advanced view 2024-11-13 20:03:04 -08:00
cb4f88f02a adds csv capability 2024-11-11 21:39:36 -08:00
df3183f85c progress on reports. 2024-11-10 22:09:14 -08:00
966deb232a tweaks 2024-11-04 21:43:41 -08:00
48d575fe70 create manual ledger experience 2024-10-28 15:18:07 -07:00
bf7e63f7e0 beginning on new journal entry 2024-10-26 20:11:03 -07:00
7ee99b3542 cash flows 2024-10-26 00:20:10 -07:00
7e890cebee Make bigoli work 2024-10-24 23:26:59 -07:00
864ecec1b2 balance sheet 2024-10-24 22:27:29 -07:00
f9d02e4798 Makes an experience for balance sheet multi choice 2024-10-24 22:21:52 -07:00
3da8bf054f Sets up multi date 2024-10-22 23:55:02 -07:00
77571e3589 addresses minor issues. 2024-10-22 23:16:19 -07:00
12baf70d5c merged 2024-10-22 22:52:40 -07:00
767081d675 Updates for ledger import 2024-10-21 23:59:26 -07:00
e3ac67114c minor tweaks. 2024-10-18 23:21:49 -07:00
2311acb9a2 Dropdown works well 2024-10-18 21:00:50 -07:00
acaa2a7d1e improve look of search 2024-10-16 15:37:22 -07:00
9d22de1338 new balance sheet 2024-10-15 20:46:18 -07:00
ca27fcdb57 Fixes 2024-10-15 19:22:19 -07:00
631ee905da popper to tippy 2024-10-15 06:45:33 -07:00
ca5d90b17f investigate progress. 2024-10-14 23:21:48 -07:00
c0bcc33b68 Makes new balance sheet page. It's much faster. 2024-10-13 19:29:49 -07:00
427f50fb6b Improves balance sheet, starts moving it to new layout 2024-10-11 20:36:23 -07:00
d41837db83 balance sheet replacement almost ready. 2024-10-11 08:55:43 -07:00
046b70d593 fixes a couple loading issues, starts on report rendering. 2024-10-11 00:19:29 -07:00
cf81e3999c Adds ability to query for snapshots 2024-10-02 09:28:05 -07:00
4c8c3560d8 Updates allowed to change more than one entity at a time 2024-09-28 11:42:42 -07:00
e25e2bfc46 logging updates, makes invoice voiding trigger refresh of running balances. 2024-09-27 16:59:35 -07:00
4c14e43734 Greatly simplifies keeping bank accounts in check 2024-09-27 15:59:21 -07:00
d86492cd8d shows pending balance 2024-09-25 23:34:16 -07:00
db9e0dc459 makes solr ec2 based and adds resiliency to running balances. 2024-09-25 22:01:12 -07:00
dc44233640 Adds uploaded by for invoices, fixes REEL Produce, adds Mani Produce 2024-09-25 08:36:45 -07:00