# AR-Reconciliation-Tool — VBA + Access Demo Sample

This is a **self-built demo sample**, created by our team to illustrate the legacy VBA +
MS Access architecture described in the Customer VBA System Transition MoM, and to
demonstrate TextIQ's ability to read VBA + Access source and generate a Detail Design
Document from it.

**This is not a real customer tool and is not sourced from any external open-source
project** — no open-source example of this exact architecture pattern exists, so we built
a small, representative one ourselves for the customer demo meeting.

## What it simulates

An "AR Reconciliation" tool matching branch transaction exports against bank statements —
one plausible example of the 8 tools the customer will operate.

```
Excel Input (Transactions_*.xlsx, BankStatement_*.xlsx)
        |
        v  (Import button)
Frontend.accdb  --- linked tables --->  Data_Backend.accdb  /  Data_Log.accdb
   (Forms + VBA)                          (raw data only, no UI/VBA)
        |
        v  (Export button)
Excel Output (ReconcileReport_<month>.xlsx)
```

## Contents

- `vba-source/` — VBA modules and class, as text (source of truth, version-controlled)
- `schema/` — Access table DDL + ER diagram
- `sample-data/` — fake Excel Input files with deliberate edge cases (duplicate ref,
  rounding variance, 1-day date shift, unmatched row)
- `forms-spec.md` — form/control layout spec: cross-checked by `build/validate_sources.py`
  against the VBA source, and used as the step-by-step guide for building the 3 forms by
  hand in Access (see `build/README-build.md` — `Build-AccessDemo.ps1` only builds the
  tables and imports the VBA; COM form automation proved unreliable, so forms are built
  manually)
- `build/` — `Build-AccessDemo.ps1` (Windows-only, requires MS Access) + build
  instructions + validator/generator scripts and their tests
- `generated-design-doc-sample.md` — **produced separately**, by running TextIQ's
  `textiq-explore-code` / `textiq-analyze-business` / `textiq-generate-docs` against
  `vba-source/` + `schema/` on the TextIQ side (see the design spec, Section 5, for the
  go/no-go checkpoint). Not generated by this repo's tooling.
- `demo-talk-track.md` — click-by-click script for the customer meeting

## Building it

Text/data source (`vba-source/`, `schema/`, `forms-spec.md`) is the source of truth.
The built `Data_Backend.accdb`, `Data_Log.accdb`, and `Frontend.accdb` (with the 3
manually-built forms) are also included in this branch, ready to open directly on a
Windows machine with MS Access installed — no build step needed to try the demo.
If you change any VBA/schema/forms-spec source, regenerate them by following
`build/README-build.md` and re-copy the resulting `.accdb` files here.

## Validating source consistency

Before building, or after changing any VBA/schema/forms-spec file, run:

```bash
python3 build/validate_sources.py
```

This checks that table names referenced in VBA match `schema/backend_schema.sql`, and
that every `Module.Proc` handler referenced in `forms-spec.md` actually exists in
`vba-source/`.

## Regenerating sample data

```bash
python3 build/generate_sample_data.py
```

Deterministic (fixed random seed) — regenerates the same 3 Excel Input files with the
same edge cases.
