# validateFbrInvoice

Source: https://pakdatakit.dev/api/typescript/fbr-invoice/functions/validatefbrinvoice/

```ts
function validateFbrInvoice(invoice, options?): FbrInvoiceValidation;
```

Defined in: [fbr-invoice.ts:318](https://github.com/chmuzamil/pakdatakit/blob/a6eeaa47381308c4e4fcda45b29642fe4fbfb1fc/src/fbr-invoice.ts#L318)

Checks an FBR digital invoice against the rules of PRAL's specification
(v1.12) and Error Message Guide that need no call to FBR, and returns every
problem with FBR's error code.

Checked: invoice type (0003, 0011), date format (0005, 0042, 0113) and,
with `options.today`, a future date (0043); seller and buyer NTN/CNIC
(0401, 0402, 0009), self-invoicing (0058), names, provinces (0073, 0074),
addresses, buyer registration type (0012), the reference number of a debit
note (0026), the sandbox scenario, and on each line: HS code (0044), rate
(0020), unit, sale type (0013), required and valid amounts (0021, 0023,
0024, 0098, 0300, 0302), SRO schedule and serial (0077, 0078), Third
Schedule retail price (0090), extra tax on reduced-rate goods (0091) and
the sales tax arithmetic (0102, 0104, 0105, to within one paisa).

Not checked, because they need FBR's data: registration status, whether a
province, HS code, unit, rate, sale type or SRO is in FBR's lists or fits
the others, and the original invoice of a debit note.

## Parameters

| Parameter | Type |
| :------ | :------ |
| `invoice` | [`FbrInvoice`](https://pakdatakit.dev/api/typescript/fbr-invoice/interfaces/fbrinvoice/) |
| `options?` | [`FbrInvoiceValidationOptions`](https://pakdatakit.dev/api/typescript/fbr-invoice/interfaces/fbrinvoicevalidationoptions/) |

## Returns

[`FbrInvoiceValidation`](https://pakdatakit.dev/api/typescript/fbr-invoice/interfaces/fbrinvoicevalidation/)

`{ valid, errors }`. Never throws.
