# Configuration

## config.lua Overview

The `config.lua` file contains all configuration options for the Billing System.

## Framework Settings

### Framework Selection

```lua
Config.Framework = 'auto'
```

**Options:**

* `'auto'` - Automatically detect framework (recommended)
* `'qbox'` - Force QBox framework
* `'qb'` - Force QBCore framework
* `'esx'` - Force ESX framework
* `'custom'` - Use custom framework (requires bridge setup)

{% hint style="info" %}
Auto-detection works in most cases. Only set manually if detection fails.
{% endhint %}

## Job Configuration

### Allowed Jobs

Define which jobs can create invoices:

```lua
Config.AllowedJobs = {
    'police',
    'ambulance',
    'mechanic',
    'taxi',
    'realestate',
}
```

{% hint style="warning" %}
Job names must match exactly with your framework's job names (case-insensitive).
{% endhint %}

## Keybind Settings

### Tablet Open Key

```lua
Config.Keybind = 'F7'
```

**Common Options:**

* `'F7'` - F7 key (default)
* `'F6'` - F6 key
* `'K'` - K key
* Any valid FiveM key code

## Distance Settings

### Nearby Player Detection

```lua
Config.NearbyPlayerDistance = 10.0
```

Maximum distance (in meters) to detect nearby players for invoicing.

## Invoice Settings

### Amount Limits

```lua
Config.InvoiceSettings = {
    MinAmount = 1,
    MaxAmount = 999999,
}
```

* `MinAmount` - Minimum invoice amount
* `MaxAmount` - Maximum invoice amount

### Tax Configuration

```lua
Config.InvoiceSettings = {
    TaxRate = 0,  -- 0 = no tax
}
```

**Examples:**

* `0` - No tax
* `0.18` - 18% tax
* `0.25` - 25% tax

{% hint style="info" %}
Tax is automatically calculated and added to invoice total.
{% endhint %}

### Payment Methods

```lua
Config.InvoiceSettings = {
    AllowBankPayment = true,
    AllowCashPayment = true,
}
```

Enable or disable payment methods:

* `AllowBankPayment` - Allow bank transfers
* `AllowCashPayment` - Allow cash payments

### Feature Toggles

```lua
Config.InvoiceSettings = {
    AllowMultiRecipient = true,
    AllowPhotoAttachment = true,
    AllowRecurringPayments = true,
}
```

* `AllowMultiRecipient` - Allow invoices to multiple players
* `AllowPhotoAttachment` - Allow photo attachments
* `AllowRecurringPayments` - Allow installment payments

## Notification Settings

### Duration and Position

```lua
Config.Notifications = {
    Duration = 5000,  -- milliseconds
    Position = 'top-right',
}
```

**Position Options:**

* `'top-right'`
* `'top-left'`
* `'bottom-right'`
* `'bottom-left'`

## Receipt Settings

### Print Receipt Feature

```lua
Config.ReceiptSettings = {
    Enabled = true,
    RequireOxInventory = true,
    ItemName = 'receipt',
}
```

* `Enabled` - Enable receipt printing
* `RequireOxInventory` - Require ox\_inventory
* `ItemName` - Item name to give player

{% hint style="warning" %}
Receipt printing requires ox\_inventory to be installed.
{% endhint %}

## Cashbox Settings

### Per-Job Cashbox

```lua
Config.CashboxSettings = {
    Enabled = true,
    SharedBetweenJobs = false,
}
```

* `Enabled` - Enable cashbox feature
* `SharedBetweenJobs` - Share cashbox between all jobs

## Camera Settings

### Photo Attachment Camera

```lua
Config.CameraSettings = {
    FOV = 70.0,
    MaxPhotos = 3,
    PhotoQuality = 'high',
}
```

* `FOV` - Camera field of view
* `MaxPhotos` - Maximum photos per invoice
* `PhotoQuality` - `'low'`, `'medium'`, `'high'`

## Language Settings

### Default Language

```lua
Config.Language = 'en'
```

**Available Languages:**

* `'en'` - English
* `'tr'` - Turkish

See [Translations](https://github.com/dollar-src/docs/blob/main/billing/gitbook-translations.md) for adding more languages.

## Example Configurations

### Police Department

```lua
Config.AllowedJobs = {'police'}
Config.InvoiceSettings = {
    MinAmount = 50,
    MaxAmount = 50000,
    TaxRate = 0,
    AllowBankPayment = true,
    AllowCashPayment = false,  -- Police only accepts bank
    AllowMultiRecipient = false,
    AllowPhotoAttachment = true,
}
```

### Mechanic Shop

```lua
Config.AllowedJobs = {'mechanic'}
Config.InvoiceSettings = {
    MinAmount = 100,
    MaxAmount = 100000,
    TaxRate = 0.18,  -- 18% tax
    AllowBankPayment = true,
    AllowCashPayment = true,
    AllowMultiRecipient = true,
    AllowPhotoAttachment = true,
}
```

### Hospital

```lua
Config.AllowedJobs = {'ambulance', 'doctor'}
Config.InvoiceSettings = {
    MinAmount = 500,
    MaxAmount = 25000,
    TaxRate = 0,
    AllowBankPayment = true,
    AllowCashPayment = false,
    AllowMultiRecipient = false,
    AllowPhotoAttachment = false,
}
```

## Advanced Configuration

### Billing Menus

Billing menus are configured per-job in the admin panel or database.

See [Admin Guide](https://github.com/dollar-src/docs/blob/main/billing/gitbook-admin-guide.md) for details.

## Validation

After configuring, restart the resource:

```
restart src-billing
```

Check console for any configuration errors.

{% hint style="success" %}
Configuration complete! Test your settings in-game.
{% endhint %}


---

# 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://docs.sourcedev.pro/advanced-billing-system/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.
