This post illustrates how to add Print functionality to the report MyDaybook. This program (i.e TDL41) is an extension to our earlier program TDL38.
Download TDL41
;; PRODUCT: TDL41.TXT ;; AUTHOR: Shweta Computers
;;Objective:- ;;Adding Print functionality to MyDaybook ;;======================================================================
;;Global Formula. Assign a text string to MYTDL41 [System: Formula] MYTDL41: $$LocaleString:"Daybook"
;;Add a new menu-item to the Gateway of Tally [#Menu: Gateway of Tally]
;;ACTION used here is DISPLAY Item: @@MYTDL41 : Display: My Report
[Report: My Report]
Form : My Form Title: $$LocaleString:"Daybook" Variables: ExplodeFlag
;;This is used to set the variables which will affect Printing only. PrintSet: ReportTitle: $$LocaleString:"Daybook" PrintSet: PrintFileName: "Daybook"
[Form: My Form]
;;PrintButton is a pre-defined button. We are just adding it here. ;;This will display a PRINT button on the right-hand side of Tally screen. Buttons: PrintButton
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
;;Pre-defined button in Default Tally. Try using KEY instead of BUTTON, ;;Alt+F1 still works, but the "Alt+F1" button is not displayed Button: ExplodeFlag
[Part: My DB Title] Option: My DB PrntTitle : $$InPrintMode Option: My DB ScrTitle : NOT $$InPrintMode
[!Part: My DB PrntTitle] Use: DSP AccTitles
[!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 : :
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 a extension to program TDL38.TXT
2) This program adds a button called PrintButton which is a
pre-defined button. This will add the Printing functionality
in our Report.
3) We have defined OPTIONAL parts "My DB PrntTitle" and "My DB ScrTitle"
as we want to have different titles for Printing and Screen.
4) We have added SPACE(s) to our Form for formatting purpose.
Example:-
Space Bottom: if $$InPrintMode then 0.5 else 0.05 inches
5) $$InPrintMode is a Internal function that returns logical true
if the report is being printed.