Skill: purvik6062/ca-skill (version 1.0.6)

--- emoji: 🧾 name: tally-prime-ca version: 1.0.6 author: Maxxit description: >- Full-service CA skill for TallyPrime running locally. Read accounting reports (day book, trial balance, P&L, balance sheet, outstandings, GST) and post or update vouchers (purchase/sales/payment/receipt/journal, credit note, debit note, contra) via TallyPrime XML-over-HTTP. Use when the user mentions Tally, accounting entries, invoices/bills, ledgers, outstanding, GST, returns, or financial statements. disableModelInvocation: false requires: env: - TALLY_URL metadata: openclaw: requiredEnv: - TALLY_URL bins: - curl primaryCredential: TALLY_URL --- # 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. 2. Ensure masters exist: party ledger, purchase/sales ledger, GST ledger(s), bank/cash ledger (if needed). 3. Post voucher with a **unique GUID**. 4. 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. 2. **Never guess ledgers**: verify ledgers exist before voucher import; create missing masters first. 3. **Dates are `YYYYMMDD`** (no separators). 4. **Idempotency**: always set a stable unique `GUID` per voucher to prevent duplicates on retries. 5. **Balance vouchers**: total debits must equal total credits (Tally error: “Voucher totals do not match!”). 6. **Escape XML**: narration/party names may contain `&` → use `&amp;` in XML. 7. **Posting is write operation**: confirm intent (and company) before any create/alter/cancel. 8. **Prefer bill-wise allocations** for party ledgers to keep outstandings correct (see `reference/vouchers.md`). 9. **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`. 10. **Accounting Invoice Mode — always use `LEDGERENTRIES.LIST`**: when `OBJVIEW="Invoice Voucher View"` is set (Modes 1 and 2 in `reference/vouchers.md`), every ledger block **must** use `<LEDGERENTRIES.LIST>`, not `<ALLLEDGERENTRIES.LIST>`. Tally silently ignores `ALLLEDGERENTRIES` in this view, causing the voucher to be saved with no entries and the error "No accounting or inventory entries are available." 11. **Voucher class decision — confirm before posting**: before posting any Purchase or Sales voucher, check whether the company's voucher type uses a class for GST splitting. Run the preflight checklist in the "Preflight checklist before posting" section below. If class mode is confirmed, set `<CLASSNAME>EXACT_CLASS_NAME</CLASSNAME>` in the voucher header and include all four GST header fields (`CMPGSTIN`, `PARTYGSTIN`, `GSTREGISTRATIONTYPE`, `PLACEOFSUPPLY`). **If class existence is unconfirmed, stop and ask — do not post without it.** Full decision rules and templates are in the "Voucher class — decision rules" section of `reference/vouchers.md`. ## Preflight checklist before posting Run through every item before sending any Create/Alter/Delete request. **Stop at the first unresolved item and ask the user.** | # | Check | How to verify | Block if… | |---|---|---|---| | 1 | **Company confirmed** | User stated it explicitly | Name not given — ask | | 2 | **Server reachable** | `curl -s --max-time 5 "$TALLY_URL"` | No response / wrong port | | 3 | **Voucher type uses a class?** | Export voucher type masters or ask user | Unknown — ask before posting | | 4 | **Class name confirmed** (if class mode) | List voucher type via masters export; match exact class name in Tally | Class not found — ask, never guess | | 5 | **Party ledger exists** | Ledger existence check (`reference/masters.md`) | Missing — create first | | 6 | **Purchase/Sales/GST ledgers exist** | Same as above | Missing — create first | | 7 | **GST header fields available** (if class mode) | `CMPGSTIN`, `PARTYGSTIN`, `GSTREGISTRATIONTYPE`, `PLACEOFSUPPLY` | Any missing — ask user | | 8 | **Voucher totals balance** | Sum all `AMOUNT` values = 0 | Mismatch — fix before posting | ## Step 0: Check TallyPrime server ```bash curl -s --max-time 5 "$TALLY_URL" ``` Expected (example): ```xml <RESPONSE>TallyPrime Server is Running</RESPONSE> ``` 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, GST/address fields, and party ledger creation with required field prompts). **New company?** Run the "New Company Setup — Standard GST Ledgers" block in `reference/masters.md` first. It creates the seven minimum ledgers every GST-registered company needs: | # | Ledger | Type | |---|---|---| | 1 | `Input Sgst @ 9 %` | Input GST | | 2 | `Input Cgst @ 9 %` | Input GST | | 3 | `Input IGST @ 18 %` | Input GST | | 4 | `Purchase @ 18 %` | Purchase ledger | | 5 | `Round Off` | Rounding | | 6 | `Output Sgst @ 9 %` | Output GST | | 7 | `Output Cgst @ 9 %` | Output GST | Quick group defaults (common CA mapping): | Ledger type | Parent group | |---|---| | Customer | `Sundry Debtors` | | 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: ``` {companyShort}-{voucherType}-{voucherNumber}-{date} ``` Examples: - [REDACTED_SECRET] - `abc-creditnote-cn09-20260302` ## Multi-company CA workflow (recommended) 1. Capture company name early (and confirm spelling). 2. Validate connectivity. 3. Fetch required ledgers/masters or create them. 4. Only then post the voucher. 5. Reply with: company, voucher type, voucher number, date, amount breakdown, and whether any masters were created. ## Advanced reference - Reports and data export: `reference/reports.md` - Voucher templates (including Debit/Credit Note, Contra, bill-wise allocations, alter/cancel): `reference/vouchers.md` - Masters (ledgers/groups + GST/address, alteration): `reference/masters.md` - Inventory (stock groups/items/UOM, item invoices): `reference/inventory.md` - Error handling and troubleshooting: `reference/errors.md`

path: reference/errors.md
content: # Errors & Troubleshooting — TallyPrime XML

This file is a practical troubleshooting guide for CA automation using TallyPrime XML-over-HTTP.

## Quick triage checklist

1. **Server reachable**: `curl -s --max-time 5 "$TALLY_URL"`
2. **Company correct**: `SVCURRENTCOMPANY` exact spelling (including spaces/case).
3. **Date format**: `YYYYMMDD`, and within the company’s configured financial year.
4. **Dependent masters exist**: ledgers, stock items, UOM, voucher types.
5. **Totals match**: Dr/Cr totals equal.
6. **XML escaped**: narration and names don’t contain raw `&`, `<`, `>`.

## Common errors (what they mean + how to fix)

| Symptom / error text | Likely cause | Fix |
|---|---|---|
| Connection refused / timeout | TallyPrime not running or wrong port | Open TallyPrime; confirm port; check `$TALLY_URL` |
| Response doesn’t contain “Server is Running” | Wrong URL or Tally integration not enabled | Verify TallyPrime is running and integration is enabled |
| XML parser throws `ParseError` / "no element found" | Export Data responses are XML fragments (no single root) — this is by design | Use Python regex instead of `xml.etree.ElementTree`; see parsing guide in `reference/reports.md` |
| `curl ... > file` produces truncated or empty file | Shell redirect can silently truncate in compound commands | Use `curl --output /tmp/file.xml` (the `-o` flag) |
| `Could not find Report 'X'` | Wrong `REPORTNAME` | Use report names in `reference/reports.md`; if still failing, verify in TallyPrime Developer |
| `Could not find Collection 'X'` | Collection not available | Use custom TDL pattern (see `reference/reports.md`) |
| `Ledger 'X' does not exist` | Missing ledger master | Create ledger first (see `reference/masters.md`) |
| `Stock Item 'X' does not exist` | Missing inventory master | Create stock item/UOM (see `reference/inventory.md`) |
| `Voucher date is missing` / `The date ... is Out of Range` | Date outside configured FY | Ask user to confirm FY settings in the company; use a valid date |
| `Voucher totals do not match!` | Dr/Cr totals mismatch (or wrong sign conventions) | Ensure totals balance; export a known-good voucher from UI and match signs/tags |
| `DESC not found` | Incorrect envelope structure / wrong request shape | Compare to base templates; ensure `REQUESTDESC` and `REQUESTDATA` are placed correctly |
| `CREATED=0` with `ERRORS>0` | Generic import failure | Inspect response details; reduce to minimal fields; add fields incrementally |
| Silent wrong-company data | Wrong `SVCURRENTCOMPANY` | Confirm exact company name as seen in Tally |

## Import response XML (what to look for)

Tally typically returns an import “statistics” block indicating how many objects were created/altered and error counts.

Common fields include:

- `CREATED`
- `ALTERED`
- `DELETED`
- `ERRORS`
- `EXCEPTIONS`
- “Last Voucher ID imported” (varies)

Rule: treat any non-zero `ERRORS` or `EXCEPTIONS` as a failure and **do not assume** posting succeeded.

## XML escaping rules (minimum)

If user-provided text contains reserved XML chars, escape them before embedding:

- `&` → `&amp;`
- `<` → `&lt;`
- `>` → `&gt;`
- `"` → `&quot;`
- `'` → `&apos;`

High-risk fields: `NARRATION`, ledger names, party names, item names.

## Debugging workflow (recommended)

When a write fails:

