This post illustrates how to add Access-control functionality to menu-option MyDBKTDL (MyDaybook). This program (i.e TDL42) is an extension to our earlier program TDL41.
To understand this program, you must enable the Security features in your Company. It is advised to try out this program in a Dummy Company.
Steps enable Security Control:-
1) Open any Company (say Dummy)
2) Press Alt+F3 in the "Gateway of Tally" menu. This will bring forth "Company Info" screen.
3) Select option "Alter" and select the Company Name.
4) In the "Company Alteration" screen, set "Security Control" to YES and enter the ADMIN-name and password. Save the Company details.
Steps to Create new User:-
1) Press Alt+F3 in the "Gateway of Tally" menu and then select "Security Control" option.
2)Next, select option "Users and passwords" to create a user. Enter any Username (say ABC) and password and then set the "Security Level" to DATA ENTRY.
Steps to Assign rights to the new User:-
1) Press Alt+F3 in the "Gateway of Tally" menu and then select "Security Control" option.
2)Next, select option "Types of Security" and then disallow access to Report DAYBOOK to the User that you have created.
Summary
In the above mentioned steps, we have
a) Enabled "Security Control" in the Company Alteration screen
b) Created a new user.
c) Disallowed Access-rights to DAYBOOK report to the new User (ABC).
As you can see, we have restricted the newly created USER from Accessing the DAYBOOK Report. Now, in program TDL42, we create a new report MYDBKTDL which belongs to the DAYBOOK family. As a result, the ACCESS-CONTROL for DAYBOOK applies to MYDBKTDL also.
Download TDL42
;; PROGRAM: TDL42.TXT ;; AUTHOR : Shweta Computers
;;Objective:- ;;Allow/Disallow Access-control to Menu option that we have added in ;;Gateway of Tally ;;======================================================================
;;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 : <mode> : <family report="" name=""> ;; 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
;;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]
Buttons: PrintButton ;;PrintButton is a pre-defined button. We just add is here.
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
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
[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 ;;Syntax:- ;;Repeat : <line> : <Collection>
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
;;Important:- ;;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: 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 : 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) This program is an extension of program TDL41.TXT
2) ACCESS-CONTROL functionality is added to the menu-option MYDBKTDL using the $$Allow function.