> For the complete documentation index, see [llms.txt](https://shredded.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://shredded.gitbook.io/docs/paid-scripts/shr-bossmenu/config.md).

# CONFIG

## Config & Integrations

All settings in **`config.lua`**.

***

### Main options

```lua
Config.Locale = 'en'
Config.AdminGroups = { 'admin', 'superadmin' }
Config.AdminCommand = 'abossmenu'
Config.FinanceCooldown = 2000          -- ms between deposit/withdraw
Config.HireDistance = 5.0              -- meters for hire confirm

Config.BossGrades = { ['boss'] = true }  -- fallback grade_name check
Config.ExcludedJobs = { 'unemployed', 'unemployed2' }
```

***

### Duty

```lua
Config.Duty = {
    Mode = 'esx',           -- esx | esx_service | export | event | none
    Resource = 'esx_service',
    Export = nil,           -- for Mode = 'export'
    SyncInterval = 30000,   -- check duty state (ms)
    SaveInterval = 1        -- save to DB every N minutes
}
```

***

### Analytics

```lua
Config.Analytics = {
    KeepHistoryMonths = 12  -- auto-delete old logs
}
```

***

### Billing (automatic — default)

Paid society invoices are **synced automatically** from the `billing` DB table. No billing script edits or custom events required.

```lua
Config.Integrations = {
    Billing = {
        Enabled = true,
        Table = 'billing',        -- invoice table name
        PollInterval = 10000,     -- poll every 10 seconds
        TargetType = 'society'    -- target_type for society invoices
    }
}
```

**How it works:**

1. Every X ms the resource reads the `billing` table (society invoices).
2. When an invoice gets `paid_date`, or disappears (DeleteAfterPay), it is recorded in analytics.
3. Duplicates are tracked in `shr_bossmenu_billing_sync` — you do not fill this table manually.

**Requirements:**

* Your billing script writes to the standard ESX `billing` table
* `target_type = 'society'`, `target = 'society_police'` (or your society account name)
* A boss location exists for that job with the matching `society` name

That is all you need. **Skip the custom billing section below** if you use the standard `billing` table.

***

### Custom billing (non-standard billing script only)

Only if invoices are **not** stored in the `billing` table, or your script does not follow the standard schema. Edit the open file `server/integrations.lua`:

```lua
-- example: custom event from another billing script
AddEventHandler('your-billing:paid', function(society, amount, payerId, label)
    exports['shr_bossmenu']:RecordSocietyDeposit(society, amount, {
        payerIdentifier = payerId,
        label = label
    })
end)
```

Or call from another resource:

```lua
exports['shr_bossmenu']:RecordSocietyDeposit('society_police', 5000, {
    payerIdentifier = 'license:xxx',
    label = 'Invoice'
})
```

Set `Config.Integrations.Billing.Enabled = false` if you rely only on a custom hook and not DB sync.

***

### Database tables

`shr_bossmenu_locations` · `shr_bossmenu_grade_permissions` · `shr_bossmenu_activity` · `shr_bossmenu_monthly` · `shr_bossmenu_logs` · `shr_bossmenu_billing_sync`

Created by `sql/install.sql` + auto-migrate on start.
