tally_alter_voucher
Change an existing TallyPrime voucher's lines, amounts, date, narration, or reference. Preview the before/after result, then confirm the write.
Instructions
Change an EXISTING voucher in TallyPrime — its lines, amounts, date, narration or reference.
Give the voucher's guid and current date (from tally_get_vouchers), and the COMPLETE voucher as it should be afterwards: every line, not only the changed ones — including items on an item invoice. The preview shows it before and after. Stock journals cannot be altered here: cancel or delete one and post it again.
If the voucher was changed or deleted in TallyPrime after the preview, the confirm is refused (TallyPrime would otherwise create a new voucher instead of altering).
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. | |
| guid | Yes | The voucher's guid, as returned by tally_get_vouchers. | |
| 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. | |
| currentDate | Yes | The voucher's date as it is NOW in TallyPrime (from the same read). | |
| 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. |