# Configuration

Configuration — moh-billing

All settings live in `config.lua`. You should never need to edit any\
other file for basic setup.

### Framework

| Key                   | Type   | Default                 | Description                                                                 |
| --------------------- | ------ | ----------------------- | --------------------------------------------------------------------------- |
| `Config.Framework`    | string | `'qbcore'`              | Which framework to use. Accepted values: `'qbcore'`,`'esx'`.                |
| `Config.QBCoreExport` | string | `'qb-core'`             | Export name of the QBCore resource. Only used when Framework is `'qbcore'`. |
| `Config.ESXEvent`     | string | `'esx:getSharedObject'` | Shared-object event name for ESX. Only used when Framework is `'esx'`.      |

### Database

| Key                      | Default              | Description                                                     |
| ------------------------ | -------------------- | --------------------------------------------------------------- |
| `Config.BillingTable`    | `'moh_billing'`      | Name of the invoices table.                                     |
| `Config.ManagementTable` | `'management_funds'` | Name of the society funds table. Compatible with qb-management. |

### Commands

| Key                      | Default     | Description                                                       |
| ------------------------ | ----------- | ----------------------------------------------------------------- |
| `Config.InvoicesCommand` | `'billing'` | In-game chat command that opens the billing UI (without the `/`). |

### Invoice Settings

| Key                       | Type    | Default    | Description                                                                                                     |
| ------------------------- | ------- | ---------- | --------------------------------------------------------------------------------------------------------------- |
| `Config.VATPercentage`    | number  | `20`       | VAT percentage shown next to invoice amounts in the UI. Visual only — does not change the charged amount.       |
| `Config.LimitDate`        | boolean | `true`     | Whether to record a payment deadline date on each invoice.                                                      |
| `Config.LimitDateDays`    | number  | `10`       | How many days from creation before the invoice is considered overdue. Only relevant when `LimitDate` is `true`. |
| `Config.AllowedSocieties` | table   | see config | List of job names whose members can *create* invoices. Any job not in this list can only *pay* invoices.        |
| `Config.MoneyAccount`     | string  | `'bank'`   | Which account money is taken from / added to. QBCore: `'bank'` or `'cash'`. ESX: `'bank'` or `'money'`.         |

### Boss Grade Access

Controls who can open the **Management** tab. A player must be in an`AllowedSociety` *and* have a grade that meets or exceeds the\
configured minimum.

| Key                       | Type   | Default    | Description                                                                                                                                                                                                                                       |
| ------------------------- | ------ | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Config.DefaultBossGrade` | number | `3`        | Minimum grade for jobs not listed in `Config.BossGrades`.                                                                                                                                                                                         |
| `Config.BossGrades`       | table  | see config | <p>Per-job minimum grade overrides. Key is the job name string, value is the<br>minimum grade integer.<br><strong>QBCore:</strong> <code>job.grade.level</code> (0 = lowest).<br><strong>ESX:</strong> <code>job.grade</code> (same integer).</p> |

Example:

```
Config.DefaultBossGrade = 3
Config.BossGrades = {
police    = 3,   -- grade 3 or higher = boss
mechanic  = 2,   -- grade 2 or higher = boss
}
```

### Money Destination

Defines where invoice payments go after a player pays.

| Key                       | Type   | Default        | Description                                                                                                                                                                                                                                              |
| ------------------------- | ------ | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Config.MoneyDestination` | string | `'management'` | <p><code>'management'</code> — 100 % goes to the society fund in the database.<br><code>'player'</code> — 100 % goes directly to the sender's bank account.<br><code>'split'</code> — a percentage goes to the sender, the rest to the society fund.</p> |
| `Config.PlayerCutPercent` | number | `20`           | Only active when `MoneyDestination = 'split'`. Percentage (0–100) of the invoice amount paid directly to the sender. The remainder goes to the management fund.                                                                                          |

### Withdraw / Deposit Limits

| Key                           | Default   | Description                                                                             |
| ----------------------------- | --------- | --------------------------------------------------------------------------------------- |
| `Config.MaxWithdrawPerAction` | `1000000` | Maximum amount a boss can withdraw in a single action. Set to `0` to disable the limit. |
| `Config.MaxDepositPerAction`  | `1000000` | Maximum amount a boss can deposit in a single action. Set to `0` to disable the limit.  |

### Discord Webhook Logs

| Key                 | Default              | Description                                                                                                      |
| ------------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `Config.Webhook`    | `''`                 | Your Discord channel webhook URL. Leave empty (`''`) to disable all logging.                                     |
| `Config.ServerName` | `'Your Server Name'` | Displayed as the author name in webhook embeds.                                                                  |
| `Config.IconURL`    | `''`                 | URL of the icon shown in webhook embeds (your server logo).                                                      |
| `Config.DateFormat` | `'%d/%m/%Y [%X]'`    | Lua `os.date` format string for the timestamp shown in embed footers.                                            |
| `Config.LogColors`  | table                | Decimal colour codes for each embed type:`invoicePaid`, `invoiceCreated`, `invoiceFailed`,`withdraw`, `deposit`. |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mohssins.gitbook.io/mohscriptsdocs/moh-billing/configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
