# Exports

{% tabs %}
{% tab title="Client" %}

### getPermissions()

> Returns a table with the player current job permissions as index keys.
>
> ```lua
> local permissions = exports['av_business']:getPermissions()
> print(json.encode(permissions, {indent = true}))
> ```

### openBilling()

> Opens the Billing Menu without using a laptop
>
> ```lua
> exports['av_business']:openBilling()
> ```

{% endtab %}

{% tab title="Server" %}

### getPermissions(playerId,job)

> Returns a table with the player permissions, every permission is a index key.
>
> **params:**
>
> * **playerId**:`number` Player server ID.
> * **job**:`string` The job used to retrieve player permissions
>
> **returns:**
>
> * **permissions**:`table` Every table index is a permission
>
> ```lua
> local playerId = 1
> local business = "uwucafe"
> local permissions = exports['av_business']:getPermissions(playerId,business)
> print(json.encode(permissions, {indent = true}))
> ```

### pendingBills(identifier)

> Returns the player pending invoices. You can use this export to prevent the user from deleting his character or blocking some other in game features.
>
> **params:**
>
> * **identifier**:`string` The character identifier
>
> **returns:**
>
> * **amount**:`number|false` The amount of pending invoices or false
>
> ```lua
> local identifier = exports['av_laptop']:getIdentifier(source)
> local invoices = exports['av_business']:pendingBills(identifier)
> if invoices then
>     print("You have "..invoices.." pending invoices")
> else
>     print("Player doesn't have any pending invoices :D")
> end
> ```

### resetBusiness(job)

> Reset the business stats, this will NOT remove any employee, it will simply wipe all data like applications, webhooks, monthly generated, etc.
>
> **params:**
>
> * **job**:`string` The job name
>
> **returns:**
>
> * **result**:`boolean`
>
> ```lua
> local result = exports['av_business']:resetBusiness("uwucafe")
> print(result)
> ```

### addMoney(playerName,job,amount,description)

> This will **NOT** remove any funds from business account, is only used for the Banking logs + Today's Income + Monthly Generated.
>
> **params:**
>
> * **playerName?**:`string|nil` Name from the player triggering the action.
> * **job**:`string` Job name
> * **amount**:`number` The amount to register
> * **description**?:`string|nil` A description that will be used for the Bank tab.
>
> ```lua
> local playerName = exports['av_laptop']:getName(source)
> local job = "uwucafe"
> local amount = 999
> local description = "Bitcoin earnings"
> exports['av_business']:addMoney(playerName,job,amount,description)
> ```

<figure><img src="https://1688068901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9bCwnajAqpi3Viykb5Wi%2Fuploads%2FPLLvZ8Ofo8WjQf79GiK2%2Fimage.png?alt=media&#x26;token=383c161e-f2b3-4cef-9b01-494197b79f70" alt=""><figcaption><p>Example using the addMoney() export</p></figcaption></figure>

### removeMoney(playerName,job,amount,description)

> This will NOT remove any funds from business account, is only used for the Banking logs.
>
> **params:**
>
> * **playerName?**:`string|nil` Name from the player triggering the action
> * **job**:`string` Job name
> * **amount**:`number` The amount to register
> * **description?**:`string|nil` A description that will be used for the Bank tab.
>
> ```lua
> local playerName = exports['av_laptop']:getName(source)
> local job = "uwucafe"
> local amount = 123
> local description = "Hello ppl from the Docs!"
> exports['av_business']:removeMoney(playerName,job,amount,description)
> ```

<figure><img src="https://1688068901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9bCwnajAqpi3Viykb5Wi%2Fuploads%2FMub7kdbjeWzPKN1sZpUt%2Fimage.png?alt=media&#x26;token=de0810d1-9c0a-4074-9c54-bbec5157338e" alt=""><figcaption><p>Example using the removeMoney() export</p></figcaption></figure>

### addTransaction(job,type,count)

