tally_create_voucher
Create a new TallyPrime voucher for journals, payments, receipts, sales, purchases, or notes via ledger lines or item invoices, then preview before confirming.
Instructions
Post a NEW voucher in TallyPrime: Journal, Payment, Receipt, Contra, Sales, Purchase, Credit Note, Debit Note, Delivery Note, Receipt Note or any custom type.
Two forms: ACCOUNTING (ledger lines only) or ITEM INVOICE (give items: stock item, quantity, rate and the sales/purchase ledger, plus the party and any tax ledgers as entries). Any ledger line or item line can be split across cost centres. For stock transfers or production use tally_create_stock_journal.
WHEN TO USE: audit adjustments, provisions, reclassifications, recording a payment, receipt, sale or purchase.
Each line is a ledger, a side (Dr/Cr) and a positive amount. Debits must equal credits exactly. Party lines can carry bill-wise allocations (New Ref for an invoice, Agst Ref to settle one). GST/TDS are posted as ordinary ledger lines to the tax ledgers, with the amounts you give: nothing calculates tax for you.
REFUSES: an unbalanced voucher, an unknown ledger or voucher type, a date before the books begin. The preview warns about likely duplicates already in the books.
WRITES TO TALLYPRIME, in two steps. This call only PREVIEWS: it checks the change against the live books and returns exactly what would be written plus a confirmToken — nothing is changed. Show the preview to the user, and only after they approve it call tally_confirm_write with the token. Never confirm on your own initiative, and never confirm a preview the user has not seen.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | Yes | Voucher date, ISO YYYY-MM-DD. | |
| items | No | Stock item lines, for an ITEM invoice (Sales, Purchase, Credit/Debit Note) or a Delivery / Receipt Note. Each is item, quantity, rate and the sales or purchase ledger it posts to; the side follows the voucher type (a sale credits, a purchase debits). | |
| company | No | Company name. Omit to use whichever company TallyPrime has loaded. If given and it is not the loaded one, the call fails with TALLY_COMPANY_NOT_LOADED rather than returning another company's data. | |
| entries | Yes | Ledger lines. Debits must equal credits exactly, counting any item lines. On an item invoice these are the party and any tax, freight or discount ledgers. | |
| narration | No | ||
| reference | No | Supplier invoice number or other reference. | |
| partyLedger | No | The party (customer/supplier) of the voucher, if any. | |
| voucherType | Yes | Voucher type as in TallyPrime: Journal, Payment, Receipt, Contra, Sales, Purchase, Credit Note, Debit Note, or a custom type. | |
| voucherNumber | No | Only for types numbered manually. Omit to let TallyPrime number it. |