;; Sri Ganeshji : Sri Balaji : Sri Pitreshwarji : Sri Durgaji : Sri Venkateshwara

/*
Objective(s)  
- 	This code demonstrates the usage of Variable in System Scope. 
- 	The Color is being altered based on the variable value. The variable value altered 
	within the Report is retained eventhough the Report is quit. This behavior can be 
	observed by setting the Field to Green color and exitting the Report and reentering 
	the Report. The modified color i.e., Green Background will be retained which shows 
	that the Variable value saved within the Report is retained and the scope of the 
	variable is Global which will be available till the current session of Tally i.e.,
	till we exit Tally.
*/
[#Menu: Gateway of Tally]

	Add	: Key Item	: Before : @@locQuit	: System Scope    : P	: Display		: System Scope
    
[Report: System Scope]

	Form	: System Scope

[Form: System Scope]

	Part	: System Scope
	Button	: System Scope Button     ;;;Defining the button in the form

[Part: System Scope]

	Lines	: System Scope

	[Line: System Scope]
		
		Fields	: System Scope
	
		[Field: System Scope]

			Set AS		: $$CurrentDate
			Option		: System Scope Red BG	: Not ##SystemVar
			Option		: System Scope Green BG	: ##SystemVar

			[!Field: System Scope Red BG]

				Background	: Red
				
			[!Field: System Scope Green BG]

				Background	: Green

;;;Declaring the system variable of type loical
[Variable: SystemVar]

	Type		: Logical

;;Declaring the system variable with default value as "No"
[System: Variable]

	SystemVar	: No

;;Declaring
[Button: System Scope Button]

    ;;Set default key for the button
	Key		: Alt + R
    
    ;;Action to set variable value when key is pressed
    Action	: Set	: SystemVar	: Not ##SystemVar

    ;;Display title as red or green on the button based on the variable
    Title	: if ##SystemVar then "Red" else "Green"

;; End-of-File
