TallyPrime (CA) Skill
Connect to a locally running TallyPrime instance via its XML-over-HTTP interface. All requests are HTTP POST to $TALLY_URL (commonly http://localhost:9000) with an XML body.
- - No cloud API: TallyPrime must be open/running on the user’s machine.
- Multi-company: Always use the correct
SVCURRENTCOMPANY (exact spelling).
Hero Use Case: WhatsApp invoice → Tally entry
Goal: zero manual entry for CAs handling many clients.
- 1. Read bill/invoice (PDF/image) and extract: company, party, GSTIN, date, invoice no, taxable, tax, total, ledger mapping.
- Ensure masters exist: party ledger, purchase/sales ledger, GST ledger(s), bank/cash ledger (if needed).
- Post voucher with a unique GUID.
- Confirm a summary back to the user.
When to use this skill
Use when the user asks to:
- - Post entries: purchase, sales, receipt, payment, journal, contra, credit note, debit note
- Check reports: day book, trial balance, balance sheet, profit & loss, ledger statement, outstandings, GST
- Manage masters: create/alter ledgers, groups, stock items/UOM (inventory clients)
- Fix data: alter or cancel a voucher
Critical rules (must follow)
- 1. Never assume company: if not explicit, ask which company to use before posting.
- Never guess ledgers: verify ledgers exist before voucher import; create missing masters first.
- Dates are
YYYYMMDD (no separators). - Idempotency: always set a stable unique
GUID per voucher to prevent duplicates on retries. - Balance vouchers: total debits must equal total credits (Tally error: “Voucher totals do not match!”).
- Escape XML: narration/party names may contain
& → use & in XML. - Posting is write operation: confirm intent (and company) before any create/alter/cancel.
- Prefer bill-wise allocations for party ledgers to keep outstandings correct (see
reference/vouchers.md). - Accounting-only vouchers (no inventory items): set
<ISINVOICE>No</ISINVOICE> and place the party ledger entry first in the ALLLEDGERENTRIES.LIST sequence. This makes the Day Book "Particulars" column show the party name (not the expense/purchase ledger) and defaults the voucher to the clean "As Voucher" view. Only use ISINVOICE=Yes for item invoices that go through reference/inventory.md.
Step 0: Check TallyPrime server
CODEBLOCK0
Expected (example):
CODEBLOCK1
If not running, stop and ask user to open TallyPrime and enable integrations for the port.
Step 1: Company context
If the user did not specify company, ask. If they did, use exact name in SVCURRENTCOMPANY.
To list companies, use the template in reference/reports.md (“Company list”).
Step 2: Verify/create required ledgers (masters)
Ledger existence checks and master creation templates are in reference/masters.md (includes ledgers, groups, and GST/address fields).
Quick group defaults (common CA mapping):
| Ledger type | Parent group |
|---|
| Customer | INLINECODE15 |
| Vendor |
Sundry Creditors |
| Sales |
Sales Accounts |
| Purchases/Expenses |
Purchase Accounts /
Direct Expenses /
Indirect Expenses |
| Bank |
Bank Accounts |
| Cash |
Cash-in-Hand |
| GST |
Duties & Taxes |
Step 3: Post vouchers (core)
Use REPORTNAME=Vouchers and always include GUID, DATE, and VOUCHERTYPENAME. Full templates (including bill-wise allocations, returns, contra) are in reference/vouchers.md.
Supported voucher types in this skill:
- - Purchase, Sales, Payment, Receipt, Journal
- Credit Note, Debit Note
- Contra
- Voucher Alteration + Cancellation
Read reports (core)
Use TALLYREQUEST=Export / REPORTNAME=... with SVEXPORTFORMAT=$$SysName:XML. Full templates are in reference/reports.md.
Common CA reports:
- - Day Book (period)
- Trial Balance (period)
- Balance Sheet
- Profit and Loss
- Ledger Vouchers (ledger statement)
- Bills Receivable / Bills Payable (outstandings)
- Ledger Outstandings / Group Outstandings
- GST: GSTR-1 and related summaries (plus GSTR-3B where available)
- Stock Summary (inventory clients)
Suggested GUID pattern
Use a deterministic pattern when invoice number exists:
CODEBLOCK2
Examples:
- - INLINECODE33
- INLINECODE34
Multi-company CA workflow (recommended)
- 1. Capture company name early (and confirm spelling).
- Validate connectivity.
- Fetch required ledgers/masters or create them.
- Only then post the voucher.
- Reply with: company, voucher type, voucher number, date, amount breakdown, and whether any masters were created.
Advanced reference
- - Reports and data export: INLINECODE35
- Voucher templates (including Debit/Credit Note, Contra, bill-wise allocations, alter/cancel): INLINECODE36
- Masters (ledgers/groups + GST/address, alteration): INLINECODE37
- Inventory (stock groups/items/UOM, item invoices): INLINECODE38
- Error handling and troubleshooting: INLINECODE39
TallyPrime (CA) 技能
通过 XML-over-HTTP 接口连接到本地运行的 TallyPrime 实例。所有请求均为 HTTP POST 至 $TALLY_URL(通常为 http://localhost:9000),请求体为 XML 格式。
- - 非云 API:TallyPrime 必须在用户机器上打开/运行。
- 多公司:始终使用正确的 SVCURRENTCOMPANY(拼写准确)。
核心用例:WhatsApp 发票 → Tally 分录
目标:为处理大量客户的 CA 实现零手动录入。
- 1. 读取账单/发票(PDF/图片),提取:公司、客户方、GSTIN、日期、发票号、应税金额、税额、总计、科目映射。
- 确保主数据存在:客户方科目、采购/销售科目、GST 科目、银行/现金科目(如需)。
- 使用唯一 GUID 过账凭证。
- 向用户确认返回摘要。
何时使用此技能
当用户要求执行以下操作时使用:
- - 过账分录:采购、销售、收款、付款、转账、对账、贷项通知单、借项通知单
- 查看报表:日记账、试算平衡表、资产负债表、损益表、科目明细表、未结款项、GST
- 管理主数据:创建/修改科目、分组、库存项目/计量单位(库存客户)
- 数据修正:修改或取消凭证
关键规则(必须遵守)
- 1. 切勿假设公司:如未明确说明,过账前需询问使用哪个公司。
- 切勿猜测科目:导入凭证前需确认科目存在;先创建缺失的主数据。
- 日期格式为 YYYYMMDD(无分隔符)。
- 幂等性:始终为每个凭证设置稳定唯一的 GUID,防止重试时产生重复。
- 平衡凭证:借方总额必须等于贷方总额(Tally 错误提示:凭证总额不匹配!)。
- XML 转义:摘要/客户方名称可能包含 & → 在 XML 中使用 &。
- 过账为写入操作:在任何创建/修改/取消操作前,需确认意图(及公司)。
- 客户方科目优先使用按账单分配,以保持未结款项正确(参见 reference/vouchers.md)。
- 纯会计凭证(无库存项目):设置 No,并在 ALLLEDGERENTRIES.LIST 序列中将客户方科目分录放在首位。这样日记账的明细列将显示客户方名称(而非费用/采购科目),并将凭证默认显示为简洁的按凭证视图。仅对通过 reference/inventory.md 处理的物料发票使用 ISINVOICE=Yes。
第 0 步:检查 TallyPrime 服务器
bash
curl -s --max-time 5 $TALLY_URL
预期结果(示例):
xml
TallyPrime Server is Running
如果未运行,请停止并请用户打开 TallyPrime 并为该端口启用集成。
第 1 步:公司上下文
如果用户未指定公司,请询问。如果已指定,则在 SVCURRENTCOMPANY 中使用准确名称。
要列出公司,请使用 reference/reports.md 中的模板(公司列表)。
第 2 步:验证/创建所需科目(主数据)
科目存在性检查和主数据创建模板位于 reference/masters.md(包括科目、分组以及 GST/地址字段)。
快速分组默认值(常见 CA 映射):
| 科目类型 | 父级分组 |
|---|
| 客户 | Sundry Debtors |
| 供应商 |
Sundry Creditors |
| 销售 | Sales Accounts |
| 采购/费用 | Purchase Accounts / Direct Expenses / Indirect Expenses |
| 银行 | Bank Accounts |
| 现金 | Cash-in-Hand |
| GST | Duties & Taxes |
第 3 步:过账凭证(核心)
使用 REPORTNAME=Vouchers,并始终包含 GUID、DATE 和 VOUCHERTYPENAME。完整模板(包括按账单分配、退货、对账)位于 reference/vouchers.md。
此技能支持的凭证类型:
- - 采购、销售、付款、收款、转账
- 贷项通知单、借项通知单
- 对账
- 凭证修改 + 取消
读取报表(核心)
使用 TALLYREQUEST=Export / REPORTNAME=... 配合 SVEXPORTFORMAT=$$SysName:XML。完整模板位于 reference/reports.md。
常见 CA 报表:
- - 日记账(期间)
- 试算平衡表(期间)
- 资产负债表
- 损益表
- 科目凭证(科目明细表)
- 应收票据 / 应付票据(未结款项)
- 科目未结款项 / 分组未结款项
- GST:GSTR-1 及相关汇总(以及可用的 GSTR-3B)
- 库存汇总(库存客户)
建议的 GUID 模式
当存在发票号时,使用确定性模式:
{公司简称}-{凭证类型}-{凭证编号}-{日期}
示例:
- - abc-purchase-ril2026-00123-20260115
- abc-creditnote-cn09-20260302
多公司 CA 工作流程(推荐)
- 1. 尽早获取公司名称(并确认拼写)。
- 验证连接性。
- 获取所需科目/主数据或创建它们。
- 然后才过账凭证。
- 回复内容:公司、凭证类型、凭证编号、日期、金额明细,以及是否创建了任何主数据。
高级参考
- - 报表和数据导出:reference/reports.md
- 凭证模板(包括借项/贷项通知单、对账、按账单分配、修改/取消):reference/vouchers.md
- 主数据(科目/分组 + GST/地址、修改):reference/masters.md
- 库存(库存分组/项目/计量单位、物料发票):reference/inventory.md
- 错误处理与故障排除:reference/errors.md