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

/*
Objective(s)  
- 	The following code demonstrates the usage of Variables Repeated across Columns
- 	The Variable Value is changed and Report is repeated for the modified variable
*/

[#Menu: Gateway of Tally]

	Add	: Item	: Before : @@locQuit	: Multi Col TB		: Display	: Multi Col TB
    
[Report: Multi Col TB]

	Form		: Multi Col TB
	ColumnReport: ColRep              ;;;It is used in case of multicolumnar reports. Report Name specified with this attribute is executed when the New Column button is activated.
	Repeat		: SVCurrentCompany    ;;;The repeat variables can hold multiple value of the same type. These values can be accessed via an implicit index framework from the field, when field is repeated. Repeat variables are supported only in report scope for the purpose of the column reports. These variables can be filled using a collection and method specification in the variable.

[Form: Multi Col TB]

	Parts		: Multi Col TB

[Part: Multi Col TB]

	Lines			: Multi Col TB Title, Multi Col TB Details
	Repeat			: Multi Col TB Details	: Multi Col TB Collection   ;;;Line repeat on Ledger collections
	Scroll			: Vertical
	Common Border	: Yes

	[Line: Multi Col TB Title]

		Use		: Multi Col TB Details
		Local	: Field		: Default				: Type	: String
		Local	: Field		: Default				: Align	: Center

		Local	: Field		: Multi Col TB Name		: Set As: "Name"
		Local	: Field		: Multi Col TB Closing	: Set As: ##SVCurrentCompany     ;;;Field will be set with the current company name
		Border	: Thin Top Bottom

	[Line: Multi Col TB Details]

		Fields		: Multi Col TB Name, Multi Col TB Closing
		Repeat		: Multi Col TB Closing   ;;;repeat the field as new columns in report

		[Field: Multi Col TB Name]

			Use		: Name Field
			Set As	: $$Name                 ;;;set the ledger name in the field

		[Field: Multi Col TB Closing]

			Use		: Amount Forex Field
			Set As	: $ClosingBalance         ;;;set the closing value in the field
			Border	: Thin Left

;;Defining Ledger collection 
;;fetch is used for remoting purposes
[Collection: Multi Col TB Collection]

	Type		: Ledger
	Fetch		: Name, ClosingBalance

;; Multi Column Report

[Report: ColRep]

	Form	: ColRep

[Form: ColRep]

	Parts	: ColRep

[Part: ColRep]

	Lines	: ColRep

	[Line: ColRep]

		Fields	: Medium Prompt, Col Rep
		Local	: Field	: Medium Prompt	: Set As	: "Select Company"

		[Field: Col Rep]

			Use			: Name Field
			Table		: List of Companies   ;;;collection display list of all the companies
			Show Table	: Always
			Modifies	: SVCurrentCompany    ;;;Setting the company selected in this field to the variable

;; End-of-File
