Commit Graph

58 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
d119e01857 Adds advanced view 2024-11-13 20:03:04 -08:00
ddb1d99cd3 Adds new ledger page 2024-08-22 22:59:47 -07:00
1bb8387051 fully removes old invoice experience 2024-08-09 20:32:32 -07:00
803abb5322 various bug fixes. 2024-07-12 21:45:48 -07:00
cb5028948e Makes loading page asynchronous 2024-04-29 11:08:59 -07:00
c8f438f616 started work on bank comparisons. 2024-04-26 21:51:56 -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
092377a93b makes creation of receivable invoices as possible 2024-04-01 15:14:58 -07:00
cf75f2b284 Merge branch 'master' into ssr-invoices 2024-04-01 08:27:20 -07:00
d1a660c5c1 Adds rudimentary version of summarizing sales 2024-03-31 00:22:53 -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
7b622b945a Adds little indicator on bank account form 2024-03-08 19:19:32 -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
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
3d5c307760 Made error page look pretty good 2023-10-30 20:47:55 -07:00
e8a419fb3c more cleanup. 2023-10-28 20:27:00 -07:00
855c23f4ae changes for running. 2023-10-28 12:17:01 -07:00
7f7458d54a Makes testing of transaction rules work 2023-10-26 21:23:52 -07:00
be9d777a17 consistent user experience with new client 2023-10-23 11:59:14 -07:00
6863684d9e Makes the entire form work but it just looks janky 2023-10-19 22:11:19 -07:00
bd9476544c Makes pnl work for companies with parenthesis 2023-10-17 13:03:48 -07:00
346ece787a migrates accounts to new dialog, adds client search to user 2023-10-17 10:14:02 -07:00
f997c41abd migrates accounts 2023-10-14 23:21:22 -07:00
d9fec54062 Migrates user page to SSR 2023-10-12 21:55:37 -07:00
8c3756f1c1 Sets up impersonate for ssr pages too 2023-09-28 23:22:25 -07:00
fddd3d9007 makes all sales orders use new grid helper 2023-09-27 23:52:57 -07:00
85597fd9eb ssr sales 2023-09-14 22:45:05 -07:00
Bryce
3597a5004d adds plaid reauth 2023-08-20 15:40:31 -07:00
Bryce
486c428917 Pregenerates recommendatios 2023-08-19 13:52:44 -07:00
Bryce
a8ce1c1ed7 Makes yodlee edit work again 2023-08-10 22:04:05 -07:00
Bryce
ea4ccf731e Invoices can now be imported with the POWER OF AI 2023-08-03 21:33:15 -07:00
Bryce
88eda03e7f Aside from urls and nomenclature, glimpse works. 2023-08-03 20:53:09 -07:00
Bryce
460e2077b9 Begins the process of AI-powered invoices 2023-08-02 22:34:56 -07:00
Bryce
5b5b15cb27 Makes plaid user configurable 2023-07-24 20:55:40 -07:00
Bryce
184f04681c Makes insights work 2023-07-13 20:50:14 -07:00
Bryce
3540346fc8 Makes tailwind version of history page 2023-06-01 09:26:52 -07:00
b9ae20125b Yodlee page in ssr. 2023-05-13 22:51:03 -07:00
8dca622947 Makes reports page work with new tailwind 2023-05-12 15:17:54 -07:00
e78c73e093 Makes company 1099 page work better and faster 2023-05-12 12:27:48 -07:00
c52444499f adds alternative ezcater solution. 2023-05-05 15:10:39 -07:00
b200728c6a makes cloud search possible. 2023-05-04 17:07:08 -07:00
69eaf42eda (cloud) adds transaction insights 2023-04-18 11:32:58 -07:00