1. Retry with **minimal** voucher: only required tags + two ledger lines.
2. If minimal works, add optional fields one at a time (bill allocations, GST ledgers, inventory lines).
3. If minimal fails, export a similar voucher created in UI and diff structure/signs.

## Best practice: “export-first” for fragile setups

For each new client setup:

1. Create one example voucher type in UI (Sales, Purchase, Receipt, Payment, Contra, Credit Note, Debit Note).
2. Export the voucher/master to XML.
3. Store/derive the template from exported XML (this avoids sign/view surprises).

## Where to look for report names and variables

If a report or variable is inconsistent across client environments:

- Use **TallyPrime Developer** → Navigate → Jump to Definition → Report → search name (e.g., `Profit and Loss`).
- Use exported XML from the UI version of the report to infer variables (e.g., ageing slabs).



path: reference/inventory.md
content: # Inventory (Stock Groups / Items / UOM) + Item Invoices

This file covers inventory masters and itemized voucher patterns for trading/manufacturing clients.

## Conventions

- Inventory masters also use `REPORTNAME=All Masters`.
- For item invoices, prefer **Invoice Voucher View** and include `ALLINVENTORYENTRIES.LIST`.
- If a tag/value is unclear, create one sample in Tally UI and export the voucher/master to XML; then replicate.

## Create Stock Group

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>All Masters</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <STOCKGROUP NAME="Electronics" ACTION="Create">
            <NAME>Electronics</NAME>
          </STOCKGROUP>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

## Create Unit of Measure (UOM) — simple

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>All Masters</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <UNIT NAME="Pcs" ACTION="Create">
            <NAME>Pcs</NAME>
            <ISSIMPLEUNIT>Yes</ISSIMPLEUNIT>
            <ORIGINALNAME>Pieces</ORIGINALNAME>
            <DECIMALPLACES>0</DECIMALPLACES>
          </UNIT>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

## Create Stock Item (minimal)

UOM is commonly required.

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>All Masters</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <STOCKITEM NAME="ITEM_NAME" ACTION="Create">
            <NAME>ITEM_NAME</NAME>
            <PARENT>STOCK_GROUP_NAME</PARENT>
            <BASEUNITS>UOM_NAME</BASEUNITS>
          </STOCKITEM>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

## Create Godown / Location

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>All Masters</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <GODOWN NAME="Factory" ACTION="Create">
            <NAME>Factory</NAME>
          </GODOWN>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

## Sales (Item Invoice) — inventory entries

This is a template for an item invoice with one item line. Expand by repeating `ALLINVENTORYENTRIES.LIST` blocks.

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>Vouchers</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <VOUCHER VCHTYPE="Sales" ACTION="Create" OBJVIEW="Invoice Voucher View">
            <GUID>UNIQUE_GUID</GUID>
            <DATE>YYYYMMDD</DATE>
            <VOUCHERTYPENAME>Sales</VOUCHERTYPENAME>
            <VOUCHERNUMBER>INVOICE_NO</VOUCHERNUMBER>
            <ISINVOICE>Yes</ISINVOICE>
            <PERSISTEDVIEW>Invoice Voucher View</PERSISTEDVIEW>
            <PARTYLEDGERNAME>CUSTOMER_LEDGER</PARTYLEDGERNAME>

            <!-- Party ledger -->
            <ALLLEDGERENTRIES.LIST>
              <LEDGERNAME>CUSTOMER_LEDGER</LEDGERNAME>
              <ISPARTYLEDGER>Yes</ISPARTYLEDGER>
              <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
              <AMOUNT>-TOTAL_AMOUNT</AMOUNT>
              <BILLALLOCATIONS.LIST>
                <NAME>INVOICE_NO</NAME>
                <BILLTYPE>New Ref</BILLTYPE>
                <AMOUNT>-TOTAL_AMOUNT</AMOUNT>
              </BILLALLOCATIONS.LIST>
            </ALLLEDGERENTRIES.LIST>

            <!-- Item line -->
            <ALLINVENTORYENTRIES.LIST>
              <STOCKITEMNAME>ITEM_NAME</STOCKITEMNAME>
              <ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
              <ACTUALQTY>1 Pcs</ACTUALQTY>
              <BILLEDQTY>1 Pcs</BILLEDQTY>
              <RATE>1000.00/Pcs</RATE>
              <AMOUNT>1000.00</AMOUNT>

              <BATCHALLOCATIONS.LIST>
                <GODOWNNAME>Main Location</GODOWNNAME>
                <BATCHNAME>Primary Batch</BATCHNAME>
                <AMOUNT>1000.00</AMOUNT>
                <ACTUALQTY>1 Pcs</ACTUALQTY>
                <BILLEDQTY>1 Pcs</BILLEDQTY>
              </BATCHALLOCATIONS.LIST>

              <ACCOUNTINGALLOCATIONS.LIST>
                <LEDGERNAME>SALES_LEDGER</LEDGERNAME>
                <ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
                <AMOUNT>1000.00</AMOUNT>
              </ACCOUNTINGALLOCATIONS.LIST>
            </ALLINVENTORYENTRIES.LIST>
          </VOUCHER>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

## Notes

- If godowns/batches are not enabled, `GODOWNNAME` is typically `Main Location` and `BATCHNAME` is `Primary Batch`.
- For services-only invoices, prefer accounting-only sales voucher templates (see `reference/vouchers.md`).



path: reference/masters.md
content: # Masters (Ledgers / Groups) — TallyPrime XML

This file contains templates to create and alter accounting masters that CAs routinely need: groups and ledgers (including address/GST fields where relevant).

## Conventions

- Master operations use `TALLYREQUEST=Import Data` and `REPORTNAME=All Masters`.
- Always include `SVCURRENTCOMPANY`.
- Create dependent masters first (e.g., group before ledger).

## Create Group

Example: create `North Zone Debtors` under `Sundry Debtors`.

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>All Masters</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <GROUP NAME="North Zone Debtors" ACTION="Create">
            <NAME>North Zone Debtors</NAME>
            <PARENT>Sundry Debtors</PARENT>
          </GROUP>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

## Create Ledger (minimal)

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>All Masters</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <LEDGER NAME="LEDGER_NAME" ACTION="Create">
            <NAME>LEDGER_NAME</NAME>
            <PARENT>PARENT_GROUP</PARENT>
          </LEDGER>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

## Create Party Ledger (Customer / Vendor)

Before creating, collect all required fields from the user:

| Field | Description | Example |
|---|---|---|
| `LEDGER_NAME` | Full legal name of the party | `Sample Suppliers Pvt Ltd` |
| `PARENT` | `Sundry Debtors` (customer) or `Sundry Creditors` (vendor/supplier) | `Sundry Creditors` |
| `PARTYGSTIN` | 15-digit GSTIN of the party | `24AAAAA0000A1Z5` |
| `GSTREGISTRATIONTYPE` | GST registration type | `Regular` / `Unregistered` / `Consumer` / `Composition` |
| `STATE` | State of the party's registered address | `Maharashtra` |
| `PLACEOFSUPPLY` | Usually same as state | `Maharashtra` |
| `ADDRESS` (lines) | Street address (one `<ADDRESS>` tag per line) | `123 Main Road`, `Industrial Area` |
| `MAILINGNAME` | Name to print on invoices (usually same as ledger name) | `Sample Suppliers Pvt Ltd` |
| `OPENINGBALANCE` | Opening balance amount (0 if none; positive = credit, negative = debit) | `10000.00` |
| `APPLICABLEFROM` | GST registration effective date in `YYYYMMDD` | `20170701` |

**Ask the user for every field above before posting. Do not guess GSTIN, state, or opening balance.**

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>All Masters</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <LEDGER NAME="LEDGER_NAME" ACTION="Create">
            <NAME>LEDGER_NAME</NAME>
            <PARENT>Sundry Creditors</PARENT><!-- or Sundry Debtors -->
            <TAXTYPE>Others</TAXTYPE>
            <GSTREGISTRATIONTYPE>Regular</GSTREGISTRATIONTYPE>
            <PARTYGSTIN>PARTY_GSTIN</PARTYGSTIN>
            <COUNTRYOFRESIDENCE>India</COUNTRYOFRESIDENCE>
            <LEDGERCOUNTRYISDCODE>+91</LEDGERCOUNTRYISDCODE>
            <ISBILLWISEON>No</ISBILLWISEON>
            <ISCOSTCENTRESON>No</ISCOSTCENTRESON>
            <OPENINGBALANCE>0</OPENINGBALANCE>

            <LANGUAGENAME.LIST>
              <NAME.LIST TYPE="String">
                <NAME>LEDGER_NAME</NAME>
                <NAME>2</NAME>
              </NAME.LIST>
              <LANGUAGEID>1033</LANGUAGEID>
            </LANGUAGENAME.LIST>

            <LEDGSTREGDETAILS.LIST>
              <APPLICABLEFROM>YYYYMMDD</APPLICABLEFROM>
              <GSTREGISTRATIONTYPE>Regular</GSTREGISTRATIONTYPE>
              <STATE>STATE_NAME</STATE>
              <PLACEOFSUPPLY>STATE_NAME</PLACEOFSUPPLY>
              <GSTIN>PARTY_GSTIN</GSTIN>
              <ISOTHTERRITORYASSESSEE>No</ISOTHTERRITORYASSESSEE>
              <CONSIDERPURCHASEFOREXPORT>No</CONSIDERPURCHASEFOREXPORT>
              <ISTRANSPORTER>No</ISTRANSPORTER>
              <ISCOMMONPARTY>No</ISCOMMONPARTY>
            </LEDGSTREGDETAILS.LIST>

            <LEDMAILINGDETAILS.LIST>
              <ADDRESS.LIST TYPE="String">
                <ADDRESS>ADDRESS_LINE_1</ADDRESS>
                <ADDRESS>ADDRESS_LINE_2</ADDRESS>
              </ADDRESS.LIST>
              <APPLICABLEFROM>YYYYMMDD</APPLICABLEFROM>
              <MAILINGNAME>LEDGER_NAME</MAILINGNAME>
              <STATE>STATE_NAME</STATE>
              <COUNTRY>India</COUNTRY>
            </LEDMAILINGDETAILS.LIST>

            <CONTACTDETAILS.LIST>
              <NAME>Primary Mobile No.</NAME>
              <COUNTRYISDCODE>+91</COUNTRYISDCODE>
              <ISDEFAULTWHATSAPPNUM>Yes</ISDEFAULTWHATSAPPNUM>
            </CONTACTDETAILS.LIST>

          </LEDGER>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

