Add blank column, rename column.
[capital-apms-progress.git] / process / report / project-listing.p
blob083ca495dd24b92dcb0c71e117403641d04fc6f2
1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
2 &ANALYZE-RESUME
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
5 ------------------------------------------------------------------------*/
7 &IF DEFINED(UIB_IS_RUNNING) &THEN
8 DEF VAR report-options AS CHAR NO-UNDO INITIAL "".
9 &ELSE
10 DEF INPUT PARAMETER report-options AS CHAR NO-UNDO.
11 &ENDIF
13 DEF VAR active-flag AS LOGI NO-UNDO INIT Yes.
14 DEF VAR by-projectcode AS LOGI NO-UNDO.
15 DEF VAR by-entitycode AS LOGI NO-UNDO.
16 DEF VAR by-shortname AS LOGI NO-UNDO.
18 DEF VAR sort-desc AS CHAR NO-UNDO.
19 DEF VAR filt-desc AS CHAR NO-UNDO.
21 DEF VAR preview AS LOGI NO-UNDO INIT Yes.
22 DEF VAR user-name AS CHAR NO-UNDO.
23 {inc/username.i "user-name"}
24 DEF VAR timeStamp AS CHAR FORMAT "X(44)" NO-UNDO.
25 timeStamp = STRING( TODAY, "99/99/9999") + ", " + STRING( TIME, "HH:MM:SS") + " for " + user-name.
27 /* _UIB-CODE-BLOCK-END */
28 &ANALYZE-RESUME
31 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
33 /* ******************** Preprocessor Definitions ******************** */
35 &Scoped-define PROCEDURE-TYPE Procedure
36 &Scoped-define DB-AWARE no
40 /* _UIB-PREPROCESSOR-BLOCK-END */
41 &ANALYZE-RESUME
45 /* *********************** Procedure Settings ************************ */
47 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
48 /* Settings for THIS-PROCEDURE
49 Type: Procedure
50 Allow:
51 Frames: 0
52 Add Fields to: Neither
53 Other Settings: CODE-ONLY COMPILE
55 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
57 /* ************************* Create Window ************************** */
59 &ANALYZE-SUSPEND _CREATE-WINDOW
60 /* DESIGN Window definition (used by the UIB)
61 CREATE WINDOW Procedure ASSIGN
62 HEIGHT = 27.4
63 WIDTH = 30.14.
64 /* END WINDOW DEFINITION */
66 &ANALYZE-RESUME
68 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
69 /* ************************* Included-Libraries *********************** */
71 {inc/method/m-txtrep.i}
73 /* _UIB-CODE-BLOCK-END */
74 &ANALYZE-RESUME
80 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
83 /* *************************** Main Block *************************** */
85 RUN parse-parameters.
87 OUTPUT TO VALUE(txtrep-print-file) KEEP-MESSAGES PAGE-SIZE 0.
89 RUN pclrep-start( preview, "reset,portrait,tm,2,a4,lm,4,courier,cpi,18,lpi,9").
91 RUN project-listing.
93 OUTPUT CLOSE.
95 RUN pclrep-finish.
97 /* _UIB-CODE-BLOCK-END */
98 &ANALYZE-RESUME
101 /* ********************** Internal Procedures *********************** */
103 &IF DEFINED(EXCLUDE-each-project) = 0 &THEN
105 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-project Procedure
106 PROCEDURE each-project :
107 /*------------------------------------------------------------------------------
108 Purpose:
109 Parameters: <none>
110 Notes:
111 ------------------------------------------------------------------------------*/
113 RUN pclrep-line( "courier,Fixed,cpi,18,lpi,9,Normal",
114 STRING( Project.ProjectCode, "99999" ) + SPC(4) +
115 STRING( Project.Active, "Yes/No" ) + SPC( 4 ) +
116 STRING( Project.Name, "X(30)" ) + SPC( 4 ) +
117 Project.EntityType +
118 STRING( Project.EntityCode, "99999" )
121 END PROCEDURE.
123 /* _UIB-CODE-BLOCK-END */
124 &ANALYZE-RESUME
126 &ENDIF
128 &IF DEFINED(EXCLUDE-group-header) = 0 &THEN
130 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE group-header Procedure
131 PROCEDURE group-header :
132 /*------------------------------------------------------------------------------
133 Purpose:
134 Parameters: <none>
135 Notes:
136 ------------------------------------------------------------------------------*/
138 DEF INPUT PARAMETER header-text AS CHAR NO-UNDO.
140 RUN pclrep-line( "Helvetica,Point,8,Bold,Proportional", header-text ).
141 RUN pclrep-line( "", "" ).
143 END PROCEDURE.
145 /* _UIB-CODE-BLOCK-END */
146 &ANALYZE-RESUME
148 &ENDIF
150 &IF DEFINED(EXCLUDE-inst-page-footer) = 0 &THEN
152 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-page-footer Procedure
153 PROCEDURE inst-page-footer :
154 /*------------------------------------------------------------------------------
155 Purpose: Print any page footer
156 ------------------------------------------------------------------------------*/
158 END PROCEDURE.
160 /* _UIB-CODE-BLOCK-END */
161 &ANALYZE-RESUME
163 &ENDIF
165 &IF DEFINED(EXCLUDE-inst-page-header) = 0 &THEN
167 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-page-header Procedure
168 PROCEDURE inst-page-header :
169 /*------------------------------------------------------------------------------
170 Purpose: Print any page header
171 ------------------------------------------------------------------------------*/
173 RUN pclrep-line( "univers,Point,7,bold,proportional", TimeStamp).
174 RUN pclrep-line( "univers,Point,12,bold,proportional",
175 FILL( " ", 45) + "Project Listing by " + sort-desc
178 RUN pclrep-line( "", "").
179 RUN pclrep-line( "courier,Fixed,cpi,18,lpi,9,Bold",
180 STRING( "Code", "X(5)" ) + SPC(4) +
181 STRING( "Active", "X(5)" ) + SPC( 2 ) +
182 STRING( "Name", "X(30)" ) + SPC( 4 ) +
183 STRING( "Owning Entity", "X(13)" )
185 RUN pclrep-line( "", "").
187 END PROCEDURE.
189 /* _UIB-CODE-BLOCK-END */
190 &ANALYZE-RESUME
192 &ENDIF
194 &IF DEFINED(EXCLUDE-parse-parameters) = 0 &THEN
196 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
197 PROCEDURE parse-parameters :
198 /*------------------------------------------------------------------------------
199 Purpose:
200 Parameters: <none>
201 Notes:
202 ------------------------------------------------------------------------------*/
204 DEF VAR i AS INT NO-UNDO.
205 DEF VAR token AS CHAR NO-UNDO.
207 DO i = 1 TO NUM-ENTRIES( report-options, "~n" ):
208 token = ENTRY( i, report-options, "~n" ).
210 CASE ENTRY( 1, token ):
212 WHEN "Sort" THEN
214 CASE ENTRY( 2,token ):
215 WHEN "Code" THEN ASSIGN by-projectcode = Yes sort-desc = "Project Code".
216 WHEN "Entity" THEN ASSIGN by-entitycode = Yes sort-desc = "Owning Entity".
217 END CASE.
218 END.
220 WHEN "Active" THEN
221 CASE ENTRY( 2, token ):
222 WHEN "Yes" THEN ASSIGN active-flag = Yes filt-desc = "Active Only".
223 WHEN "No" THEN ASSIGN active-flag = No filt-desc = "Inactive Only".
224 OTHERWISE ASSIGN active-flag = ? filt-desc = "".
225 END CASE.
227 WHEN "Preview" THEN preview = ENTRY( 2, token ) = "Yes".
229 END CASE.
231 END.
233 END PROCEDURE.
235 /* _UIB-CODE-BLOCK-END */
236 &ANALYZE-RESUME
238 &ENDIF
240 &IF DEFINED(EXCLUDE-project-listing) = 0 &THEN
242 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE project-listing Procedure
243 PROCEDURE project-listing :
244 /*------------------------------------------------------------------------------
245 Purpose:
246 Parameters: <none>
247 Notes:
248 ------------------------------------------------------------------------------*/
250 &SCOP WHERE-PHRASE WHERE ( IF active-flag = ? THEN True ELSE Project.Active = active-flag )
252 IF by-projectcode THEN
253 FOR EACH Project NO-LOCK {&WHERE-PHRASE}:
254 RUN each-project.
255 END.
257 ELSE IF by-entitycode THEN
258 FOR EACH Project NO-LOCK {&WHERE-PHRASE}
259 BREAK BY Project.EntityType BY Project.EntityCode:
261 IF FIRST-OF( Project.EntityCode ) THEN
263 RUN group-header( Project.EntityType + STRING(Project.EntityCode,"99999") ).
264 END.
266 RUN each-project.
268 IF LAST-OF( Project.EntityCode ) THEN RUN pclrep-line( ?, ? ).
270 END.
273 END PROCEDURE.
275 /* _UIB-CODE-BLOCK-END */
276 &ANALYZE-RESUME
278 &ENDIF