1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
5 Report
: Printout of RentalSpace multipliers for Amtrust
6 Author
: Andrew McMillan
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'.
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;".
32 /* _UIB-CODE-BLOCK-END
*/
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
*/
50 /* *********************** Procedure Settings
************************ */
52 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
53 /* Settings for
THIS-PROCEDURE
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
69 /* END WINDOW DEFINITION
*/
73 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
74 /* ************************* Included-Libraries
*********************** */
76 {inc
/method
/m-txtrep.i
}
80 /* _UIB-CODE-BLOCK-END
*/
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'
).
103 FOR EACH Property
NO-LOCK WHERE Property.Active
:
112 /* _UIB-CODE-BLOCK-END
*/
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 /*------------------------------------------------------------------------------
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
)
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> </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.
142 PUT UNFORMATTED '
<tr class
=end
><td colspan
=4> </td></tr>~n'.
146 /* _UIB-CODE-BLOCK-END
*/
151 &IF DEFINED(EXCLUDE-each-rentalspace) = 0 &THEN
153 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-rentalspace Procedure
154 PROCEDURE each-rentalspace
:
155 /*------------------------------------------------------------------------------
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 .
168 IF RentalSpace.AreaStatus
= "V" THEN tenant-name
= "* * * Vacant * * *".
169 IF RentalSpace.AreaStatus
= "C" THEN tenant-name
= "* * * Common * * *".
171 PUT UNFORMATTED '
<tr class
=row'
(rowcounter
MODULO 2) '
>~n'.
173 PUT UNFORMATTED "<td> </td>".
174 PUT UNFORMATTED "<td align=right>".
175 PUT UNFORMATTED STRING(RentalSpace.Level
) .
176 PUT UNFORMATTED "/" STRING(RentalSpace.LevelSeq
) .
177 PUT UNFORMATTED " </td>~n".
179 PUT UNFORMATTED "<td align=right>" RentalSpace.RentalSpaceCode
" </td>~n".
180 PUT UNFORMATTED "<td>" RentalSpace.Description
"</td>~n".
181 PUT UNFORMATTED "<td align=right>" TRIM( STRING(RentalSpace.MarketRental
, "->>>,>>>,>>9.99")) "% </td>~n".
182 PUT UNFORMATTED "<td>" tenant-name
"</td>~n".
183 PUT CONTROL "</tr>~n".
184 rowcounter
= rowcounter
+ 1.
187 /* _UIB-CODE-BLOCK-END
*/
192 &IF DEFINED(EXCLUDE-parse-parameters) = 0 &THEN
194 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
195 PROCEDURE parse-parameters
:
196 /*------------------------------------------------------------------------------
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'.
219 /* _UIB-CODE-BLOCK-END
*/
224 &IF DEFINED(EXCLUDE-report-footers) = 0 &THEN
226 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE report-footers Procedure
227 PROCEDURE report-footers
:
228 /*------------------------------------------------------------------------------
230 ------------------------------------------------------------------------------*/
231 PUT UNFORMATTED "</table>~n".
233 PUT UNFORMATTED '
<p
><p style
="' time-font '">Report prepared at ' timeStamp .
236 /* _UIB-CODE-BLOCK-END
*/
241 &IF DEFINED(EXCLUDE-report-headers) = 0 &THEN
243 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE report-headers Procedure
244 PROCEDURE report-headers
:
245 /*------------------------------------------------------------------------------
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'.
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".
276 /* _UIB-CODE-BLOCK-END
*/