> **Note**: For unregistered parties, omit `<PARTYGSTIN>` and set `<GSTREGISTRATIONTYPE>Unregistered</GSTREGISTRATIONTYPE>` in both the ledger header and `LEDGSTREGDETAILS.LIST`.

## Create Ledger (with address / contact fields)

Field availability depends on enabled features. Safest workflow: create a sample ledger in UI and export it to XML, then copy required tags.

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>All Masters</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <LEDGER NAME="LEDGER_NAME" ACTION="Create">
            <NAME>LEDGER_NAME</NAME>
            <PARENT>PARENT_GROUP</PARENT>

            <MAILINGNAME.LIST TYPE="String">
              <MAILINGNAME>MAILING_NAME</MAILINGNAME>
            </MAILINGNAME.LIST>

            <ADDRESS.LIST TYPE="String">
              <ADDRESS>ADDRESS_LINE_1</ADDRESS>
              <ADDRESS>ADDRESS_LINE_2</ADDRESS>
              <ADDRESS>CITY</ADDRESS>
            </ADDRESS.LIST>

            <PINCODE>PIN</PINCODE>
            <COUNTRYNAME>India</COUNTRYNAME>
            <STATENAME>STATE_NAME</STATENAME>
            <EMAIL>EMAIL</EMAIL>
            <MOBILE>MOBILE</MOBILE>
            <LEDGERPHONE>PHONE</LEDGERPHONE>
          </LEDGER>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

## Ledger alteration (update existing ledger)

Set `ACTION="Alter"` and send the desired fields.

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>All Masters</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <LEDGER NAME="LEDGER_NAME" ACTION="Alter">
            <NAME>LEDGER_NAME</NAME>
            <PARENT>NEW_PARENT_GROUP</PARENT>
          </LEDGER>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

## Ledger group reference (common CA mapping)

| Ledger Type | Parent Group |
|---|---|
| Customer (debtor) | `Sundry Debtors` |
| Vendor (creditor) | `Sundry Creditors` |
| Sales income | `Sales Accounts` |
| Purchases | `Purchase Accounts` |
| Direct costs | `Direct Expenses` |
| Indirect expenses | `Indirect Expenses` |
| Bank account | `Bank Accounts` |
| Cash | `Cash-in-Hand` |
| GST ledgers | `Duties & Taxes` |

## New Company Setup — Standard GST Ledgers

When a new company is created, run all seven blocks below (in order) to set up the minimum GST ledger set. Substitute `COMPANY_NAME` with the exact company name.

### 1. Input SGST @ 9 %

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>All Masters</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <LEDGER NAME="Input Sgst @ 9 %" ACTION="Create">
            <NAME>Input Sgst @ 9 %</NAME>
            <PARENT>Duties &amp; Taxes</PARENT>
            <TAXTYPE>GST</TAXTYPE>
            <GSTDUTYHEAD>SGST/UTGST</GSTDUTYHEAD>
            <RATEOFTAXCALCULATION>9</RATEOFTAXCALCULATION>
            <ROUNDINGMETHOD>&#4; Not Applicable</ROUNDINGMETHOD>
            <ISGSTDUTYLEDGER>Yes</ISGSTDUTYLEDGER>
          </LEDGER>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

### 2. Input CGST @ 9 %

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>All Masters</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <LEDGER NAME="Input Cgst @ 9 %" ACTION="Create">
            <NAME>Input Cgst @ 9 %</NAME>
            <PARENT>Duties &amp; Taxes</PARENT>
            <TAXTYPE>GST</TAXTYPE>
            <GSTDUTYHEAD>CGST</GSTDUTYHEAD>
            <RATEOFTAXCALCULATION>9</RATEOFTAXCALCULATION>
            <ROUNDINGMETHOD>&#4; Not Applicable</ROUNDINGMETHOD>
            <ISGSTDUTYLEDGER>Yes</ISGSTDUTYLEDGER>
          </LEDGER>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

### 3. Input IGST @ 18 %

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>All Masters</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <LEDGER NAME="Input IGST @ 18 %" ACTION="Create">
            <NAME>Input IGST @ 18 %</NAME>
            <PARENT>Duties &amp; Taxes</PARENT>
            <TAXTYPE>GST</TAXTYPE>
            <GSTDUTYHEAD>IGST</GSTDUTYHEAD>
            <RATEOFTAXCALCULATION>18</RATEOFTAXCALCULATION>
            <ROUNDINGMETHOD>&#4; Not Applicable</ROUNDINGMETHOD>
            <ISGSTDUTYLEDGER>Yes</ISGSTDUTYLEDGER>
          </LEDGER>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

### 4. Purchase @ 18 % (with GST rate details)

Purchase ledger under `Purchase Accounts` with embedded GST rate splits (CGST 9% + SGST 9% + IGST 18%) for local taxable goods.

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>All Masters</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <LEDGER NAME="Purchase @ 18 %" ACTION="Create">
            <NAME>Purchase @ 18 %</NAME>
            <PARENT>Purchase Accounts</PARENT>

            <GSTAPPLICABLE>&#4; Applicable</GSTAPPLICABLE>
            <GSTTYPEOFSUPPLY>Goods</GSTTYPEOFSUPPLY>
            <TAXTYPE>Others</TAXTYPE>
            <VATAPPLICABLE>&#4; Applicable</VATAPPLICABLE>

            <ISBILLWISEON>No</ISBILLWISEON>
            <ISCOSTCENTRESON>Yes</ISCOSTCENTRESON>
            <ISREVENUE>Yes</ISREVENUE>
            <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>

            <GSTDETAILS.LIST>
              <APPLICABLEFROM>20170701</APPLICABLEFROM>
              <TAXABILITY>Taxable</TAXABILITY>
              <GSTNATUREOFTRANSACTION>Local Purchase - Taxable</GSTNATUREOFTRANSACTION>
              <SRCOFGSTDETAILS>Specify Details Here</SRCOFGSTDETAILS>
              <GSTTYPEOFSUPPLY>Goods</GSTTYPEOFSUPPLY>

              <STATEWISEDETAILS.LIST>
                <STATENAME>&#4; Any</STATENAME>

                <RATEDETAILS.LIST>
                  <GSTRATEDUTYHEAD>CGST</GSTRATEDUTYHEAD>
                  <GSTRATEVALUATIONTYPE>Based on Value</GSTRATEVALUATIONTYPE>
                  <GSTRATE>9</GSTRATE>
                  <GSTRATEPERUNIT>0</GSTRATEPERUNIT>
                </RATEDETAILS.LIST>

                <RATEDETAILS.LIST>
                  <GSTRATEDUTYHEAD>SGST/UTGST</GSTRATEDUTYHEAD>
                  <GSTRATEVALUATIONTYPE>Based on Value</GSTRATEVALUATIONTYPE>
                  <GSTRATE>9</GSTRATE>
                  <GSTRATEPERUNIT>0</GSTRATEPERUNIT>
                </RATEDETAILS.LIST>

                <RATEDETAILS.LIST>
                  <GSTRATEDUTYHEAD>IGST</GSTRATEDUTYHEAD>
                  <GSTRATEVALUATIONTYPE>Based on Value</GSTRATEVALUATIONTYPE>
                  <GSTRATE>18</GSTRATE>
                  <GSTRATEPERUNIT>0</GSTRATEPERUNIT>
                </RATEDETAILS.LIST>

              </STATEWISEDETAILS.LIST>
            </GSTDETAILS.LIST>

            <HSNDETAILS.LIST>
              <APPLICABLEFROM>20210401</APPLICABLEFROM>
              <HSNCODE></HSNCODE>
              <SRCOFHSNDETAILS>As per Company/Group</SRCOFHSNDETAILS>
            </HSNDETAILS.LIST>

            <LANGUAGENAME.LIST>
              <NAME.LIST TYPE="String">
                <NAME>Purchase @ 18 %</NAME>
                <NAME>18</NAME>
              </NAME.LIST>
              <LANGUAGEID>1033</LANGUAGEID>
            </LANGUAGENAME.LIST>

          </LEDGER>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

