Payentry Report Writer Guide
Transcription
Payentry Report Writer Guide
Report Writer Guide Notice The information in this document is subject to change without notice. MPAY Inc. shall not be liable for any technical or editorial errors contained herein or for incidental or consequential damages resulting from the performance, furnishing, or use of this publication. The software described in this document is furnished under license and may be used or copied only in accordance with the terms of that license. No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, including (but not limited to) photocopying, recording, scanning, or retrieval system, for any reason other than the purchaser’s personal use without the express written permission of MPAY Inc. The company data contained in the examples within this text is fictitious and any resemblace to real people, places, or companies is purely coincidental. MPAY, Millenium, and payentry.com are trademarks of MPAY Inc. Windows, Windows 2000, Windows XP, Windows Vista, and Windows 7 are registered trademarks of Microsoft, Inc. All other brand and product names are trademarks or registered trademarks of their respective owners. Corporate Headquarters: 9920 West Kincey Avenue Suite 120 Huntersville, NC 28078 Phone: 781-810-9009 http://www.mpay.com Copyright © 2008–2011 by MPAY, Inc. Version: February, 2011 Document Number: PE-32931404-RPTWRGD-01 All rights reserved Printed in the United States of America TOC Table of Contents • • • • • • Chapter 1: Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5 Accessing the Report Writer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5 Creating a New Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7 Saving Your Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Editing an Existing Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Report Writer Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Chapter 2: Using the Report Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Step 1: Add Fields for the Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 The Fields sub-page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Working with Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Special Fields in the Employee List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Special Payroll Formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Step 2: Sort & Group the Report Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Step 3: Filter the Report Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Filtering Formula Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Filters About Companies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Filters About Employees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 An Advanced Filter for a Deduction Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Formula Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Report Writer Tips & Tricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 General Tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Calculate Employer Taxes in Report Writer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Chapter 3: Running & Retrieving Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Running Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Request Area tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Report Writer tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Report Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Date Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Output Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Delivery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Queued Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Retrieving a Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Release 3.29 • • • • • iii • Table of Contents Chapter 4: Example of Creating a Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Premise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Step 1: Create a New Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Step 2: Add the Necessary Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Field 1: Plan ID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Field 2: Employee SSN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Fields 3 & 4: Employee Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Field 5: Current Contribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Field 6: YTD Contribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Field 7: Employee Contribution Rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Step 3: Define the Sorting Criteria . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Step 4: Add the Necessary Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 35 36 36 36 37 37 38 38 39 39 Chapter 5: Advanced Report Writer Scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Current Date & Length of Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using the Basic Formula . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using a VB Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Specifying Results as Integers or Decimals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Calculating Age Based on the Report End Date . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Accessing the Employee Annual Salary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Formatting Date Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Formatting Numeric Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Using “If” Statements for Replacements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Single Replacements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 42 42 43 44 44 44 45 45 45 Multiple Replacements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 Using the Date Range of the Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 Using the Dates of the Most Recently Processed Payroll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 Alternative Fill Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Advanced Calculations Using Rates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Simulating Wildcard Characters in Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Displaying Employee Pay Grade Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Displaying Names or Descriptions Instead of Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Employee Department Name Instead of Department Code . . . . . . . . . . . . . . . . . . . . 48 48 50 51 51 Employee Termination Description Instead of Termination Code . . . . . . . . . . . . . . 51 Handling Blank Dates in Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 Determining Employee Age . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 Notes and Known Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 iv • • • • • • Report Writer Guide Chapter 1 Getting Started • • • • • • This guide explains how to use the Report Writer feature on Payentry.com. Reporting data is an important element in satisfying your customers’ needs. You may find that you need a report that is slightly different from—or not included in—the existing reports on Payentry.com. When it comes to creating your own reports, the Report Writer feature allows you to produce a report quickly without getting into unnecessary details and complexity. It allows you to create, edit, and save an unlimited number of custom reports. This guide describes the various features and functions of the report writer, as well as provide some sample reports to get you started. You can use Report Writer for most of your reporting needs because it has access to almost all data in the database. You can: • Create employee and personnel listings • Access current, month-to-date (MTD), quarter-to-date (QTD), and year-to-date (YTD) values for any earning, deduction, or tax code • Create most types of output files This chapter explains how to access the Report Writer, create and save new reports, edit existing reports, and remove unwanted reports. Accessing the Report Writer To access the Report Writer, perform the following: 1. From the Main Menu page, select the appropriate company. 2. Click on the Reports link, as shown in Figure 1: PE-32931404-RPTWRGD-01 • • • • • 5 • Getting Started Figure 1: Reports option on the Main Menu The system displays the All Report Groups page, the main reporting area on Payentry.com. It defaults to the Request Area tab, as shown in Figure 2: Figure 2: Report Writer reports 6 • • • • • • Report Writer Guide Release 3.29 This page displays all existing Report Writer reports in the upper portion of the page (see Figure 2) and all other available system reports in the lower portion. 3. From this page, you can: • Edit an existing Report Writer report Either click the Edit link or the Report Writer tab. For more information, see “Editing an Existing Report” on page 11. • Run an existing Report Writer report Click the report’s associated Run link. For more information, see Chapter 3, “Running & Retrieving Reports.” • Add a new Report Writer report For more information, see the next section. Creating a New Report To create a new report, perform the following steps: 1. From the All Report Groups page, click the Report Writer tab. The browser displays a blank page, as shown in Figure 3: Figure 3: New report on the Report Writer tab 2. Click the New button. The browser displays three fields on the page, as shown in Figure 4: Figure 4: The three fields to begin a new report PE-32931404-RPTWRGD-01 • • • • • • 7 Getting Started This is an important step in creating a report. You must define the report itself. The basic information includes the Report Title, Sub Title, and Report Type. Note You are restricted to using only one report type at a time. You cannot create your report beginning in one type, then change the report type and add information from that new type. Explanations of the fields are as follows: Report Type Informs the system what to display for detail items on the report. For example: • If you select Employee List in this drop-down field, Payentry.com displays one line per employee. • If you select Employee Paychecks, the system displays one line per check. In addition, the report type controls the report data to which you have access. The two database tables that are standard for every report are the co (company information) and ee (employee information) tables. You’ll be allowed to use all data for the items you select and all items above it. Each report type will select the database tables relevant to that report type: Figure 5: The report type selects the relevant tables 8 • • • • • • Report Writer Guide Release 3.29 For example, if you select Employee DirectDeposits as the report type, you will have access to the EDirDep table in addition to the standard tables. Some of the types that you may use frequently include: • Company List Displays basic company setup information. • Employee List Displays basic employee information. • Employee Paychecks Displays check register-style information (gross, retirement, and so on). Use code groups to handle the kind of information you want. • Employee Rates Displays information about employee rates of pay. The report type Employee List is the most commonly used type and is available to be used on any of the Employee report types. If you decide to use a company level report type, the employee listing is not available. An example of the drop-down list is shown in Figure 6: Figure 6: Some of the available report types Table 1 is a non-comprehensive list of the different report types available on Payentry.com: PE-32931404-RPTWRGD-01 • • • • • • 9 Getting Started Table 1: Report Types Report Type Available Data Report Detail Common Uses Employee Accruals Company Demographic Employee Demographic Employee Accrual Setup Employee Deductions Company Demographic Employee Demographic Employee Deduction Setup 1 line per deduction per employee EE Deduction Setup. (for reports that include current, MTD, or YTD deduction amounts use the Employee List type.) Employee Dependents Company Demographic Employee Demographic Employee Dependents 1 line per dependent per employee Dependent Listing Employee Direct Deposits Company Demographic Employee Demographic Employee Direct Deposit Setup 1 line per direct deposit per employee EE Direct Deposit Setup Employee Education Company Demographic Employee Demographic Employee Education 1 line per education entry EE Education Listing per employee Employee Emergency Contacts Company Demographic Employee Demographic Employee Emergency Contacts 1 line per emergency contact per employee EE Emergency Contact Listing Employee Events Company Demographic Employee Demographic Employee Events 1 line per event per employee EE Event Listing 1 line per fringe earning code per employee EE Fringe Setup Company Demographic Employee Fringe Benefits Employee Demographic Employee Fringe Setup 1 line per accrual per employee Time Off Balances EE Accrual Setup Employee List Company Demographic Employee Demographic Summarized Payroll Information 1 line per employee Employee List, 401k export files, Reports with payroll numbers Employee Paychecks Company Demographic Employee Demographic Employee Prior Checks 1 line per check Check Register Employee Rates Company Demographic Employee Demographic Employee Rate Setup 1 line per rate code per employee EE Rate Setup Employee Reviews Company Demographic Employee Demographic Employee Reviews 1 line per review per employee EE Review Listing Employee Skills Company Demographic Employee Demographic Employee Skills 1 line per skill per employee EE Skill Listing Employee Taxes Company Demographic Employee Demographic Employee Tax Setup 1 line per tax code per employee EE Tax Setup The Employee List type is the most common and will probably be used for a majority of your reports. If you do not know which type to select, try the Employee List type first. 10 • • • • • • Report Writer Guide Release 3.29 Note Table 1 does not list all report types. Most of those not listed concern company setup information for clients with multiple codes on Payentry.com. Those types are not covered in this document. Report Title The heading of the report. The system displays this text in the list of Report Writer reports on the All Report Groups page (Figure 2 on page 6). It is also displayed on the left-hand side if the report title block which is displayed on the top of all pages in the report. Sub Title [Optional] The subheading of the report. Whatever you enter into this field will be displayed on the report itself, directly underneath the report title. 3. Enter the appropriate values for the Report Type, Report Title, and Sub Title fields. You must enter a value in at least one of these fields. 4. Press the [Enter] key. Once you enter text in or more of the fields and select the report to edit, you must configure the report. See Chapter 2, “Using the Report Editor.” Saving Your Report Once you have entered values for the Report Type and Report Title fields, click on the Save button (located between the New and Run buttons) to save your new report and display the report editing screen. Tip It is recommended that you click the Save button periodically whenever you are editing a report. This action ensures that you do not loose too much of your work, in case of a failure in your connection or a timeout occurs due to inactivity and you are automatically logged off. Editing an Existing Report To edit an existing report, you can do one of the following: • Under the Request Area tab, click the Edit link of the associated report name: PE-32931404-RPTWRGD-01 • • • • • • 11 Getting Started Figure 7: The Edit column – or – • Under the Report Writer tab, select the report in the Edit drop-down list: Figure 8: The Edit drop-down list Once you select the report to edit, you must configure the report. See Chapter 2, “Using the Report Editor.” Report Writer Restrictions The Payentry.com Report Writer can not do the following: 12 • • • • • • • Create “fancy” formatting, such as boxes, shading, other fonts, color, and so on • Report on system setup information • Report on individual pay detail items (EPayHistDetail) • Report on labor distribution information • Change the margins • Use data from two related tables on the same report (in addition to the company and employee tables) • Print a report in Landscape format. All reports print in Portrait format; therefore, if a report requires more space than the width of a regular page, you will have to export the report and use another program. Report Writer Guide Chapter 2 Using the Report Editor • • • • • • This chapter explains how to work with the data that appears in your report. Whenever you create a new report or edit an existing report, the browser displays the report editor page, as shown in Figure 9: Figure 9: Creating a report The report editor page includes: • A tree view in the Available Fields area The Available Fields area on the left-hand side of the page contains the field selection tree, which displays all of the data fields available to you for your report. • Four tabbed sub-pages The report configuration area on the right-hand side contains four sub-tabs, which you use to design and build your report: • Fields — Specifies the fields and headings that appear in the report. This defines the content of the report. • Sorts — [Optional] Specifies how the report is sorted. • Company Filters & Employee Filters — [Optional] Specifies any filtering done in the report. Each sub-page is explained in each of the main steps. PE-32931404-RPTWRGD-01 • • • • • 13 • Using the Report Editor Tip It is recommended that you periodically save your work (by clicking the Save button) whenever you are editing a report. This action prevents loss of information in the event of an automatic inactivity log-off or a connection failure. The basic steps for working with the Report Writer editor are outlined below. Each step is explained in detail in subsequent sections: • Step 1: Add Fields for the Report • Step 2: Sort & Group the Report Output • Step 3: Filter the Report Input Step 1: Add Fields for the Report The Fields sub-tab allows you to select the data to display on your report. When you click on the Fields sub-tab, the system displays the Fields sub-page: Figure 10: Fields tab showing the left-most columns Use this page to enter all of the items you want displayed on your report. Each field you select become a column in your report. You can enter four different types of data into the fields column: A. Data fields from the database, which are displayed in the Available Fields list B. Static or “fixed” entries, which you type in directly C. Special payroll fields D. Special payroll formulas The information that you can include in the report is determined by the Report Type dropdown list (see Chapter 1, “Getting Started”). 14 • • • • • • Report Writer Guide Release 3.29 Each line item in the list of fields produces a column of data on the finished report. The columns in the report that are displayed from left to right correspond with the row of the Fields sub-page, from top to bottom. The report in Figure 10 on page 14 will have six columns. The leftmost column will be labeled EE # and contain the employee ID, and the rightmost column will be Base Rate. The Fields sub-page The fields (columns) and buttons on the Fields page are as follows: Format When you press the Format button, the browser displays a pop-up dialog, as shown in Figure 11: Figure 11: Format pop-up dialog The pop-up menu will allow you to perform special formatting on the field. Each setting is explained below. Show 0 Put a check in this check box to make the system show zeroes instead of leaving the field blank (if it is a numeric field and the value is zero or null). Total Put a check in this check box to include a total for this column on the report. No Punct Put a check in this check box to suppress all punctuation marks from values in this column. No Periods Put a check in this check box to suppress all decimals from number fields. No Commas Put a check in this check box to suppress commas from number fields. Overpunch Put a check in this check box to display numbers using the overpunch format. The last digit of the number will be changed to a letter to differentiate between positive and negative numbers. Uppercase Put a check in this check box to change all letters for these field values to uppercase characters. PE-32931404-RPTWRGD-01 • • • • • • 15 Using the Report Editor The next two fields in each row concern how the column is labeled on the report: Field The name of the field. A column on the report will list values of this field. You can enter four different types of data into the Field column: • Data fields from the database Fields from the database are displayed in the Available Fields tree to the left of the Fields sub-page. Database fields contain actual company and employee data that is stored on the Payentry.com site for your company. To include a data field in the report, click on the field name in the Available Fields tree. Once you click on the field, it is automatically added to the list of fields included on your report. • Static or “fixed” entries These are field that you type directly into the last row on the Fields sub-page. If you want a column to contain specific text, simply type the text you want surrounded by double quotes. For example, you are creating an export file and need to put the characters T00129 in each line. You would enter "T00129" (with the quotes) in the blank row at the bottom of the list. Note The static text you enter directly into the Field column will be repeated on each line of the report. • Special payroll fields For more information, see “Special Fields in the Employee List” on page 18. • Special payroll formulas For more information, see “Special Payroll Formulas” on page 20. Heading The column title that will appear above the field on the report. This field is automatically filled in when you select a field from the Available Fields tree. The rest of the fields in each row concern how the column is formatted on the report: Len 16 • • • • • • The maximum number of characters that will be display in this column. The default value is the length defined in the database. You can change the value, if you wish. Report Writer Guide Release 3.29 If you set this field to 0 (zero), the column for this field will not be included on the report. For fields that you define manually, such as static text and formulas, you must enter a value in this field. Dec The number of decimal places that will be displayed for the values of this field. The default value is 2. L/R Indicates whether this column will be left- or right-justified. Fill Indicates the character to be used if the column is to be filled with a character rather than spaces. For example, some organizations wish to fill a monetary amount with pound signs (#) before the actual number. A most commonly use is to zero-fill fields on output files. For example, you have a number field (such as “rate”) and set the length to a value of 10 and fill to 0 (the zero character). If the data is the number 100.25, the output on the report will be: 0000100.25 The blank spaces in the field are filled with zeros. This is especially useful when creating fixed length export files. Order Allows you to move rows on the sub-page, which corresponds to order of the columns on your report. To move a report column to the left, click that line item’s up arrow. Likewise, click a line item’s down arrow to move the report column to the right. Remove When you press the Remove button, the system deletes the line item from the report. For more information on formatting and output options, see Chapter 5, “Advanced Report Writer Scripting.” Working with Fields To select the fields that will be used to generate the report, perform the following: 1. In the Available Fields tree, click a field you want to include in the report. The system adds that field to the bottom of the list under the Fields sub-tab. 2. If you no longer wish to include a field that’s already listed, click the Remove button for that line item. 3. If you want to include a “fixed” value (a particular value you want to appear) instead of a database value (see step 1), type the value you want to appear, enclosed in quotes; for example: PE-32931404-RPTWRGD-01 • • • • • • 17 Using the Report Editor "100" or "ML71" or "Dog" You can used this feature to enter, say, a plan ID or record identifier in a 401(k) output file. 4. Repeat the preceding steps until all the fields you wish to use in the report are listed under the Fields tab. The order of the fields on this page corresponds to the order of the columns in your report. The order from top-to-bottom in the field list matches the left-to-right order of the report columns. You can change the order in which the columns appear on the report. Use the up-arrow and down-arrow buttons in the Order column of the Fields sub-page to move the fields up and down. Special Fields in the Employee List The Report Writer has special payroll fields available to get current, MTD, QTD, and YTD payroll numbers, as well as deduction and rate setup information. Expanding the Employee Fields in the Available Fields tree includes several special sections, as shown in Figure 12: Figure 12: Special payroll fields The explanations of the fields are as follows: Deductions The employee deduction setup information. Use the Deductions fields to retrieve the current deduction setup information for any deduction code, based on the date selected when the report is run. 18 • • • • • • Report Writer Guide Release 3.29 Figure 13: Special Deductions fields To use one of these items: • Expand Deductions. • Find the deduction you want. • Expand it to see all of the available deduction setup fields. • Click on a field to add it to the report. Use the same steps for each special field group. Current Current payroll values for all codes and code groups. Use the Current fields to enter payroll numbers (Earning, Deduction, and Tax) for the current payroll period. Note If the report is run across a range of dates, the numbers will be the sum total for that range. When you expand Current, you will see all earning, deduction, and tax codes, as well as code sets: Earnings will be preceded by an E, Deductions by a D, and taxes by a T. Expanding any code (or code set) will give you the available totals for that code. For earnings you can select total hours or amount, for deductions you can select total amount, and for taxes you can select total taxable wages, capped taxable wages, or total amount. CYTD, CQTD, CMTD Rates PE-32931404-RPTWRGD-01 The CMTD, CQTD, and CYTD fields function the same as the Current fields, except they are designed to display total Month to Date (CMTD), Quarter to Date (CQTD) and Year to Date (CYTD) numbers. The employee rate information. • • • • • • 19 Using the Report Editor Use the Rates fields to get the current rate code setup information for any rate code (including base rate), based on the date selected when the report is run. These special sections use the year, month, quarter, and time frame of the report. Special Payroll Formulas You can enter a formula in place of a database field or static entry. You typically use formulas to provide special text formatting or add values together. For example, the following formula displays an employee name in the “last, first” format: ee.lastName + “, “ + ee.firstName The following formula adds the current regular and overtime earnings together: ee.Current("E","Reg").amount + ee.Current("E","OT").amount Special payroll formulas can use most Visual Basic (VB) functions: • Text formatting functions Display the first letter of the middle name only: Left (ee.middlename,1) Display check box values as “Y” or “N”: replace (replace(ee.owner, "1", "Y"), "0", "N") • Date formatting functions Change the date format from 01/03/2006 to January 3, 2006: Monthname (Month(ee.hiredate), False) + " " + + Cstr(Year(ee.hiredate)) • Cstr(Day(ee.hiredate)) + ", " Math functions Divide a rate by a specific number (10): EDed.rate / 10 Step 2: Sort & Group the Report Output When you click on the Sorts tab, the system displays the Sorts page: 20 • • • • • • Report Writer Guide Release 3.29 Figure 14: Sorts tab The format of the Sorts sub-page is similar to the Fields page. Report Writer allows you to sort information to control the order in which the data is displayed on the report. In addition, you can have the system generate totals at each sort break by checking the Subtotal field. Click on one or more fields in the Available Fields tree to add fields to the list on this page. These subtotals are in addition to any field-level total defined under the Fields sub-tab. Subtotals are generated for each field that can be mathematically summarized. The explanations of the fields are as follows: Field The name of the field upon which you are going to group or sort the output. The grouping and sorting is performed based on the first line item, then the second, and so on. For example, in the example in Figure 14, the data will be first grouped by department, then sorted by employee ID within each department. Description The default description of this field in the database. This field is automatically populated when you select a database field from the Available Fields tree. Subtotal Put a check in this check box to create a subtotal of this column on the report. Order These arrows are used to move the field up (or down) in the list of sorting fields. Remove When you press the Remove button, the system deletes the line item from the sort criteria. PE-32931404-RPTWRGD-01 • • • • • • 21 Using the Report Editor Step 3: Filter the Report Input To add a filter to your report, select the appropriate filter sub-tab (for example, Company Filters or Employee Filters, based on the data you want to filter) and enter your filter conditions. When you click on a Filters sub-tab, the system displays a Filters page, as shown in the example in Figure 15: Figure 15: Adding employee filters Filters allow you to narrow down the data to a smaller subset. You can either include or exclude that data from the report. Fields that you use as filtering elements will not necessarily appear on the report. In other words, you can use a filter based on information that is not included in the report itself. Each report allows you to create two standard filters that correspond with the Available Fields tree: • The Company Filter sub-tab corresponds with fields listed in Company Fields (the co table). • Likewise, the Employee Filter sub-tab corresponds with fields listed in Employee Fields (the ee table). Some reports add a third table of available fields and corresponding sub-tab, which is determined by the type of report you select (the Report Type field on the Setup tab). Be sure you have that sub-tab selected before you add fields from its corresponding table: Figure 16: Using the correct table/sub-tab combination 22 • • • • • • Report Writer Guide Release 3.29 Note For data that is related to employee listings, enter filter statements on the Employee Filter sub-tab. In similar fashion, use the Company Filter sub-tab to filter company-based reports. The explanations of the sub-tab fields are as follows: Field The name of the field from the database upon which you are basing the filter. As with the other pages, you can double-click on a field in the Available Fields tree to enter the name. Comparison Value And/Or Use this drop-down list to select the comparison you are making between the Field and the Value. Valid entries are: • = — Is Equal to • < — Is Less Than • > — Is Greater Than • <= — Is Less Than or Equal to • >= — is Greater Than or Equal to • <> — Is Not Equal to The text or number to which you are comparing the value of the Field. If you are entering text, enclose it in double quotes. Use this drop-down list to select an operator if you are creating more than one comparison in your filter. Valid entries are AND and OR: • If you use AND, all of the filter conditions must be met for the data to display. • If you use OR, any one of the filter conditions must be met for the data to display. Note A hierarchy exists for these operators. The AND operator is executed first, but as soon as the system reads an OR operator, every subsequent operator is considered an OR statement. If you need to create a compound statement, where several statements are grouped together, use parentheses to define the groupings. For an example of how to use the parentheses properly, see “An Advanced Filter for a Deduction Report.” Advanced PE-32931404-RPTWRGD-01 Use this button to enter multiple SQL statements rather than comparison fields described above. When you click this button, the Field, Comp, Value, and And/Or columns are replaced by a text area. • • • • • • 23 Using the Report Editor If you use this method of creating a filter, be aware that proper SQL syntax is very important. Tip You can use code groups instead of formulas. If you already have code groups defined for the company, you can use them from the employee list of available fields. For more information, see “Special Fields in the Employee List” on page 18. Note If you click the Advanced button and enter SQL statements in the text area, then decide you want to return to the normal filtering method, you must delete the SQL statements in the text area first. Some examples of how to use filtering formulas are contained in the next section. Filtering Formula Examples The examples in this section provide you with formulas for common filters. Filters About Companies Show all companies except one (in this case, company ABC): co.co <> “ABC” Figure 17: Show all companies except ABC 24 • • • • • • Report Writer Guide Release 3.29 Show all companies in particular states (in this case, Massachusetts & California): co.state = “MA” AND co.state = “CA” Figure 18: Show companies located in MA or CA only Filters About Employees Show all active and full-time employees: ee.empStatus = “A” AND ee.empType = “Full” Figure 19: Show all active and full-time employees Show employees who work in cost centers 100 or 200: ee.cc1 = “100” OR ee.cc1 = “200” Figure 20: Show employees in cost centers 100 or 200 PE-32931404-RPTWRGD-01 • • • • • • 25 Using the Report Editor Show all active employees who work in cost centers 100 or 200: ee.empStatus = “A” AND ee.cc1 = “100” OR ee.cc1 = “200” Figure 21: Show active employees in cost centers 100 or 200 An Advanced Filter for a Deduction Report The following code is an example of how to use SQL statements after clicking the Advanced button. Use the AND operator to specify that the filter must meet all of the conditions you define: EDed.dcode = "U" AND EDed.rate >= "5.00" AND EDed.rate <= "9.00" Use the OR operator to specify that the filter must meet at least one of the conditions. In addition, you can create compound statements by grouping AND filters within parentheses: (EDed.dcode = "U" AND EDed.rate >= "5.00" AND EDed.rate <= "9.00") OR (EDed.dcode = "V" AND EDed.rate >= "5.00" AND EDed.rate <= "9.00") If you use the Deduction table as your tree, your deduction filter tab has to be defined first with the deduction code; afterwards, you define the rate you are trying to compile. 26 • • • • • • Report Writer Guide Release 3.29 Formula Examples You can manually enter formulas in the Field column, as shown in the examples below. Display employee’s last name in the format Last, First: ee.lastName + ", " + ee.firstName Figure 22: Show employee’s last and first names Add current regular and overtime earnings together: ee.Current("E","Reg").amount + ee.Current("E","OT").amount Display only the first letter of the middle name: Left(ee.middlename,1) Display check box values are yes or no: replace (replace(ee.owner, "1", "Y"), "0", "N") Change date format from 01/03/09 to January 3, 2009: Monthname (Month(ee.hiredate), False) + " " + Cstr(Year(ee.hiredate)) Cstr(Day(ee.hiredate)) + ", " + Divide a rate by a specific number (for example, 10): EDed.rate/10 Get an employee’s annual salary: ee.AnnualSalary(co.safecheckdate) PE-32931404-RPTWRGD-01 • • • • • • 27 Using the Report Editor Report Writer Tips & Tricks General Tips Here are some things to keep in mind when you work with reports: • Use code groups instead of lengthy formulas. • Use taxable wage values to calculate employer tax amounts. • When adding text fields, always enter a Len value (because the default is zero). • Column headers comply to the Len value. They will truncate if longer than the Len value. • You can remove the column headers as necessary. • Preview the report as you build it. Adjust your layout as necessary. Calculate Employer Taxes in Report Writer Use the SQL statement format below to print employer taxes on a report. Employer taxes are not available in Report Writer; they are calculated at the company level and updated in the ELaborDistribution table. You can use the following format (the taxes listed are for instructional purposes only): (ee.Current("T","SS-R").cappedTaxable * .062) + (ee.Current("T","FUTA").cappedTaxable * .008) + (ee.Current("T","MED-R").cappedTaxable * .0145) + (ee.Current("T","TXSUI").cappedTaxable * .027) + (ee.Current("T","MOSUI").cappedTaxable * 0.0351) + (ee.Current("T","KSSUI").cappedTaxable * .0297) 28 • • • • • • Report Writer Guide Chapter 3 Running & Retrieving Reports • • • • • • Running Reports You can run your report from two locations: • The default reporting page (Request Area tab), which is the same page you use to run reports provided with the system – or – • The report editor (Report Writer tab) while you create or modify the report, which allows you to see report layout according to your current settings Request Area tab You can run an existing report under the Request Area tab, click the Run link of the associated report name: Figure 23: Request Area tab, Run column Report Writer tab You can run an existing report under the Report Writer tab, click the Run button to run the report you are currently editing: PE-32931404-RPTWRGD-01 • • • • • 29 • Running & Retrieving Reports Figure 24: Report Writer tab, Run button If the Run button is not available, the system is indicating that the report has been modified since it was last saved. In order to run the report, you must save if first by pressing the Save button. Once you save the report, the Run button becomes active. Report Parameters When you tell the system to run a report, it displays the report parameters: Figure 25: Report parameters Select the appropriate settings in the Date Range, Output Format, and Delivery sections. 30 • • • • • • Report Writer Guide Release 3.29 After you have defined the parameters, click the Run Report button at the bottom of the page to generate the report. Date Range This section allows you to select the dates on which the report’s data will be based. Dates for the reports (such as the current month, and so on) are based on the calendar date on your computer. Use the Override Dates option to manually select a range of check date/process number combinations on which to base a report. The explanations of the fields are as follows: Most Recent Pay Period Current Month Select this radio button to report on the last payroll that was processed. Select this radio button to report on the month based on today’s date. Current Quarter Select this radio button to report on the quarter based on today’s date. Year-to-Date Select this radio button to report on all data throughout the year up to today’s date. Override Dates Allows you to select a date range other than the standard ones (those indicated by the other radio buttons on this page). Works in conjunction with the Date and Process # drop-down lists, which Millennium automatically populates with a drop-down list of payrolls that have been processed. You can either select a payroll date from the drop-down lists or type in your own dates, such as fiscal dates that do not match any “normal” processing dates; for example, 05/01/2009 and 04/30/2010. Quarter 1, 2, 3, 4 Select these radio buttons to report on a specific quarter of the year based on the current year. Output Format This section allows you to select the report’s file type and formatting. The explanations of the fields are as follows: Output Format PE-32931404-RPTWRGD-01 Use this drop-down list to determine how the report is formatted. Valid entries include: • Portable Document Format (PDF) • ASCII Text • Comma Separated Values • Tab Separated Values • • • • • • 31 Running & Retrieving Reports Output column headers Put a check in this check box to include column headers. The default is to leave headers out of the report. Column headers are automatically included in PDF reports. This field is available only when you select ASCII Text, Comma Separated Values, or Tab Separated Values in the Output Format drop-down list. Delivery This section allows you to select how you will view the report. The explanations of the fields are as follows: View completed report Email completed report to Put a check in this check box to have the resulting report appear in a popup as soon as it is created. Put a check in this check box to have the system send the report to an email address as soon as it is created. The system stores the report in the Pickup Area tab, whether or not you check one of the check boxes above. Queued Reports After you specify the report parameters, the system displays the Report Requested Queued message: Figure 26: Report Requested Queued message 32 • • • • • • Report Writer Guide Release 3.29 It is recommended that you allow pop-ups for this site. A newly generated report: • Appears in a new browser instance The browser instance can either be a new window or new tab, depending on your browser settings. • Is stored in the Pickup Area tab It remains in the Pickup Area for 24 hours. You can download it as many times as you like during that period. If you do not allow pop-ups, the only way to see the report is to go to the Pickup Area. Retrieving a Report After the system has finished generating a report, you can retrieve it under the Pickup Area tab: Figure 27: Pickup Area tab You can: • Click the link under the Download column to display the PDF in your web browser. – or – • Right-click the link and select Save Target As to download the file to your hard drive. PE-32931404-RPTWRGD-01 • • • • • • 33 Running & Retrieving Reports 34 • • • • • • Report Writer Guide Chapter 4 Example of Creating a Report • • • • • • This chapter provides an example of going through the steps of creating a report to help you understand the concepts of using Report Writer. Premise Your 401(k) provider has requested that you produce an export file from your payroll provider that contains all active employees. The report needs to be: • Run once a month • Sorted by employee Social Security number • A comma separated file that contains the fields listed in Table 2: Table 2: Required fields for the comma separated file Field Data Description 1 Plan ID Your company’s plan identifier (4k005) 2 Employee SSN Employee’s social security number (no dashes) 3 Employee Last Name 4 Employee First Name 5 Employee Current Contribution 6 Employee YTD Contribution 7 Employee Contribution Percent Step 1: Create a New Report The first step is to create the new report, give it a name, and select the report type: Figure 28: Creating a new report You choose the Employee List report type because you want just one line per employee, as well as payroll numbers. PE-32931404-RPTWRGD-01 • • • • • 35 • Example of Creating a Report Step 2: Add the Necessary Fields The next step is to add the seven required fields (see Table 2): Figure 29: Adding the report’s required fields Field 1: Plan ID The plan ID is simply a text field that contains "4K005" for every record. You enter the text (surrounded with quotes) directly into the Field column. You also add a heading into the Heading column and set the length of the field in the Len column. Field 2: Employee SSN You add the employee’s SSN by clicking the Format button on the left hand side of the ee.ssn value. Because you added the field using the Available Fields tree, the heading and length were filled in automatically. In order to remove the dashes from the Social Security number, you click the Format button and select No Punct, as shown in Figure 30: Figure 30: Format 36 • • • • • • Report Writer Guide Release 3.29 Fields 3 & 4: Employee Name You include the employee last and first name by selecting Last Name and First Name from the Available Fields tree, as shown in Figure 31: Figure 31: Selecting the name fields Field 5: Current Contribution You enter the employee’s current 401(k) contribution by selecting Curr 401k (deduction code) under the Current > Curr D-401k special payroll fields from the Available Fields tree, as shown in Figure 32: Figure 32: Selecting the current contribution The special payroll fields are located at the bottom of the Employee Fields. PE-32931404-RPTWRGD-01 • • • • • • 37 Example of Creating a Report Field 6: YTD Contribution You enter the employee’s current year-to-date 401(k) contribution by selecting YTD 401k (deduction code) under the CYTD > YTD D-401k special payroll fields from the Available Fields tree, as shown in Figure 33: Figure 33: Selecting the current year-to-date contribution The special payroll fields are located at the bottom of the Employee Fields. Field 7: Employee Contribution Rate You enter the employee’s 401(k) contribution rate by selecting 401k (deduction code) under the Deductions > 401k Ded special payroll fields from the Available Fields tree, as shown in Figure 34: Figure 34: Employee contribution rate The special payroll fields are located at the bottom of the Employee Fields. The Deductions group has the current setup information for each of the employee’s recurring deductions. 38 • • • • • • Report Writer Guide Release 3.29 Step 3: Define the Sorting Criteria Once you have added all of the fields, you must define a sort order for the report. You click on the Sorts tab of the report editor, as shown in Figure 35: Figure 35: Sorts tab The report needs to be sorted by employee ID, so you use the Available Fields tree to select the field code ssn. The system automatically adds ee.ssn to the Field column and ssn to the Description column. You then uncheck the Sub Total check box because you only want to sort by that field—not group and total by SSN. Step 4: Add the Necessary Filters The last step is to filter the report, so that it contains only active employees. You click on the the Employee Filters tab, as shown in Figure 36: Figure 36: Employee Filters tab You select the ee.empStatus field because that is the field code that holds the employees status. You select = Equals from the Comparison drop-down list. Next, you enter the value A in the Value field because you want to include only those employees whose status code is A. You are now ready to run the report. PE-32931404-RPTWRGD-01 • • • • • • 39 Example of Creating a Report 40 • • • • • • Report Writer Guide Chapter 5 Advanced Report Writer Scripting • • • • • • One of the nice things that the Report Writer has to offer is a vast array of things you can do with it. For example, you can utilize VBScript to either manipulate data or retrieve data from non-Payentry.com sources. To get more info on VBScript, please refer to Microsoft’s VBScript documentation at the following URL: http://msdn.microsoft.com/en-us/library/t0aew7h6.aspx Note You can use VBScript functions in Report Writer—not Visual Basic programming. In this chapter you will find some examples of what you can do inside the report writer: • Current Date & Length of Service • Accessing the Employee Annual Salary • Formatting Date Strings • Formatting Numeric Fields • Using “If” Statements for Replacements • Using the Date Range of the Report • Using the Dates of the Most Recently Processed Payroll • Advanced Calculations Using Rates • Simulating Wildcard Characters in Filters • Displaying Employee Pay Grade Information • Displaying Names or Descriptions Instead of Codes • Handling Blank Dates in Filters • Determining Employee Age Current Date & Length of Service Length of service (LOS), or the number of days the employee has been employed, is calculated by Payentry.com—but not stored. The formula provided in this article explains how to take the current date and subtract the hire date to get the length of service. PE-32931404-RPTWRGD-01 • • • • • 41 • Advanced Report Writer Scripting Note The LOS figure returned on the report may not be accurate for employees that have an adjusted seniority or rehire date. Payentry.com, when calculating LOS, considers if the Adjusted Seniority and Rehire date fields have values. The order of date fields at which it looks is: adjusted seniority, rehire, hire. Therefore, the figure on the report may vary from the LOS calculation on Payentry.com. Using the Basic Formula The formula to use is: (Current Date) - (Hire Date) = LOS To derive the current date within the system, use the VB Script function Now(). To derive the employee’s hire date within the system, use ee.hiredate. Therefore, to calculate the length of service based on the hire date (calculate the amount of days between the hire date and the current date), use the following in a report: Now()-ee.hiredate To determine the LOS in years rather than days, simply divide by 365 (and note the parentheses around the days calculation): (Now()-ee.hiredate)/365 Using a VB Script The examples above use basic math to return the length of service. Other ways to determine it include using the VB script function DateDiff, which has the option of returning a variety of different intervals. The syntax for the DateDiff function is as follows: DateDiff(interval, date1, date2) The available arguments according to the Windows Scripting help files is as follows: • interval — String expression that is the interval you want to use to calculate the differences between date1 and date2. Available intervals that can be returned and the parameter required for them: 42 • • • • • • • yyyy — Year • q — Quarter • m — Month • y — Day of year Report Writer Guide Release 3.29 • • d — Day • w — Weekday • ww — Week of year • h — Hour • n — Minute • s — Second date1, date2 — Date expressions. Two dates you want to use in the calculation. Note When you use DateDiff in Report Writer, you must use quotes around the interval. If you use a field name for date values, you do not need to use quotes. Here is an example of using DateDiff to return the LOS (in months): DateDiff("m", ee.Hiredate, Now()) The syntax in the example above returns the number of months the employee has been employed. Like the calculations in “Using the Basic Formula” on page 42, it ignores the rehire dates and adjusted length of service dates. Specifying Results as Integers or Decimals The methods of calculating LOS in “Using the Basic Formula” and “Using a VB Script” round the LOS to the nearest integer. If you do not have any decimal places configured for the field in Report Writer, you need an integer for an answer. If you want decimals, you must ensure your formula will produce decimal places. In order to prevent rounding and see the closest, lowest integer—for instance, if someone has worked 18 months, the following will return 1 year because the employee has only worked one full year—use the INT function. Two examples using the employee’s hire date follow: INT((Now()-ee.hiredate)/365) INT((DateDiff("d",ee.hireDate,NOW()) / 365)) Here is an example of using DateDiff to return the age of an employee (using the employee’s birth date in years in the nn.dd format): DateDiff("d", ee.birthdate, Now())/365) The syntax in the example above returns the “true” age of the employee as of today. For example, if the employee will turn 71 in December and you are running the report in October, the report displays the employee’s age as 70.8. PE-32931404-RPTWRGD-01 • • • • • • 43 Advanced Report Writer Scripting Calculating Age Based on the Report End Date To get the age as of the endDate of the report. ROUND((((CDate(CStr(mid(co.currentreportingend,5,2) + "/" + > mid(co.currentreportingend,7,2) +"/"+ left(co.currentreportingend, > 4)))-ee.birthdate)/365)-.499999999999),0) Example: Enter in a date value Tip To enter in specific dates in filters, use the pound sign on either side of the date. For example, to show January 1, 2006, you would enter: #01/01/2006# Accessing the Employee Annual Salary To calculate the annual salary for an employee, enter the expression below in a field box: ee.AnnualSalary(co.safecheckdate) Formatting Date Strings You can use VBScript Report Writer field box to reformat and display dates from the default format of dd/mm/yyyy. The examples that follow use the ee.hiredate of 01/03/2002: • To display the Jan 3, 2002 format: Monthname (Month(ee.hiredate), True) + " " + Cstr(Day(ee.hiredate)) + ", " + Cstr(Year(ee.hiredate)) • To display the January 3, 2002 format: Monthname (Month(ee.hiredate), False) + " " + Cstr(Day(ee.hiredate)) + ", " + Cstr(Year(ee.hiredate)) • To display the 01/03/02 format: Right("00" + CStr(Month(ee.hiredate)),2) + "/" + Right("00" + CStr(Day(ee.hireDate)),2) + "/" + Right(Cstr(Year(ee.hireDate)),2) 44 • • • • • • Report Writer Guide Release 3.29 To display the 132002 format: CStr(Month(ee.hireDate)) + CStr(Day(ee.hireDate)) + CStr(Year(ee.hireDate) To display the 01032002 format: Right("00" + CStr(Month(ee.hireDate)),2) + Right("00" + CStr(Day(ee.hireDate)),2) + CStr(Year(ee.hireDate)) Formatting Numeric Fields The following examples show how you can dictate the number of characters for a numeric field: A. Define a number field for 10 characters with two implied decimal places: Right(" " & EPaycheck.netCheck * 100, 10) B. Define a number field for 8 positions, two implied decimal places, and make it zero filled: Right("00000000" & EPaycheck.netCheck * 100, 8) Be sure the number of digits or spaces between the quotes matches the last number in the format command. For example, the command above has eight zeros between the quotes and value of the variable before the close parenthesis is an eight. If you typed eight zeros but made the value of the last variable a seven or a nine, the system would get confused. Using “If” Statements for Replacements In Report Writer, there is no way to write an “If” statement or use an “If” function similar to the one in Microsoft Excel®. However, if you need to use If-Then logic to change the value of a field, you can use the VBScript “Replace” statement. Single Replacements To replace a single value, the basic syntax is: Replace(FieldName, ”Value”, ”NewValue”) For example, you want to tell Report Writer, “If an employee’s last name is Smith, change it to XXX to hide their name.” In this case, you would use the following statement: Replace(ee.Lastname,"Smith", "XXX") When the system runs the above statement, it will replace the last name Smith for any employees that have that last name. PE-32931404-RPTWRGD-01 • • • • • • 45 Advanced Report Writer Scripting Multiple Replacements You can use nested “Replace” statements for scenarios like: if the value = 1, then show A; if the value = 2, then show B. To replace a value based on multiple possibilities, the basic syntax is: Replace(ReplaceStatement, “SearchText”, “NewText”) For example, you to tell Report Writer to hide the last name Smith with one value and hide the last name Jones with another value. In this case, you would use the following statement: Replace(Replace(ee.lastName,"Smith","YYY"),"Jones","XXX") When the system runs the above statement, it will replace every last name of Smith with YYY and every last name of Jones with XXX. Using the Date Range of the Report Each time you run a report at Payentry.com, you are specifying a date range for the report to run. However, many reports do not use a date range. You can use the following variables to derive the appropriate dates: • co.currentreportingstart — The start date • co.currentreportingend — The end date When using these variables, it will return a number that looks like the process number. To properly use the variable, you may need to use some string manipulation using common VBScript string modifiers. To get the date in MM/DD/YYYY format the following syntax can be used. CDate(CStr(mid(co.currentreportingstart,5,2) + "/" + mid(co.currentreportingstart,7,2) +"/" + left(co.currentreportingstart, 4))) These variables can be used in any of the fields, or can be filtered off of. Using the Dates of the Most Recently Processed Payroll If you are running a report and need to use the dates of the most recently processed payroll. It is probably easier to use the following syntax than use the reporting dates. This way you can set the report to run for the last payroll processed and not have to worry about the date ranges being passed in. • co.mostrecentcheckdate.process — The process number for the date • co.mostrecentcheckdate.periodbegin — The period begin date • co.mostrecentcheckdate.periodend — The period end date • co.mostrecentcheckdate.checkdate — The check date The different variables return different formats of dates; for example, the process number is in the format YYYYMMDD##. 46 • • • • • • Report Writer Guide Release 3.29 You can use these variables in any of the Report Writer fields or filters. For example, you have a Report Writer report that looks at a specific deduction, using multiple entries for each deduction code controlled by start and end dates. You want to see the current deduction rate value only. Therefore, you edit the EDed filter as shown below: EDed.dcode = "XXXX" AND (EDed.startDate <= CDate(CStr(mid(co.currentreportingend,5,2) + "/" + mid(co.currentreportingend,7,2) +"/" + left(co.currentreportingend,4))) AND EDed.endDate >= CDate(CStr(mid(co.currentreportingend,5,2) + "/" + mid(co.currentreportingend,7,2) +"/" + left(co.currentreportingend, 4)))) The statement above allows you to use the most current rate effective alone for a specific deduction. This logic will work with any table where there are multiple entries with begin and end dates. Simply replace EDed.startDate with the appropriate table name. Alternative Fill Option You can fill in the blank spaces of a field with a character other than the blank. However, if you are creating a PDF report, the Fill field will not work. In such cases, you can use the following formula instead: Right("FillValues" & YourField, FillValueNumber) Right("00000000" & ee.Current("E","Reg").hours,8) Here is an example: Figure 37: Alternate fill The explanations of the formula variables are: • FillValues — The value you wish to use as the filler. If your field is eight characters long (as denoted by the value of the Len field), type that character eight times and enclose it in double quotes. See the example above. PE-32931404-RPTWRGD-01 • • • • • • 47 Advanced Report Writer Scripting • YourField — The field you want to fill. In the example above, the field ee.Current("E","Reg").hours is being filled. • FillValueNumber — How many characters to fill. Must match the number of characters you typed for the FillValues variable and the value of the Len field. Advanced Calculations Using Rates Report Writer is designed to pull “current” rates based on the report run dates—which works fine until you want to perform calculations using any Visual Basic (VB) functions (Round, CDbl, CLng, and so on). Inclusion of VB functions in the calculation logic prevents Report Writer from using the “current” rates. For example, the following formula calculates annual salary and uses the current base rate: ee.Rates("Base").salary * 12 Using this same calculation with a VB function will not work. A VB function cannot access the current base rate if an employee has multiple base rates defined in their Rates/Reviews tab. However, you can create a workaround. The formula below is an example of what the syntax would look like: ROUND(ee.Rates.itembykeydate("Base",rw_dtEndCheckDate).salary, 0) * 12 This parameter uses the end check date for which the report is being run and selects the rates accordingly. Simulating Wildcard Characters in Filters If you want to include only certain records—ones that contain certain characters or text— you would usually use a wildcard character (for example, using % in SQL statements). You cannot use a wildcard character in Report Writer filters; however, you can be creative and use almost any VBScript function. Even though there is no LIKE operator in VBScript, there are ways to simulate it. How you can create a script that acts like the SQL LIKE operator is best explained through an example. In this example, you want to: • Create an employee report that lists only the tax information for SUI taxes. • Include some basic employee demographics and the tax code (tcode) from the ETax section. Therefore, when you create a new Report Writer report, you select Employee Taxes in the Report Type drop-down list. You add the desired fields from ee and Etax tables: 48 • • • • • • Report Writer Guide Release 3.29 Figure 38: Report for all employee tax codes After you run the report, you notice that the report includes every tax associated with every employee. You decide to filter the information to see only the SUI taxes assigned to each employee. Normally in SQL, you would use the wildcard character % in the ETax.tcode entry; for example, %SUI% would return only tax codes with “SUI” in the name. In Visual Basic (VB), you have to be creative and use string functions. In this example, you decide to use the INSTR() function to get the desired results. A common VB and VBScript function, INSTR() has the following parameters. INSTR([start, ]string1, string2[, compare]) Explanations of the INSTR() function arguments that you use in this example are: • start — A numeric expression that sets the starting position for each search. Should usually be 1, as that is the start of a string. • string1 — The string expression being searched. In this example, it is the field name ETax.tcode. • string2 — The string expression for which you are searching. In this example, the string for which you are searching is SUI. You want the system to look for “SUI” from the beginning of the tax code value. If the system finds the string, the function returns a number greater than 0. In Report Writer, you click on the ETax Filter sub-tab. The browser displays the following: Figure 39: Advanced filter link You click on the Advanced link because you decide it is easier to type it in directly: INSTR(1, etax.tcode, "SUI") > 0 This is the result of the steps described above: PE-32931404-RPTWRGD-01 • • • • • • 49 Advanced Report Writer Scripting Figure 40: Report for all employee tax codes This report will now return any tax assigned to the employees with “SUI” in the name and ignores any tax that does not. For more information about VBScript, see the Help file in Microsoft VBScript or search the Microsoft web site. Displaying Employee Pay Grade Information Each employee can have a pay grade assigned to them via their base rate. Presently, there is no easy way to obtain the salary rank information in Report Writer because it is stored at the company level. The only information accessible on the employee is their pay grade. In order to return the various components of the pay grade for each employee that has a pay grade, you can use the examples below. If an employee does not have a pay grade assigned, they will have a blank value or a zero, depending on your Report Writer. This will give you the maximum of the pay grade: co.paygrades.itembykey(ee.paygrade(co.safecheckdate)).Maximum This will give you the midpoint of the pay grade: co.paygrades.itembykey(ee.paygrade(co.safecheckdate)).midpoint This will give you the minimum of the pay grade: co.paygrades.itembykey(ee.paygrade(co.safecheckdate)).Minimum The examples above use the company’s current check date to obtain the pay grade from the employee. You can replace co.safecheckdate with a different date value or variable. Note If you are using a hard-coded value, you must enclose it in double quotes. To obtain the %Mid and %Max values from the employee’s Rates/Reviews tab, you must compute the annual salary and divide by the value. 50 • • • • • • Report Writer Guide Release 3.29 Displaying Names or Descriptions Instead of Codes You can change the output of a field from the actual value of the field to, for example, the description of that field. Each of the subsequent sections describe how to accomplish this kind of substitution. Employee Department Name Instead of Department Code In a Report Writer report, you want to see the name of the employee’s department—not the department number. Therefore, under the Fields tab of the report’s Report Writer properties, you would type a formula in the Field column to display each department’s name rather than the actual field name. This will print the name value of the department rather than the department code: Table 3: Employee department names Actual Dept Field Value You Would Type in the Field Column ee.cc1co.l1 co.l1departments.itembykey(ee.cc1).name ee.cc2co.l2 co.l2departments.itembykey(ee.cc2).name ee.cc3co.l3 co.l3departments.itembykey(ee.cc3).name ee.cc4co.l4 co.l4departments.itembykey(ee.cc4).name ee.cc5co.l5 co.l5departments.itembykey(ee.cc5).name Employee Termination Description Instead of Termination Code To get the description rather than the code, you would use the following field values: Table 4: Employee termination description Value You Would Type in the Field Column Heading Title co.TermReasons.itembykey(ee.TermReason).Description Reason for Termination Handling Blank Dates in Filters Dates such as Hire Date and Birth Date are stored in Millennium with NULL values. Filters, however, are not able to process fields with NULL values. In such cases, use a date less than #01/01/1900# as the value of a filter. For example, you want to run a report that shows all employees that do not have a birth date in their file. In this scenario, you enter the following formula in the Employee Filter sub-tab: ee.BirthDate < #01/01/1900# Here is how it would look: PE-32931404-RPTWRGD-01 • • • • • • 51 Advanced Report Writer Scripting Figure 41: Filtering a NULL date Determining Employee Age To determine an employee’s age, use the birth date of the employee and the current date to get the difference in days and divide by 365.25 and the scripting functions Round and Fix to display the number to the left of the decimal point: CStr(fix(Round((DateDiff("d", ee.birthdate, now()) / 365.25),2))) The result is the employee’s age as an integer, not a decimal number. Note Employees born on February 29th (leap year) will be considered one year older on February 28th on non-leap years. Notes and Known Issues At present, there are a few known issues concerning Report Writer at Payentry.com. Development is in the process of resolving some of these issues, but the less important issues are also worth noting: 52 • • • • • • • You can only report off of one Report Type at a time and cannot combine data from multiple report types. The exception occurs on most of the employee reports: you can include company demographic information. • If there are any pieces of information you are not seeing available in Report Writer, such as a specific tab is not found in the report types, please let MPAY know through the Support channels and we can forward the requests to development. Report Writer Guide