# buildFbrInvoice

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

```ts
function buildFbrInvoice(input): 
  | FbrInvoiceBuild
  | null;
```

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

Builds an FBR digital invoice from your own fields, working out
`salesTaxApplicable` on each line where you leave it out (see
[expectedSalesTax](https://pakdatakit.dev/api/typescript/fbr-invoice/functions/expectedsalestax/); uses `calculateSalesTax`). Lines with a rate
that is neither `N%` nor `Rs.N` (`Exempt`, combined rates) get 0 unless you
give the tax.

`salesTaxWithheldAtSource`, `totalValues` and
`fixedNotifiedValueOrRetailPrice` default to 0, and `invoiceRefNo` and
`buyerNTNCNIC` to `""`, as in FBR's samples. Nothing else is filled in or
changed; check the result with [validateFbrInvoice](https://pakdatakit.dev/api/typescript/fbr-invoice/functions/validatefbrinvoice/).

Also returns column totals, which are for your own records: the
specification has no invoice-level totals.

## Parameters

| Parameter | Type |
| :------ | :------ |
| `input` | [`FbrInvoiceInput`](https://pakdatakit.dev/api/typescript/fbr-invoice/type-aliases/fbrinvoiceinput/) |

## Returns

  \| [`FbrInvoiceBuild`](https://pakdatakit.dev/api/typescript/fbr-invoice/interfaces/fbrinvoicebuild/)
  \| `null`

The invoice and totals, or `null` if `input` is not an object
  with an `items` array. Never throws.
