# Project plan — superbowl_daily (Superbowl Daily)

Evidence date: 2026-10-02.

Source repository: `git@bitbucket.org:overdrive/superbowl_daily.git`.

Inspected revision: `main` at `1ba6c4a` (2026-08-04, "Add error logging functionality and handle unhandled exceptions", author Renier van Rooyen).

This plan describes what the repository contains. It does not decide what the product should become.

## Product

The solution file is `Superbowl Daily/Superbowl Daily.sln`. The Windows Forms title is **Superbowl Daily Update v1.31**. Assembly title and product are `Superbowl Daily`. Assembly company is `Silicon Overdrive`. Assembly copyright is `Copyright © Silicon Overdrive 2009`. Assembly version and file version are `1.4.0.0`. ClickOnce application version in the project file is `1.31.0.*`. Publisher name is `Silicon`.

Provenance: **Implemented** in `AssemblyInfo.vb`, `Main.Designer.vb`, and `Superbowl Daily.vbproj`.

The in-file changelog at the top of `Main.vb` continues through `v1.34 - 20260624 - cognos09 liquor license import`. The form caption still says v1.31. Those version strings disagree. Which string operators treat as the live product version is **Unknown / Requires Confirmation**.

The application is a desktop batch for the RGBC Superbowl SQL Server database. It copies Cognos and related files from UNC shares (or reads files already in a local `Imports` folder), loads them into staging and warehouse tables, recalculates stock-control product periods, writes BFBE tab-delimited exports, and emails an HTML import log.

There is no login screen. Whoever can start the executable and reach the configured SQL Server and file shares can run the batch. The audit user written into SQL is the setting `UNAME`, default `Daily Update`.

A separate repository, `superbowl_daily_2`, is documented under `silicon_ark/superbowl_daily_2/`. This repository does not mention that product. Whether `superbowl_daily` is still the production daily job, a predecessor, or a parallel tool is **Unknown / Requires Confirmation**.

## Branch reality

Default branch is `main`. `origin/HEAD` points at `main`. No other remote branches were present at inspection.

Git history in this clone is 4 commits:

| Commit | Date | Author | Subject |
|---|---|---|---|
| `069210c` | 2024-11-27 | Abdurahmaan Ismail | Initial commit (`.gitignore` only) |
| `32f0ac4` | 2026-06-30 | Renier van Rooyen | Initial code commit |
| `2a4fdbe` | 2026-07-01 | Renier van Rooyen | Liquor License added to cognos9 import |
| `1ba6c4a` | 2026-08-04 | Renier van Rooyen | Add error logging functionality and handle unhandled exceptions |

The in-file changelog starts at `v1.10 - 20090406`. Those earlier dates are **Documented** in source comments. They are not commits in this Git history.

The onboarding snapshot captured on 2026-09-28 described only `sonar-project.properties` and `sonarqube_scan.bat`, and named `069210c` as the last commit. At inspection, `origin/main` is `1ba6c4a` and those Sonar files are not in the Git tree. The snapshot does not match the repository that was inspected.

## Scope in the repository

In scope of what is present on `main`:

- One VB.NET Windows Forms project, `Superbowl Daily`, target framework .NET Framework 4.8, platform target x86 (`Superbowl Daily.vbproj`). `app.config` `supportedRuntime` sku is `.NETFramework,Version=v4.8`.
- A fixed import list (`gFile` / `gType` in `frmMain`) covering Cognos customer, sales, stock movement, daily stock, SALBA, export sales, AdCheck, AdSpend, and eSales Charter files.
- Copy or move of the first four Cognos files and `AdSpend.xls` from `\\Hennessy\Sales\...` into `Imports\`.
- Post-processing into `dwdCustomer`, `dwfSales`, `stkProductPeriod`, `mstExports`, and `stgZMB` movement buckets.
- Stock-control balance recalculation (`updatePPBalance`).
- BFBE customer and invoice exports from `sysQuery` rows named `bfbe-Sales_Month_to_Date` and `bfbe-Customer_Master`.
- HTML email of rows in `dlyImportLog` where `blnEmail = 1`.
- Append-only daily error files under `Logs\error_yyyyMMdd.log` (`ErrorLogger.vb`).
- One SQL script, `scripts/alter_mstCustomer_strLiquorLicense.sql`. The application does not run it.
- Visual Studio 11 build-process XAML under `BuildProcessTemplates/`. No pipeline definition was found in the tree.
- A solution binding to Team Foundation Server `http://tfs01:8080/tfs/vs_projects_2018`.

Out of scope of the path that `Run()` executes today, or present only as UI, comments, or unused methods:

- Mint / eSales Charter file copy from `\\Hennessy\Sales\eSalesCharter\`. The copy is gated with `And False` (changelog v1.27, 2013-12-09). The insert code remains if a file is already in `Imports\`.
- `ProduceSalesCharterQueries`. The call inside `Run()` is commented out (v1.27). The **SCQ** button still calls it.
- `MailBrandon`. The call inside `Run()` is commented out. The **Mondayly** button still calls `bfbeExports` and then `MailBrandon`.
- **Fix SAP FUCKUP**. The click handler body is entirely commented out.
- **Test**. It opens the Customer Segmentation file into a dataset and does not process rows. The period-seed block below it is commented out.
- Snell area and Snell supergroup post-checks. The SQL is commented out inside the Customer post-process.
- SonarQube files named in the onboarding snapshot. They are not in the Git tree at `1ba6c4a`.
- Automated tests. None were found.

## System architecture

```text
UNC shares on Hennessy
  \\Hennessy\Sales\snell\reports\rgbc\     cognos09/14/12, zmb59-daily
  \\Hennessy\Sales\ftp.bmi\                AdSpend.xls (Move)
        |
        v
