Add blank column, rename column.
[capital-apms-progress.git] / process / report / amtrust-rs-multipliers.p
blob11ac233c29f56b1964b323d182d80e68c8999e0f
1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
2 &ANALYZE-RESUME
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
5 Report: Printout of RentalSpace multipliers for Amtrust
6 Author: Andrew McMillan
7 Date: 4/12/2001
8 ------------------------------------------------------------------------*/
10 DEF INPUT PARAMETER report-options AS CHAR NO-UNDO.
12 DEF VAR active-only AS LOGI NO-UNDO INITIAL No.
13 DEF VAR allowed-areatypes AS CHAR NO-UNDO INITIAL 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z'.
14 RUN parse-parameters.
16 DEF VAR user-name AS CHAR NO-UNDO.
17 {inc/username.i "user-name"}
18 DEF VAR timeStamp AS CHAR FORMAT "X(44)" NO-UNDO.
19 timeStamp = STRING( TODAY, "99/99/9999") + ", " + STRING( TIME, "HH:MM:SS") + " for " + user-name.
21 DEF VAR pr-line AS CHAR INIT "" NO-UNDO. /* used everywhere to hold print line */
22 DEF VAR rowcounter AS INT INIT 0.
24 DEF VAR title-font AS CHAR NO-UNDO INITIAL "font-family: sans-serif; font-weight: 700; font-size: 14pt".
25 DEF VAR time-font AS CHAR NO-UNDO INITIAL "font-family: tahoma,sans-serif; font-size: 8pt;".
26 DEF VAR break1-font AS CHAR NO-UNDO INITIAL "font-family: serif; font-size: 14pt; font-weight: 700;".
27 DEF VAR break2-font AS CHAR NO-UNDO INITIAL "font-family: serif; font-size: 11pt; font-weight: 700;".
28 DEF VAR base-font AS CHAR NO-UNDO INITIAL "font-family: serif; font-size: 10pt;".
30 {inc/ofc-this.i}
32 /* _UIB-CODE-BLOCK-END */
33 &ANALYZE-RESUME
36 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
38 /* ******************** Preprocessor Definitions ******************** */
40 &Scoped-define PROCEDURE-TYPE Procedure
41 &Scoped-define DB-AWARE no
45 /* _UIB-PREPROCESSOR-BLOCK-END */
46 &ANALYZE-RESUME
50 /* *********************** Procedure Settings ************************ */
52 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
53 /* Settings for THIS-PROCEDURE
54 Type: Procedure
55 Allow:
56 Frames: 0
57 Add Fields to: Neither
58 Other Settings: CODE-ONLY COMPILE
60 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
62 /* ************************* Create Window ************************** */
64 &ANALYZE-SUSPEND _CREATE-WINDOW
65 /* DESIGN Window definition (used by the UIB)
66 CREATE WINDOW Procedure ASSIGN
67 HEIGHT = 28.3
68 WIDTH = 36.29.
69 /* END WINDOW DEFINITION */
71 &ANALYZE-RESUME
73 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
74 /* ************************* Included-Libraries *********************** */
76 {inc/method/m-txtrep.i}
77 {inc/null.i}
78 {inc/entity.i}
80 /* _UIB-CODE-BLOCK-END */
81 &ANALYZE-RESUME
87 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
90 /* *************************** Main Block *************************** */
92 /* Re-initialise with a more appropriate suffix for HTML files */
93 txtrep-file-suffix = ".html".
94 RUN txtrep-initialise.
96 OUTPUT TO VALUE(txtrep-print-file) KEEP-MESSAGES PAGE-SIZE 0.
98 /* RUN pclrep-start( preview, "reset,portrait,tm,2,a4,lm,6,courier,cpi,18,lpi,9"). */
99 RUN htmlrep-start('Rental Space Modifiers').
101 RUN report-headers.
103 FOR EACH Property NO-LOCK WHERE Property.Active:
104 RUN each-property.
105 END.
106 RUN report-footers.
108 OUTPUT CLOSE.
110 RUN htmlrep-finish.
112 /* _UIB-CODE-BLOCK-END */
113 &ANALYZE-RESUME
116 /* ********************** Internal Procedures *********************** */
118 &IF DEFINED(EXCLUDE-each-property) = 0 &THEN
120 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-property Procedure
121 PROCEDURE each-property :
122 /*------------------------------------------------------------------------------
123 Purpose:
124 ------------------------------------------------------------------------------*/
125 IF NOT(Property.Active) AND active-only THEN RETURN.
126 IF NOT(CAN-FIND( FIRST RentalSpace OF Property
127 WHERE CAN-DO( allowed-areatypes, RentalSpace.AreaType )
128 )) THEN RETURN.
130 PUT UNFORMATTED '<tr class=prow>~n'.
131 PUT UNFORMATTED "<td align=right>" STRING(Property.PropertyCode) "</td>~n".
132 PUT UNFORMATTED "<td colspan=5>" Property.Name "</td>~n".
133 /* PUT UNFORMATTED "<td>&nbsp;</td>~n". */
134 PUT CONTROL "</tr>~n".
136 FOR EACH RentalSpace of Property
137 WHERE CAN-DO( allowed-areatypes, RentalSpace.AreaType )
138 NO-LOCK BY RentalSpace.Level BY RentalSpace.LevelSeq:
139 RUN each-rentalspace.
140 END.
142 PUT UNFORMATTED '<tr class=end><td colspan=4>&nbsp;</td></tr>~n'.
144 END PROCEDURE.
146 /* _UIB-CODE-BLOCK-END */
147 &ANALYZE-RESUME
149 &ENDIF
151 &IF DEFINED(EXCLUDE-each-rentalspace) = 0 &THEN
153 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-rentalspace Procedure
154 PROCEDURE each-rentalspace :
155 /*------------------------------------------------------------------------------
156 Purpose:
157 ------------------------------------------------------------------------------*/
158 DEF VAR tenant-name AS CHAR NO-UNDO INITIAL " - ".
160 IF RentalSpace.AreaStatus = "L" THEN DO:
161 FIND FIRST TenancyLease OF RentalSpace NO-LOCK NO-ERROR.
162 IF AVAILABLE(TenancyLease) THEN DO:
163 FIND FIRST Tenant OF TenancyLease NO-LOCK NO-ERROR.
164 tenant-name = TRIM( STRING( Tenant.TenantCode, ">>>>>9")) + " - " + Tenant.Name .
165 END.
166 END.
167 ELSE DO:
168 IF RentalSpace.AreaStatus = "V" THEN tenant-name = "* * * Vacant * * *".
169 IF RentalSpace.AreaStatus = "C" THEN tenant-name = "* * * Common * * *".
170 END.
171 PUT UNFORMATTED '<tr class=row' (rowcounter MODULO 2) '>~n'.
173 PUT UNFORMATTED "<td>&nbsp;</td>".
174 PUT UNFORMATTED "<td align=right>".
175 PUT UNFORMATTED STRING(RentalSpace.Level) .
176 PUT UNFORMATTED "/" STRING(RentalSpace.LevelSeq) .
177 PUT UNFORMATTED "&nbsp;</td>~n".
179 PUT UNFORMATTED "<td align=right>" RentalSpace.RentalSpaceCode "&nbsp;</td>~n".
180 PUT UNFORMATTED "<td>" RentalSpace.Description "</td>~n".
181 PUT UNFORMATTED "<td align=right>" TRIM( STRING(RentalSpace.MarketRental, "->>>,>>>,>>9.99")) "% &nbsp;</td>~n".
182 PUT UNFORMATTED "<td>" tenant-name "</td>~n".
183 PUT CONTROL "</tr>~n".
184 rowcounter = rowcounter + 1.
185 END PROCEDURE.
187 /* _UIB-CODE-BLOCK-END */
188 &ANALYZE-RESUME
190 &ENDIF
192 &IF DEFINED(EXCLUDE-parse-parameters) = 0 &THEN
194 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
195 PROCEDURE parse-parameters :
196 /*------------------------------------------------------------------------------
197 Purpose:
198 ------------------------------------------------------------------------------*/
199 DEF VAR token AS CHAR NO-UNDO.
200 DEF VAR i AS INT NO-UNDO.
202 {inc/showopts.i "report-options"}
204 DO i = 1 TO NUM-ENTRIES( report-options, "~n" ):
205 token = ENTRY( i, report-options, "~n" ).
207 CASE ENTRY( 1, token ):
208 WHEN "Selection" THEN ASSIGN
209 active-only = ENTRY(2,token) = "Active".
210 WHEN "NoCarparks" THEN DO:
211 allowed-areatypes = 'A,B,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z'.
212 END.
213 END CASE.
215 END.
217 END PROCEDURE.
219 /* _UIB-CODE-BLOCK-END */
220 &ANALYZE-RESUME
222 &ENDIF
224 &IF DEFINED(EXCLUDE-report-footers) = 0 &THEN
226 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE report-footers Procedure
227 PROCEDURE report-footers :
228 /*------------------------------------------------------------------------------
229 Purpose:
230 ------------------------------------------------------------------------------*/
231 PUT UNFORMATTED "</table>~n".
233 PUT UNFORMATTED '<p><p style="' time-font '">Report prepared at ' timeStamp .
234 END PROCEDURE.
236 /* _UIB-CODE-BLOCK-END */
237 &ANALYZE-RESUME
239 &ENDIF
241 &IF DEFINED(EXCLUDE-report-headers) = 0 &THEN
243 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE report-headers Procedure
244 PROCEDURE report-headers :
245 /*------------------------------------------------------------------------------
246 Purpose:
247 ------------------------------------------------------------------------------*/
249 PUT UNFORMATTED '<style type="text/css"><!--~n'.
250 PUT UNFORMATTED '.base, p, td ~{' base-font '}~n'.
251 PUT UNFORMATTED '.title ~{' title-font '}~n'.
252 PUT UNFORMATTED '.prow ~{ color: #fcfc90; background: #101050; ' break1-font '}~n'.
253 PUT UNFORMATTED '.row0 ~{ background: #f0f0c0; }~n'.
254 PUT UNFORMATTED '.row1 ~{ background: #fafbe8; }~n'.
255 PUT UNFORMATTED '.break1 ~{' break1-font '}~n'.
256 PUT UNFORMATTED '.break2 ~{' break2-font '}~n'.
257 PUT UNFORMATTED '--></style>~n'.
259 RUN htmlrep-body.
260 PUT UNFORMATTED '<h2 style="' + title-font + '">Rental Space Multipliers</h2>~n'.
263 PUT UNFORMATTED "<table>~n".
265 PUT UNFORMATTED "<tr>~n".
266 PUT UNFORMATTED "<th>Property</th>~n".
267 PUT UNFORMATTED "<th>Area</th>~n".
268 PUT UNFORMATTED "<th>Code</th>~n".
269 PUT UNFORMATTED "<th>Name</th>~n".
270 PUT UNFORMATTED "<th>Multiplier</th>~n".
271 PUT UNFORMATTED "<th>Tenant</th>~n".
272 PUT CONTROL "</tr>~n".
274 END PROCEDURE.
276 /* _UIB-CODE-BLOCK-END */
277 &ANALYZE-RESUME
279 &ENDIF