invoice.dueDate
When a document posted on a date falls due under its (or a given) billing term.
Computes when a document posted on postDate falls due under a billing term: the document's own (give invoice) or one
you name by GUID or name (term). A days term adds its days; a proximo term falls due on its day of the next month
(clamped to the month's end), or of the month after when the posting day is past its cutoff. With no term, the due date
is the posting date. invoice.post uses the same rule when you give no dueDate.
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.dueDate","params":{"invoice":"aa210b7131de44c48b8513cd27c00e95","postDate":"2024-03-28"}}
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"dueDate": "2024-04-27",
"due": "2024-04-27T10:59:00Z"
}
}
Request:
{"jsonrpc":"2.0","id":2,"method":"invoice.dueDate","params":{"term":"Prox15","postDate":"2024-03-28"}}
Response:
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"dueDate": "2024-05-15",
"due": "2024-05-15T10:59:00Z"
}
}
Command line
red-ale exec --book book.gnucash --script - <<'EOF'
invoice.dueDate {"invoice":"aa210b7131de44c48b8513cd27c00e95","postDate":"2024-03-28"}
invoice.dueDate {"term":"Prox15","postDate":"2024-03-28"}
EOF
It prints:
[
{
"dueDate": "2024-04-27",
"due": "2024-04-27T10:59:00Z"
},
{
"dueDate": "2024-05-15",
"due": "2024-05-15T10:59:00Z"
}
]
MCP tool call
Tool call:
{"name":"invoice.dueDate","arguments":{"invoice":"aa210b7131de44c48b8513cd27c00e95","postDate":"2024-03-28"}}
Result:
{
"structuredContent": {
"dueDate": "2024-04-27",
"due": "2024-04-27T10:59:00Z"
}
}
Tool call:
{"name":"invoice.dueDate","arguments":{"term":"Prox15","postDate":"2024-03-28"}}
Result:
{
"structuredContent": {
"dueDate": "2024-05-15",
"due": "2024-05-15T10:59:00Z"
}
}
Effect: read.
Params
Params of invoice.dueDate.
invoice(Guid or null): A document whose billing term to use. Give this orterm.term(BillTermRef or null): A billing term to use, by GUID or by name. Give this orinvoice.postDate(Date, required): The posting date.
Result
Result of invoice.dueDate.
dueDate(Date, required): The due date.due(Timestamp, required): The instant GnuCash stores: the day-neutral time of the due date.