# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

Visual FoxPro 9.0 desktop application for task/project management and software distribution tracking. The app manages work assignments (tasks/lucrări), client software versions, and generates ROA update XML files for client auto-update mechanisms. Backend is Oracle via ODBC. Language of code and comments is Romanian.

## Building & Running

There is no command-line build system. Compilation happens inside the Visual FoxPro 9.0 IDE:

- **Build executable:** Open `tasks.pjx` in VFP IDE → Project → Build Executable → produces `tasks.exe`
- **Run interactively:** `tasks.exe` (GUI mode)
- **Run silently with auto XML generation:** `tasks.exe "s" "xml_roa_auto"`

No test framework and no linter exist for this project.

## Configuration

`settings.ini` (at project root) is the primary configuration file. Key sections:

- `[connection]` — Oracle ODBC credentials for `CENTRAL`, `CONTAFIN_ORACLE`, `SOFT_SERII` schemas
- `[folder]` — Output paths for ROA XML, SQL scripts, and Contafin exports
- `[script]` — SQL script filename prefixes per module
- `[wrap]` — Executable wrapping/encryption settings

A template lives at `settings.ini.tmpl`.

## Architecture

### Entry Point & Initialization

`programe/main.prg` is the startup module. It sets global variables, loads class libraries, configures paths from `settings.ini`, establishes the Oracle connection (via `conecteaza()` in `programe/proceduri_sql.prg`), and opens the main menu/form.

Key globals set in `main.prg`: `gnHandle` (DB connection), `gcAppPath`, `gcDataPath`, `gcTempPath`, `gnIdUtilizator`, `gnIdClient`, `gnIdProgram`, `gcProgrameChangeLogsFile`.

### File Types

| Extension | Purpose |
|-----------|---------|
| `.prg` | Source procedures/functions |
| `.scx/.sct` | Form definition + code |
| `.vcx/.vct` | Class library definition + code |
| `.frx/.frt` | Report definition + code |
| `.mnx/.mnt/.mpr` | Menu definition |
| `.fxp` | Compiled program (auto-generated) |
| `.pjx/.pjt` | VFP project file |

### Core Modules

**`programe/proceduri_sql.prg`** — Database layer. `conecteaza(host, user, pass)` opens ODBC connection into `gnHandle`. `executaSql(cSql)` runs queries.

**`programe/oproceduri_comune.prg`** — Defines `oexecutor` class: the main SQL execution object with properties `nHandle`, `cSql`, `cCursor`, `nSucces`, `cEroare`, `lReconnect`. `oExecute()` runs queries and populates cursors, handles reconnection.

**`programe/proceduri.prg`** — Business logic: `EditTask()`, `EditLucrare()`, `genereaza_xml_roa()`, `genereaza_xml_roa_tot()`. The XML generation queries `VSC_PROGRAME_CLIENTI` and writes `ROASTART_<client>.xml` to the configured output folder.

**`programe/actualizare_roa.prg` / `clase/actualizareroa.vcx`** — ROA update generation workflow.

**`programe/generare_script.prg` / `clase/generare_script.vcx`** — SQL migration script generation.

**`clase/execute_script.vcx`** — Applies SQL scripts to target databases with progress tracking, logging, and rollback on error. Output goes to timestamped folders under `roa_central/`.

**`programe/rapoarte.prg`** — Report runner using `utile/foxypreviewer.app` for PDF/RTF/HTML output. Report templates are `.frx` files in `rapoarte/`.

### UI Layer

Forms are in `ferestre/` (`.scx` files). All inherit from `clase/_frm_base.vcx`. Grids inherit from `clase/_grd_base.vcx`. The main tasks form is `ferestre/frm_tasks.scx`.

### Data Flow

```
settings.ini → conecteaza() → gnHandle (Oracle ODBC)
                                    ↓
                     oexecutor.oExecute(cSql) → cursor
                                    ↓
              Business logic (proceduri.prg, *.vcx classes)
                                    ↓
         Forms (ferestre/*.scx) / Reports (rapoarte/*.frx) / XML output
```

### Version History

`changelog_tasks.txt` contains the full version history in Romanian. Current version: **1.1.14** (January 2021). `programe_changelogs.xml` tracks program-level change metadata for the ROA distribution system.
