Tally ERP 9 | Tally 9 | Tally 8.1 | Tally 7.2 | Tally 6.3 | Learn Tally TDL

Monday, August 20, 2007

Example 43: Adding Narration line and F12 key functionality to My Daybook

This program TDL43.TXT is an extension to my earlier program TDL42.TXT. It adds the following functionality to the program TDL42.TXT (i.e. My Daybook Report)

a) Display the Narration line
b) Add F12 Configuration button

Please note that pressing F12 key displays the Configuration screen that contains several options. This programs addresses only the Narration option (and Condensed/Detailed) in the Configuration screen.

Download TDL43

The new code has been shown as highlighted.

;; AUTHOR : Shweta Computers
;;To display Narration line and provide F12 Configuration key functionality
;;in My Daybook

;;Global Formula. Used to assign a simple text string to a Global constant.
[System: Formula]
MYDBKTDL: $LocaleString:"Daybook"

;;Add a new menu-item to the Gateway of Tally
[#Menu: Gateway of Tally]
Item: @@MYDBKTDL : Display: My DBKTDL

;;Control whether the menu-option is displayed or not?
Control: @@MYDBKTDL: $Allow:Display:Daybook

;; Syntax for $Allow
;; $Allow : :
;; Return Value : Logical

[Report: MYDBKTDL]

Family: $Translate:"Daybook"
;; The attribute FAMILY specifies that this Report (i.e. MYDBKTDL)
;; belongs to a Family (report) named Daybook.
;; DAYBOOK is a pre-defined report and here we are specifying that
;; MYDBKTDL report belongs to the same DAYBOOK family.
;; This will affect ACCESS to MYDBKTDL report.
;; Now, when we change the ACCESS to DAYBOOK report using option
;; "Gateway of Tally -> Alt+F3 -> Security Features".
;; it will automatically affect the report MYDBKTDL

Form : My Form

;;Title of the Report
Title: $LocaleString:"Daybook"

;;This variable is used in the current Report
Variables: ExplodeFlag, ExplodeNarrFlag

;;Required for F12 Configuration
Set : IsDaybook: Yes
Repeat: SVColumntype, SVColumnName

;;PRINTSET affects the variables related to Printing, whereas
;;SET is used to assign values to variables used otherwise.
PrintSet: ReportTitle: $LocaleString:"Daybook"
PrintSet: PrintFileName: "Daybook"

[Form: My Form]

Button: PrintButton
;;PrintButton is a pre-defined button. We just add is here.

Button: ExplodeFlag
;;EXPLODEFLAG is a pre-defined button in Default Tally.
;;Try using KEY instead of BUTTON, Alt+F1 still works,
;;but the "Alt+F1" button is not displayed

;;Required for F12 configuration
Button: DYBKConfigure

Space Top : if $InPrintMode then ##SVSpaceTop else 0.05 inches
Space Bottom: if $InPrintMode then 0.5 else 0.05 inches
Space Left : if $InPrintMode then 0.5 else 0.05 inches
Space Right : if $InPrintMode then 0.25 else 0.05 inches

Part: My DB Title,My DB Body

[Part: My DB Title]

;;Optional Parts
Option: My DB PrntTitle : $InPrintMode
Option: My DB ScrTitle : NOT $InPrintMode

[!Part: My DB PrntTitle]

Use: DSP AccTitles
;;This is a pre-defined part in default TDL

[!Part: My DB ScrTitle]
Line: My DB Title

[Line: My DB Title]
Field : Name Field
Local : Field : Name Field : Set as : $LocaleString:"Daybook"

[Part: My DB Body]
Line: My Line

Repeat : My Line: My Collection
;;Repeat : :

Scroll: Vertical

;;Shows border
Common Border: Yes

[Line: My Line]
Left Fields: Myfld1,MyFld2
Right Fields: MyFld3,MyFld4

;;This Shows the Ledger details when Alt+F1 key is pressed
Explode: MyExplodePart : ##ExplodeFlag

[Field: Myfld1]
;;TYPE attribute specifies the data-type of the field
Type : Date
Set as : $Date

[Field: Myfld2]
Use : Name Field
Set as : $CollectionField:$LedgerName:1:AllLedgerEntries

[Field: Myfld3]
Use : Short Name Field
Set as : $VoucherTypeName

[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
Line : MyExplodeNarrLine

;;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: Left Fields: fldExplodeLedger,fldExplodeAmount

;;This skips the first object of Collection AllLedgerEntries
Empty: $IsFirstObj

;;Ledger Name field
[Field: fldExplodeLedger]
Indent : 10
Use : Name Field
Set as : $LedgerName
Style : Small Italic
Width : @@NameWidth

;;Amount field
[Field: fldExplodeAmount]
Use : Amount Field
Set as : $Amount
Style : Small Italic
Width : @@ShortWidth

;; Line to Display Narration
[Line: MyExplodeNarrline]
Add: Left Fields: fldExplodeNarration

;;Display Narration field
[Field: fldExplodeNarration]
Indent : 12
Use : Name Field
Set as : $Narration
Style : Small Italic
Width : @@NameWidth

;;Collection definition
[Collection: My Collection]
Type: Voucher

1) This program is an extension of program TDL42.TXT
2) We have added functionality to display the Narration line
3) We have added functionality for F12 Configuration key

Tally; Tally Developer and Tally Definition Language are trademarks or registered trademarks of "Tally Solutions FZ LLC", Bangalore.