> **Note**: Adjust the rate (9 %, 5 %, 12 %, 28 %, etc.) and nature of transaction (e.g., `Interstate Purchase - Taxable`) to match the company's actual tax slabs and supply type.

### 5. Round Off

Used to absorb invoice rounding differences. Place this in every new company setup.

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>All Masters</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <LEDGER NAME="Round Off" ACTION="Create">
            <NAME>Round Off</NAME>
            <PARENT>Indirect Expenses</PARENT>
            <TAXTYPE>Others</TAXTYPE>
            <TDSAPPLICABLE>&#4; Not Applicable</TDSAPPLICABLE>
            <GSTAPPLICABLE>&#4; Not Applicable</GSTAPPLICABLE>
            <VATAPPLICABLE>&#4; Not Applicable</VATAPPLICABLE>
            <VATDEALERNATURE>Invoice Rounding</VATDEALERNATURE>
            <ROUNDINGMETHOD>Normal Rounding</ROUNDINGMETHOD>
            <ROUNDINGLIMIT>1</ROUNDINGLIMIT>
            <ISBILLWISEON>No</ISBILLWISEON>
            <ISCOSTCENTRESON>Yes</ISCOSTCENTRESON>
            <ISREVENUE>Yes</ISREVENUE>
            <ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
            <LANGUAGENAME.LIST>
              <NAME.LIST TYPE="String">
                <NAME>Round Off</NAME>
                <NAME>3</NAME>
              </NAME.LIST>
              <LANGUAGEID>1033</LANGUAGEID>
            </LANGUAGENAME.LIST>
          </LEDGER>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

### 6. Output SGST @ 9 %

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>All Masters</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <LEDGER NAME="Output Sgst @ 9 %" ACTION="Create">
            <NAME>Output Sgst @ 9 %</NAME>
            <PARENT>Duties &amp; Taxes</PARENT>
            <TAXTYPE>GST</TAXTYPE>
            <GSTDUTYHEAD>SGST/UTGST</GSTDUTYHEAD>
            <RATEOFTAXCALCULATION>9</RATEOFTAXCALCULATION>
            <ROUNDINGMETHOD>&#4; Not Applicable</ROUNDINGMETHOD>
            <ISGSTDUTYLEDGER>Yes</ISGSTDUTYLEDGER>
          </LEDGER>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

### 7. Output CGST @ 9 %

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>All Masters</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <LEDGER NAME="Output Cgst @ 9 %" ACTION="Create">
            <NAME>Output Cgst @ 9 %</NAME>
            <PARENT>Duties &amp; Taxes</PARENT>
            <TAXTYPE>GST</TAXTYPE>
            <GSTDUTYHEAD>CGST</GSTDUTYHEAD>
            <RATEOFTAXCALCULATION>9</RATEOFTAXCALCULATION>
            <ROUNDINGMETHOD>&#4; Not Applicable</ROUNDINGMETHOD>
            <ISGSTDUTYLEDGER>Yes</ISGSTDUTYLEDGER>
          </LEDGER>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

## Check if a ledger exists (export list and search)

Use `List of Accounts` report to fetch masters in the company and confirm existence.

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Export Data</TALLYREQUEST></HEADER>
  <BODY>
    <EXPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>List of Accounts</REPORTNAME>
        <STATICVARIABLES>
          <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
    </EXPORTDATA>
  </BODY>
</ENVELOPE>
```

Then search the response for `<NAME>LEDGER_NAME</NAME>`.



path: reference/reports.md
content: # Reports & Data Export (TallyPrime XML)

This file contains **full XML templates** to export accounting/inventory reports for CA workflows.

## Conventions

- All requests are HTTP POST to `$TALLY_URL` with `Content-Type: application/xml`.
- Use `YYYYMMDD` dates in `SVFROMDATE` / `SVTODATE`.
- Always set `SVCURRENTCOMPANY` to the exact company name as shown in Tally.
- Preferred export format: `$$SysName:XML` (HTML is also supported).

## Base template (Export Data / Report)

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER>
    <TALLYREQUEST>Export Data</TALLYREQUEST>
  </HEADER>
  <BODY>
    <EXPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>REPORT_NAME</REPORTNAME>
        <STATICVARIABLES>
          <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
    </EXPORTDATA>
  </BODY>
</ENVELOPE>
```

## Server status (sanity check)

```bash
curl -s --max-time 5 "$TALLY_URL"
```

## Day Book (period)

Mandatory vars: `SVFROMDATE`, `SVTODATE`.

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Export Data</TALLYREQUEST></HEADER>
  <BODY>
    <EXPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>Day Book</REPORTNAME>
        <STATICVARIABLES>
          <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
          <SVFROMDATE>FROM_YYYYMMDD</SVFROMDATE>
          <SVTODATE>TO_YYYYMMDD</SVTODATE>
        </STATICVARIABLES>
      </REQUESTDESC>
    </EXPORTDATA>
  </BODY>
</ENVELOPE>
```

## Trial Balance (period)

Mandatory vars: `SVFROMDATE`, `SVTODATE`.

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Export Data</TALLYREQUEST></HEADER>
  <BODY>
    <EXPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>Trial Balance</REPORTNAME>
        <STATICVARIABLES>
          <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
          <SVFROMDATE>FROM_YYYYMMDD</SVFROMDATE>
          <SVTODATE>TO_YYYYMMDD</SVTODATE>
        </STATICVARIABLES>
      </REQUESTDESC>
    </EXPORTDATA>
  </BODY>
</ENVELOPE>
```

## Balance Sheet

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Export Data</TALLYREQUEST></HEADER>
  <BODY>
    <EXPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>Balance Sheet</REPORTNAME>
        <STATICVARIABLES>
          <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
    </EXPORTDATA>
  </BODY>
</ENVELOPE>
```

## Profit and Loss

Tally report name is typically `Profit and Loss`. If your Tally instance uses a different internal report name, use TallyPrime Developer “Jump to Definition” to confirm.

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Export Data</TALLYREQUEST></HEADER>
  <BODY>
    <EXPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>Profit and Loss</REPORTNAME>
        <STATICVARIABLES>
          <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
    </EXPORTDATA>
  </BODY>
</ENVELOPE>
```

## Ledger Vouchers (Ledger statement, period)

Mandatory var: `SVLEDGERNAME`, plus dates.

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Export Data</TALLYREQUEST></HEADER>
  <BODY>
    <EXPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>Ledger Vouchers</REPORTNAME>
        <STATICVARIABLES>
          <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
          <SVLEDGERNAME>LEDGER_NAME</SVLEDGERNAME>
          <SVFROMDATE>FROM_YYYYMMDD</SVFROMDATE>
          <SVTODATE>TO_YYYYMMDD</SVTODATE>
        </STATICVARIABLES>
      </REQUESTDESC>
    </EXPORTDATA>
  </BODY>
</ENVELOPE>
```

## Bills Receivable (Outstanding receivables)

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Export Data</TALLYREQUEST></HEADER>
  <BODY>
    <EXPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>Bills Receivable</REPORTNAME>
        <STATICVARIABLES>
          <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
    </EXPORTDATA>
  </BODY>
</ENVELOPE>
```

## Bills Payable (Outstanding payables)

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Export Data</TALLYREQUEST></HEADER>
  <BODY>
    <EXPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>Bills Payable</REPORTNAME>
        <STATICVARIABLES>
          <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
    </EXPORTDATA>
  </BODY>
</ENVELOPE>
```

## Ledger Outstandings (Party-wise outstanding for a ledger)

Mandatory var: `SVLEDGERNAME`.

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Export Data</TALLYREQUEST></HEADER>
  <BODY>
    <EXPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>Ledger Outstandings</REPORTNAME>
        <STATICVARIABLES>
          <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
          <SVLEDGERNAME>LEDGER_NAME</SVLEDGERNAME>
        </STATICVARIABLES>
      </REQUESTDESC>
    </EXPORTDATA>
  </BODY>
</ENVELOPE>
```

## Group Outstandings (Outstanding for a group)

Mandatory var: `SVGROUPNAME` is commonly used. Some Tally setups use `SVGROUP`. If it fails, confirm the variable in default TDL.

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Export Data</TALLYREQUEST></HEADER>
  <BODY>
    <EXPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>Group Outstandings</REPORTNAME>
        <STATICVARIABLES>
          <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
          <SVGROUPNAME>GROUP_NAME</SVGROUPNAME>
        </STATICVARIABLES>
      </REQUESTDESC>
    </EXPORTDATA>
  </BODY>
</ENVELOPE>
```

## GST: GSTR-1 report (period)

Mandatory vars: `SVFROMDATE`, `SVTODATE`.

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Export Data</TALLYREQUEST></HEADER>
  <BODY>
    <EXPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>GSTR1</REPORTNAME>
        <STATICVARIABLES>
          <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
          <SVFROMDATE>FROM_YYYYMMDD</SVFROMDATE>
          <SVTODATE>TO_YYYYMMDD</SVTODATE>
        </STATICVARIABLES>
      </REQUESTDESC>
    </EXPORTDATA>
  </BODY>
</ENVELOPE>
```

## GST: GSTR-3B (period)

