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

Monday, June 18, 2007

Example 25: Adding Voucher-Creation-Date/Time

This program TDL25 adds FOUR (invisible) fields to the Voucher entry screen. The fields are as follows:-
a) Voucher-Creation-Date
b) Voucher-Creation-Time
c) Voucher-Alteration-Date
d) Voucher-Alteration-Time

The basic idea of adding these fields is to keep track of "Vouchers that have been added or modified during a specific period ?"

Create a plain text file that contains the following Code. For those who have joined now, please note that you can use plain TXT files to customize Tally even without Tally Developer. For more information, refer post "How to Customize Tally Software using TXT files ?"

CODE

;; PRODUCT: 
;; PRODUCT-ID: cc307cfa-1d7f-4f9a-92f8-ace40a2943be
;; AUTHOR: Shweta Computers
;;=====================================================================

;;UDF's declaration. New fields declaration
;;=====================================================================
[System: UDF]
fldVCHCreationDate : Date : 1025
fldVCHCreationTime : String: 1026
fldVCHAlterationDate: Date : 1027
fldVCHAlterationTime: String: 1028

;;This will expose the newly added fields through Voucher Object so
;;that it can be accessed elsewhere
;;=====================================================================
[#Object: Voucher]
VCHCreationDate : $fldVCHCreationDate
VCHCreationTime : $fldVCHCreationTime
VCHAlterationDate: $fldVCHAlterationDate
VCHAlterationTime: $fldVCHAlterationTime

;;The Voucher Object is modified to include optional definitions
;;a) In case of Voucher Creation, the prtVchNarrationInCreateMode replaces
;; the existing VoucherNarration Part definition
;;b) In case of Voucher Altertion, the prtVchNarrationInAlterMode replaces
;; the existing VoucherNarration Part definition
;;=====================================================================
[#Part: VCH Narration]
Option: prtVCHNarrationInCreateMode : $$InCreateMode AND NOT $$InDuplicateMode
Option: prtVCHNarrationInAlterMode : $$InAlterMode OR $$InDuplicateMode

;;Optional Part definition
[!Part: prtVCHNarrationInCreateMode]
;; Local: Line : VCH NarrPrompt: Add: Fields: Short Prompt
;; Local: Field: Short Prompt : Set as: "Create mode: "
Add: Line: LnVCHNarrationInCreateMode

;;Line definition
[Line: lnVCHNarrationInCreateMode]
Add : Fields: VCHCreationDate
Add : Fields: VCHCreationTime

;;Optional Part definition
[!Part: prtVCHNarrationInAlterMode]
;; Local: Line : VCH NarrPrompt: Add: Fields: Short Prompt
;; Local: Field: Short Prompt : Set as: "Alter mode: "
Add: Line: LnVCHNarrationInAlterMode

;;Line definition
[Line: lnVCHNarrationInAlterMode]
Add : Fields: VCHAlterationDate
Add : Fields: VCHAlterationTime

;;Field definition for Voucher Creation Date
;;=====================================================================
[Field: VCHCreationDate]
Use: Short Date Field
Storage: fldVCHCreationDate
Set as: $$MachineDate
Set Always: Yes
;;Try changing Invisible to NO
Invisible: Yes

;;Field definition for Voucher Creation Time
;;=====================================================================
[Field: VCHCreationTime]
Use: Short Name Field
Storage: fldVCHCreationTime
Set as: $$MachineTime
Set Always: Yes
;;Try changing Invisible to NO
Invisible: Yes

;;Field definition for Voucher Alteration Date
;;=====================================================================
[Field: VCHAlterationDate]
Use: Short Date Field
Storage: fldVCHAlterationDate

;;This will forcefully store the $$MachineDate (i.e. CurrentDate in field)
Type: Date: Forced

Set as: $$MachineDate
Set Always: Yes

;;Try changing Invisible to NO
Invisible: Yes

;;Field definition for Voucher Alteration Time
;;=====================================================================
[Field: VCHAlterationTime]
Use: Short Name Field
Storage: fldVCHAlterationTime

;;This will forcefully store the $$MachineTime (i.e. CurrentTime in field)
Type: String: Forced

Set as: $$MachineTime
Set Always: Yes

;;Try changing Invisible to NO
Invisible: Yes
Download the TDL25 sample program.

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