# Server Exports

{% hint style="info" %}
Here you will find the list of usable exports for Car Sale Job, you can use them if you have basic or advanced programming knowledge, we do not recommend using these if you do not have such knowledge.
{% endhint %}

{% hint style="warning" %}
REMEMBER ABOUT CLIENT SIDE AND SERVER SIDE IN CHOOSING EXPORT!
{% endhint %}

***

## Get Account

Use following export to get some company account data.

```lua
exports['p_carsale']:getAccount(jobName)
```

* jobName: `string`
  * Existing job name of some dealership

Return:

* account: `table`

***

## Account Data

You can use some function from list below

### newContract

```lua
local account = exports['p_carsale']:getAccount('dealership')
account.newContract(contractData)
```

* contractData: `table`
  * seller: `string`
  * buyer: `string`
  * model: `string`
  * price: `string`
  * engine?: `number`
  * plate: `string`
  * transmission?: `number`
  * suspension?: `number`
  * brakes?: `number`
  * turbo?: `boolean`

***

### getContracts

```lua
local account = exports['p_carsale']:getAccount('dealership')
account.getContracts()
```

Return:

* contracts: `table`

***

### getBalance

```lua
local account = exports['p_carsale']:getAccount('dealership')
account.getBalance()
```

Return:

* balance: `number`

***

### saveMoney

Save company money manually \[It's already saving after using addMoney or removeMoney]

```lua
local account = exports['p_carsale']:getAccount('dealership')
account.saveMoney()
```

***

### addMoney

Add some amount of money to company account

```lua
local account = exports['p_carsale']:getAccount('dealership')
local amount = 100
account.addMoney(amount)
```

Return:

* success: `boolean`

***

### removeMoney

Remove some amount of money from company account

```lua
local account = exports['p_carsale']:getAccount('dealership')
local amount = 100
account.removeMoney(amount)
```

Return:

* success: `boolean`

***

### getStats

Use this if you want to fetch company total income and sold vehicles

```lua
local account = exports['p_carsale']:getAccount('dealership')
local stats = account.getStats()
```

Return:

* stats: `table`
  * soldVehicles: `number`
  * income: `number`

***

### updateStat

Use this if you want to update some statistic manually

```lua
local account = exports['p_carsale']:getAccount('dealership')
local statName = 'soldVehicles'
local value = 1
local stats = account.updateStat(statName, value)
```

{% hint style="warning" %}
statName and value also can be table!
{% endhint %}

```lua
local account = exports['p_carsale']:getAccount('dealership')
local statName = {'soldVehicles', 'income'}
local value = {1, 100}
local stats = account.updateStat(statName, value)
```

Return:

* success: `boolean`

***
