- Tạo template (mẫu báo cáo) từ chương trình MS Word hoặc bất kỳ trình soạn thảo văn bản nào. Mẫu báo cáo sẽ phải lưu dưới định dạng *.rtf (rich text format).
- Copy mẫu báo cáo này vào template folder tại My Documents\Phoebus\Report Templates\
- Truy cập chức năng ELC - (Employee Labor Contract)
- Ở ô lệnh. nhập lệnh W và bấm enter. Nếu bạn chưa có mẫu HĐ nào thì Phoebus sẽ tự tạo 1 mẫu cho bạn
Report Design Reference
In a report template all controlling words, variables and data fields must be comprised between symbols "\" (back slash), for instance: \date\ or \data.EmplCode\
Reference to a field name may be created, using its number. For example: \data.(0)\, \data.(5)\
Report generator ignores spaces in field names and keywords. However, if you want to use name with spaces, you may write it between the chars "[" and "]" for example \Table1:[Field name with spaces]\
If there is a report variable declared as CustomerName, in the pattern of the report it may be referenced as \CustomerName\. Variables are stored in VarList collection.
There are several types of constants in Phoebus RTF report template. String constants are defined with double quotes, single quotes, or "~" symbols.
For example: \"constant string 1"\, \'constant string 2' \, \~constant string 3~\. Constants are often used as parameters for user defined functions. If you need to place text with a "\" symbol in report template, you also may use a string constant, for example: \"c:\My Documents\"\.
Numeric constants are numbers in decimal or exponential form: \2\, \2.5\, \3E-1\. Decimal separator is a dot in input template, however in output results it appears according with machine regional settings.
Date constants are always written in a form \{yyyy-mm-dd}\, for example \{2007-06-20}\.
Boolean constants are \True\ or \False\. If you have EK RTF component properties TrueValue and FalseValue set for example to "Yes" and "No", in a report results you will see Yes and No instead of True and False.
In addition to operating with database fields and variables, you may create a user defined function, for example \myfunc(a:field1, a:field2)\.
Operators and functions in report
Different arithmetical and logical expressions may be used in report template.
- Arithmetical operations: >, <, =, <=, >=, <>, != (not equal), +, -, *, /, % (mod)
- Logical operations: && (and), || (or), ! (not)
For example:
\IF( (table1:field1>b+1) || (table1:field1=0) )\
............
\ENDIF\
The next built-in functions are supported by report language:
- Variables and conditions: VAR, SET, IIF, :=
- String functions: STR, VAL, UPPER, LOWER, COPY, MID, SUBSTR, POS, TRIM, FORMATFLOAT
- Data tables navigation: EOF, BOF, LAST, FIRST, NEXT, PRIOR
- Numeric functions: ROUND, INT, FRAC, POWER, INTPOWER
- Date/time functions: NOW, DATE, TIME, DATETOSTR, DATETIMETOSTR, TIMETOSTR, STRTODATE, STRTODATETIME, STRTOTIME, YEAR, MONTH, DAY, SYEAR, SMONTH, SDAY, DTOS, STOD
VAR(VAR1, ... , VAR N) - Creates variables VAR1, ... VAR N if they don't exist. |
VarName := Value - Assigns Value to variable VarName, for example \a:=4\ |
SET(VarName, Value) - Assigns Value to variable VarName. |
IIF(Logical_expr, Value1, Value2) - Returns one of two values depending on the value of a logical expression. This function, also known as Immediate IF, evaluates a logical expression and then returns one of two expressions. If the logical expression evaluates to True, IIF( ) returns the first expression. If the logical expression evaluates to False, IIF( ) returns the second expression. |
String functions.
| ||||||
| ||||||
| ||||||
| ||||||
| ||||||
| ||||||
| ||||||
Data navigation
|
Numeric report functions.
|
|
|
|
|
Date and time report functions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Format of IF-ENDIF construction is:
\If(<boolean value>)\
.............................................
.............................................\elsif(<boolean value>)\
.............................................\elsif(<boolean value>)\
.............................................\else\
\elsif\ and \else\ are optional.\endif\
<boolean value> may be a variable, data field or user defined function.
All records of a data table, attached to the ReportData collection, may be inserted in a document as a table rows or in any free form. For this use keywords \Scan(DataTable)\ and \Endscan\. Inside cycle scan-endscan may be located a block of text with data fields, variables and constants, for example:
Lines with words "Scan", "Endscan" are excluded from the result document. However, if in step of designing a report you want to see as will look a result, you may set an attribute "hidden font" for words "Scan", "Endscan".
Full format of scan block is:
\Scan(DataTable) [, while(<boolean value>)] [,page] [,noeof] [,function1,...,functionN]\............................................
\Scanentry [,function1,...,functionN]\............................................
\Scanfooter [,function1,...,functionN]\............................................
\Endscan [,function1,...,functionN]\
If keyword "while" defined in a scan expression, scan block will be terminated when <boolean value> returns false result. "While" is often used with records grouped by some data field. <boolean value> may be a report variable, data field or user defined function.Option "page" forces to begin every record of scanned DataTable (besides first) from a new page.
If you use option "noeof" report generator will skip entire scan block if scanned DataTable have no any records. This option is useful when making master-details reports.
: with option "noeof" scan block will start from the current record. DataTable will not be moved to the first record.Attention
Words "Scanentry" and "Scanfooter" are optional. You may add them when using option "noeof" in "scan" keyword, or if you want to develop some special functionality, calling optional scan block functions.
Use option "noeof" with keyword \Scanentry\ to manage scan block with some header section. Every new record of DataTable will return control to the position of \Scanentry\ keyword. However, if DataTable has no any records, entire block from "scan" to the "endscan" will be missed. For example:
Keyword \Scanfooter\ may be used to manage scan block with some footer section. Every time when report generator gets "Scanfooter", it returns control to the position of \Scanentry\ or \Scan\ keyword. If DataTable has no any records, entire block from "Scan" to the "Endscan" will be missed. For example:
\Scanentry\ and \Scanfooter\ may be used simultaneously:
NOTE
: You must type keywords \scan(...)\, \scanentry\ and \endscan\ all with the same format attributes, for example with font Arial, 10, regular (or other that you like). It guarantees that format attributes inside block scan-endscan will be correct in output document.If you use "page" option and a table immediately after "scan" keyword in report template, keep in mind that you should have at least one paragraph (empty line) before the table in the RTF document, otherwise, RTF editor such as MS Word ignores "new page" control.
Recommended technique:
When editing report template, place keywords \scan(...)\, \endscan\ outside of table or in the same cell to prevent corrupting of RTF table structure.
Optional functions may be used with commands "scan", "scanentry", "scanfooter", "endscan".
\scancommand, ...., function1(source,destination)...functionN(...)\
Each function is performed when report generator gets corresponded scan command.
The first argument in each function is "source" data field or report variable. Result of each function is stored in a report variable, which is "destination" argument. Function may have noreset option - in this case its result will not be initiated with zero value if function was computed at least once. If result variable does not exists it will be created automatically.
Besides SUM, CTN, CTS functions you may call user defined functions.
Sometimes it is necessary to declare report variable inside the report template, especially if this variable is an argument for user defined function. For this use VAR function.
Sum function
SUM(source, destination [, noreset]) - totals data field or report variable.
source - data field or report variable to sum.
destination - report variable to store result of the function.
noreset - use this option if you don't want to initialize destination variable with zero value. New values of the source field will be added to the previous result of the function.
Example of a report:
\scan(a)\
\a:number\ - \a:value\
\endscan, sum(a:value,s_value)\total: \s_value\\scan(b)\\b:number\ - \b:value\\endscan, sum(b:value,s_value,noreset)\All totals: \s_value\
Result may be like this:
1 - 5
2 - 10
3 - 4
total: 19
1 - 10All totals: 29

