1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12 GUI
6 &Scoped-define WINDOW-NAME CURRENT-WINDOW
7 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS V-table-Win
8 /*------------------------------------------------------------------------
11 ------------------------------------------------------------------------*/
13 /* *************************** Definitions
************************** */
15 &SCOPED-DEFINE REPORT-ID "Amtrust Rent Report"
19 /* _UIB-CODE-BLOCK-END
*/
23 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
25 /* ******************** Preprocessor Definitions
******************** */
27 &Scoped-define PROCEDURE-TYPE SmartViewer
29 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
31 /* Name of first Frame and
/or Browse and
/or first Query
*/
32 &Scoped-define FRAME-NAME F-Main
35 &Scoped-define EXTERNAL-TABLES RP
36 &Scoped-define FIRST-EXTERNAL-TABLE RP
39 /* Need to scope the external tables to this procedure
*/
40 DEFINE QUERY external_tables
FOR RP.
41 /* Standard List Definitions
*/
42 &Scoped-Define ENABLED-FIELDS RP.Char1 RP.Int1 RP.Int2 RP.Char2 RP.Char3 ~
43 RP.Log2 RP.Log6 RP.Log3 RP.Log1
44 &Scoped-define FIELD-PAIRS~
45 ~
{&FP1}Int1 ~{&FP2}Int1 ~{&FP3}~
46 ~
{&FP1}Int2 ~{&FP2}Int2 ~{&FP3}
47 &Scoped-define ENABLED-TABLES RP
48 &Scoped-define FIRST-ENABLED-TABLE RP
49 &Scoped-Define ENABLED-OBJECTS RECT-23 cmb_MonthFrom cmb_MonthTo btn_print
50 &Scoped-Define DISPLAYED-FIELDS RP.Char1 RP.Int1 RP.Int2 RP.Char2 RP.Char3 ~
51 RP.Log2 RP.Log6 RP.Log3 RP.Log1
52 &Scoped-Define DISPLAYED-OBJECTS fil_Property fil_Property2 cmb_MonthFrom ~
55 /* Custom List Definitions
*/
56 /* ADM-CREATE-FIELDS
,ADM-ASSIGN-FIELDS
,List-3
,List-4
,List-5
,List-6
*/
58 /* _UIB-PREPROCESSOR-BLOCK-END
*/
63 /* *********************** Control Definitions
********************** */
66 /* Definitions of the field level widgets
*/
67 DEFINE BUTTON btn_print
72 DEFINE VARIABLE cmb_MonthFrom
AS CHARACTER FORMAT "X(256)":U
74 VIEW-AS COMBO-BOX INNER-LINES 24
78 DEFINE VARIABLE cmb_MonthTo
AS CHARACTER FORMAT "X(256)":U
80 VIEW-AS COMBO-BOX INNER-LINES 24
84 DEFINE VARIABLE fil_Property
AS CHARACTER FORMAT "X(256)":U
89 DEFINE VARIABLE fil_Property2
AS CHARACTER FORMAT "X(256)":U
94 DEFINE RECTANGLE RECT-23
95 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
99 /* ************************ Frame Definitions
*********************** */
102 RP.Char1
AT ROW 1.2 COL 2 NO-LABEL
103 VIEW-AS RADIO-SET VERTICAL
105 "All properties", "All":U
,
106 "Single Property", "OneProperty":U
,
107 "Range of Properties", "PropertyRange":U
110 RP.Int1
AT ROW 2 COL 17.29 COLON-ALIGNED NO-LABEL FORMAT "99999"
114 fil_Property
AT ROW 2 COL 26.43 COLON-ALIGNED NO-LABEL
115 RP.Int2
AT ROW 3 COL 17.29 COLON-ALIGNED NO-LABEL FORMAT "99999"
119 fil_Property2
AT ROW 3 COL 26.43 COLON-ALIGNED NO-LABEL
120 cmb_MonthFrom
AT ROW 4.2 COL 17.29 COLON-ALIGNED
121 cmb_MonthTo
AT ROW 4.2 COL 37.86 COLON-ALIGNED
122 RP.Char2
AT ROW 6 COL 3.86 HELP
124 VIEW-AS RADIO-SET VERTICAL
126 "Full detail", "Detail":U
,
127 "1 Line per Lease/Area/Acct", "LinePerLease":U
,
128 "4 Lines per Property", "FourPerProperty":U
,
129 "1 Line per Property", "LinePerProperty":U
131 RP.Char3
AT ROW 6 COL 34.72 HELP
133 VIEW-AS RADIO-SET VERTICAL
135 "Rent Forecast", "Rents":U
,
136 "Expenses", "Expenses":U
,
137 "Recoveries", "Recoveries":U
,
138 "Net Expenses", "NetExpenses":U
140 RP.Log2
AT ROW 9.6 COL 3.86
144 RP.Log6
AT ROW 9.8 COL 34.72
145 LABEL "Show agents fees"
148 RP.Log3
AT ROW 10.6 COL 34.72
152 RP.Log1
AT ROW 10.8 COL 3.86
157 btn_print
AT ROW 11.6 COL 58.14
158 RECT-23
AT ROW 1 COL 1
159 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
160 SIDE-LABELS NO-UNDERLINE THREE-D
161 AT COL 1 ROW 1 SCROLLABLE
163 DEFAULT-BUTTON btn_print.
166 /* *********************** Procedure Settings
************************ */
168 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
169 /* Settings for
THIS-PROCEDURE
171 External Tables
: ttpl.RP
172 Allow
: Basic
,DB-Fields
174 Add Fields to
: EXTERNAL-TABLES
175 Other Settings
: PERSISTENT-ONLY
COMPILE
178 /* This procedure should always be
RUN PERSISTENT. Report the error
, */
179 /* then cleanup and return.
*/
180 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
181 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT."
182 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
186 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
188 /* ************************* Create Window
************************** */
190 &ANALYZE-SUSPEND _CREATE-WINDOW
191 /* DESIGN Window definition
(used by the UIB
)
192 CREATE WINDOW V-table-Win
ASSIGN
195 /* END WINDOW DEFINITION
*/
200 /* *************** Runtime Attributes and UIB Settings
************** */
202 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
203 /* SETTINGS
FOR WINDOW V-table-Win
204 VISIBLE,,RUN-PERSISTENT
*/
205 /* SETTINGS
FOR FRAME F-Main
206 NOT-VISIBLE Size-to-Fit
*/
208 FRAME F-Main
:SCROLLABLE = FALSE
209 FRAME F-Main
:HIDDEN = TRUE.
211 /* SETTINGS
FOR RADIO-SET RP.Char2
IN FRAME F-Main
213 /* SETTINGS
FOR RADIO-SET RP.Char3
IN FRAME F-Main
215 /* SETTINGS
FOR FILL-IN fil_Property
IN FRAME F-Main
217 /* SETTINGS
FOR FILL-IN fil_Property2
IN FRAME F-Main
219 /* SETTINGS
FOR FILL-IN RP.Int1
IN FRAME F-Main
220 EXP-LABEL EXP-FORMAT
*/
221 /* SETTINGS
FOR FILL-IN RP.Int2
IN FRAME F-Main
222 EXP-LABEL EXP-FORMAT
*/
223 /* SETTINGS
FOR TOGGLE-BOX RP.Log1
IN FRAME F-Main
225 /* SETTINGS
FOR TOGGLE-BOX RP.Log2
IN FRAME F-Main
227 /* SETTINGS
FOR TOGGLE-BOX RP.Log3
IN FRAME F-Main
229 /* SETTINGS
FOR TOGGLE-BOX RP.Log6
IN FRAME F-Main
231 /* _RUN-TIME-ATTRIBUTES-END
*/
235 /* Setting information for Queries and Browse Widgets fields
*/
237 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
238 /* Query rebuild information for
FRAME F-Main
241 */ /* FRAME F-Main
*/
247 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB V-table-Win
248 /* ************************* Included-Libraries
*********************** */
250 {src
/adm
/method
/viewer.i
}
251 {inc
/method
/m-mntvwr.i
}
253 /* _UIB-CODE-BLOCK-END
*/
259 /* ************************ Control Triggers
************************ */
261 &Scoped-define SELF-NAME btn_print
262 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn_print V-table-Win
263 ON CHOOSE OF btn_print
IN FRAME F-Main
/* OK */
267 SELF:SENSITIVE = Yes.
270 /* _UIB-CODE-BLOCK-END
*/
274 &Scoped-define SELF-NAME RP.Char1
275 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Char1 V-table-Win
276 ON VALUE-CHANGED
OF RP.Char1
IN FRAME F-Main
/* Char1
*/
278 RUN select-options-changed.
281 /* _UIB-CODE-BLOCK-END
*/
285 &Scoped-define SELF-NAME cmb_MonthFrom
286 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_MonthFrom V-table-Win
287 ON U1
OF cmb_MonthFrom
IN FRAME F-Main
/* From month
*/
289 {inc
/selcmb
/scmths1.i
"RP" "Int3"}
292 /* _UIB-CODE-BLOCK-END
*/
296 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_MonthFrom V-table-Win
297 ON U2
OF cmb_MonthFrom
IN FRAME F-Main
/* From month
*/
299 {inc
/selcmb
/scmths2.i
"RP" "Int3"}
302 /* _UIB-CODE-BLOCK-END
*/
306 &Scoped-define SELF-NAME cmb_MonthTo
307 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_MonthTo V-table-Win
308 ON U1
OF cmb_MonthTo
IN FRAME F-Main
/* To
*/
310 {inc
/selcmb
/scmthe1.i
"RP" "Int4"}
313 /* _UIB-CODE-BLOCK-END
*/
317 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_MonthTo V-table-Win
318 ON U2
OF cmb_MonthTo
IN FRAME F-Main
/* To
*/
320 {inc
/selcmb
/scmthe2.i
"RP" "Int4"}
323 /* _UIB-CODE-BLOCK-END
*/
327 &Scoped-define SELF-NAME fil_Property
328 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Property V-table-Win
329 ON U1
OF fil_Property
IN FRAME F-Main
331 {inc
/selfil
/sfpro1.i
"RP" "Int1"}
334 /* _UIB-CODE-BLOCK-END
*/
338 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Property V-table-Win
339 ON U2
OF fil_Property
IN FRAME F-Main
341 {inc
/selfil
/sfpro2.i
"RP" "Int1"}
344 /* _UIB-CODE-BLOCK-END
*/
348 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Property V-table-Win
349 ON U3
OF fil_Property
IN FRAME F-Main
351 {inc
/selfil
/sfpro3.i
"RP" "Int1"}
354 /* _UIB-CODE-BLOCK-END
*/
358 &Scoped-define SELF-NAME fil_Property2
359 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Property2 V-table-Win
360 ON U1
OF fil_Property2
IN FRAME F-Main
362 {inc
/selfil
/sfpro1.i
"RP" "Int2"}
365 /* _UIB-CODE-BLOCK-END
*/
369 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Property2 V-table-Win
370 ON U2
OF fil_Property2
IN FRAME F-Main
372 {inc
/selfil
/sfpro2.i
"RP" "Int2"}
375 /* _UIB-CODE-BLOCK-END
*/
379 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Property2 V-table-Win
380 ON U3
OF fil_Property2
IN FRAME F-Main
382 {inc
/selfil
/sfpro3.i
"RP" "Int2"}
385 /* _UIB-CODE-BLOCK-END
*/
389 &Scoped-define SELF-NAME RP.Int1
390 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Int1 V-table-Win
391 ON LEAVE OF RP.Int1
IN FRAME F-Main
/* Int1
*/
393 {inc
/selcde
/cdpro.i
"fil_Property"}
396 /* _UIB-CODE-BLOCK-END
*/
400 &Scoped-define SELF-NAME RP.Int2
401 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Int2 V-table-Win
402 ON LEAVE OF RP.Int2
IN FRAME F-Main
/* Int2
*/
404 {inc
/selcde
/cdpro.i
"fil_Property2"}
407 /* _UIB-CODE-BLOCK-END
*/
413 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK V-table-Win
416 /* *************************** Main Block
*************************** */
418 /* _UIB-CODE-BLOCK-END
*/
422 /* ********************** Internal Procedures
*********************** */
424 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available V-table-Win
425 PROCEDURE adm-row-available
:
426 /*------------------------------------------------------------------------------
427 Purpose
: Override
(thoroughly
!) the Progress adm-row-available
428 ------------------------------------------------------------------------------*/
430 /* Define variables needed by this internal procedure.
*/
431 {src
/adm
/template
/row-head.i
}
433 /* Create a list of all the tables that we need to get.
*/
434 {src
/adm
/template
/row-list.i
"Creditor"}
436 /* Get the record
ROWID's from the RECORD-SOURCE.
*/
437 {src
/adm
/template
/row-get.i
}
439 /* FIND each record specified by the RECORD-SOURCE.
*/
440 {src
/adm
/template
/row-find.i
"Creditor"}
442 /* Process the newly available records
(i.e. display fields
,
443 open queries
, and
/or pass records on to any RECORD-TARGETS
).
*/
444 {src
/adm
/template
/row-end.i
}
448 /* _UIB-CODE-BLOCK-END
*/
452 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI V-table-Win _DEFAULT-DISABLE
453 PROCEDURE disable_UI
:
454 /*------------------------------------------------------------------------------
455 Purpose
: DISABLE the User Interface
457 Notes
: Here we clean-up the user-interface by deleting
458 dynamic widgets we have created and
/or hide
459 frames. This procedure is usually called when
460 we are ready to
"clean-up" after running.
461 ------------------------------------------------------------------------------*/
462 /* Hide all frames.
*/
464 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
467 /* _UIB-CODE-BLOCK-END
*/
471 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable-appropriate-fields V-table-Win
472 PROCEDURE enable-appropriate-fields
:
473 /*------------------------------------------------------------------------------
475 ------------------------------------------------------------------------------*/
476 DO WITH FRAME {&FRAME-NAME}:
478 RUN select-options-changed.
483 /* _UIB-CODE-BLOCK-END
*/
487 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-enable-fields V-table-Win
488 PROCEDURE inst-enable-fields
:
489 /*------------------------------------------------------------------------------
491 ------------------------------------------------------------------------------*/
493 RUN enable-appropriate-fields.
497 /* _UIB-CODE-BLOCK-END
*/
501 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-initialize V-table-Win
502 PROCEDURE inst-initialize
:
503 /*------------------------------------------------------------------------------
505 ------------------------------------------------------------------------------*/
506 DEF VAR user-name
AS CHAR NO-UNDO.
508 {inc
/username.i
"user-name"}
510 FIND RP
WHERE RP.UserName
= user-name
511 AND RP.ReportID
= {&REPORT-ID} NO-ERROR.
513 IF NOT AVAILABLE RP
THEN DO WITH FRAME {&FRAME-NAME}:
515 ASSIGN RP.ReportID
= {&REPORT-ID}
516 RP.UserName
= user-name
522 RUN dispatch
( 'display-fields'
:U
).
523 RUN dispatch
( 'enable-fields'
:U
).
527 /* _UIB-CODE-BLOCK-END
*/
531 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-destroy V-table-Win
532 PROCEDURE pre-destroy
:
533 /*------------------------------------------------------------------------------
537 ------------------------------------------------------------------------------*/
539 RUN check-modified
( "CLEAR" ).
543 /* _UIB-CODE-BLOCK-END
*/
547 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE run-report V-table-Win
548 PROCEDURE run-report
:
549 /*------------------------------------------------------------------------------
550 Purpose
: Actually run the report through RB engine.
551 ------------------------------------------------------------------------------*/
552 DEF VAR report-options
AS CHAR NO-UNDO.
555 IF RETURN-VALUE = "FAIL" THEN RETURN.
557 RUN dispatch
( 'update-record'
:U
).
559 report-options
= RP.Char1
560 + (IF RP.Char1
= "OneProperty" THEN
561 "~nProperties," + STRING(RP.Int1
) + "," + STRING(RP.Int1
)
562 ELSE (IF RP.Char1
= "PropertyRange" THEN
563 "~nProperties," + STRING(RP.Int1
) + "," + STRING(RP.Int2
)
565 + (IF RP.Log1
THEN "~nPreview" ELSE "")
566 + (IF RP.Log2
THEN "~nMonthly" ELSE "")
567 + (IF RP.Log3
THEN "~nConsolidated" ELSE "")
568 + (IF RP.Log6
THEN "~nShowAgentsFees" ELSE "")
569 + "~nSummariseTo," + RP.Char2
570 + "~nReportOn," + RP.Char3
571 + "~nMonths," + STRING( RP.Int3
) + "," + STRING( RP.Int4
) .
573 {inc
/bq-do.i
"forecast/amtrust-rent-report.p" "report-options" "NOT RP.Log1"}
577 /* _UIB-CODE-BLOCK-END
*/
581 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE select-options-changed V-table-Win
582 PROCEDURE select-options-changed
:
583 /*------------------------------------------------------------------------------
585 ------------------------------------------------------------------------------*/
586 DEF VAR options
AS CHAR NO-UNDO.
588 options
= INPUT FRAME {&FRAME-NAME} RP.Char1.
592 DO WITH FRAME {&FRAME-NAME}:
593 HIDE RP.Int1 fil_Property RP.Int2 fil_Property2.
594 RUN set-link-attributes
IN sys-mgr
( THIS-PROCEDURE, STRING( fil_Property
:HANDLE ), "HIDDEN = Yes":U
).
595 RUN set-link-attributes
IN sys-mgr
( THIS-PROCEDURE, STRING( fil_Property2
:HANDLE ), "HIDDEN = Yes":U
).
598 WHEN "OneProperty" THEN
599 DO WITH FRAME {&FRAME-NAME}:
600 HIDE RP.Int2 fil_Property2.
601 VIEW RP.Int1 fil_Property.
602 RUN set-link-attributes
IN sys-mgr
( THIS-PROCEDURE, STRING( fil_Property
:HANDLE ), "HIDDEN = No":U
).
603 RUN set-link-attributes
IN sys-mgr
( THIS-PROCEDURE, STRING( fil_Property2
:HANDLE ), "HIDDEN = Yes":U
).
606 WHEN "PropertyRange" THEN
607 DO WITH FRAME {&FRAME-NAME}:
608 VIEW RP.Int1 fil_Property RP.Int2 fil_Property2.
609 RUN set-link-attributes
IN sys-mgr
( THIS-PROCEDURE, STRING( fil_Property
:HANDLE ), "HIDDEN = No":U
).
610 RUN set-link-attributes
IN sys-mgr
( THIS-PROCEDURE, STRING( fil_Property2
:HANDLE ), "HIDDEN = No":U
).
616 /* _UIB-CODE-BLOCK-END
*/
620 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records V-table-Win
621 PROCEDURE send-records
:
622 /*------------------------------------------------------------------------------
624 ------------------------------------------------------------------------------*/
626 /* Define variables needed by this internal procedure.
*/
627 {src
/adm
/template
/snd-head.i
}
629 /* For each requested table
, put it's
ROWID in the output list.
*/
630 {src
/adm
/template
/snd-list.i
"Creditor"}
632 /* Deal with any unexpected table requests before closing.
*/
633 {src
/adm
/template
/snd-end.i
}
637 /* _UIB-CODE-BLOCK-END
*/
641 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed V-table-Win
642 PROCEDURE state-changed
:
643 /* -----------------------------------------------------------
647 -------------------------------------------------------------*/
648 DEFINE INPUT PARAMETER p-issuer-hdl
AS HANDLE NO-UNDO.
649 DEFINE INPUT PARAMETER p-state
AS CHARACTER NO-UNDO.
652 /* Object instance CASEs can go here to replace standard behavior
654 {src
/adm
/template
/vstates.i
}
658 /* _UIB-CODE-BLOCK-END
*/
662 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE verify-report V-table-Win
663 PROCEDURE verify-report
:
664 /*------------------------------------------------------------------------------
666 ------------------------------------------------------------------------------*/
668 CASE INPUT FRAME {&FRAME-NAME} RP.Char1:
670 WHEN 'OneProperty'
THEN
671 IF NOT CAN-FIND( FIRST Property
WHERE Property.PropertyCode
=
672 INPUT FRAME {&FRAME-NAME} RP.Int1 ) THEN
674 MESSAGE "You must select a property" VIEW-AS ALERT-BOX ERROR.
675 APPLY '
ENTRY'
:U
TO RP.Int1
IN FRAME {&FRAME-NAME}.
682 /* _UIB-CODE-BLOCK-END
*/