Report name varies by Tally version/config. Common names include `GSTR3B` / `GSTR-3B`. If Tally responds “Could not find Report”, verify report name in TallyPrime Developer.

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Export Data</TALLYREQUEST></HEADER>
  <BODY>
    <EXPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>GSTR3B</REPORTNAME>
        <STATICVARIABLES>
          <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
          <SVFROMDATE>FROM_YYYYMMDD</SVFROMDATE>
          <SVTODATE>TO_YYYYMMDD</SVTODATE>
        </STATICVARIABLES>
      </REQUESTDESC>
    </EXPORTDATA>
  </BODY>
</ENVELOPE>
```

## Stock Summary (inventory clients)

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Export Data</TALLYREQUEST></HEADER>
  <BODY>
    <EXPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>Stock Summary</REPORTNAME>
        <STATICVARIABLES>
          <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
    </EXPORTDATA>
  </BODY>
</ENVELOPE>
```

## Company list (for multi-company CA setups)

There isn’t a single universal “Company List” report across all Tally setups; the robust approach is to use a **collection** export or a TDL-backed report. Use this section as the starting point:

### Option A: Export a default collection (if available)

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER>
    <VERSION>1</VERSION>
    <TALLYREQUEST>EXPORT</TALLYREQUEST>
    <TYPE>COLLECTION</TYPE>
    <ID>List of Companies</ID>
  </HEADER>
  <BODY>
    <DESC>
      <STATICVARIABLES>
        <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
      </STATICVARIABLES>
    </DESC>
  </BODY>
</ENVELOPE>
```

If this returns “Could not find Collection”, use Option B.

### Option B: Custom TDL (recommended fallback)

If the required report/collection doesn’t exist, send a full TDL Report/Form/Part/Line/Field/Collection definition. This is also how you build **special-purpose reports** for CA automation.

The following template is **verified working** for listing companies:

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER>
    <VERSION>1</VERSION>
    <TALLYREQUEST>Export</TALLYREQUEST>
    <TYPE>Data</TYPE>
    <ID>CompanyListReport</ID>
  </HEADER>
  <BODY>
    <DESC>
      <STATICVARIABLES>
        <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
      </STATICVARIABLES>
      <TDL>
        <TDLMESSAGE>
          <REPORT NAME="CompanyListReport">
            <FORMS>CompanyListForm</FORMS>
          </REPORT>
          <FORM NAME="CompanyListForm">
            <PARTS>CompanyListPart</PARTS>
          </FORM>
          <PART NAME="CompanyListPart">
            <LINES>CompanyListLine</LINES>
            <REPEAT>CompanyListLine : CompanyCollection</REPEAT>
            <SCROLL>Vertical</SCROLL>
          </PART>
          <LINE NAME="CompanyListLine">
            <FIELDS>CompanyNameField</FIELDS>
          </LINE>
          <FIELD NAME="CompanyNameField">
            <SET>$Name</SET>
          </FIELD>
          <COLLECTION NAME="CompanyCollection">
            <TYPE>Company</TYPE>
          </COLLECTION>
        </TDLMESSAGE>
      </TDL>
    </DESC>
  </BODY>
</ENVELOPE>
```

Response format: `<COMPANYNAMEFIELD>` elements, one per company.

## Export as HTML (for human viewing / quick preview)

Swap:

```xml
<SVEXPORTFORMAT>$$SysName:HTML</SVEXPORTFORMAT>
```

Then save the response to a `.html` file and open in a browser.

## Notes on ageing analysis (outstandings by slabs)

Ageing configuration is often controlled by report options and variables, and may require either:

- A custom TDL report that fetches bill data and computes ageing buckets, or
- A “snapshot export” from the configured report in the user’s Tally environment.

If you must implement ageing via XML for a specific client setup, the recommended workflow is:

1. Configure Ageing in Tally UI for the report (Bills Receivable/Payable).
2. Export the report to XML and reuse the variables/tags observed (or replicate via TDL).



path: reference/vouchers.md
content: # Vouchers (Create / Alter / Cancel) — TallyPrime XML

This file contains **full voucher XML templates** for CA workflows, including returns (Credit/Debit Notes), Contra, bill-wise allocation, and safe update/cancel patterns.

## Conventions (must follow)

- Always set `SVCURRENTCOMPANY`.
- Always set `DATE` as `YYYYMMDD`.
- Always include a unique `GUID` for idempotency.
- For bills/outstanding tracking, include `BILLALLOCATIONS.LIST` on the **party ledger entry**.
- Ensure voucher totals match (sum of amounts = 0).
- Escape XML special characters (`&` → `&amp;`).

## Voucher class — decision rules

Follow this decision tree **every time** before posting a Purchase or Sales voucher. Do not skip steps.

```
Does the company's voucher type have a class configured?
│
├─ YES → What is the exact class name?
│         │
│         ├─ Confirmed (e.g. "Purchase @ 18 %")
│         │   → Use Accounting Invoice Mode with class template below.
│         │   → Set CLASSNAME, CMPGSTIN, PARTYGSTIN, GSTREGISTRATIONTYPE, PLACEOFSUPPLY.
│         │   → Use LEDGERENTRIES.LIST (not ALLLEDGERENTRIES.LIST).
│         │
│         └─ Not confirmed / unsure
│             → STOP. Ask user: "What is the exact class name configured in Tally
│               for this voucher type?" Do not post until confirmed.
│
├─ NO  → Use ledger-only mode (no CLASSNAME in header).
│         → Choose mode based on inventory:
│             Item invoice  → Mode 1 (Invoice Voucher View + ALLINVENTORYENTRIES)
│             Ledger-only   → Mode 2 (Accounting Invoice Mode, no inventory)
│
└─ UNKNOWN → STOP. Ask user: "Does this company use voucher classes for GST
              (e.g. 'Purchase @ 18%')?" Do not guess.
```

### How to check if a voucher type uses a class

Export voucher type masters and look for `<CLASSNAME>` entries under the relevant voucher type, or ask the user to confirm in Tally UI via **Accounts Info → Voucher Types → Alter → [Voucher Type] → Default Class**.

### Class mode — required header fields

When `CLASSNAME` is set, always include all four GST header fields. Missing any one of them will cause Tally to reject the voucher or save it with incorrect GST treatment.

```xml
<CLASSNAME>Purchase @ 18 %</CLASSNAME>   <!-- exact name as configured in Tally -->
<CMPGSTIN>COMPANY_GSTIN</CMPGSTIN>
<PARTYGSTIN>PARTY_GSTIN</PARTYGSTIN>
<GSTREGISTRATIONTYPE>Regular</GSTREGISTRATIONTYPE>
<PLACEOFSUPPLY>STATE_NAME</PLACEOFSUPPLY>
```

### Class mode — full Purchase template (Invoice Voucher View)

Use this when `CLASSNAME` is confirmed. Note: ledger blocks use `LEDGERENTRIES.LIST`, not `ALLLEDGERENTRIES.LIST`.

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>Vouchers</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <VOUCHER VCHTYPE="Purchase" ACTION="Create" OBJVIEW="Invoice Voucher View">
            <GUID>GUID_VALUE</GUID>
            <DATE>YYYYMMDD</DATE>
            <VOUCHERTYPENAME>Purchase</VOUCHERTYPENAME>
            <VOUCHERNUMBER>INVOICE_NO</VOUCHERNUMBER>
            <PARTYLEDGERNAME>VENDOR_LEDGER</PARTYLEDGERNAME>
            <ISINVOICE>Yes</ISINVOICE>

            <!-- Class and GST header — required when class mode is active -->
            <CLASSNAME>Purchase @ 18 %</CLASSNAME>
            <CMPGSTIN>COMPANY_GSTIN</CMPGSTIN>
            <PARTYGSTIN>PARTY_GSTIN</PARTYGSTIN>
            <GSTREGISTRATIONTYPE>Regular</GSTREGISTRATIONTYPE>
            <PLACEOFSUPPLY>STATE_NAME</PLACEOFSUPPLY>

            <!-- Party (vendor) — use LEDGERENTRIES.LIST in Invoice Voucher View -->
            <LEDGERENTRIES.LIST>
              <LEDGERNAME>VENDOR_LEDGER</LEDGERNAME>
              <ISPARTYLEDGER>Yes</ISPARTYLEDGER>
              <ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
              <AMOUNT>TOTAL_AMOUNT</AMOUNT>
              <BILLALLOCATIONS.LIST>
                <NAME>INVOICE_NO</NAME>
                <BILLTYPE>New Ref</BILLTYPE>
                <AMOUNT>TOTAL_AMOUNT</AMOUNT>
                <BILLDATE>YYYYMMDD</BILLDATE>
              </BILLALLOCATIONS.LIST>
            </LEDGERENTRIES.LIST>

            <!-- Purchase ledger (taxable value) -->
            <LEDGERENTRIES.LIST>
              <LEDGERNAME>PURCHASE_LEDGER</LEDGERNAME>
              <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
              <AMOUNT>-TAXABLE_VALUE</AMOUNT>
            </LEDGERENTRIES.LIST>

            <!-- GST Input CGST -->
            <LEDGERENTRIES.LIST>
              <LEDGERNAME>Input Cgst @ 9 %</LEDGERNAME>
              <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
              <AMOUNT>-CGST_AMOUNT</AMOUNT>
            </LEDGERENTRIES.LIST>

            <!-- GST Input SGST -->
            <LEDGERENTRIES.LIST>
              <LEDGERNAME>Input Sgst @ 9 %</LEDGERNAME>
              <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
              <AMOUNT>-SGST_AMOUNT</AMOUNT>
            </LEDGERENTRIES.LIST>
          </VOUCHER>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

