# Project plan — superbowl_cronjob

Evidence date: 2026-10-02.

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

Inspected revision: `master` at `986893e` (2026-09-11, Abdurahmaan Ismail, "Merged in feature/fsr-delivery-block-z5 (pull request #4)"). The scan-host path `~/projects/sonar_scan/repos/superbowl_cronjob` was not on this machine. The tree was read from that git revision. Credential values are omitted.

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

## Product

The repository is a VB.NET Windows Forms executable named **Superbowl Cronjob** (`Superbowl Cronjob/Superbowl Cronjob.vbproj`, assembly `Superbowl Cronjob`, namespace `Superbowl_Cronjob`). It is a batch worker for the RGBC Superbowl SQL Server database. On each launch it runs a fixed pre-process (Repsly import, free-stock promotion, Edward Snell SOAP export, vendor reminders), then drains rows in `sysCronJob` whose status is `New`.

There is no README and no product requirements document in the source repository or in Silicon Ark before this set. Version notes live as dated comments at the top of `Superbowl Cronjob/Superbowl Cronjob/frmCronjob.vb`, from `v1.0.1` through comments dated 2024-11-27.

The Superbowl web application that inserts `sysCronJob` rows is not in this repository. Provenance: **Inferred** from job comments such as "moved existing process from Superbowl Web Product Archive" on `ArchiveProduct`.

## Branch reality

| Line | Tip | Date | What it is |
|---|---|---|---|
| `master` (default; `origin/HEAD`) | `986893e` | 2026-09-11 | 28 commits, 2021-02-10 to 2026-09-11 |
| `origin/VendorApplication` | `f520ceb` | 2023-01-11 | "Repo consolidation". Already merged into `master` (`662e5e4`, 2023-05-29) |
| `origin/feature/fsr-delivery-block-z5` | `bb5b170` | 2026-09-11 | Merged by pull request #4 (`986893e`) |

**Discrepancy:** the onboarding scan recorded the local checkout at `ce672a6` (2023-05-29, "Change of notification on Vendor App") and listed `sonar-project.properties` and `sonarqube_scan.bat` at the repository root. `ce672a6` is an ancestor of current `master`. Those two Sonar files are not in git history on any branch. Provenance: **Unknown** — they may have been untracked files on the scan host. `BuildProcessTemplates/` is in git.

History falls into two stretches:

- 2021-02-10 to 2023-05-29 — Lloyd, then RDvanRooyen and Dirk: vendor-app jobs, resend mail, vendor report, a reverted call-cycle change, and the vendor-notification commit `ce672a6`.
- 2026-03-04 to 2026-09-11 — maanie (`Abdurahmaan Ismail` on the merge commit): Repsly purchase-order import, Edward Snell IDOC/SOAP, Repsly free-stock promotion, RGBC free-stock SAP export, and the delivery-block `Lifsk` `Z5` fix.

## Objectives (inferred from the implementation, not from a written plan)

- Drain the Superbowl `sysCronJob` queue: emails, PDFs, Sage CSV exports, brand quantity-forecast generation, and product-code archive.
- Pull Repsly purchase orders into SQL and send non-FSR orders to Edward Snell.
- Turn Repsly documents whose type is `FSR` into Superbowl free-stock requisitions and notify approvers.
- Send manager-approved free-stock requisitions to Edward Snell when the SAP export gate is on.
- Chase free-stock, purchase-order, and vendor records that stay `Pending` past a day threshold, inside a noon window.

## Scope

### In scope of `master`

1. Windows Forms host `frmCronjob` (`.NET Framework 4.8`, output type `WinExe`).
2. Queue handlers in `frmCronjob.Run` for the job types listed in `features.md`.
3. Pre-process classes `RepslyOrder_AM_Process`, `RepslyFSR_AM_Process`, `RepslyOrder_ESnell_Process`, and `FsrOrder_ESnell_Process`.
4. Shared helpers under `Superbowl Cronjob/Superbowl Cronjob/App_code/VB/` (`db` access is `db.generic.vb` / `db.cls.vb`).
5. SQL scripts under `Superbowl Cronjob/Superbowl Cronjob/Scripts/` for Repsly tables and free-stock SAP columns. Whether they have been applied to the database is **Unknown / Requires Confirmation**.
6. Typed DataSets, the `vendorDone.rdlc` report, and ReportViewer packages used to render PDFs.
7. An implementation plan checked into `.cursor/plans/repsly_order_integration_faa35b01.plan.md`. Its phase-1 and phase-2 test items are still `pending`. Later commits added free-stock SAP export, which that plan does not describe.
8. Legacy Team Foundation Server 11 build XAML under `BuildProcessTemplates/`. No `bitbucket-pipelines.yml` and no test project are in git.

### Out of scope / not in this repository

- The Superbowl website, its login, and the screens that approve requisitions or insert `sysCronJob` rows.
- The Repsly product, the Edward Snell / SAP system, Sage, and the SMTP server.
- A scheduler definition (Windows Task Scheduler, service, or cron). The form runs once and closes when `My.Settings.Debug` is false. How production starts the executable is **Unknown / Requires Confirmation**.
- Automated tests.

### Present in source, not on the current run path

