1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
5 Report
: To Do List printout
(and export
)
6 Author
: Andrew McMillan
8 ------------------------------------------------------------------------*/
10 DEF INPUT PARAMETER report-options
AS CHAR NO-UNDO.
12 DEF VAR preview
AS LOGI
NO-UNDO INIT No.
13 DEF VAR show-rebates
AS LOGI
NO-UNDO INIT No.
14 DEF VAR person-1
AS INT NO-UNDO INIT 0.
15 DEF VAR person-n
AS INT NO-UNDO INIT 99999.
16 DEF VAR period-1
AS DATE NO-UNDO.
17 DEF VAR period-n
AS DATE NO-UNDO.
18 DEF VAR selection-style
AS CHAR NO-UNDO.
21 DEF VAR user-name
AS CHAR NO-UNDO.
22 {inc
/username.i
"user-name"}
23 DEF VAR timeStamp
AS CHAR FORMAT "X(44)" NO-UNDO.
24 timeStamp
= STRING( TODAY, "99/99/9999") + ", " + STRING( TIME, "HH:MM:SS") + " for " + user-name.
26 DEF VAR pr-line
AS CHAR INIT "" NO-UNDO.
/* used everywhere to hold print line
*/
27 DEF VAR person-code
AS INT NO-UNDO.
28 DEF VAR person-name
AS CHAR NO-UNDO.
30 DEF VAR title-font
AS CHAR NO-UNDO INITIAL "proportional,helv,point,12,bold".
31 DEF VAR time-font
AS CHAR NO-UNDO INITIAL "proportional,helv,point,6,normal".
32 DEF VAR break1-font
AS CHAR NO-UNDO INITIAL "proportional,helv,point,12,lpi,7,bold".
33 DEF VAR break2-font
AS CHAR NO-UNDO INITIAL "proportional,helv,point,8,bold".
34 DEF VAR base-font
AS CHAR NO-UNDO INITIAL "fixed,courier,cpi,17,lpi,8.5,bold".
38 DEF TEMP-TABLE TaskDue
NO-UNDO
40 FIELD FlowTaskNo
AS INT
41 INDEX XPKDueTasks
AS PRIMARY UNIQUE DueDate FlowTaskNo.
43 /* _UIB-CODE-BLOCK-END
*/
47 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
49 /* ******************** Preprocessor Definitions
******************** */
51 &Scoped-define PROCEDURE-TYPE Procedure
55 /* _UIB-PREPROCESSOR-BLOCK-END
*/
60 /* *********************** Procedure Settings
************************ */
62 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
63 /* Settings for
THIS-PROCEDURE
67 Add Fields to
: Neither
68 Other Settings
: CODE-ONLY
COMPILE
70 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
72 /* ************************* Create Window
************************** */
74 &ANALYZE-SUSPEND _CREATE-WINDOW
75 /* DESIGN Window definition
(used by the UIB
)
76 CREATE WINDOW Procedure
ASSIGN
79 /* END WINDOW DEFINITION
*/
85 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
86 /* ************************* Included-Libraries
*********************** */
88 {inc
/method
/m-txtrep.i
}
92 /* _UIB-CODE-BLOCK-END
*/
97 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
100 /* *************************** Main Block
*************************** */
102 OUTPUT TO VALUE(txtrep-print-file
) KEEP-MESSAGES PAGE-SIZE 0.
104 RUN pclrep-start
( preview
, "reset,portrait,tm,2,a4,lm,6,courier,cpi,18,lpi,9").
106 IF selection-style
= "Me" THEN RUN for-one-person
( person-1
).
107 ELSE IF selection-style
= "Manager" THEN RUN for-one-person
( person-1
).
109 RUN preselect-people.
117 /* _UIB-CODE-BLOCK-END
*/
121 /* ********************** Internal Procedures
*********************** */
123 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE for-each-property Procedure
124 PROCEDURE for-each-property
:
125 /*------------------------------------------------------------------------------
127 ------------------------------------------------------------------------------*/
128 FOR EACH FlowTask
WHERE FlowTask.ActivityStatus
<> "DONE"
129 AND FlowTask.EntityType
= "P"
130 AND FlowTask.EntityCode
= Property.PropertyCode
NO-LOCK:
131 IF FlowTask.DueDate
< period-1
OR FlowTask.DueDate
> period-n
THEN NEXT.
132 IF CAN-FIND( TaskDue
OF FlowTask
) THEN NEXT.
134 TaskDue.DueDate
= FlowTask.DueDate.
135 TaskDue.FlowTaskNo
= FlowTask.FlowTaskNo.
137 FOR EACH Tenant
WHERE Tenant.Active
AND Tenant.EntityType
= "P"
138 AND Tenant.EntityCode
= Property.PropertyCode
NO-LOCK:
139 FOR EACH FlowTask
WHERE FlowTask.ActivityStatus
<> "DONE"
140 AND FlowTask.EntityType
= "T"
141 AND FlowTask.EntityCode
= Tenant.TenantCode
NO-LOCK:
142 IF FlowTask.DueDate
< period-1
OR FlowTask.DueDate
> period-n
THEN NEXT.
143 IF CAN-FIND( TaskDue
OF FlowTask
) THEN NEXT.
145 TaskDue.DueDate
= FlowTask.DueDate.
146 TaskDue.FlowTaskNo
= FlowTask.FlowTaskNo.
152 /* _UIB-CODE-BLOCK-END
*/
156 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE for-each-task Procedure
157 PROCEDURE for-each-task
:
158 /*------------------------------------------------------------------------------
160 ------------------------------------------------------------------------------*/
161 DEF VAR entity-desc
AS CHAR NO-UNDO.
163 entity-desc
= get-entity-name
( FlowTask.EntityType
, FlowTask.EntityCode
).
164 pr-line
= null-str
( STRING( FlowTask.DueDate
, "99/99/9999"), "??/??/????") + " "
165 + STRING( FlowTask.ActivityStatus
,"X(5)")
166 + STRING( FlowTask.FlowTaskType
, "X(5)" )
167 + STRING( FlowTask.Description
, "X(15)" ) + " "
168 + STRING( FlowTask.EntityType
, "X")
169 + STRING( FlowTask.EntityCode
, "99999") + " "
171 RUN pclrep-line
( base-font
, pr-line
).
175 /* _UIB-CODE-BLOCK-END
*/
179 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE for-one-person Procedure
180 PROCEDURE for-one-person
:
181 /*------------------------------------------------------------------------------
183 ------------------------------------------------------------------------------*/
184 DEF INPUT PARAMETER this-person
AS INT NO-UNDO.
186 person-code
= this-person.
187 FIND Person
WHERE Person.PersonCode
= this-person
NO-LOCK NO-ERROR.
188 IF NOT AVAILABLE(Person
) THEN RETURN.
189 person-name
= Person.FirstName
+ " " + Person.LastName .
191 RUN pclrep-line
( break1-font
, "Tasks for " + person-name
).
193 FOR EACH FlowTask
WHERE FlowTask.ActivityStatus
<> "DONE"
194 AND FlowTask.AllocatedTo
= this-person
NO-LOCK:
195 IF FlowTask.DueDate
< period-1
OR FlowTask.DueDate
> period-n
THEN NEXT.
196 IF CAN-FIND( TaskDue
OF FlowTask
) THEN NEXT.
198 TaskDue.DueDate
= FlowTask.DueDate.
199 TaskDue.FlowTaskNo
= FlowTask.FlowTaskNo.
202 FOR EACH Property
WHERE Property.Active
AND Property.Manager
= this-person
NO-LOCK:
203 RUN for-each-property.
206 FOR EACH Property
WHERE Property.Active
AND Property.Administrator
= this-person
NO-LOCK:
207 RUN for-each-property.
211 FIND FlowTask
OF TaskDue
NO-LOCK NO-ERROR.
212 IF AVAILABLE(FlowTask
) THEN RUN for-each-task.
218 /* _UIB-CODE-BLOCK-END
*/
222 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-page-footer Procedure
223 PROCEDURE inst-page-footer
:
224 /*------------------------------------------------------------------------------
225 Purpose
: Print any page footer
226 ------------------------------------------------------------------------------*/
230 /* _UIB-CODE-BLOCK-END
*/
234 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-page-header Procedure
235 PROCEDURE inst-page-header
:
236 /*------------------------------------------------------------------------------
237 Purpose
: Print any page header
238 ------------------------------------------------------------------------------*/
240 RUN pclrep-line
( "univers,Point,6,bold,Proportional", TimeStamp
).
241 RUN pclrep-line
( "", "" ).
242 RUN pclrep-line
( "univers,Point,12,bold,Proportional",
244 + TRIM(STRING(person-code
))
247 RUN pclrep-line
( "", "" ).
249 /* Put any column headers here
*/
250 pr-line
= " Due By Stat Type Description Entity/Description" .
252 RUN pclrep-line
( base-font
, pr-line
).
253 RUN pclrep-down-by
(1).
257 /* _UIB-CODE-BLOCK-END
*/
261 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
262 PROCEDURE parse-parameters
:
263 /*------------------------------------------------------------------------------
265 ------------------------------------------------------------------------------*/
266 DEF VAR token
AS CHAR NO-UNDO.
267 DEF VAR i
AS INT NO-UNDO.
268 DEF VAR fin-year
AS INT NO-UNDO.
270 {inc
/showopts.i
"report-options"}
271 period-1
= TODAY - 180.
272 period-n
= TODAY + 90.
274 DO i
= 1 TO NUM-ENTRIES( report-options
, "~n" ):
275 token
= ENTRY( i
, report-options
, "~n" ).
277 CASE ENTRY( 1, token
):
278 WHEN "Preview" THEN preview
= Yes.
279 WHEN "Manager" THEN person-1
= INT( ENTRY(2,token
) ).
280 WHEN "Selection" THEN selection-style
= ENTRY(2,token
).
281 WHEN "Period" THEN ASSIGN
282 period-1
= DATE( ENTRY(2,token
) )
283 period-n
= DATE( ENTRY(3,token
) ).
284 WHEN "Person" THEN ASSIGN
285 person-1
= INT( ENTRY(2,token
) )
286 person-n
= INT( ENTRY(3,token
) ).
293 /* _UIB-CODE-BLOCK-END
*/
297 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE preselect-people Procedure
298 PROCEDURE preselect-people
:
299 /*------------------------------------------------------------------------------
301 ------------------------------------------------------------------------------*/
305 /* _UIB-CODE-BLOCK-END
*/