### `LEDGERENTRIES.LIST` vs `ALLLEDGERENTRIES.LIST` — when to use which

| OBJVIEW | Correct tag | Wrong tag (silent failure) |
|---|---|---|
| `Invoice Voucher View` | `LEDGERENTRIES.LIST` | `ALLLEDGERENTRIES.LIST` |
| `Accounting Voucher View` | `ALLLEDGERENTRIES.LIST` | `LEDGERENTRIES.LIST` |

Using the wrong tag causes Tally to silently save the voucher with no ledger entries, producing the error "No accounting or inventory entries are available."

---

## Base template (Import Voucher)

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>Vouchers</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <VOUCHER VCHTYPE="VOUCHER_TYPE" ACTION="Create" OBJVIEW="Accounting Voucher View">
            <!-- voucher body -->
          </VOUCHER>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

## Amount sign conventions (rule of thumb)

Tally’s sign conventions can vary by persisted view and voucher configuration. The most reliable method is: **create the voucher in Tally UI once, export to XML, and replicate the tags/signs**.

That said, many setups follow:

| Voucher | Party entry | Counter-ledger entry |
|---|---|---|
| Sales | Party debit (receivable) | Sales/GST credit |
| Purchase | Party credit (payable) | Purchase/GST debit |
| Receipt | Bank/Cash debit | Party credit |
| Payment | Party debit | Bank/Cash credit |

If Tally returns “Voucher totals do not match!”, adjust sign conventions to match the exported “known good” format.

## Bill-wise allocation snippet (attach to party ledger entry)

Use this on party ledger entries (customers/vendors) to keep outstandings accurate.

```xml
<BILLALLOCATIONS.LIST>
  <NAME>INVOICE_OR_REF</NAME>
  <BILLTYPE>New Ref</BILLTYPE>
  <AMOUNT>AMOUNT_SIGNED</AMOUNT>
</BILLALLOCATIONS.LIST>
```

Bill types: `New Ref`, `Agst Ref`, `Advance`, `On Account`.

## Sales (Invoice) — accounting-only

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>Vouchers</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <VOUCHER VCHTYPE="Sales" ACTION="Create" OBJVIEW="Accounting Voucher View">
            <GUID>UNIQUE_GUID</GUID>
            <DATE>YYYYMMDD</DATE>
            <VOUCHERTYPENAME>Sales</VOUCHERTYPENAME>
            <VOUCHERNUMBER>INVOICE_NO</VOUCHERNUMBER>
            <NARRATION>NARRATION_TEXT</NARRATION>
            <ISINVOICE>Yes</ISINVOICE>
            <PARTYLEDGERNAME>CUSTOMER_LEDGER</PARTYLEDGERNAME>

            <!-- Party (customer) -->
            <ALLLEDGERENTRIES.LIST>
              <LEDGERNAME>CUSTOMER_LEDGER</LEDGERNAME>
              <ISPARTYLEDGER>Yes</ISPARTYLEDGER>
              <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
              <AMOUNT>-TOTAL_AMOUNT</AMOUNT>
              <BILLALLOCATIONS.LIST>
                <NAME>INVOICE_NO</NAME>
                <BILLTYPE>New Ref</BILLTYPE>
                <AMOUNT>-TOTAL_AMOUNT</AMOUNT>
              </BILLALLOCATIONS.LIST>
            </ALLLEDGERENTRIES.LIST>

            <!-- Sales ledger -->
            <ALLLEDGERENTRIES.LIST>
              <LEDGERNAME>SALES_LEDGER</LEDGERNAME>
              <ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
              <AMOUNT>BASE_AMOUNT</AMOUNT>
            </ALLLEDGERENTRIES.LIST>

            <!-- GST Output (optional) -->
            <ALLLEDGERENTRIES.LIST>
              <LEDGERNAME>GST_OUTPUT_LEDGER</LEDGERNAME>
              <ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
              <AMOUNT>GST_AMOUNT</AMOUNT>
            </ALLLEDGERENTRIES.LIST>
          </VOUCHER>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

## Purchase — three modes

Choose the mode based on what the client needs. All three use `VCHTYPE="Purchase"`.

| Mode | `OBJVIEW` | `ISINVOICE` | Has inventory | Use when |
|---|---|---|---|---|
| Item Invoice | `Invoice Voucher View` | Yes | Yes (`ALLINVENTORYENTRIES`) | Stock items with Rate/Qty/Amount columns |
| Accounting Invoice | `Invoice Voucher View` | Yes | No | Invoice layout but ledger-only (services, expenses) |
| As Voucher | `Accounting Voucher View` | No | No | Classic By/To accounting view; best fallback |

### Mode 1 — Item Invoice (stock-based, Rate/Qty/Amount)

`OBJVIEW="Invoice Voucher View"` + `ISINVOICE=Yes` + `ALLINVENTORYENTRIES.LIST`. Use when you want full stock-item detail and the invoice layout.

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>Vouchers</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <VOUCHER VCHTYPE="Purchase" ACTION="Create" OBJVIEW="Invoice Voucher View">
            <GUID>GUID_VALUE</GUID>
            <DATE>YYYYMMDD</DATE>
            <VOUCHERTYPENAME>Purchase</VOUCHERTYPENAME>
            <VOUCHERNUMBER>INVOICE_NO</VOUCHERNUMBER>
            <PARTYLEDGERNAME>VENDOR_LEDGER</PARTYLEDGERNAME>
            <ISINVOICE>Yes</ISINVOICE>

            <!-- Party (vendor) — credit side -->
            <ALLLEDGERENTRIES.LIST>
              <LEDGERNAME>VENDOR_LEDGER</LEDGERNAME>
              <ISPARTYLEDGER>Yes</ISPARTYLEDGER>
              <ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
              <AMOUNT>TOTAL_AMOUNT</AMOUNT>
              <BILLALLOCATIONS.LIST>
                <NAME>INVOICE_NO</NAME>
                <BILLTYPE>New Ref</BILLTYPE>
                <AMOUNT>TOTAL_AMOUNT</AMOUNT>
                <BILLDATE>YYYYMMDD</BILLDATE>
              </BILLALLOCATIONS.LIST>
            </ALLLEDGERENTRIES.LIST>

            <!-- Stock item line(s) — repeat for each item -->
            <ALLINVENTORYENTRIES.LIST>
              <STOCKITEM>STOCK_ITEM_NAME</STOCKITEM>
              <ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
              <RATE>RATE_PER_UNIT</RATE>
              <AMOUNT>LINE_AMOUNT</AMOUNT>
              <ACTUALQTY>QUANTITY</ACTUALQTY>
              <BILLEDQTY>QUANTITY</BILLEDQTY>
              <BATCHALLOCATIONS.LIST>
                <GODOWNNAME>Main Location</GODOWNNAME>
                <BATCHNAME>Primary Batch</BATCHNAME>
                <QUANTITY>QUANTITY</QUANTITY>
              </BATCHALLOCATIONS.LIST>
            </ALLINVENTORYENTRIES.LIST>

            <!-- Purchase ledger (taxable value) -->
            <ALLLEDGERENTRIES.LIST>
              <LEDGERNAME>PURCHASE_LEDGER</LEDGERNAME>
              <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
              <AMOUNT>-TAXABLE_VALUE</AMOUNT>
            </ALLLEDGERENTRIES.LIST>

            <!-- GST Input CGST -->
            <ALLLEDGERENTRIES.LIST>
              <LEDGERNAME>Input Cgst @ 9 %</LEDGERNAME>
              <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
              <AMOUNT>-CGST_AMOUNT</AMOUNT>
            </ALLLEDGERENTRIES.LIST>

            <!-- GST Input SGST -->
            <ALLLEDGERENTRIES.LIST>
              <LEDGERNAME>Input Sgst @ 9 %</LEDGERNAME>
              <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
              <AMOUNT>-SGST_AMOUNT</AMOUNT>
            </ALLLEDGERENTRIES.LIST>
          </VOUCHER>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

### Mode 2 — Accounting Invoice (invoice layout, no inventory)

`OBJVIEW="Invoice Voucher View"` + `ISINVOICE=Yes` + ledger entries only (no `ALLINVENTORYENTRIES`). Renders the party header and invoice columns without requiring stock items. Supports round-off entry.

