Commit Graph

26 Commits

Author SHA1 Message Date
e6507d5387 merged 2026-08-04 22:15:59 -07:00
5126f3799d data(sysco): apply client category verification sheet to line-item mapping
Recategorizes 131 Sysco line-item descriptions per the client-reviewed
"Product Category Verification with codes" sheet: 96 existing rows re-coded
and 35 new rows appended (ids 1796-1830).

Root cause this addresses: get-line-account matches on exact description
string and silently defaults anything unmapped to 50000 Food Costs. Only 147
of the sheet's 321 reviewed rows coded the way the client expected. Note the
sheet's "change" column understates the work -- 20 of its 53 change rows are
no-ops (Paper -> Paper, confirming the gloves/liners/hairnets) and 3 were
already fixed in 38575aa5 / 7a0e256f, while 214,398 lines of movement come
from rows the client ticked as correct against a suggestion that already
differed from production.

Moves, replayed over all 1,022,732 DET lines in sysco-poller:

  50000 -> 51500 Dry Goods            90,481 ln   $5,215,011.82  105 clients
  50000 -> 51450 Dressing & Sauce     58,191 ln   $4,445,726.56   98
  50000 -> 51400 Bread and Bun        37,705 ln   $3,964,462.24   96
  50000 -> 52000 Soft Beverage        36,244 ln   $1,033,497.52   94
  50000 -> 51200 Produce               6,519 ln     $460,629.32   98
  55000 -> 51500 Dry Goods             6,516 ln     $259,750.60   97
  50000 -> 74100 Cleaning Supplies     5,630 ln     $205,233.19   98
  55000 -> 74100 Cleaning Supplies     5,222 ln     $125,946.32   99
  50000 -> 51120 Chicken/Poultry         265 ln      $42,482.50    8
  50000 -> 51300 Dairy                    36 ln       $5,941.69    6
  50000 -> 55000 Paperware                54 ln       $1,751.22   18
  54400 -> 51450 Dressing & Sauce         24 ln       $1,413.26    1
  total                               246,887 ln  $15,761,846.24

Only three source accounts are touched: 50000 and 55000 (the two silent
defaults) plus the single intended 54400 -> 51450 vinaigrette row. Nothing
else leaves a deliberately assigned account.

The 7 Misc Charges descriptions are deliberately left alone per Bryce,
including PICKLE CHIP KOSH 1/4 KK, which therefore stays at the 50000
default rather than moving to Produce as the sheet originally suggested.

Also corrects the PAPER & DISP fallback comment in sysco.clj: 440 of its 455
mapped descriptions point at 55000, not all 454. The 15 exceptions (foil
pans -> 51500, scour pads -> 74100) are mapped explicitly, so the
description map still wins ahead of the fallback. No logic changed.

Affects only clients with the code-sysco-items feature flag, and only at
import time -- already-imported invoices keep their existing splits.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-04 22:00:57 -07:00
7a0e256f07 fix(sysco): fall back to PAPER & DISP category when description is unmapped
The Sysco importer codes each line item by exact description match against
resources/sysco_line_item_mapping.csv, silently defaulting to GL 50000 (Food
Costs) when the description is absent. Every new or renamed Sysco SKU
therefore leaks into Food Costs until someone hand-patches the CSV, which is
what 38575aa5 did for 34 descriptions.

Add a category-level fallback consulted after the description map and before
the 50000 default, enabled for PAPER & DISP only. The description mapping
still wins wherever it exists, so nothing already mapped changes.

PAPER & DISP is safe to generalize: all 454 mapped PAPER & DISP rows point at
55000, with no exceptions. Of the 852 distinct descriptions ever invoiced
under that category, only 3 resolved elsewhere, each because a row with a
different category shared the description and won the later-wins (into {}).
One of those, DESSERT CUP, was simply mis-categorized -- it is paper, and its
own lid (id 1782 LID DOME DESSERT CUP) was already 55000 -- so correct id 1772
to PAPER & DISP / 55000. The remaining two stay at 50000 on purpose, since
they are not paper: PAD SCRUB S-S 35 GRAM 1.25 OZ (SUPP & EQUIP) and TEST
STRIP SANITIZER QUAT (CHEMICAL/JANTRL).

Verified by replaying both changes over all 1,022,732 DET lines in the 56,010
CSVs under sysco-poller/: every resulting transition is 50000 -> 55000 (10,994
lines, $728,106.62). No line that already resolved to a non-default account
moved.

Note this only affects clients carrying the code-sysco-items feature flag, and
only on import -- already-imported invoices need a separate recode.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-31 07:43:58 -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
ca5d90b17f investigate progress. 2024-10-14 23:21:48 -07:00
2d6985f5ca adds extra sysco logging 2024-08-14 23:15:20 -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
Bryce
38030637ba should prevent bad error message from uploaded invoices. 2024-04-14 22:35:39 -07:00
930b900849 Makes logging unified 2023-10-30 12:35:18 -07:00
Bryce
1444a661d8 fixes sysco import. 2023-05-30 13:52:08 -07:00
Bryce
d6b3048ff0 Makes imports more resilient 2023-05-24 08:45:26 -07:00
Bryce
74385a18f0 minor typo 2023-05-23 08:45:50 -07:00
b2ad7790cf Migrates back to datomic on-prem 2023-04-29 07:12:51 -07:00
6622aae589 no need for transact-with-ledger. 2023-04-03 09:04:33 -07:00
6a0f593606 (cloud) minor fix 2023-03-24 11:02:17 -07:00
142d9474ae (cloud) Made invoice proposition a usable ion 2023-03-24 11:02:17 -07:00
d02fba2b44 Makes integreat run on datomic cloud 2023-03-24 10:56:28 -07:00
d6d1dfaf22 sysco fix 2022-09-28 09:05:46 -07:00
63254ba401 no need for ledger automation. 2022-09-27 17:04:47 -07:00
ed759bac31 More background task cleanup 2022-09-23 12:09:39 -07:00