Skip to content
GitHub
Browse the docs

Invoices and expenses

Invoice

InvoiceEditor

Invoice and credit-note lines with totals computed from them. An agent drafts; a person finalizes.

The person sees

Invoice · Draft

DescriptionQuantityUnit priceDiscount %TaxNetRemove line
$18,125.00
$2,142.00
Net$20,267.00
Tax 25%$5,066.75
Total$25,333.75
Install
booki_version=$(npm view @booki-aui/react@latest version) &&
ui_sdk_version=$(npm view "@booki-aui/react@$booki_version" peerDependencies.@ui-sdk/core) &&
pnpm add --save-exact "@booki-aui/core@$booki_version" "@booki-aui/react@$booki_version" "@booki-aui/styles@$booki_version" \
  "@ui-sdk/core@$ui_sdk_version" "@ui-sdk/react@$ui_sdk_version"

Try the bridge

Open this page in a browser and run the example in the console with a fresh preview. Read the current ref from the snapshot before acting.

Console
const { agent } = window
const entry = agent.snapshot().filter(
  (entry) => !entry.offPage && entry.component === "invoice-editor",
)[0]
const result = await agent.act({
  steps: [{
    ref: entry.ref,
    action: "addLine",
    args: [{"description":"Oppfølging november","quantity":2,"unitPriceMinor":145000,"taxRate":25}],
  }],
})
console.log(result.ok) // true

The draft gains a line for two units at 145000 minor units each. Its gross is 362500 minor units including 25% tax.

Import from @booki-aui/react. For Booki's default styling, add import "@booki-aui/styles".