Commit Graph

304 Commits

Author SHA1 Message Date
ba87805d4c Add vendor pre-population for bulk code and individual edit forms
- Add vendor-changed HTMX handlers for both bulk code and individual edit
- Pre-populate default account at 100% when vendor is selected and no accounts exist
- Fix render-accounts-section to render from step-params correctly
- Change bulk code vendor-changed from hx-get to hx-post to include form data
- Add routes for vendor-changed endpoints
- Update e2e tests to cover vendor pre-population
- Run lein cljfmt fix across codebase
2026-05-21 14:45:19 -07:00
567db50a66 Add $/% toggle for transaction account amounts in manual edit
When editing a transaction manually, users can now toggle between viewing
account amounts as dollar values or percentages. The toggle appears in the
table header as a radio button group ($ / %).

Key features:
- Global toggle switches all accounts simultaneously
- $→%: amounts are converted to percentages of the transaction total
- %→$: uses percentages->dollars with spread-cents for accurate cent distribution
- Form state preserves vendor, memo, approval status when toggling
- Save handler converts % back to $ before persisting to Datomic
- Uses HTMX to re-render only the account grid body on toggle

New route: /toggle-amount-mode
New functions: ->percentage, percentages->dollars, convert-accounts-mode,
              account-grid-body*, toggle-amount-mode
2026-05-20 23:07:11 -07:00
bc89a7d586 fixes 2026-05-18 15:39:31 -07:00
a156ac99fe tries sales changes 2026-05-18 15:38:07 -07:00
8367036f85 merged 2026-05-16 00:36:16 -07:00
aeb7891efa Merge branch 'master' of codecommit://integreat 2026-05-16 00:25:37 -07:00
Bryce
1b2e2e4da7 Merge branch 'master' of gitea.story-basking.ts.net:notid/integreat 2026-05-16 00:17:01 -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
Bryce
04bc7cae78 total column 2026-04-09 14:32:39 -07:00
d008ec71c3 merged 2026-01-05 21:37:30 -08:00
96934b12fd Sample ledger show 2025-05-23 17:25:18 -07:00
5a05c144ea progress on bulk activities 2025-03-31 10:55:47 -07:00
0bae8f3d1b Improvements for transaction page 2025-03-22 23:21:21 -07:00
04ec980b02 handles home page 2025-03-11 20:27:28 -07:00
e22beb149e much smaller build (hopefully) and transactions progress. 2025-03-10 22:13:53 -07:00
fcb46bf756 msot 2025-03-10 15:04:39 -07:00
7373ef41d1 Removes old login page, more progress on transactions 2025-03-10 14:09:45 -07:00
7c7fc10a8d transactions page progress. 2025-03-02 20:09:40 -08:00
956d233fe1 bulk edit is now possible 2025-01-20 21:18:52 -08:00
084df59149 Allows paying from credit 2025-01-17 23:10:42 -08:00
717e89c799 Unpay autopays 2024-12-11 15:00:58 -08:00
a4a40fc9c2 applying feedback 2024-11-20 09:48:07 -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
aed9113306 correct link throughs 2024-11-11 19:29:17 -08:00
df3183f85c progress on reports. 2024-11-10 22:09:14 -08:00
052e7c2d36 fixes broken query 2024-11-06 09:47:37 -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
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
f589b24908 makes balance sheet with multiple dates easy. 2024-10-23 09:18:14 -07:00
3da8bf054f Sets up multi date 2024-10-22 23:55:02 -07:00
b31bffd5e8 Bug fix 2024-10-20 20:54:42 -07:00
2311acb9a2 Dropdown works well 2024-10-18 21:00:50 -07:00
ca5d90b17f investigate progress. 2024-10-14 23:21:48 -07:00
502a05bdcd preliminary investigate 2024-10-13 20:55:10 -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
046b70d593 fixes a couple loading issues, starts on report rendering. 2024-10-11 00:19:29 -07:00
6fd609be3e Adds new ledger import page 2024-08-26 20:53:21 -07:00
bb7e0abeed External ledger 2024-08-24 23:12:14 -07:00
4316ebb34a Links for ledger, and bank account picker 2024-08-23 23:24:05 -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
1bb8387051 fully removes old invoice experience 2024-08-09 20:32:32 -07:00
e947b4592c fixes several issues with scheduled payments 2024-08-02 22:32:18 -07:00
803abb5322 various bug fixes. 2024-07-12 21:45:48 -07:00
41398944d2 typo and invoice parse fix. 2024-06-25 07:04:18 -07:00
fb6f5a5fc3 fixing balance sheet mistake. 2024-06-07 20:23:00 -07:00