File a pending contra set-off draft settling one side in full (approved on its review page in Taokeh)
create_contra_draftFiles a pending draft of Contra set-off: what a customer owes the company is set off against what the company owes the same business as a supplier. Customers and suppliers are separate records, so whether they are one business is the approver's call: the review page shows the two side by side, with any same name, BRN or TIN. The two sides set off the same ringgit amount; one side is settled in full: every invoice at exactly what it still owes (open_invoices outstanding), or every bill at exactly what is still owed on it (search_documents docType bill, outstanding). A part set-off, or an invoice or bill with a live credit or debit note against it, is recorded by hand on Banking → Contra set-off. Every named document must be open; a refusal lists what each named document still owes. Nothing is posted until an admin or bookkeeper approves it on its review page (no one-tap approval); approval records it exactly as the contra page does: A/R and A/P both go down by the amount, no money moves and no tax is charged. The result carries both sides, the amount and the journal lines. Refused at filing and approval in the page's words: the sides not equal, a document of another customer or supplier, a foreign-currency document, an amount over what a document owes, a date in a locked period. One contra draft per customer and supplier pair waits at a time; if a document is paid, credited or set off before approval, approval refuses and nothing is posted.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"date": "<date>",
"customerId": "<customerId>",
"vendorId": "<vendorId>",
"invoiceAllocations": "<invoiceAllocations>",
"billAllocations": "<billAllocations>"
},
"name": "create_contra_draft"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | Yes | The set-off date, YYYY-MM-DD. | |
| memo | No | A memo printed on the contra note. | |
| note | No | A short note for the reviewer: where the figures came from. | |
| vendorId | Yes | The supplier side, from resolve_vendor. | |
| customerId | Yes | The customer side, from resolve_customer. | |
| needsReview | No | true flags the draft for the reviewer. | |
| billAllocations | Yes | The supplier's open bills (search_documents, docType `bill`) and the ringgit set off on each, [{purchaseId, amount}]. No bill with a live debit note. | |
| invoiceAllocations | Yes | The customer's open invoices (open_invoices) and the ringgit set off on each, [{saleId, amount}]. No invoice with a live credit or debit note. |