Local Imports\  --OleDb text/Excel-->  SQL Server catalog Superbowl
        |                                      |
        |                                      +-- mst* / dwd* / dwf* / stg* / stk*
        |                                      +-- sysQuery (SQL text, not in this repo)
        |                                      +-- dlyImportLog
        v
Local Imported\   (Move in Release, Copy in DEBUG)
Local BFBE\       tab-delimited ZA_*_INVW.txt and ZA_*_CUST.txt
Local Output\     Sales Charter CSVs, then copy to \\Hennessy\Sales\eSalesCharter\NewFiles\
Local Logs\       error_yyyyMMdd.log
SMTP              import log and optional BFBE mail
```

`Run()` order:

1. Seed up to six future `mstPeriod` rows when the latest period is fewer than 24 months ahead of the current `yyyyMM`, using `mstCompany` where `strCompany = 'RGBC'`.
2. Insert a `dlyDataWarehouse` customer and product count.
3. Copy or move source files.
4. Resolve a `SALBA_*` file name in `Imports\`.
5. Import each file that exists.
6. Post-process Customer, Sales, ZMB, and Exports.
7. Recalculate `stkProductPeriod` from the earliest period present in `stgCognos14` or `stgZMB`.
8. Email the import log.
9. Run BFBE exports (monthly variant when the day of month is 1).
10. In a non-DEBUG build, close the form.

## Major components

| Component | Role | Evidence |
|---|---|---|
| `frmMain` | Form, batch orchestration, file IO, mail | `Main.vb`, `Main.Designer.vb` |
| `sqlDB_Daily` | Connection used by the batch, staging inserts, customer daily update, export SQL | `sqlDB_daily.vb` |
| `sqlDB_Superbowl` | Customer insert and warehouse customer SQL, plus a large unused master-data SQL surface | `sqlDB_superbowl.vb` |
| `sqlDB_StockControl` | Product-period insert and import update used by sales and ZMB post-processing | `sqlDB_stockcontrol.vb` |
| `Duodecimal` | Year-month period arithmetic | `Duodecimal.vb` |
| `ErrorLogger` | File log that must not throw | `ErrorLogger.vb` |
| `MyApplication` | Unhandled-exception hook | `ApplicationEvents.vb` |
| `scripts/alter_mstCustomer_strLiquorLicense.sql` | Manual column add for `strLiquorLicense` | SQL file comment |

`sqlDB_Superbowl` and `sqlDB_StockControl` contain many `sql_get_*` / `sql_insert_*` methods for brands, products, reps, users, and channels. A search of `Main.vb` shows the batch calls customer insert/update, stock-control product-period helpers, and daily staging inserts. The rest of that SQL surface has no caller in this repository. Provenance: **Implemented** as methods, **Unknown** whether another application was expected to call them.

## Milestones visible in the repository

| When | What | Provenance |
|---|---|---|
| 2009-04-06 onward | Changelog inside `Main.vb` from v1.10 through v1.33 (server rename Benriach to Hennessy, 2024-11-27) | Documented in comments. Not Git commits. |
| 2024-11-27 | Git repository created with `.gitignore` only | Implemented (`069210c`) |
| 2026-06-24 | Changelog line v1.34 liquor licence | Documented in comments |
| 2026-06-30 | Application source committed | Implemented (`32f0ac4`) |
| 2026-07-01 | Liquor licence column on Cognos 9 customer import | Implemented (`2a4fdbe`) |
| 2026-08-04 | `ErrorLogger`, unhandled-exception logging, more `Try` around `Run()` | Implemented (`1ba6c4a`) |

No roadmap, issue tracker, or milestone document is in the repository. Future work is **Unknown / Requires Confirmation**.

## Known dependencies

- .NET Framework 4.8, x86.
- SQL Server database `Superbowl` (catalog name in both connection strings).
- Microsoft Jet OLEDB 4.0 for text and Excel imports (`ConnectTxt`, `ConnectExcel`).
- UNC host `Hennessy` for Cognos, AdSpend, and Sales Charter output.
- SMTP host setting `tullamore.rgbc.local` for non-DEBUG builds. DEBUG builds use `smtp.office365.com:587`.
- `sysQuery` rows by ID (5, 8, 9, 10, 11, 12, 13, 14, 15, 16, 31) and by name (`bfbe-Sales_Month_to_Date`, `bfbe-Customer_Master`). The SQL text is not in this repository.
- Windows user who can read the shares and, for the release connection, use integrated security.

## Current project status

**Implemented** and committed on `main` through 2026-08-04. The committed user setting `blnDebug` is `True`, so a machine using the committed defaults does not auto-start `Run()` on load. Whether production overrides that setting is **Unknown / Requires Confirmation**.

Release connection defaults disagree between files:

- `My Project/Settings.settings` release data source is `Benriach`.
- `app.config` release data source is `Hennessy`.
- File-copy paths in `Main.vb` use `Hennessy` (changelog v1.33).

Which connection string a deployed executable uses is **Unknown / Requires Confirmation**.

Build outputs (`bin\`, `obj\`), Visual Studio user files (`.vs\`, `.suo`), a sample `cognos14.txt`, `xAdSpend.xls`, and `Superbowl Daily_TemporaryKey.pfx` are committed. There is no CI definition in the tree.

## Human confirmation

- Whether this batch is still the production daily job, given `superbowl_daily_2`.
- Which version label is current (form v1.31, changelog v1.34, assembly 1.4.0.0).
- Production values of `blnDebug`, SQL server, SMTP, and email recipients.
- Whether `scripts/alter_mstCustomer_strLiquorLicense.sql` and the `sysQuery` ID 8 and 31 updates named in that script have been applied.
- Whether the Sonar files from the 2026-09-28 scan exist only on a scan host and were never committed.