> **Critical — use `LEDGERENTRIES.LIST`, not `ALLLEDGERENTRIES.LIST`**
> When `OBJVIEW="Invoice Voucher View"` is set, Tally silently ignores every `<ALLLEDGERENTRIES.LIST>` block and saves the voucher with no accounting entries, producing the error "No accounting or inventory entries are available." Switch every ledger block to `<LEDGERENTRIES.LIST>` for this mode.

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>Vouchers</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <VOUCHER VCHTYPE="Purchase" ACTION="Create" OBJVIEW="Invoice Voucher View">
            <GUID>GUID_VALUE</GUID>
            <DATE>YYYYMMDD</DATE>
            <VOUCHERTYPENAME>Purchase</VOUCHERTYPENAME>
            <VOUCHERNUMBER>INVOICE_NO</VOUCHERNUMBER>
            <PARTYLEDGERNAME>VENDOR_LEDGER</PARTYLEDGERNAME>
            <ISINVOICE>Yes</ISINVOICE>
            <NARRATION>NARRATION_TEXT</NARRATION>

            <!-- Party (vendor) — credit side -->
            <LEDGERENTRIES.LIST>
              <LEDGERNAME>VENDOR_LEDGER</LEDGERNAME>
              <ISPARTYLEDGER>Yes</ISPARTYLEDGER>
              <ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
              <AMOUNT>TOTAL_AMOUNT</AMOUNT>
              <BILLALLOCATIONS.LIST>
                <NAME>INVOICE_NO</NAME>
                <BILLTYPE>New Ref</BILLTYPE>
                <AMOUNT>TOTAL_AMOUNT</AMOUNT>
                <BILLDATE>YYYYMMDD</BILLDATE>
              </BILLALLOCATIONS.LIST>
            </LEDGERENTRIES.LIST>

            <!-- Purchase / expense ledger -->
            <LEDGERENTRIES.LIST>
              <LEDGERNAME>PURCHASE_LEDGER</LEDGERNAME>
              <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
              <AMOUNT>-TAXABLE_VALUE</AMOUNT>
            </LEDGERENTRIES.LIST>

            <!-- GST Input CGST -->
            <LEDGERENTRIES.LIST>
              <LEDGERNAME>Input Cgst @ 9 %</LEDGERNAME>
              <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
              <AMOUNT>-CGST_AMOUNT</AMOUNT>
            </LEDGERENTRIES.LIST>

            <!-- GST Input SGST -->
            <LEDGERENTRIES.LIST>
              <LEDGERNAME>Input Sgst @ 9 %</LEDGERNAME>
              <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
              <AMOUNT>-SGST_AMOUNT</AMOUNT>
            </LEDGERENTRIES.LIST>

            <!-- Round off (optional) -->
            <LEDGERENTRIES.LIST>
              <LEDGERNAME>Round Off</LEDGERNAME>
              <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
              <AMOUNT>-ROUND_OFF</AMOUNT>
            </LEDGERENTRIES.LIST>
          </VOUCHER>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

### Mode 2 variant — Accounting Invoice with a voucher class

If the Purchase voucher type is configured to use a **voucher class** (e.g. `Purchase @ 18 %`) for automatic GST splits, the XML must declare the class and supply the GST identification fields. Without `<CLASSNAME>`, Tally assumes the class will provide ledger entries and rejects a ledger-only payload with "No accounting or inventory entries are available."

Required additions when a class is in use:

| Field | Where | Purpose |
|---|---|---|
| `<CLASSNAME>` | `<VOUCHER>` header | Activates the voucher class (exact name as defined in Tally) |
| `<CMPGSTIN>` | `<VOUCHER>` header | Company GSTIN (15-char) |
| `<PARTYGSTIN>` | `<VOUCHER>` header | Vendor GSTIN |
| `<GSTREGISTRATIONTYPE>` | `<VOUCHER>` header | e.g. `Regular` |
| `<PLACEOFSUPPLY>` | `<VOUCHER>` header | State name for IGST/CGST+SGST determination |

```xml
<VOUCHER VCHTYPE="Purchase" ACTION="Create" OBJVIEW="Invoice Voucher View">
  <GUID>GUID_VALUE</GUID>
  <DATE>YYYYMMDD</DATE>
  <VOUCHERTYPENAME>Purchase</VOUCHERTYPENAME>
  <CLASSNAME>Purchase @ 18 %</CLASSNAME>
  <VOUCHERNUMBER>INVOICE_NO</VOUCHERNUMBER>
  <PARTYLEDGERNAME>VENDOR_LEDGER</PARTYLEDGERNAME>
  <ISINVOICE>Yes</ISINVOICE>
  <NARRATION>NARRATION_TEXT</NARRATION>

  <!-- GST header fields required when a class is active -->
  <CMPGSTIN>COMPANY_GSTIN</CMPGSTIN>
  <PARTYGSTIN>VENDOR_GSTIN</PARTYGSTIN>
  <GSTREGISTRATIONTYPE>Regular</GSTREGISTRATIONTYPE>
  <PLACEOFSUPPLY>STATE_NAME</PLACEOFSUPPLY>

  <!-- Party (vendor) — credit side; use LEDGERENTRIES.LIST in Invoice Voucher View -->
  <LEDGERENTRIES.LIST>
    <LEDGERNAME>VENDOR_LEDGER</LEDGERNAME>
    <ISPARTYLEDGER>Yes</ISPARTYLEDGER>
    <ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
    <AMOUNT>TOTAL_AMOUNT</AMOUNT>
    <BILLALLOCATIONS.LIST>
      <NAME>INVOICE_NO</NAME>
      <BILLTYPE>New Ref</BILLTYPE>
      <AMOUNT>TOTAL_AMOUNT</AMOUNT>
      <BILLDATE>YYYYMMDD</BILLDATE>
    </BILLALLOCATIONS.LIST>
  </LEDGERENTRIES.LIST>

  <!-- Purchase / expense ledger (taxable value) -->
  <LEDGERENTRIES.LIST>
    <LEDGERNAME>PURCHASE_LEDGER</LEDGERNAME>
    <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
    <AMOUNT>-TAXABLE_VALUE</AMOUNT>
  </LEDGERENTRIES.LIST>

  <!-- GST ledgers — class drives the split, but entries must still be explicit -->
  <LEDGERENTRIES.LIST>
    <LEDGERNAME>Input Cgst @ 9 %</LEDGERNAME>
    <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
    <AMOUNT>-CGST_AMOUNT</AMOUNT>
  </LEDGERENTRIES.LIST>

  <LEDGERENTRIES.LIST>
    <LEDGERNAME>Input Sgst @ 9 %</LEDGERNAME>
    <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
    <AMOUNT>-SGST_AMOUNT</AMOUNT>
  </LEDGERENTRIES.LIST>
</VOUCHER>
```

### Mode 3 — As Voucher (classic accounting entry, fallback)

`OBJVIEW="Accounting Voucher View"` + `ISINVOICE=No`. Tally renders this with By/To columns. **Party entry must come first** so the Day Book "Particulars" column shows the vendor name.

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>Vouchers</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <VOUCHER VCHTYPE="Purchase" ACTION="Create" OBJVIEW="Accounting Voucher View">
            <GUID>GUID_VALUE</GUID>
            <DATE>YYYYMMDD</DATE>
            <VOUCHERTYPENAME>Purchase</VOUCHERTYPENAME>
            <VOUCHERNUMBER>INVOICE_NO</VOUCHERNUMBER>
            <PARTYLEDGERNAME>VENDOR_LEDGER</PARTYLEDGERNAME>
            <ISINVOICE>No</ISINVOICE>
            <NARRATION>NARRATION_TEXT</NARRATION>

            <!-- Party (vendor) — FIRST so Particulars shows vendor name -->
            <ALLLEDGERENTRIES.LIST>
              <LEDGERNAME>VENDOR_LEDGER</LEDGERNAME>
              <ISPARTYLEDGER>Yes</ISPARTYLEDGER>
              <ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
              <AMOUNT>TOTAL_AMOUNT</AMOUNT>
            </ALLLEDGERENTRIES.LIST>

            <!-- Purchase / expense ledger -->
            <ALLLEDGERENTRIES.LIST>
              <LEDGERNAME>PURCHASE_LEDGER</LEDGERNAME>
              <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
              <AMOUNT>-TAXABLE_VALUE</AMOUNT>
            </ALLLEDGERENTRIES.LIST>

            <!-- GST Input CGST -->
            <ALLLEDGERENTRIES.LIST>
              <LEDGERNAME>Input Cgst @ 9 %</LEDGERNAME>
              <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
              <AMOUNT>-CGST_AMOUNT</AMOUNT>
            </ALLLEDGERENTRIES.LIST>

            <!-- GST Input SGST -->
            <ALLLEDGERENTRIES.LIST>
              <LEDGERNAME>Input Sgst @ 9 %</LEDGERNAME>
              <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
              <AMOUNT>-SGST_AMOUNT</AMOUNT>
            </ALLLEDGERENTRIES.LIST>

            <!-- Round off (optional) -->
            <ALLLEDGERENTRIES.LIST>
              <LEDGERNAME>Round Off</LEDGERNAME>
              <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
              <AMOUNT>-ROUND_OFF</AMOUNT>
            </ALLLEDGERENTRIES.LIST>
          </VOUCHER>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

