Print the Total Page Number

Administrator
Member, Moderator, Administrator Posts: 2,506
Print the Total Page Number
small trick to print the total page number
This fob file is uploaded as support for the thread Display page no in format PageNo / TotalPage Simple trick.
Objects are Form 80000 & Report 80000.
http://www.mibuso.com/dlinfo.asp?FileID=962
Discuss this download here.
small trick to print the total page number
This fob file is uploaded as support for the thread Display page no in format PageNo / TotalPage Simple trick.
Objects are Form 80000 & Report 80000.
http://www.mibuso.com/dlinfo.asp?FileID=962
Discuss this download here.
0
Comments
-
OBJECT Form 80000 GetPageNoTest { OBJECT-PROPERTIES { Date=05/31/08; Time=[ 8:27:29 AM]; Modified=Yes; Version List=; } PROPERTIES { Width=8000; Height=3190; } CONTROLS { { 1000000000;CommandButton;1980;1210;2860;550; CaptionML=ENU=Run Vendor Report; OnPush=BEGIN { intFileName := 0; REPEAT intFileName := intFileName + 1 UNTIL NOT EXISTS ( FORMAT(intFileName) + '.xml'); CLEAR(rptTestReport); rptTestReport.SAVEASXML(FORMAT(intFileName) + '.xml'); intTotalPageNo :=rptTestReport.getPageNo; IF ERASE( FORMAT(intFileName) + '.xml') THEN BEGIN END; CLEAR(rptTestReport); rptTestReport.SetPageNo (intTotalPageNo); } rptTestReport.RUN; CLEAR(rptTestReport); END; } } CODE { VAR rptTestReport@1000000000 : Report 80000; intTotalPageNo@1000000001 : Integer; intFileName@1000000002 : Integer; BEGIN END. } } OBJECT Report 80000 GetPageNoForOrder { OBJECT-PROPERTIES { Date=05/31/08; Time=[ 8:54:00 AM]; Modified=Yes; Version List=NAVW15.00; } PROPERTIES { CaptionML=ENU=Vendor - List; OnPreReport=BEGIN VendFilter := Vendor.GETFILTERS; IF NOT bolCalcPageNo THEN BEGIN intFileName := 0; REPEAT intFileName := intFileName + 1 UNTIL NOT EXISTS ( FORMAT(intFileName) + '.xml'); CLEAR(rptTestReport); rptTestReport.SetCalcStatus; rptTestReport.SETTABLEVIEW (Vendor); rptTestReport.SAVEASXML(FORMAT(intFileName) + '.xml'); intTotalPageNo :=rptTestReport.getPageNo; IF ERASE( FORMAT(intFileName) + '.xml') THEN BEGIN END; END; END; } DATAITEMS { { PROPERTIES { DataItemTable=Table23; OnPreDataItem=BEGIN CurrReport.CREATETOTALS("Balance (LCY)"); END; OnAfterGetRecord=BEGIN CALCFIELDS("Balance (LCY)"); FormatAddr.FormatAddr( VendAddr,Name,"Name 2",'',Address,"Address 2", City,"Post Code",County,"Country/Region Code"); END; ReqFilterFields=No.,Search Name,Vendor Posting Group; } SECTIONS { { PROPERTIES { SectionType=Header; PrintOnEveryPage=Yes; SectionWidth=18150; SectionHeight=1004; } CONTROLS { { 1 ;Label ;0 ;0 ;7500 ;423 ;FontSize=8; FontBold=Yes; CaptionML=ENU=Vendor - List } { 2 ;TextBox ;15000;0 ;3150 ;423 ;HorzAlign=Right; SourceExpr=FORMAT(TODAY,0,4) } { 3 ;TextBox ;0 ;423 ;7500 ;423 ;SourceExpr=COMPANYNAME } { 1000000000;Label ;15928;450 ;750 ;423 ;ParentControl=1000000001 } { 1000000001;TextBox;16678;450 ;450 ;423 ;CaptionML=ENU=Page; SourceExpr=CurrReport.PAGENO } { 1000000002;Label ;17128;451 ;485 ;423 ;HorzAlign=Center; VertAlign=Center; CaptionML=ENU=/ } { 1000000003;TextBox;17604;451 ;450 ;423 ;CaptionML=ENU=Page; SourceExpr=rptTestReport.getPageNo } } } { PROPERTIES { SectionType=Header; PrintOnEveryPage=Yes; SectionWidth=18150; SectionHeight=423; } CONTROLS { } } { PROPERTIES { SectionType=Header; PrintOnEveryPage=Yes; SectionWidth=18150; SectionHeight=450; OnPreSection=BEGIN CurrReport.SHOWOUTPUT((CurrReport.PAGENO = 1) AND (VendFilter <> '')); END; } CONTROLS { { 8 ;TextBox ;0 ;0 ;18150;423 ;SourceExpr=Vendor.TABLECAPTION + ': ' + VendFilter } } } { PROPERTIES { SectionType=Header; PrintOnEveryPage=Yes; SectionWidth=18150; SectionHeight=1269; } CONTROLS { { 9 ;Label ;0 ;0 ;1500 ;846 ;ParentControl=18; VertAlign=Bottom; FontBold=Yes; MultiLine=Yes } { 10 ;Label ;1650 ;0 ;4500 ;846 ;ParentControl=19; VertAlign=Bottom; FontBold=Yes; MultiLine=Yes } { 11 ;Label ;6300 ;0 ;1500 ;846 ;ParentControl=20; VertAlign=Bottom; FontBold=Yes; MultiLine=Yes } { 12 ;Label ;7950 ;0 ;1500 ;846 ;ParentControl=21; VertAlign=Bottom; FontBold=Yes; MultiLine=Yes } { 13 ;Label ;9600 ;0 ;1500 ;846 ;ParentControl=22; VertAlign=Bottom; FontBold=Yes; MultiLine=Yes } { 14 ;Label ;11250;0 ;1500 ;846 ;ParentControl=23; VertAlign=Bottom; FontBold=Yes; MultiLine=Yes } { 15 ;Label ;12900;0 ;1500 ;846 ;ParentControl=24; HorzAlign=Right; VertAlign=Bottom; FontBold=Yes; MultiLine=Yes } { 16 ;Label ;14550;0 ;750 ;846 ;ParentControl=25; VertAlign=Bottom; FontBold=Yes; MultiLine=Yes } { 17 ;Label ;15450;0 ;1800 ;846 ;ParentControl=26; HorzAlign=Right; VertAlign=Bottom; FontBold=Yes; MultiLine=Yes } } } { PROPERTIES { SectionType=Body; SectionWidth=18150; SectionHeight=4653; } CONTROLS { { 18 ;TextBox ;0 ;0 ;1500 ;423 ;FontBold=Yes; SourceExpr="No." } { 19 ;TextBox ;1650 ;0 ;4500 ;423 ;FontBold=Yes; CaptionML=ENU=Name and Address; SourceExpr=VendAddr[1] } { 20 ;TextBox ;6300 ;0 ;1500 ;423 ;CaptionML=ENU=Vendor Posting Group; SourceExpr="Vendor Posting Group" } { 21 ;TextBox ;7950 ;0 ;1500 ;423 ;CaptionML=ENU=Invoice Disc. Code; SourceExpr="Invoice Disc. Code" } { 22 ;TextBox ;9600 ;0 ;1500 ;423 ;CaptionML=ENU=Payment Terms Code; SourceExpr="Payment Terms Code" } { 23 ;TextBox ;11250;0 ;1500 ;423 ;CaptionML=ENU=Payment Method; SourceExpr="Payment Method Code" } { 24 ;TextBox ;12900;0 ;1500 ;423 ;SourceExpr=Priority } { 25 ;TextBox ;14550;0 ;750 ;423 ;CaptionML=ENU=Currency Code; SourceExpr="Currency Code" } { 26 ;TextBox ;15450;0 ;1800 ;423 ;SourceExpr="Balance (LCY)" } { 27 ;TextBox ;1650 ;423 ;4500 ;423 ;SourceExpr=VendAddr[2] } { 28 ;TextBox ;1650 ;846 ;4500 ;423 ;SourceExpr=VendAddr[3] } { 29 ;TextBox ;1650 ;1269 ;4500 ;423 ;SourceExpr=VendAddr[4] } { 30 ;TextBox ;1650 ;1692 ;4500 ;423 ;SourceExpr=VendAddr[5] } { 31 ;Label ;1650 ;2961 ;1500 ;423 ;ParentControl=32 } { 32 ;TextBox ;3300 ;2961 ;2850 ;423 ;SourceExpr=Contact } { 33 ;Label ;1650 ;3384 ;1500 ;423 ;ParentControl=34 } { 34 ;TextBox ;3300 ;3384 ;2850 ;423 ;SourceExpr="Phone No." } { 37 ;TextBox ;1650 ;2115 ;4500 ;423 ;SourceExpr=VendAddr[6] } { 38 ;TextBox ;1650 ;2538 ;4500 ;423 ;SourceExpr=VendAddr[7] } } } { PROPERTIES { SectionType=Footer; SectionWidth=18150; SectionHeight=476; OnPostSection=BEGIN ReportTotalPage := CurrReport.PAGENO; END; } CONTROLS { { 35 ;Label ;0 ;0 ;2250 ;423 ;FontBold=Yes; CaptionML=ENU=Total (LCY) } { 36 ;TextBox ;2300 ;0 ;1800 ;423 ;FontBold=Yes; SourceExpr="Balance (LCY)" } } } } } } REQUESTFORM { PROPERTIES { Width=0; Height=110; SaveValues=Yes; } CONTROLS { } } CODE { VAR VendFilter@1000 : Text[250]; VendAddr@1001 : ARRAY [8] OF Text[50]; FormatAddr@1002 : Codeunit 365; ReportTotalPage@1000000000 : Integer; rptTestReport@1000000003 : Report 80000; intTotalPageNo@1000000002 : Integer; intFileName@1000000001 : Integer; bolCalcPageNo@1000000004 : Boolean; PROCEDURE getPageNo@1000000002() ReturnPage : Integer; BEGIN ReturnPage := ReportTotalPage; END; PROCEDURE SetPageNo@1000000032(PageNumber@1000000000 : Integer); BEGIN ReportTotalPage := PageNumber; END; PROCEDURE SetCalcStatus@1000000000(); BEGIN bolCalcPageNo := TRUE; END; BEGIN END. } }
0 -
I tried to apply this code into the printed purchase order, but find that the button on form called the codeunit, which will execute the report internally.
Is there any suggestion how to include the code for generating the XML in the PO?
Thanks.0 -
If you will use this method inside the same report, namely recursively, you must set a flag to prevent an endless loop. I used the fragment of the code in the OnPreReport section but created endless recursive report creations. So I set a flag, say SavingAsXML by using a function like below:
SetSavingAsXML(aSavingAsXML : Boolean) SavingAsXML := aSavingAsXML;
And write the following code like below:Report - OnPreReport() IF NOT SavingAsXML THEN BEGIN FileName := STRSUBSTNO('Temp_%1_Nakl.xml',FORMAT(CREATEDATETIME(TODAY,TIME),0,'<Day,2><Month,2><Year4><Hour><Minute><Second>')); CLEAR(RptNakledilenFis); GLEntry.COPYFILTERS("G/L Entry"); RptNakledilenFis.SETTABLEVIEW(GLEntry); RptNakledilenFis.SetSavingAsXML(TRUE); IF ERASE(FileName) THEN; IF RptNakledilenFis.SAVEASXML(FileName) THEN; TotalPageNo := RptNakledilenFis.GetTotalPageNo; IF ERASE(FileName) THEN; END;
RptNakledilenFis is a report variable that OnPreReport section belongs to.Cem Karaer @ Pargesoft
Dynamics NAV Developer since 20050
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions