Purchase Vouchers With Inventory
Published
This exercise imports Purchase 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 Purchase 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 | SUPPLIER'S NAME | PURCHASE LEDGER | STOCK ITEM | QTY | UNIT | RATE | AMOUNT | NARRATION |
| 2 | 11077 | 01/04/2026 | Vero Beach Embroidery | Purchase Account | Silk Thread | 10 | Nos | 10 | 100 | Silk |
| 3 | 11078 | 01/04/2026 | A R S Marketing | Purchase Account | Cotton Fabric | 5 | Mtr | 40 | 200 | Mix |
| 4 | 11079 | 01/04/2026 | Vero Beach Embroidery | Purchase Account | Silk Thread | 30 | Nos | 10 | 300 | Silk |
| 5 | 11080 | 01/04/2026 | V S Traders | Purchase Account | Embroidery Needle | 20 | Nos | 20 | 400 | Mix |
| 6 | 11081 | 01/04/2026 | Parimal Arts | Purchase Account | Cotton Fabric | 12.5 | Mtr | 40 | 500 | Silk |
Step 1 — Create the masters
The voucher refers to four masters: the Supplier Ledger (Column C), the Purchase
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 Supplier LEDGER Master (Column C) -->
<MASTER TYPE="LEDGER">
<NAME.LIST>
<NAME COLUMNREFERENCE="C"/>
</NAME.LIST>
<!-- Suppliers are created under Sundry Creditors -->
<PARENT>Sundry Creditors</PARENT>
<ISBILLWISEON>Yes</ISBILLWISEON>
<AFFECTSSTOCK>No</AFFECTSSTOCK>
<ISCOSTCENTRESON>No</ISCOSTCENTRESON>
</MASTER>
<!-- Create Purchase LEDGER Master (Column D) -->
<MASTER TYPE="LEDGER">
<NAME.LIST>
<NAME COLUMNREFERENCE="D"/>
</NAME.LIST>
<PARENT>Purchase 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 Purchase Voucher in invoice mode. The Supplier Ledger is
credited under LEDGERENTRIES.LIST, while the Stock Item line under
ALLINVENTORYENTRIES.LIST carries the quantity, rate and amount,
and debits the Purchase 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 : Purchase invoice with Stock Items (one Excel row = one voucher) -->
<VOUCHER>
<!-- Unique ID of the voucher : Invoice No. (Column A) -->
<GUID FORMULA="=+"udi-PRCHSE" & A#"/>
<DATE COLUMNREFERENCE="B"/>
<EFFECTIVEDATE COLUMNREFERENCE="B"/>
<VOUCHERTYPENAME>Purchase</VOUCHERTYPENAME>
<VOUCHERNUMBER COLUMNREFERENCE="A"/>
<NARRATION COLUMNREFERENCE="J"/>
<ISINVOICE>Yes</ISINVOICE>
<PERSISTEDVIEW>Invoice Voucher View</PERSISTEDVIEW>
<!-- Supplier -->
<PARTYNAME COLUMNREFERENCE="C"/>
<PARTYLEDGERNAME COLUMNREFERENCE="C"/>
<BASICBASEPARTYNAME COLUMNREFERENCE="C"/>
<BASICBUYERNAME COLUMNREFERENCE="C"/>
<!-- Supplier Ledger : Credited (Cr), amount is positive -->
<LEDGERENTRIES.LIST>
<LEDGERNAME COLUMNREFERENCE="C"/>
<ISDEEMEDPOSITIVE>No</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 : Purchase Ledger (Column D) is Debited via the accounting allocation -->
<ALLINVENTORYENTRIES.LIST>
<STOCKITEMNAME COLUMNREFERENCE="E"/>
<ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
<RATE COLUMNREFERENCE="H"/>
<AMOUNT FORMULA="=+I#*-1"/>
<ACTUALQTY COLUMNREFERENCE="F"/>
<BILLEDQTY COLUMNREFERENCE="F"/>
<!-- Purchase Ledger -->
<ACCOUNTINGALLOCATIONS.LIST>
<LEDGERNAME COLUMNREFERENCE="D"/>
<ISDEEMEDPOSITIVE>Yes</ISDEEMEDPOSITIVE>
<AMOUNT FORMULA="=+I#*-1"/>
</ACCOUNTINGALLOCATIONS.LIST>
<BATCHALLOCATIONS.LIST>
<GODOWNNAME>Main Location</GODOWNNAME>
<BATCHNAME>Primary Batch</BATCHNAME>
<DESTINATIONGODOWNNAME>Main Location</DESTINATIONGODOWNNAME>
<AMOUNT FORMULA="=+I#*-1"/>
<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 Purchase Ledger has
AFFECTSSTOCKset toYesbecause it is used with Stock Items; the Supplier Ledger has it set toNo. - The Supplier Ledger is credited with a positive amount (
=+I#*1), and the Purchase Ledger is debited with the negative amount (=+I#*-1) through the accounting allocation, so the voucher nets to zero. - The Voucher
GUIDuses its own prefix (udi-PRCHSE), so a Purchase Voucher never overwrites a Sales Voucher that has the same invoice number. - 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