- `FreeStockRequisition_AM_Process` (CSV import from an ADM share). No caller instantiates it.
- `PurchaseOrderRequisition_AM_Process`. The only construction site in `PreProcess` is commented out.

Provenance: **Implemented** classes, **not invoked** by `frmCronjob_Load` / `Run` / `PreProcess` at `986893e`.

## System architecture

```text
External scheduler (not in this repo)  OR  operator clicks Run when Debug is true
        |
        v
frmCronjob  (VB.NET WinForms, .NET Framework 4.8)
        |
        |-- PreProcess, every run
        |     1. Repsly API  -->  repslyOrder / repslyOrderItem / repslyImportRun
        |     2. FSR rows    -->  fsrRequisition / fsrItem + sysCronJob FSR_NewRequisition
        |     3. non-FSR rows --> Edward Snell SOAP (IDOC), mark blnSentToESnell
        |     4. Approved FSR --> Edward Snell SOAP, only if FsrSapExportEnabled
        |     5. noon window --> pending FSR / POR / vendor reminder mail
        |
        |-- sysCronJob where Status = 'New'
              BrandQF, ArchiveProduct,
              FSR_*, POR_*, vendor jobs
              |
              +--> SQL Server catalog Superbowl
              +--> SMTP
              +--> PDF under the exe Reports\PDF folder
              +--> CSV onto the Sage PO-Adinga share (approved PO and receipt jobs)
```

Release file shares, from the `#Else` block in `frmCronjob_Load` (comment dated 2024-11-27: Benriach renamed to Hennessy, Wixworth renamed to Ruinart):

| Role | Release path |
|---|---|
| ADM download | `\\Hennessy\Sales\ADM\` |
| POR documents | `\\Ruinart\documents\` |
| Sage PO export | `\\Hennessy\Sage\Afw\PO-Adinga\` |

The release SQL setting still names server `Benriach`, catalog `Superbowl`, integrated security. Provenance: **Implemented** in `app.config`. Whether `Benriach` is still the live SQL host is **Unknown / Requires Confirmation**.

## Major components

| Component | Role |
|---|---|
| `frmCronjob` | Load, pre-process, queue loop, mail, PDF |
| `db` | SQL connection chosen by `#If DEBUG` |
| `RepslyApiClient` | HTTP Basic GET of `/export/purchaseorders/{lastDocumentId}` |
| `IdocGenerator` | SOAP 1.2 body for Edward Snell `ZRfcEdiIdocInputOrders` |
| `QFGen` | Brand quantity-forecast (`BrandQF` jobs) |
| `Export_Process` | CSV export of approved POs and receipts |
| `sysQuery` | HTML mail bodies stored in the database, selected by numeric `ID` |

## Milestones visible in git

| When | What landed |
|---|---|
| 2010–2015 (comments only; predates this git history) | Quantity forecast, `ArchiveProduct`, free-stock email and PDF |
| 2017–2019 (comments) | Purchase-order requisition mail, Sage CSV, routing by user-group limits |
| 2021-02 to 2023-05 | Vendor application jobs and notification changes, first commits in this repo |
| 2026-03-04 to 2026-04-01 | Repsly order pull and Edward Snell order post (`Augru` 279) |
| 2026-04-17 to 2026-04-22 | Repsly free-stock promotion into `fsrRequisition` |
| 2026-07-14 to 2026-09-11 | Approved free-stock SAP export (`Augru` 285) and delivery block `Z5` |

## Implementation plan

There is no forward roadmap in the repository. The checked-in Repsly plan marks "Test Phase 1 with Repsly Live" and "Test Phase 2 with ESnell QA endpoint" as `pending`. The committed `ESnellSoapEndpoint` host is `ediqa.esnell.co.za`. `FsrSapExportEnabled` is `False`, and `Scripts/AlterFsrRequisition_SapColumns.sql` says to leave it false until Edward Snell confirms order reason 285 in SAP QA.

## Known dependencies

- SQL Server database `Superbowl` (tables written by this exe and by the Superbowl web app).
- Repsly API v3 (`https://api.repsly.com/v3` in committed settings).
- Edward Snell SOAP RFC `zso_idoc_input` (committed URL is the QA host).
- SMTP: release uses `My.Settings.SMTPHost` (`10.0.0.2` in committed settings). Debug builds use Office 365 on port 587. The debug mailbox password is hardcoded. Value omitted.
- UNC shares Hennessy and Ruinart for release file I/O.
- NuGet: Report Viewer 11 / 2015 runtime, ReportViewer control 150.900.148, `Microsoft.SqlServer.Types` 14.0.314.76. Packages are committed under `Superbowl Cronjob/packages/`.
- .NET Framework 4.8 on Windows.

## Current project status

`master` builds as a desktop executable that is meant to be launched, run once, and exit when `Debug` is false. The committed application setting `Debug` is `True`, so a build that uses the committed config shows the form and waits for the Run button. Provenance: **Implemented**. Whether the deployed config overrides `Debug` is **Unknown / Requires Confirmation**.

Free-stock SAP export code is on `master` and is switched off by `FsrSapExportEnabled`.

No Silicon Ark documents existed for this project before this set.
