AyaNova service management & work order software
AyaNova Support Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        


Putting page XX of XX on report so that it... Expand / Collapse
Author
Message
Posted 11/13/2007 1:12:49 PM
AyaNova Sales & Support

AyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & Support

Group: Administrators
Last Login: 11/29/2008 4:41:18 PM
Posts: 1,865, Visits: 4,323
Putting page XX of XX on report so that it identifies for the specific workorder or specific client even if printing from grid:


Example of use:

1. You print out all completed workorders from the Service Workorders grid - works out to be a total of 27 pages for all workorders combined, And the first workorder that is actually 2 pages, the PageInfo on it says Page 1 of 27 and Page 2 of 27; next workorder says page 3 of 27 and so on. Even though you print off all of the relevant workorders from the grid, you want each workorders pages to specifiy for that specific workorder. For example, if the first workorder has two pages it would say Page 1 of 2 and Page 2 of 2 and so on, even though printing all of the workorders at the same time.


I have included two example report templates in this topic so that you can download, import and follow what are the steps to do this.


Sample Completed WO with Grand Total and Pages Per WO [For use with AyaNova 3]

This is a further edit of the Sample Detailed Service Workorder with Grand Total

Note that this custom page xx of xx MUST be located in GroupHeader of a report - it can not be located in a ReportFooter or PageFooter as it needs to be tied to a specific dataobject that occurs just once - which in this case is the Workorder Number.

First, must do as outlined in topic http://forum.ayanova.com/Topic2159-103-1.aspx where you need to create a GroupHeader for the DetailReport - "WorkorderHeader" band, move all fields into that GroupHeader, edit datafields again as needed (i.e. Bindings -> Text -> select correct binding for the field), set the PageBreak and RepeatEverypage property for this GroupHeader, set the PageBreak property for the DetailReport band
Now I dragged a label from the Toolbox tab to above the Workorder # field in this GroupHeader for the DetailReport - "WorkorderHeader" section.

I select this label I have just created, and edit its OnPrintOnPage script properites to


using DevExpress.XtraPrinting;
using DevExpress.XtraReports.UI;
using DevExpress.XtraReports.Native;
// ...

string lastID = "";
int pageNumber = 0;

private void OnPrintOnPage(object sender, DevExpress.XtraReports.UI.PrintOnPageEventArgs e) {

   string curID = ((XRLabel)sender).Tag.ToString();
   int pageCount = 0;

   foreach (Page page in xtraReport1.PrintingSystem.document.Pages) {
      BrickEnumerator brickEnum = page.GetEnumerator();

      while (brickEnum.MoveNext()) {
         XRBrick brick = brickEnum.Current as XRBrick;
         if (brick != null && brick.Data.Control == (XRLabel)sender) {
            if (brick.Data.Tag.ToString() == curID)
               pageCount++;
         }
      }
   }

   if (curID == lastID)
      pageNumber++;
   else
      pageNumber = 1;

   lastID = curID;
   ((XRLabel)sender).Text = "Page " + pageNumber.ToString() + " of " +
pageCount.ToString();

}

Still with the xrLabel18 selected, I bind the Tag to the Workorder number datafield via DataBindings -> Tag -> Bindings -> reportDataSet1 - WorkorderHeader.LT_O_Workorder (by selecting Workorder in the drop down)

Now when you Print Preview, if any of the workorders span more than 1 page, it will display as such.


Sample Client Billable with Pages Per Client [For use with AyaNova 3]

This is a further edit of the Sample Total Billable Grouped By Client

Note that this custom page xx of xx MUST be located in GroupHeader of a report - it can not be located in a ReportFooter or PageFooter as it needs to be tied to a specific dataobject that occurs just once.

The original sample report template already has a GroupHeader for the DetailReport.

First, we first set the Property for GroupHeader1 RepeatEveryPage to True
Then we just add a new label from the Toolbox, add the OnPrintOnPage script for that label. But in this case, we bind the Tag to the Client datafield, as we want the report to identify pages based on the client that has the workorders.

AyaNova Sales & Technical Support
http://www.ayanova.com
Post #3555
Posted 2/6/2008 1:04:01 PM
AyaNova Sales & Support

AyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & SupportAyaNova Sales & Support

Group: Administrators
Last Login: 11/29/2008 4:41:18 PM
Posts: 1,865, Visits: 4,323
For use with AyaNova 4, refer to the AyaNova 4 Sample Completed WO with Grand Total and Pages per WO

Note that the script used is as below because the latest printing engine component does not utilize xrBrick as did the older printing engine used by AyaNova 3

using DevExpress.XtraPrinting;
using DevExpress.XtraReports.UI;
using DevExpress.XtraReports.Native;
// ...

string lastID = "";
int pageNumber = 0;

private void OnPrintOnPage(object sender, DevExpress.XtraReports.UI.PrintOnPageEventArgs e) {

       string curID = ((XRLabel)sender).Tag.ToString();
    int pageCount = 0;

    foreach (Page page in xtraReport1.PrintingSystem.document.Pages) {
        BrickEnumerator brickEnum = page.GetEnumerator();

        while (brickEnum.MoveNext()) {
            VisualBrick brick = brickEnum.Current as VisualBrick;

            if (brick != null && brick.BrickOwner == (XRLabel)sender) {
                if (brick.Value.ToString() == curID)
                    pageCount++;
            }
        }
    }

    if (curID == lastID)
        pageNumber++;
    else
        pageNumber = 1;

    lastID = curID;
    ((XRLabel)sender).Text = "Page " + pageNumber.ToString() + " of " + pageCount.ToString();
}


AyaNova Sales & Technical Support
http://www.ayanova.com
Post #3813
« Prev Topic | Next Topic »

Reading This Topic Expand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: AyaNova Sales & Support

Permissions Expand / Collapse

All times are GMT -8:00, Time now is 7:42am

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.078. 12 queries. Compression Disabled.