Commit Graph

60 Commits

Author SHA1 Message Date
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
aaeafae871 dates work again 2024-12-11 22:51:17 -08:00
a8c7c7eb8e cleans up grids 2024-11-18 19:41:54 -08:00
f859655aad profit and loss now works. 2024-10-26 19:11:08 -07:00
7ee99b3542 cash flows 2024-10-26 00:20:10 -07:00
c0bcc33b68 Makes new balance sheet page. It's much faster. 2024-10-13 19:29:49 -07:00
67827b41d0 Adds float visibility 2024-08-28 21:49:40 -07:00
6fd609be3e Adds new ledger import page 2024-08-26 20:53:21 -07:00
c0d173125c hides link 2024-08-24 23:13:21 -07:00
bb7e0abeed External ledger 2024-08-24 23:12:14 -07:00
87ea623318 Removes glimpse, adds copy ids, cleans up error stuff, and supports ledyard 2024-08-23 21:37:35 -07:00
ddb1d99cd3 Adds new ledger page 2024-08-22 22:59:47 -07:00
af8e55803d merged. 2024-05-26 20:22:13 -07:00
1b80712742 charts 2024-04-29 20:56:37 -07:00
b537e99ecf adds glimpse for power users 2024-04-24 22:56:10 -07:00
1de86104d7 hides report 2024-04-24 22:09:01 -07:00
0a0746df0d hides report 2024-04-24 22:08:48 -07:00
99db96ad61 Adds bank reconciliation report 2024-04-24 21:27:19 -07:00
095fdc1d2f Makes another new vendor report 2024-04-22 21:48:22 -07:00
22e92c819b Adds new expense report, with ability to break down by vendor 2024-04-19 21:48:28 -07:00
263e432a6b working on import page 2024-04-17 22:13:28 -07:00
Bryce
71b5b9864c Applies all of the feedback for the new page 2024-04-14 22:29:01 -07:00
ae3ceb9ffe quick fix. 2024-04-04 21:37:37 -07:00
543c09118a permissions 2024-04-03 20:19:10 -07:00
dfccbf35cd Makes editing work correctly for non-admins 2024-04-03 20:08:46 -07:00
092377a93b makes creation of receivable invoices as possible 2024-04-01 15:14:58 -07:00
1594291c62 simple issue 2024-03-25 22:10:01 -07:00
554d0af35e Fixes the sidebar's jank 2024-03-25 22:02:11 -07:00
6bd475e86d Functional mobile invoice experience 2024-03-23 21:16:06 -07:00
Bryce
e914f8b994 Sidebars link correctly 2024-03-20 19:47:41 -07:00
Bryce
0cdf908acd Makes browsing work rigth 2024-03-20 15:47:00 -07:00
Bryce
8af5713ba2 Makes navigation a little bit better. 2024-03-20 14:48:44 -07:00
fb2eefc9ac invoices page works, needs dialog. 2024-03-09 21:25:55 -08:00
d73a3153bb payments ssr
voiding

supports bulk void.

exact match id linking

voidnig payments works.

minor tweak.
2024-03-09 11:59:17 -08:00
fcefbd5d6d Makes groups possible 2024-02-08 11:41:03 -08:00
8063a8fcbd Builds client SSR approach, sunsets old cljs. 2024-02-07 21:22:56 -08:00
99e4f05769 Makes an okay experience of editing vendors through a wizard 2023-11-01 23:06:18 -07:00
8c0307ff73 deleting more cruft. 2023-10-31 22:59:22 -07:00
6af9b6568f excel import moved over 2023-10-31 22:40:03 -07:00
25b397325a Adds new default admin page 2023-10-31 13:59:03 -07:00
7796e34834 Another admin page 2023-10-31 12:44:10 -07:00
f61aca26cd minor improvement in sidebar 2023-10-31 08:47:21 -07:00
a5672d8954 show hide 2023-10-30 16:41:58 -07:00
f0a7c378f7 can run transaction rules 2023-10-28 21:03:59 -07:00
7f7458d54a Makes testing of transaction rules work 2023-10-26 21:23:52 -07:00
8c3d792b28 company 1099 works 2023-10-26 11:04:44 -07:00
bd9476544c Makes pnl work for companies with parenthesis 2023-10-17 13:03:48 -07:00
f997c41abd migrates accounts 2023-10-14 23:21:22 -07:00
99accc067c progress on migrating all grids. 2023-09-28 22:22:25 -07:00
fddd3d9007 makes all sales orders use new grid helper 2023-09-27 23:52:57 -07:00