# Solk Connector Agent

> A Windows program that reads the database of ETA, Zirve, Akınsoft Wolvox and other desktop systems on SQL Server / Firebird and sends accounts, balances, invoices, products and stock to Solk — setup, commands, table discovery, your own queries, security.

Desktop accounting programs have no service open to the internet; the data lives in a database on a computer in your company. The **Solk Connector Agent** (`SolkAjan.exe`) runs on a Windows computer that can reach that database, **only reads** it and sends the data through the [Solk ERP API](/guides/erp#api). It never writes to the program: only `SELECT` runs, SQL Server is read without taking locks (*READ UNCOMMITTED*), Firebird is read in a read-only transaction.

| Program | Database | Tables tried first |
|---|---|---|
| **ETA** (ETA:SQL · ETA:V8) | SQL Server | `CARKART` · `CARHAR` · `FATFIS` · `STKKART` |
| **Zirve** | SQL Server | `CARI` · `CARI_HAREKET` · `FATURA` · `STOK` |
| **Akınsoft Wolvox** | Firebird (`WOLVOX.FDB`) | `CARI` · `CARIHR` · `FATURA` · `STOK` (linked by `BLKODU`) |
| Other | SQL Server or Firebird | table discovery or [your own queries](#queries) |

:::warning
The connection is **beta**. Table and column names can differ between versions; the agent [discovers](#discovery) them first and the `dene` command shows what it found. Check the output on first setup and, if needed, write to [Solk support](/guides/support) with the output of `SolkAjan.exe tablolar`.
:::

## Setup {#setup}

:::steps
### Create the connection
Under **Settings → Accounting and ERP → Add connection** choose **ETA**, **Zirve** or **Akınsoft Wolvox** → **Prepare the connection and agent file**. On the page that opens, **download solk_ajan.json** — the file contains the connection's API key and can be downloaded **only then** (if lost: **New key and file**).

### Download the agent
Download [SolkAjan.zip](https://solk.app/indir/SolkAjan.zip) to a Windows 10 / 11 or Windows Server computer that can reach the database and extract it (e.g. `C:\SolkAjan`). Put `solk_ajan.json` next to `SolkAjan.exe`.

### Enter the database
The `db` section of `solk_ajan.json`:
- **ETA / Zirve:** `server` = the SQL Server instance (e.g. `SERVER\ETA`), `database` = the company database. With Windows sign-in `"trusted": true`; with a SQL user `user` / `password` and `"trusted": false`. If the computer has no SQL Server ODBC driver, install Microsoft's *ODBC Driver 18 for SQL Server*.
- **Akınsoft Wolvox:** `database` = the path of `WOLVOX.FDB`, `user` / `password` = the Firebird user. If the database is on another computer, `server` = that computer's name; if `fbclient.dll` isn't in the standard place, put its path in `fbclient`.

### Try it
`SolkAjan.exe dene` — tests the Solk connection and the database and shows, for each list, the table found, the query built and sample records. Nothing is sent.

### Send and schedule
`SolkAjan.exe calis` sends now; `SolkAjan.exe kur` adds a Windows Task Scheduler task that runs every 30 minutes (change with `--dakika 15`). With Windows sign-in the task only runs while the user is signed in; for always-on, use a SQL user and `kur --sistem`.
:::

After a run, **Last data** on the connection page updates, accounts go to [matching](/guides/erp#matching), and balances and invoices appear on the company card.

## Commands {#commands}

| Command | What it does |
|---|---|
| `dene` | Solk + database connection, tables found, queries, sample records (nothing sent) |
| `tablolar [name]` | Lists tables; with a name, all columns of the matching tables |
| `calis [--kuru]` | Reads and sends (`--kuru`: reads and counts, doesn't send) |
| `kur [--dakika N] [--sistem]` | Adds the scheduled task |
| `kaldir` | Removes the scheduled task |
| `surum` | Version |

Every run is written to `solk_ajan.log`; two runs never overlap.

## Discovery {#discovery}

For each list the agent picks the table that carries the needed columns — table names known for the program are tried first, backup / archive tables are ranked down:

| List | Needed | Optional |
|---|---|---|
| Accounts | account code, title | tax no / office, city, phone, email, currency, balance, credit limit |
| Balances | account (code or link), debit, credit in account movements | — (balance = debit − credit) |
| Invoices | invoice no, account, date, amount | due date, net, remaining, currency, type — last `invoice_days` days (default 365) |
| Products | item code, name | unit, sales price, currency |
| Stock | item code (or link), quantity | warehouse |

Column names are recognised in Turkish or the program's own names (*CARIKODU*, *TICARI_UNVANI*, *CARKOD*, *FATFISGENTOPLAM*, *STOK_ADI* …). Where records link by number (`BLKODU`), as in Wolvox, the agent fetches account and item codes with a join.

## Your own queries {#queries}

If discovery picks the wrong table, force it:

```json
"tablolar": {"customers": "CARI", "invoices": "FATURA", "stock": "STOK_DEPO"}
```

Or write the query yourself — column aliases (`AS`) are Solk fields; in invoices `?` is the start date:

```json
"sorgular": {
  "customers": "SELECT CARIKODU AS code, TICARI_UNVANI AS name, VERGI_NUMARASI AS tax_no, ILI AS city FROM CARI",
  "balances":  "SELECT c.CARIKODU AS code, SUM(h.BORC) - SUM(h.ALACAK) AS balance FROM CARIHR h JOIN CARI c ON c.BLKODU = h.BLCRKODU GROUP BY c.CARIKODU",
  "invoices":  "SELECT f.FATURA_NO AS no, c.CARIKODU AS customer, f.TARIHI AS date, f.GENEL_TOPLAM AS total FROM FATURA f JOIN CARI c ON c.BLKODU = f.BLCRKODU WHERE f.TARIHI >= ?",
  "stock":     "SELECT s.STOKKODU AS code, d.DEPO_ADI AS wh, d.MIKTARI AS qty FROM STOK_DEPO d JOIN STOK s ON s.BLKODU = d.BLSTKODU"
}
```

For sales invoices only, add a condition to the discovered query: `"filtreler": {"invoices": "FATURA_TURU = 'SATIS'"}`. Turn a list off with `"sets": {"stock": false}`. A query may only be a single `SELECT`; queries with write or execute statements are not run.

| List | Solk fields (* required) |
|---|---|
| customers | `code`*, `name`*, `tax_no`, `tax_office`, `city`, `phone`, `email`, `currency`, `balance`, `credit_limit` |
| balances | `code`*, `balance` (positive = the customer owes) |
| invoices | `no`*, `customer`* (account code), `date`*, `total`*, `due`, `net`, `remaining`, `currency`, `kind`, `ext_id` |
| products | `code`*, `name`*, `unit`, `price`, `currency` |
| stock | `code`*, `qty`*, `wh` (one warehouse per row) |

## Security {#security}

- `solk_ajan.json` contains the API key; keep it only on the computer running the agent. If it leaks, **New key and file** on the connection page — the old key stops working immediately.
- The key can only send data to this connection; it can't access anything else in Solk.
- A read-only database user is enough (`db_datareader` on SQL Server).
- The agent only connects out to your Solk address (HTTPS 443); the database is never exposed to the internet.