Method

invoice.due

Posted, unpaid documents falling due within some days: GnuCash's bills-due and invoices-due reminders.

Lists the posted documents that are still open and fall due within daysInAdvance days (default 7) of now: GnuCash's reminders of invoices due (kind: invoices, customer documents) and bills due (kind: bills, vendor and employee documents). Overdue documents are included. Sorted by due date; amount is the open balance, signed as on the A/R or A/P account.

GnuCash shows these at book open, from its preferences; red-ale has no screen, so the preferences are the params.

Examples

Example: with a copy of the synthetic/business-editable example book open as book.gnucash.

JSON-RPC

Request:

{"jsonrpc":"2.0","id":1,"method":"invoice.due","params":{"kind":"invoices","daysInAdvance":60,"now":"2024-04-01T00:00:00Z"}}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "invoice": "aa210b7131de44c48b8513cd27c00e95",
      "id": "000001",
      "company": "Acme & Sons <Ltd>",
      "dueDate": "2024-04-03",
      "amount": {
        "num": "87300",
        "denom": "100"
      },
      "…": "…"
    }
  ]
}

Command line

red-ale exec --book book.gnucash invoice.due '{"kind":"invoices","daysInAdvance":60,"now":"2024-04-01T00:00:00Z"}'

It prints:

[
  {
    "invoice": "aa210b7131de44c48b8513cd27c00e95",
    "id": "000001",
    "company": "Acme & Sons <Ltd>",
    "dueDate": "2024-04-03",
    "amount": {
      "num": "87300",
      "denom": "100"
    },
    "…": "…"
  }
]

MCP tool call

Tool call:

{"name":"invoice.due","arguments":{"kind":"invoices","daysInAdvance":60,"now":"2024-04-01T00:00:00Z"}}

Result:

{
  "content": [
    {
      "type": "text",
      "text": "[{\"invoice\":\"aa210b7131de44c48b8513cd27c00e95\",\"id\":\"000001\",\"company\":\"Acme & Sons <Ltd>\",\"dueDate\":\"2024-04-03\",\"amount\":{\"num\":\"87300\",\"denom\":\"100\"},\"…\":\"…\"}]"
    }
  ]
}

Effect: read.

Params

Params of invoice.due.

  • kind (DueKind, required): Which documents.
  • daysInAdvance (integer (int64)): How many days ahead to look (GnuCash's days-in-advance preference, default 7). Negative counts as 0.
  • now (Timestamp or null): The moment to look from. Default: now.

Result

Type: array of DueDocument.