> Use it to register a Transaction for the Chart component, read [overview-chart](https://docs.av-scripts.com/laptop-pack-v3/business/config/overview-chart "mention") for more info on how the Overview Chart works.
>
> **params:**
>
> * **business**:`string` The job name ("police", "ambulance", "mechanic", etc....)
> * **name**:`string` The transaction name (NOT label).
> * **amount**:`number` The amount of transactions to add (1 by default)
>
> **returns:**
>
> * **added**:`boolean`&#x20;
>
> ```lua
> local job = "mechanic"
> local type = "tuning"
> local count = 1
> local result = exports['av_business']:addTransaction(job,type,count)
> print(result)
> ```

### addActivity(job,identifier,count)

> Employee of the month is based on the number of activities completed during the month. Use this export if you have any extra activity you’d like to count toward this.
>
> **params:**
>
> * **job**:`string` Player job
> * **identifier**:`string` The player identifier
> * **count**:`number` The amount of points to add to player monthly activities.
>
> **returns**:
>
> * **result**:`boolean`
>
> ```lua
> local job = "uwucafe"
> local identifier = exports['av_laptop']:getIdentifier(source)
> local count = 1
> local added = exports['av_business']:addActivity(job,identifier,count)
> print(added)
> ```

### processLaundry(job,type,amount,title,description)

> If the business has 'marked' funds available in its Vault Stash, the system will calculate and process the cleanable amount based on the activity type, multipliers, and remaining daily limits, make sure to send the needed parameters.
>
> **params:**
>
> * **job**:`string` The business job name
> * **type**:`string` The activity type, must match one from the Config.GlobalCleanActivities or Config.JobCleanActivities if the business have their own values. If you sent an invalid type the process will be cancelled.
> * **amount:**`number` Amount of money to process.
> * **title?**:`string` Title used for the bank log
> * **description?**:`string` Description used for the bank log
>
> **returns:**
>
> * **processed**:`boolean` True if the money was processed, false means something went wrong, you can enable Config.Debug to get more info in your server console (txadmin)
>
> ```lua
> local job = "uwucafe"
> local type = "cashiers" -- "cashiers", "deliveries", "billing" or your custom one
> local amount = 100
> local processed = exports['av_business']:processLaundry(job,type,amount)
> print(processed) 
> ```

### toggleDuty(playerId,state)

> Set the player job duty status.
>
> **params:**
>
> * **playerId**:`number` Player server id
> * **status:**`boolean` Duty status
>
> ```lua
> local playerId = source
> local state = true -- or false to exit duty
> exports['av_business']:toggleDuty(playerId, state)
> ```

{% endtab %}

{% tab title="Society" %}
{% hint style="info" %}
This exports are linked to AV Business BUT they are located in **av\_laptop/server/editable/exports.lua**

**All this exports are server side only.**
{% endhint %}

### getSociety(job)

> Retrieves a society funds.
>
> **params:**
>
> * **job**:`string` The job name
>
> returns:
>
> * **money**:`number` Society funds
>
> ```lua
> local funds = exports['av_laptop']:getSociety("police")
> print(funds)
> ```

### addSociety(playerId,job,amount,name,description)

> Add funds to the society.
>
> **params:**
>
> * **playerId?**:`number|nil` Server ID from player who's triggering the export
> * **job**:`string` The business to add the funds
> * **amount**:`number` Amount to add
> * **name?**:`string|nil` Player name who's triggering the export, this is used in the Bank tab > Employee field.
> * **description?**:`string|nil` A short description for the bank logs.
>
> ```lua
> local playerId = 1
> local job = "uwucafe"
> local amount = 99
> local name = exports['av_laptop']:getName(playerId)
> local description = "Hello World"
> exports['av_laptop']:addSociety(playerId,job,amount,name,description)
> ```

### removeSociety(playerId,job,amount,name,description)

> Remove funds from society.
>
> **params:**
>
> * **playerId?**:`number|nil` Server ID from player who's triggering the export
> * **job**:`string` The business to remove funds
> * **amount**:`number` Amount to remove
> * **name?**:`string|nil` Player name who's triggering the export, this is used in the Bank tab > Employee field.
> * **description?**:`string|nil` A short description for the bank logs
>
> ```lua
> local playerId = 1
> local job = "uwucafe"
> local amount = 123
> local name = exports['av_laptop']:getName(playerId)
> local description = "Business expenses"
> exports['av_laptop']:removeSociety(playerId,job,amount,name,description)
> ```

{% endtab %}
{% endtabs %}
