The five record types
Every row starts with its record tag. The composite key (entity · transaction · store · terminal) repeats on every row; T and D point back to their S line, P is sequential.
Batch & SKU logic
How one Cegid line becomes one or several exported lines, and how every amount is prorated across them. Worked examples with figures.
One receipt, end to end
Selection & scope
| Condition | Why |
|---|
Sign conventions
Cegid stores sale quantities positive and returns negative; D365 expects the opposite on sales lines. Amounts and quantities are flipped uniformly; unit price stays positive.
Lookups & codes
All crosswalks resolve through store free-fields and extended code tables — no hard-coded values in the query body, so new stores and entities onboard through reference data.
| Purpose | Cegid source | Resolves to |
|---|
Cegid tables used
Standard Y2 tables plus custom tables for QR-to-batch resolution.
| Table | Prefix | Role | Origin |
|---|
SQL generator
Builds the five-branch UNION ALL statement from the field list above — one branch per record type, every branch emitting the same ordered column list with '' wherever a column does not apply. Edit a field above and regenerate: the SQL follows the contract.
Press “Generate SQL”.
COUNT(DISTINCT …) because window functions are banned, and it is repeated identically in the S, T and D branches. Run it against a real dossier and reconcile row counts before shipping.File validation
Load the file Cegid produced and check it against this contract — column alignment, fixed constants, sign conventions, cardinality, consolidation and header control totals. Nothing leaves the browser.
AI analysis
Sends the contract, the loaded export file, and any project files you attach to the Claude API, and streams the answer back. Your key is used from this page only.
sessionStorage, cleared when the tab closes, and is never written into content.json or the exported HTML. It is sent to api.anthropic.com from the page, so use a key scoped to a workspace you're willing to spend from — anyone who can open this tab can spend it. If the request is blocked by CORS, put a small server-side proxy in front instead of pasting the key here.Paste a key, pick a preset or type a question, then Run.