# \_invoiceGenerate

Generate an invoice for the Job.

### Parameters

#### id

The ID of the Job.

### Example

```
FM_api('Job_invoiceGenerate', ['id' => '222402']);
```

### Result

#### On Success

```
{'id':'206976',
 'appointment_id':'222402',
 'cdate':'2015-11-02',
 'customer_id':'100831',
 'total':'0',
 'paid':'0',
 'rows':'[]',
 'notes':'',
 'num':'5',
 'type':'0',
 'status':'-1',
 'discount':'0',
 'pandp':'0',
 'doc_no':null,
 'order_no':null,
 'discount_vat':'0',
 'pandp_vat':'0',
 'total_net':'0.0000'}
```

The ID returned here is the database ID of the invoice row.

Note the Status, which starts as '-1', meaning 'Draft'. Common Status values are:

* -1: Draft
* 0: Quoted
* 1: Invoiced
* 2: Paid
* 3: Cancelled

#### On Failure

```
{'error':'Appointment 206976 does not exist.'}
```