## Receipt (money received)

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>Vouchers</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <VOUCHER VCHTYPE="Receipt" ACTION="Create" OBJVIEW="Accounting Voucher View">
            <GUID>UNIQUE_GUID</GUID>
            <DATE>YYYYMMDD</DATE>
            <VOUCHERTYPENAME>Receipt</VOUCHERTYPENAME>
            <NARRATION>NARRATION_TEXT</NARRATION>
            <ISINVOICE>No</ISINVOICE>
            <PARTYLEDGERNAME>CUSTOMER_LEDGER</PARTYLEDGERNAME>

            <!-- Bank/Cash (money in) -->
            <ALLLEDGERENTRIES.LIST>
              <LEDGERNAME>BANK_OR_CASH_LEDGER</LEDGERNAME>
              <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
              <AMOUNT>-AMOUNT</AMOUNT>
            </ALLLEDGERENTRIES.LIST>

            <!-- Customer -->
            <ALLLEDGERENTRIES.LIST>
              <LEDGERNAME>CUSTOMER_LEDGER</LEDGERNAME>
              <ISPARTYLEDGER>Yes</ISPARTYLEDGER>
              <ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
              <AMOUNT>AMOUNT</AMOUNT>
            </ALLLEDGERENTRIES.LIST>
          </VOUCHER>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

## Payment (money paid)

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>Vouchers</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <VOUCHER VCHTYPE="Payment" ACTION="Create" OBJVIEW="Accounting Voucher View">
            <GUID>UNIQUE_GUID</GUID>
            <DATE>YYYYMMDD</DATE>
            <VOUCHERTYPENAME>Payment</VOUCHERTYPENAME>
            <NARRATION>NARRATION_TEXT</NARRATION>
            <ISINVOICE>No</ISINVOICE>
            <PARTYLEDGERNAME>VENDOR_OR_EXPENSE_LEDGER</PARTYLEDGERNAME>

            <!-- Payee (vendor/expense) -->
            <ALLLEDGERENTRIES.LIST>
              <LEDGERNAME>VENDOR_OR_EXPENSE_LEDGER</LEDGERNAME>
              <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
              <AMOUNT>-AMOUNT</AMOUNT>
            </ALLLEDGERENTRIES.LIST>

            <!-- Bank/Cash (money out) -->
            <ALLLEDGERENTRIES.LIST>
              <LEDGERNAME>BANK_OR_CASH_LEDGER</LEDGERNAME>
              <ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
              <AMOUNT>AMOUNT</AMOUNT>
            </ALLLEDGERENTRIES.LIST>
          </VOUCHER>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

## Journal (adjustments)

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>Vouchers</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <VOUCHER VCHTYPE="Journal" ACTION="Create" OBJVIEW="Accounting Voucher View">
            <GUID>UNIQUE_GUID</GUID>
            <DATE>YYYYMMDD</DATE>
            <VOUCHERTYPENAME>Journal</VOUCHERTYPENAME>
            <NARRATION>NARRATION_TEXT</NARRATION>
            <ISINVOICE>No</ISINVOICE>

            <!-- Debit -->
            <ALLLEDGERENTRIES.LIST>
              <LEDGERNAME>DEBIT_LEDGER</LEDGERNAME>
              <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
              <AMOUNT>-AMOUNT</AMOUNT>
            </ALLLEDGERENTRIES.LIST>

            <!-- Credit -->
            <ALLLEDGERENTRIES.LIST>
              <LEDGERNAME>CREDIT_LEDGER</LEDGERNAME>
              <ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
              <AMOUNT>AMOUNT</AMOUNT>
            </ALLLEDGERENTRIES.LIST>
          </VOUCHER>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

## Credit Note (sales return)

Credit Note is commonly a separate voucher type configured in Tally. If your voucher type name differs, set `VCHTYPE` and `VOUCHERTYPENAME` accordingly.

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>Vouchers</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <VOUCHER VCHTYPE="Credit Note" ACTION="Create" OBJVIEW="Accounting Voucher View">
            <GUID>UNIQUE_GUID</GUID>
            <DATE>YYYYMMDD</DATE>
            <VOUCHERTYPENAME>Credit Note</VOUCHERTYPENAME>
            <VOUCHERNUMBER>CN_NO</VOUCHERNUMBER>
            <NARRATION>NARRATION_TEXT</NARRATION>
            <ISINVOICE>No</ISINVOICE>
            <PARTYLEDGERNAME>CUSTOMER_LEDGER</PARTYLEDGERNAME>

            <!-- Reduce sales / reverse tax as per configuration -->
            <ALLLEDGERENTRIES.LIST>
              <LEDGERNAME>SALES_RETURN_LEDGER</LEDGERNAME>
              <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
              <AMOUNT>-BASE_AMOUNT</AMOUNT>
            </ALLLEDGERENTRIES.LIST>

            <ALLLEDGERENTRIES.LIST>
              <LEDGERNAME>GST_OUTPUT_LEDGER</LEDGERNAME>
              <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
              <AMOUNT>-GST_AMOUNT</AMOUNT>
            </ALLLEDGERENTRIES.LIST>

            <ALLLEDGERENTRIES.LIST>
              <LEDGERNAME>CUSTOMER_LEDGER</LEDGERNAME>
              <ISPARTYLEDGER>Yes</ISPARTYLEDGER>
              <ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
              <AMOUNT>TOTAL_AMOUNT</AMOUNT>
            </ALLLEDGERENTRIES.LIST>
          </VOUCHER>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

## Debit Note (purchase return)

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>Vouchers</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <VOUCHER VCHTYPE="Debit Note" ACTION="Create" OBJVIEW="Accounting Voucher View">
            <GUID>UNIQUE_GUID</GUID>
            <DATE>YYYYMMDD</DATE>
            <VOUCHERTYPENAME>Debit Note</VOUCHERTYPENAME>
            <VOUCHERNUMBER>DN_NO</VOUCHERNUMBER>
            <NARRATION>NARRATION_TEXT</NARRATION>
            <ISINVOICE>No</ISINVOICE>
            <PARTYLEDGERNAME>VENDOR_LEDGER</PARTYLEDGERNAME>

            <ALLLEDGERENTRIES.LIST>
              <LEDGERNAME>PURCHASE_RETURN_LEDGER</LEDGERNAME>
              <ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
              <AMOUNT>BASE_AMOUNT</AMOUNT>
            </ALLLEDGERENTRIES.LIST>

            <ALLLEDGERENTRIES.LIST>
              <LEDGERNAME>GST_INPUT_LEDGER</LEDGERNAME>
              <ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
              <AMOUNT>GST_AMOUNT</AMOUNT>
            </ALLLEDGERENTRIES.LIST>

            <ALLLEDGERENTRIES.LIST>
              <LEDGERNAME>VENDOR_LEDGER</LEDGERNAME>
              <ISPARTYLEDGER>Yes</ISPARTYLEDGER>
              <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
              <AMOUNT>-TOTAL_AMOUNT</AMOUNT>
            </ALLLEDGERENTRIES.LIST>
          </VOUCHER>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

## Contra (bank transfers / cash deposit / withdrawal)

Contra vouchers are highly configuration-dependent. Use as a template and validate signs by exporting a known-good contra voucher from the client’s Tally.

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>Vouchers</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <VOUCHER VCHTYPE="Contra" ACTION="Create" OBJVIEW="Accounting Voucher View">
            <GUID>UNIQUE_GUID</GUID>
            <DATE>YYYYMMDD</DATE>
            <VOUCHERTYPENAME>Contra</VOUCHERTYPENAME>
            <NARRATION>NARRATION_TEXT</NARRATION>
            <ISINVOICE>No</ISINVOICE>

            <!-- From account -->
            <ALLLEDGERENTRIES.LIST>
              <LEDGERNAME>FROM_LEDGER</LEDGERNAME>
              <ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
              <AMOUNT>-AMOUNT</AMOUNT>
            </ALLLEDGERENTRIES.LIST>

            <!-- To account -->
            <ALLLEDGERENTRIES.LIST>
              <LEDGERNAME>TO_LEDGER</LEDGERNAME>
              <ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
              <AMOUNT>AMOUNT</AMOUNT>
            </ALLLEDGERENTRIES.LIST>
          </VOUCHER>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

## Voucher alteration (edit existing)

Voucher identification typically requires a stable identifier (GUID or master ID). If you created the voucher via integration with a GUID, you can re-send with the same GUID and `ACTION="Alter"` (or use the documented alteration approach for your Tally setup).

Template (fill in the exact identifiers based on exported voucher XML):

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>Vouchers</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <VOUCHER VCHTYPE="Sales" ACTION="Alter" OBJVIEW="Accounting Voucher View">
            <GUID>EXISTING_GUID</GUID>
            <!-- Include the full altered voucher content -->
          </VOUCHER>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

## Voucher cancellation (void)

Cancellation is similar to alteration, but uses `ACTION="Cancel"` for the identified voucher.

```xml
<?xml version="1.0" encoding="utf-8"?>
<ENVELOPE>
  <HEADER><TALLYREQUEST>Import Data</TALLYREQUEST></HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <REPORTNAME>Vouchers</REPORTNAME>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>COMPANY_NAME</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <VOUCHER VCHTYPE="Sales" ACTION="Cancel" OBJVIEW="Accounting Voucher View">
            <GUID>EXISTING_GUID</GUID>
          </VOUCHER>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>
```

## Multi-line item invoices (inventory)

For itemized invoices using `ALLINVENTORYENTRIES.LIST` and `ACCOUNTINGALLOCATIONS.LIST`, see `reference/inventory.md`.



Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (HIGH)