# Voucher editor (VoucherComposer) · Booki

> Agent-operable journal — addLine, setDebit/Credit, assertBalance.

Source: https://booki.dev/docs/voucher-composer

Vouchers and ledger

# Voucher editor

`VoucherComposer`

Agent-operable journal — addLine, setDebit/Credit, assertBalance.

The person sees

| Account | Name | Debit | Credit |
| --- | --- | --- | --- |
| 1200 | Accounts receivable | $12,500.00 | — |
| 4000 | Sales revenue | — | $10,000.00 |
| 2150 | Sales tax payable | — | $2,500.00 |
| In balance | $12,500.00 | $12,500.00 |  |

In balance · $12,500.00 / $12,500.00

Bridge demo

```
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.

```javascript
const { agent } = window
const entry = agent.snapshot().filter(
  (entry) => !entry.offPage && entry.component === "voucher-composer",
)[0]
const result = await agent.act({
  steps: [{
    ref: entry.ref,
    action: "setCredit",
    args: ["2",1050000],
  }],
})
console.log(result.ok) // true
```

Line 2 changes to 1050000 minor units (10,500.00). The draft is now 50000 minor units out of balance.

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