;; Sri Ganeshji : Sri Balaji : Sri Pitreshwarji : Sri Durgaji : Sri Venkateshwara /* Objective(s) - This program illustrates the use of following attributes of Field Bound Field Invisible - This program illustrates the use of following attributes of Object Local formula About this program - This program shows a trial balance report where columns can be added, modified and deleted and also auto colmn functionality is - povided. */ [#Menu: Gateway of Tally] Add: Item: ($$LocaleString:"Auto Trial Balance"): Display:TSPL AutoCol Trial Balance [Report: TSPL AutoCol Trial Balance] Title : $$LocaleString:"Custom Trial Balance" Form : TSPL AutoCol Trial Balance Repeat : SVCurrentCompany, SVFromDate, SVToDate ColumnReport: TSPL MyMultiColumns1 Variable : TSPLAutoCol TB Group, IsLedgerWise, SVPeriodicity PrintSet : Report Title : $$LocaleString:"Custom Trial Balance" Set : IsLedgerWise : No ;; When the attribute Column Report is mentioned, the attribute ;; Repeat should also be mentioned. The New Column, Alter Column and ;; Delete Column buttons will automatically get activated ;; once Column Report & Repeat attributes are mentioned ;; together in the report. ;; PrintSet At Report Definition will set the Variable Value ;; in Print Mode [Form: TSPL AutoCol Trial Balance] Button : F2ChangePeriod, ChangeCompany, LedgerWiseButton Keys : ChangePeriod ;;To incorporate the change in TallyPrime Bottom Button : Add Column, Alter Column, Delete Column BottomButton: TSPLMyAutoButton, BlankButton, InvReports, AcctReports, ReportOperations, FilterButton, ValueButton Buttons : PrintButton, ExportButton, UploadButton, MailButton Parts : TSPL AutoCol TB Title, TSPL AutoCol TB Details Page Break : TSPL DSP ClPageBreak, TSPL AutoCol TB OpPgPart Height : 100% Page Width : 100% Page Space Top : 0 Space Left : 0 Background : Released Pale Yellow Option : Prn AutoCol TB : $$InPrintMode [!Form: Prn AutoCol TB] Add : Parts : At Beginning : DSP CompanyName, DSP CompanyAddress, DSP ReportTitle Space Left : 0.25 inch ;; For enabling Titles during Printing, Form Level Optional parts ;; Company Name, Address and Report Title are used from defTDL. [Part: TSPL AutoCol TB OpPgPart] Parts : DSP CompanyName, DSP CompanyAddress, DSP ReportTitle, TSPL AutoCol TB Title Vertical : Yes ;; Every continuous page should have the above parts during Printing [Part: TSPL AutoCol TB Title] Lines : TSPL AutoCol TB Title1, TSPL AutoCol TB Title2, TSPL AutoCol TB Title3, TSPL AutoCol TB STitle Border : Thin Top [Line: TSPL AutoCol TB Title1] Use : TSPL AutoCol TB Title3 Local : Field : Name Field : Set as : "" Local : Field : TSPL AutoCol TB DrAmt Field : Set as : @@CmpMailName Local : Field : TSPL AutoCol TB DrAmt Field : Lines : 0 Local : Field : TSPL AutoCol TB DrAmt Field : Border : Thin Left Invisible : $$IsCommon:SVCurrentCompany AND $$InPrintMode ;; This Line is made Invisible in Print Mode only if Columns selected ;; are of single company [Line: TSPL AutoCol TB Title2] Use : TSPL AutoCol TB Title3 Local : Field : Default : Style : Normal Local : Field : Name Field : Set as : $$LocaleString:"Particulars" Local : Field : Name Field : Style : Normal Bold Local : Field : Name Field : WideSpaced : Yes Local : Field : TSPL AutoCol TB DrAmt Field : Set as : @@DSPDateStr Local : Field : TSPL AutoCol TB DrAmt Field : Border : Left Full Thin Bottom ;; DSPFDateStr is the Default Formula which displays the values ;; present in both the date variables - SVFromDate & SVTodate [Line: TSPL AutoCol TB Title3] Fields : Name Field, TSPL AutoCol TB DrAmt Field Local : Field : Default : Type : String Local : Field : Name Field : Set as : "" Local : Field : Name Field : Align : Center Local : Field : TSPL AutoCol TB DrAmt Field : Align : Centre Local : Field : TSPL AutoCol TB DrAmt Field : Border : Left Full Thin Bottom Local : Field : TSPL AutoCol TB DrAmt Field : Set as : $$LocaleString:"Closing Balance" Repeat : TSPL AutoCol TB DrAmt Field [Line: TSPL AutoCol TB STitle] Fields : Name Field, TSPL AutoCol TB Amount Field Local : Field : Default : Style : Normal Local : Field : Default : Align : Centre Local : Field : Default : Type : String Local : Field : Name Field : Set as : "" Local : Field : TSPL AutoCol TB DrAmt Field : Set as : $$LocaleString:"Debit" Local : Field : TSPL AutoCol TB CrAmt Field : Set as : $$LocaleString:"Credit" Local : Field : TSPL AutoCol TB CrAmt Field : Border : Thin Left Repeat : TSPL AutoCol TB Amount Field Border : Thin Bottom [Part: TSPL AutoCol TB Details] Lines : TSPL AutoCol TB Details BottomLines : TSPL AutoCol TB Total Repeat : TSPL AutoCol TB Details : TSPL AutoCol TB GroupLed Total : TSPL AutoCol TB DrAmt Field, TSPL AutoCol TB CrAmt Field Scroll : Vertical CommonBorder: Yes Float : Yes Page Break : TSPL AutoCol TB ClPgLine, TSPL AutoCol TB OpPgLine Option : TSPL AutoCol TB Details Led : ##IsLedgerWise ;; Part Level Page Breaks is introduced to have Page Totals ;; at the beginning (except first page) and end (except last page) ;; of every page ;; The optional part is selected when Ledgerwise is selected by the user. [!Part: TSPL AutoCol TB Details Led] Repeat : TSPL AutoCol TB Details : TSPL AutoCol TB Led Local : Collection: TSPL AutoCol TB Led : BelongsTo : Yes ;; If Ledgerwise Option is selected by the user, Collection should ;; have attribute BelongsTo set to Yes as the Ledgers pertaining to ;; all the Groups and Sub-Groups needs to be displayed together [Line: TSPL AutoCol TB ClPgLine] ;; Line for Closing Page Totals Use : TSPL AutoCol TB Details Delete : Fields : TSPL AutoCol TB Amount Field Add : Fields : TSPL AutoCol TB AmountSTField Delete : Repeat : TSPL AutoCol TB AmountSTField Add : Repeat : TSPL AutoCol TB AmountSTField Local : Field : Default : Style : Normal Bold Local : Field : TSPL AutoCol TB Name Field : Set as : "Carried Over" Local : Field : TSPL AutoCol TB Name Field : WideSpaced : Yes Local : Field : TSPL AutoCol TB DrAmtSTField : Set as : $$Total:AutoColTBDrAmtField Local : Field : TSPL AutoCol TB DrAmtSTField : Border : Totals Local : Field : TSPL AutoCol TB CrAmtSTField : Set as : $$Total:AutoColTBCrAmtField Local : Field : TSPL AutoCol TB CrAmtSTField : Border : Totals Space Top : 1 [Line: TSPL AutoCol TB OpPgLine] ;; Line for Opening Page Totals Use : TSPL AutoCol TB ClPgLine Local : Field : TSPL AutoCol TB DrAmtSTField : Delete : Border Local : Field : TSPL AutoCol TB CrAmtSTField : Delete : Border Local : Field : TSPL AutoCol TB Name Field : Set as : "Brought Foward" Space Top : 0 Space Bottom: 1 [Field: TSPL AutoCol TB AmountSTField] ;; New Field Definition for the Page Totals Fields : TSPL AutoCol TB DrAmt STField, TSPL AutoCol TB CrAmt STField Border : Thin Left [Field: TSPL AutoCol TB DrAmtSTField] Use : TSPL AutoCol TB DrAmt Field [Field: AutoCol TB CrAmtSTField] Use : TSPL AutoCol TB CrAmt Field [Line: TSPL AutoCol TB Details] Fields : TSPL AutoCol TB Name Field, TSPL AutoCol TB Amount Field Local : Field : TSPL AutoCol TB Name Field : Set as : $$Name Local : Field : TSPL AutoCol TB DrAmt Field : Set as : if $$IsDr:$ClosingBalance then $ClosingBalance else 0 Local : Field : TSPL AutoCol TB CrAmt Field : Set as : if $$IsDr:$ClosingBalance then 0 else $ClosingBalance Repeat : TSPL AutoCol TB Amount Field ;; Repeat Attribute of Line will position the Field to the Right, ;; as if it is a Right Field. [Field: TSPL AutoCol TB Name Field] Use : Name Field Variable : TSPL AutoCol TB Group Display : TSPL AutoCol Trial Balance : $$IsGroup Option : TSPL AutoCol TB LedName Field : $$IsLedger [!Field: TSPL AutoCol TB LedName Field] Variable : LedgerName Display : Ledger Monthly Summary Style : Normal Italic [Field: TSPL AutoCol TB Amount Field] Fields : TSPL AutoCol TB DrAmt Field, TSPL AutoCol TB CrAmt Field ;;Field has 2 fields within where the main field is repeated to generate the columns Border : Thin Left Display : TSPL AutoCol Trial Balance : $$IsGroup Display : TSPL Ledger Monthly Summary : $$IsLedger [Field: TSPL AutoCol TB DrAmt Field] Use : Amount Field Style : Normal Bound : 10, 20 ;;Provides minimum and maximum column width [Field: TSPL AutoCol TB CrAmt Field] Use : Amount Field Style : Normal Bound : 10, 20 ;;Provides minimum and maximum column width [Collection: TSPL AutoCol TB GroupLed] Collection : TSPL AutoCol TB Group, TSPL AutoCol TB Led [Collection: TSPL AutoCol TB Group] Type : Group Child Of : ##TSPLAutoColTBGroup Filter : NoProfit Fetch : Name, ClosingBalance ;; NoProfit Formula is used to Filter all the Ledgers ;; except Profit and Loss Account. [Collection: TSPL AutoCol TB Led] Type : Ledger Child Of : ##TSPLAutoColTBGroup Filter : NoProfit [Variable: TSPLAutoCol TB Group] Type : String Default : "" Volatile : Yes [System: Formula] NoProfit : NOT $$IsLedgerProfit AND $ClosingBalance > 0 ;; Function IsLedgerProfit returns Yes, only if the current object ;; is a Profit & Loss Ledger Account. [Line: TSPL AutoCol TB Total] Use : TSPL AutoCol TB Details Local : Field : Default : Style : Normal Bold Local : Field : TSPL AutoCol TB Name Field : Set as : "GRAND TOTAL" Local : Field : TSPL AutoCol TB Name Field : WideSpaced : Yes Local : Field : TSPL AutoCol TB Name Field : Align : Centre Local : Field : TSPL AutoCol TB DrAmt Field : Set as : $$Total:TSPLAutoColTBDrAmtField Local : Field : TSPL AutoCol TB CrAmt Field : Set as : $$Total:TSPLAutoColTBCrAmtField Border : Flush Totals Fixed : Yes Space Top : 1 ;; Fixed Attribute at Line Definition will not allow the cursor to be ;; placed on that line while viewing and scrolling ;; End-of-Trial-Balance ;; Report for displaying Column Option [Report: TSPLMyMultiColumns1] Title : $$LocaleString:"Column Details" [Form: TSPLMyMultiColumns1] No Confirm : Yes Full Width : No Space Right : 0.25 Background : @@SV_UNBLUE Parts : TSPLMy MultiColumns1 Option : Small Size Form [Part: TSPLMy MultiColumns1] Lines : Form SubTitle, TSPLMy MultiCompany, TSPLMy MultiFromDate, TSPLMy MultiToDate Local : Field : Form SubTitle : Info : $$LocaleString:"Column Details" [Line: TSPL My MultiCompany] Fields : Short Prompt, TSPL My MultiCompany Local : Field : Short Prompt : Info : $$LocaleString:"Company :" SpaceBottom : 1 Invisible : $$SelectedCmps = 1 ;; SelectedCmps is a function which returns the number of selected companies. ;; It requires no parameters. This means that if the Selected Companies equals ;; to 1 then this line should be made invisible [Field: TSPL My MultiCompany] Use : Name Field Modifies : SVCurrentCompany Table : Company Show Table : Always ;; Modifies alters the Value of a Variable to be used subsequently [Line: TSPL My MultiFromDate] Fields : Short Prompt, TSPL My MultiFromDate Local : Field : Short Prompt : Info : $$LocaleString:"From Date :" SpaceBottom : 1 [Field: TSPL My MultiFromDate] Use : Uni Date Field Modifies : SVFromDate Width : 9 [Line: TSPL My MultiToDate] Fields : Short Prompt, TSPL My MultiToDate Local : Field : Short Prompt : Info : $$LocaleString:"To Date :" SpaceBottom : 0.25 [Field: TSPL My MultiToDate] Use : TSPL My MultiFromDate Modifies : SVToDate ;; Changes to achieve AutoColumn [Button: TSPLMyAutoButton] Key : Alt+N Action : Auto Columns : TSPLMyAutoColumns1 Title : $$LocaleString:"Auto Column" Inactive : $$NumItems:TSPLMyAutoColumns1 < 1 ;; Action Auto Columns is an action which takes a report as its value ;; and gives auto columns in the base report accordingly. ;; MyAutoColumns is a report being displayed when the button ;; MyAutoButton is clicked. [Collection: TSPLMyAuto Columns1] Title : $$LocaleString:"Column Details" Object : TSPLMyCurrentCompany, TSPLMyQuarterly, TSPLMyMonthly, TSPLMyYearly, TSPLMyHalfYearly Filter : Belongs Format : $$Name, 15 Client Only : Yes ;; Belongs is a system formula which filters the objects ;; based on the value of the Methods BelongsIf of all the objects ;; Function Name returns the Name of any given objects ;; These are static objects with appropriate methods used in the autocolumn configuration ;; Function NumItems returns the number of selected companies ;; BelongsIf is a method of object MyCurrentCompany, which ;; is used to control the display of the object in the collection [Object: TSPLMyCurrentCompany] Name : $$LocaleString:"Company" VarName : "SVCurrentCompany" CollName : "List of Primary Companies" BelongsIf : $$NumItems:ListOfPrimaryCompanies > 1 IsAgeWise : No Periodicity : "" [Object: TSPLMyQuarterly] Name : $$LocaleString:"Quarterly" VarName : "SVFromDate, SVToDate" CollName : "Period Collection" BelongsIf : "Yes" IsAgeWise : No Periodicity : "3 Month" [Object: TSPLMyHalfYearly] Name : $$LocaleString:"Half-Yearly" VarName : "SVFromDate, SVToDate" CollName : "Period Collection" BelongsIf : "Yes" IsAgeWise : No Periodicity : "6 Month" [Object: TSPLMyMonthly] Name : $$LocaleString:"Monthly" VarName : "SVFromDate, SVToDate" CollName : "Period Collection" BelongsIf : "Yes" IsAgeWise : No Periodicity : "Month" [Object: TSPLMyYearly] Name : $$LocaleString:"Yearly" VarName : "SVFromDate, SVToDate" CollName : "Period Collection" BelongsIf : "Yes" IsAgeWise : No Periodicity : "Year" ;; Report AutoColumn [Report: TSPLMyAutoColumns1] Auto : Yes Title : $$LocaleString:"Auto Repeat Columns" [Form: TSPLMyAutoColumns1] No Confirm : Yes Full Width : No Space Top : 1 Space Bottom: 1 Space Left : 1 Space Right : 1 Background : @@SV_UNYELLOW Parts : TSPLMy AutoColumns Output : TSPLMy AutoColumns Option : Small Size Form ;; Output Attribute at Form Definition is used to return a Field value ;; to the calling Report ;; No Confirm Attribute at Form Definition will not prompt the user to ;; save the auto-column screen [Part: TSPL My AutoColumns] Lines : Form SubTitle, TSPL My AutoColumns Local : Field : Form SubTitle : Info : $$LocaleString:"Auto Repeat Columns" [Line: TSPL My AutoColumns] Fields : Medium Prompt, TSPL My SelectAuto, TSPL My AutoColumns, TSPL My CollName, TSPL My StartPeriod, TSPL My EndPeriod, TSPL My SetPeriodicity Local : Field : Medium Prompt : Info : $$LocaleString:"Repeat Using :" SpaceBottom : 0.25 [Field: TSPL My SelectAuto] Use : Short Name Field Table : TSPLMyAutoColumns1 Show Table : Always [Field: TSPL My AutoColumns] Use : Short Name Field Invisible : Yes ;;Field holds the variable name corresponding to the selection made in the previous field. this field Set as : $$Table:TSPLMySelectAuto:$VarName ;;is set to invisible as this need not be shown to the user but this is used as output field in the Set always : Yes ;;Output attribute of the report to send to the calling report Skip : Yes ;; Function Table selects the Object Name from the previous Field MySelectAuto ;; and displays the corresponding method value of VarName [Field: TSPL My CollName] Use : Short Name Field Invisible : Yes Set as : $$Table:TSPLMySelectAuto:$CollName Modifies : DSPRepeatCollection Set always : Yes Skip : Yes ;; We are modifying the value of the default variable DSPRepeatCollection ;; by the value of the Method CollName from the selected Object ;; DSPRepeatCollection is repeated in the Default Variables SVCurrentCompany, ;; SVFromDate and SVToDate, which gets new values for each column [Field: TSPLMy StartPeriod] Use : Short Date Field Invisible : Yes Set as : if $$IsEmpty:$$Table:TSPLMySelectAuto:$Periodicity then ##SVFromDate else + if $$Table:TSPLMySelectAuto:$Periodicity = "Day" then ##SVFromDate else + $$LowValue:SVFromDate Set always : Yes Modifies : SVFromDate Skip : Yes ;; Value of Variable SVFromDate is set here based on the Periodicity Method. ;; LowValue is a Function that returns beginning date of the Current Period [Field: TSPLMy EndPeriod] Use : Short Date Field Invisible : Yes Set as : if $$IsEmpty:$$Table:TSPLMySelectAuto:$Periodicity then ##SVToDate else + if $$Table:TSPLMySelectAuto:$Periodicity = "Day" then $$MonthEnd:#DSPStartPeriod else $$HighValue:SVToDate Set always : Yes Modifies : SVToDate Skip : Yes ;; Value of Variable SVToDate is set here based on the Periodicity Method. ;; MonthEnd is a Function gives the last day for a given month [Field: TSPL My SetPeriodicity] Use : Short Name Field Invisible : Yes Set as : if NOT $$IsEmpty:$$Table:MySelectAuto:$Periodicity then $$Table:MySelectAuto:$Periodicity else "Month" Set always : Yes Modifies : SVPeriodicity ;; End-of-File