Sales Vouchers With Inventory
Published
This exercise imports Sales Invoices that carry stock item line items — each Excel row becomes one voucher with a Stock Item, its Quantity, Unit and Rate, posted against a Sales Ledger. It builds on the previous exercise by adding the Unit and Stock Item masters and the inventory entries of the voucher.
The Excel sheet
| A | B | C | D | E | F | G | H | I | J | |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | INV NO. | DATE | CLIENT'S NAME | SALES LEDGER | STOCK ITEM | QTY | UNIT | RATE | AMOUNT | NARRATION |
| 2 | 11077 | 01/04/2026 | Vero Beach Embroidery | Sales Account | Silk Thread | 10 | Nos | 10 | 100 | Silk |
| 3 | 11078 | 01/04/2026 | A R S Marketing | Sales Account | Cotton Fabric | 5 | Mtr | 40 | 200 | Mix |
| 4 | 11079 | 01/04/2026 | Vero Beach Embroidery | Sales Account | Silk Thread | 30 | Nos | 10 | 300 | Silk |
| 5 | 11080 | 01/04/2026 | V S Traders | Sales Account | Embroidery Needle | 20 | Nos | 20 | 400 | Mix |
| 6 | 11081 | 01/04/2026 | Parimal Arts | Sales Account | Cotton Fabric | 12.5 | Mtr | 40 | 500 | Silk |
Step 1 — Create the masters
The voucher refers to four masters: the Party Ledger (Column C), the Sales
Ledger (Column D), the Unit (Column G) and the Stock Item (Column E).
udiMagic processes MASTER tags before VOUCHER tags,
so anything that doesn't exist yet in Tally is created in the same import.
The UNIT master must come before the STOCKITEM,
because the Stock Item uses the Unit as its base unit.
<!-- Create Party LEDGER Master (Column C) -->
<MASTER TYPE="LEDGER">
<NAME.LIST>
<NAME COLUMNREFERENCE="C"/>
</NAME.LIST>
<!-- Group is hard coded -->
<PARENT>Sundry Debtors</PARENT>
<ISBILLWISEON>Yes</ISBILLWISEON>
<AFFECTSSTOCK>No</AFFECTSSTOCK>
<ISCOSTCENTRESON>No</ISCOSTCENTRESON>
</MASTER>
<!-- Create Sales LEDGER Master (Column D) -->
<MASTER TYPE="LEDGER">
<NAME.LIST>
<NAME COLUMNREFERENCE="D"/>
</NAME.LIST>
<PARENT>Sales Accounts</PARENT>
<ISBILLWISEON>No</ISBILLWISEON>
<ISCOSTCENTRESON>No</ISCOSTCENTRESON>
<!-- Yes, because this ledger is used with Stock Items -->
<AFFECTSSTOCK>Yes</AFFECTSSTOCK>
<USEFORVAT>No</USEFORVAT>
</MASTER>
<!-- Create UNIT Master (Column G). Must come before the StockItem. -->
<MASTER TYPE="UNIT">
<!-- The UNIT Master does not support Aliases : use NAME directly -->
<NAME COLUMNREFERENCE="G"/>
<ISSIMPLEUNIT>Yes</ISSIMPLEUNIT>
</MASTER>
<!-- Create STOCKITEM Master (Column E) -->
<MASTER TYPE="STOCKITEM">
<NAME.LIST>
<NAME COLUMNREFERENCE="E"/>
</NAME.LIST>
<!-- Empty PARENT = no Stock Group (udiMagic default) -->
<PARENT/>
<BASEUNITS COLUMNREFERENCE="G"/>
</MASTER>
Step 2 — Write the Voucher tags
Each Excel row becomes one Sales Voucher in invoice mode. The Party Ledger is
debited under LEDGERENTRIES.LIST, while the Stock Item line under
ALLINVENTORYENTRIES.LIST carries the quantity, rate and amount,
and credits the Sales Ledger through its
ACCOUNTINGALLOCATIONS.LIST. To see the exact structure Tally
uses, enter one sample invoice in Tally Prime and export it from
Gateway of Tally >> Display >> Daybook >> Alt+E
(see udiMagic XML tags for how
COLUMNREFERENCE maps each tag to your Excel columns).
<!-- VOUCHER : Sales invoice with Stock Items (one Excel row = one voucher) -->
<VOUCHER>
<!-- Unique ID of the voucher : Invoice No. (Column A) -->
<GUID FORMULA="=+"udi-MLKIYT" & A#"/>
<DATE COLUMNREFERENCE="B"/>
<EFFECTIVEDATE COLUMNREFERENCE="B"/>
<VOUCHERTYPENAME>Sales</VOUCHERTYPENAME>
<VOUCHERNUMBER COLUMNREFERENCE="A"/>
<NARRATION COLUMNREFERENCE="J"/>
<ISINVOICE>Yes</ISINVOICE>
<PERSISTEDVIEW>Invoice Voucher View</PERSISTEDVIEW>
<!-- Party (Client) -->
<PARTYNAME COLUMNREFERENCE="C"/>
<PARTYLEDGERNAME COLUMNREFERENCE="C"/>
<BASICBASEPARTYNAME COLUMNREFERENCE="C"/>
<BASICBUYERNAME COLUMNREFERENCE="C"/>
<!-- Party Ledger : Debited (Dr), amount is negative -->
<LEDGERENTRIES.LIST>
<LEDGERNAME COLUMNREFERENCE="C"/>
<ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
<AMOUNT FORMULA="=+I#*-1"/>
<BILLALLOCATIONS.LIST SKIP="=Len(trim(A#))=0">
<NAME COLUMNREFERENCE="A"/>
<BILLTYPE>New Ref</BILLTYPE>
<AMOUNT FORMULA="=+I#*-1"/>
</BILLALLOCATIONS.LIST>
</LEDGERENTRIES.LIST>
<!-- StockItem line : Sales Ledger (Column D) is Credited via the accounting allocation -->
<ALLINVENTORYENTRIES.LIST>
<STOCKITEMNAME COLUMNREFERENCE="E"/>
<ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
<RATE COLUMNREFERENCE="H"/>
<AMOUNT COLUMNREFERENCE="I"/>
<ACTUALQTY COLUMNREFERENCE="F"/>
<BILLEDQTY COLUMNREFERENCE="F"/>
<!-- Sales Ledger -->
<ACCOUNTINGALLOCATIONS.LIST>
<LEDGERNAME COLUMNREFERENCE="D"/>
<ISDEEMEDPOSITIVE>No</ISDEEMEDPOSITIVE>
<AMOUNT COLUMNREFERENCE="I"/>
</ACCOUNTINGALLOCATIONS.LIST>
<BATCHALLOCATIONS.LIST>
<GODOWNNAME>Main Location</GODOWNNAME>
<BATCHNAME>Primary Batch</BATCHNAME>
<DESTINATIONGODOWNNAME>Main Location</DESTINATIONGODOWNNAME>
<AMOUNT COLUMNREFERENCE="I"/>
<ACTUALQTY COLUMNREFERENCE="F"/>
<BILLEDQTY COLUMNREFERENCE="F"/>
</BATCHALLOCATIONS.LIST>
</ALLINVENTORYENTRIES.LIST>
</VOUCHER>
- Master tags are processed before the voucher, and the
UNITmaster must precede theSTOCKITEMmaster that uses it. - The
UNITmaster doesn't support aliases, soNAMEis used directly instead of aNAME.LIST. - The Sales Ledger has
AFFECTSSTOCKset toYesbecause it is used with Stock Items; the Party Ledger has it set toNo. - The Party Ledger is debited with a negative amount (
=+I#*-1), and the Sales Ledger is credited with the positive amount through the accounting allocation, so the voucher nets to zero. - The Godown (
Main Location) and Batch (Primary Batch) are hard-coded because the sheet has no columns for them. - Quantities can be decimals, such as 12.5 Mtr in the last row.
Ready to import your Excel data into Tally?
Download udiMagic and start a 14-day free trial — no credit card required.
Download udiMagic View Pricing