Commit Graph

140 Commits

Author SHA1 Message Date
901d9eb508 date-choosing 2026-06-02 07:13:29 -07:00
e5a2d0bbba Simplify sysco line item allocation: use actual amounts, default unmatched to food cost (50000) 2026-05-27 13:22:29 -07:00
a4d7ac5982 Allows upload of CSV of sysco with line item parsing 2026-05-26 21:53:04 -07:00
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
8367036f85 merged 2026-05-16 00:36:16 -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
d008ec71c3 merged 2026-01-05 21:37:30 -08:00
01329bbdf5 Disallows chatgpt for emailed invoices. 2025-03-25 21:26:40 -07:00
0bae8f3d1b Improvements for transaction page 2025-03-22 23:21:21 -07:00
cf8b5cd2fa square fixes 2025-02-25 23:30:18 -08:00
ca5d90b17f investigate progress. 2024-10-14 23:21:48 -07:00
41167a24a7 Updates allowed to change more than one entity at a time 2024-09-28 11:46:01 -07:00
4c14e43734 Greatly simplifies keeping bank accounts in check 2024-09-27 15:59:21 -07:00
065e56d621 adds extra logging, allows printing of checks even if solr has issues. 2024-09-15 21:42:33 -07:00
d9bd09a9cc Resets selected on page change, adds account number to drop downs and makes missing emails less noisy 2024-08-22 21:14:43 -07:00
2d6985f5ca adds extra sysco logging 2024-08-14 23:15:20 -07:00
daafe9eaa1 another fix 2024-05-18 10:41:57 -07:00
1e797592bf load historical sales fix 2024-05-18 10:10:36 -07:00
a7428a2d19 fixes sysco import 2024-05-15 21:30:30 -07:00
518bdb7945 fixing sysco rollout bug. 2024-05-07 20:27:51 -07:00
7d9fe59592 build error 2024-05-03 11:12:47 -07:00
d1a06f24f2 reverts behavior if the totals don't match. 2024-05-02 23:14:05 -07:00
52a23209d7 Sysco can now import for a line item 2024-05-02 23:08:18 -07:00
c50b706de9 Script for deleting vendors 2024-05-02 21:35:03 -07:00
002c3d8688 Adds refresh button 2024-05-01 16:02:15 -07:00
e6a8f7dc78 other tweaks 2024-05-01 12:39:48 -07:00
f9900f5f71 changes 2024-05-01 08:29:05 -07:00
e3b17e50e2 Sales nearly ready 2024-04-30 22:38:21 -07:00
f6dba46835 home stretch 2024-04-29 23:05:33 -07:00
f25ddc2ee4 Sales summaries in slightly more detail 2024-04-29 22:44:09 -07:00
04ad2c9b68 minor tweak 2024-04-24 17:06:59 -07:00
7154d0ff21 Creates daily sales summaries 2024-04-24 16:15:30 -07:00
22e92c819b Adds new expense report, with ability to break down by vendor 2024-04-19 21:48:28 -07:00
58217158e3 Adds unknown processor to payments 2024-04-18 12:37:11 -07:00
Bryce
38030637ba should prevent bad error message from uploaded invoices. 2024-04-14 22:35:39 -07:00
72a17486cd Fixes bug with client page 2024-04-01 19:46:37 -07:00
3957286624 Adds gift cards to sales summaries 2024-04-01 16:06:34 -07:00
4c52dbc4d6 minor tweaks 2024-03-31 22:06:18 -07:00
ded5371e77 Makes simple sales summaries 2024-03-31 21:47:40 -07:00
d1a660c5c1 Adds rudimentary version of summarizing sales 2024-03-31 00:22:53 -07:00
a5e6b0549d Should make reloading AND aot work again 2024-02-08 15:20:58 -08:00
8c61d6571a Should fix builds 2024-02-07 22:28:22 -08:00
8063a8fcbd Builds client SSR approach, sunsets old cljs. 2024-02-07 21:22:56 -08:00
3211635dce removing old square 2023-11-01 10:02:57 -07:00
930b900849 Makes logging unified 2023-10-30 12:35:18 -07:00
Bryce
0f74b71cd1 minor error 2023-10-27 20:44:10 -07:00
Bryce
6c3017d1eb include more details when error happens importing 2023-10-27 20:37:42 -07:00
6059e8a4ca fixes historical load 2023-10-18 23:49:04 -07:00
2454695124 fixes glimpse 2023-09-14 12:59:32 -07:00
0d209829e8 reduces the number of duplicates that we try to import. 2023-09-08 07:15:28 -07:00