You are on page 1of 3

;; product: tdl38.

;; product-id: ae535cfa-1r7f-3h7a-31h3-a5r55a984e6e
;; author: shweta computers

;;using the explode attribute to display ledgers details in
;;my daybook format

;;add a new menu-item to the gateway of tally

[#menu: gateway of tally]

;;the action used here is display

item: example 38: display: my report

[report: my report]
form : my form

[form: my form]
part: my part

;;pre-defined button in default tally. try using key instead of button,

;;alt+f1 still works, but the "alt+f1" button is not displayed
button: explodeflag

[part: my part]
line: my line

repeat : my line: my collection

;;repeat : <line> : <collection>

scroll: vertical

;;shows border
common border: yes

[line: my line]
left fields: myfld1,myfld2,myfld3,myfld4

;;this shows the ledger details when alt+f1 key is pressed

explode: myexplodepart : (##explodeflag or $$keyexplode)

[field: myfld1]
;;type attribute specifies the data-type of the field
type : date
set as : $date

[field: myfld2]
;;the use keyword inherits the functionality/properties of the specified object
use : short name field
set as : $vouchertypename

[field: myfld3]
use : name field
set as : $$collectionfield:$ledgername:1:allledgerentries

[field: myfld4]
use : amount field
set as : $amount

;;this part is displayed when explodeflag variable is set to yes
;;i.e. when user presses alt+f1 key
[part: myexplodepart]
line : myexplodline

;;repeats the line myexplodeline to display the allledgerentries

;;collection fields
repeat : myexplodline : allledgerentries

;; specify the fields that you wish to display when the part is exploded
[line: myexplodline]

;;show this field on the left side of the line

add: right fields: fldexplodeledger,fldexplodeamount

;;this skips the first object of collection allledgerentries

empty: $$isfirstobj

;;ledger name field

[field: fldexplodeledger]
use : name field
set as : if not $$isfirstobj then $ledgername else ""
style : small italic
width : @@namewidth

;;amount field
[field: fldexplodeamount]
use : amount field
set as : $amount
style : small italic
width : @@shortwidth

;;collection definition
[collection: my collection]
type: voucher

;; notes:-
;; 1) explode attribute is used at line definition level to display (i.e explode)
;; additional details.
;; 2) when the user presses alt+f1 key, the ledger details are shown.
;; 3) the attribute empty is used at line definition level as shown below:-
;; empty: $$isfirstobj
;; syntax:- empty : <condition>
;; the empty attribute is used at the line definition level to skip the line,
;; if the condition is true. herein, we have specified that 1st object of the
;; collection "allledgerentries" must be skipped.
;; 4) $$isfirstobj
;; return value: logical
;; checks whether the object is the 1st object or not in the given collection
;; 5) collectionfield is a tally internal function. it returns the method/field
;; data of the specified collection as applied on the "nth" object of the
;; collection. in the above code, it fetches the 1st ledgername from the
;; collection "allledgerentries".
;; syntax: $$collectionfield: <method/field> : <positionnumber> : <collection>
;; return value: method/field value as specified as the 1st argument
;; 6) allledgerentries is a pre-defined collection that contains ledger details
;; for the voucher object. $ledgername is a method/field of this collection.
;; 7) date,vouchertypename,vouchernumber,amount are methods/fields of
;; voucher object.
;; 8) namewidth, shortwidth, small italic are pre-defined global formulaes.