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 Rental Run"
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.Log2 RP.Char3 RP.Log3 ~
43 RP.Log4 RP.Log5 RP.Log6 RP.Log1
44 &Scoped-define FIELD-PAIRS~
45 ~
{&FP1}Int1 ~{&FP2}Int1 ~{&FP3}
46 &Scoped-define ENABLED-TABLES RP
47 &Scoped-define FIRST-ENABLED-TABLE RP
48 &Scoped-Define ENABLED-OBJECTS RECT-23 cmb_MonthFrom cmb_MonthTo btn_print
49 &Scoped-Define DISPLAYED-FIELDS RP.Char1 RP.Int1 RP.Log2 RP.Char3 RP.Log3 ~
50 RP.Log4 RP.Log5 RP.Log6 RP.Log1
51 &Scoped-Define DISPLAYED-OBJECTS fil_Property cmb_MonthFrom cmb_MonthTo
53 /* Custom List Definitions
*/
54 /* ADM-CREATE-FIELDS
,ADM-ASSIGN-FIELDS
,List-3
,List-4
,List-5
,List-6
*/
56 /* _UIB-PREPROCESSOR-BLOCK-END
*/
61 /* *********************** Control Definitions
********************** */
64 /* Definitions of the field level widgets
*/
65 DEFINE BUTTON btn_print
70 DEFINE VARIABLE cmb_MonthFrom
AS CHARACTER FORMAT "X(256)":U
72 VIEW-AS COMBO-BOX INNER-LINES 24
76 DEFINE VARIABLE cmb_MonthTo
AS CHARACTER FORMAT "X(256)":U
78 VIEW-AS COMBO-BOX INNER-LINES 24
82 DEFINE VARIABLE fil_Property
AS CHARACTER FORMAT "X(256)":U
87 DEFINE RECTANGLE RECT-23
88 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
92 /* ************************ Frame Definitions
*********************** */
95 RP.Char1
AT ROW 1.2 COL 2 NO-LABEL
96 VIEW-AS RADIO-SET VERTICAL
98 "All properties", "All":U
,
99 "Single Property", "OneProperty":U
102 RP.Int1
AT ROW 2 COL 13.86 COLON-ALIGNED NO-LABEL FORMAT "99999"
106 fil_Property
AT ROW 2 COL 23.57 COLON-ALIGNED NO-LABEL
107 RP.Log2
AT ROW 3.2 COL 6.14 HELP
109 VIEW-AS RADIO-SET HORIZONTAL
111 "Clear all and regenerate", yes
,
112 "Regenerate these properties", ?
,
115 RP.Char3
AT ROW 4.4 COL 6.14 HELP
117 VIEW-AS RADIO-SET HORIZONTAL
119 "Everything", "All":U
,
121 "Expenses", "Expenses":U
,
122 "Recoveries", "Recoveries":U
124 cmb_MonthFrom
AT ROW 8.2 COL 13.86 COLON-ALIGNED
125 cmb_MonthTo
AT ROW 8.2 COL 37.86 COLON-ALIGNED
126 RP.Log3
AT ROW 10 COL 6.14
127 LABEL "Apply ratchet to all leases"
130 RP.Log4
AT ROW 10.8 COL 6.14
134 RP.Log5
AT ROW 11.6 COL 6.14
135 LABEL "Rental report"
138 RP.Log6
AT ROW 11.6 COL 24.43
139 LABEL "Skip agents fees"
142 RP.Log1
AT ROW 12.4 COL 6.14
147 btn_print
AT ROW 12.4 COL 58.14
148 RECT-23
AT ROW 1 COL 1
149 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
150 SIDE-LABELS NO-UNDERLINE THREE-D
151 AT COL 1 ROW 1 SCROLLABLE
153 DEFAULT-BUTTON btn_print.
156 /* *********************** Procedure Settings
************************ */
158 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
159 /* Settings for
THIS-PROCEDURE
161 External Tables
: ttpl.RP
162 Allow
: Basic
,DB-Fields
164 Add Fields to
: EXTERNAL-TABLES
165 Other Settings
: PERSISTENT-ONLY
COMPILE
168 /* This procedure should always be
RUN PERSISTENT. Report the error
, */
169 /* then cleanup and return.
*/
170 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
171 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT."
172 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
176 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
178 /* ************************* Create Window
************************** */
180 &ANALYZE-SUSPEND _CREATE-WINDOW
181 /* DESIGN Window definition
(used by the UIB
)
182 CREATE WINDOW V-table-Win
ASSIGN
185 /* END WINDOW DEFINITION
*/
190 /* *************** Runtime Attributes and UIB Settings
************** */
192 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
193 /* SETTINGS
FOR WINDOW V-table-Win
194 VISIBLE,,RUN-PERSISTENT
*/
195 /* SETTINGS
FOR FRAME F-Main
196 NOT-VISIBLE Size-to-Fit
*/
198 FRAME F-Main
:SCROLLABLE = FALSE
199 FRAME F-Main
:HIDDEN = TRUE.
201 /* SETTINGS
FOR RADIO-SET RP.Char3
IN FRAME F-Main
203 /* SETTINGS
FOR FILL-IN fil_Property
IN FRAME F-Main
205 /* SETTINGS
FOR FILL-IN RP.Int1
IN FRAME F-Main
206 EXP-LABEL EXP-FORMAT
*/
207 /* SETTINGS
FOR TOGGLE-BOX RP.Log1
IN FRAME F-Main
209 /* SETTINGS
FOR RADIO-SET RP.Log2
IN FRAME F-Main
211 /* SETTINGS
FOR TOGGLE-BOX RP.Log3
IN FRAME F-Main
213 /* SETTINGS
FOR TOGGLE-BOX RP.Log4
IN FRAME F-Main
215 /* SETTINGS
FOR TOGGLE-BOX RP.Log5
IN FRAME F-Main
217 /* SETTINGS
FOR TOGGLE-BOX RP.Log6
IN FRAME F-Main
219 /* _RUN-TIME-ATTRIBUTES-END
*/
223 /* Setting information for Queries and Browse Widgets fields
*/
225 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
226 /* Query rebuild information for
FRAME F-Main
229 */ /* FRAME F-Main
*/
235 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB V-table-Win
236 /* ************************* Included-Libraries
*********************** */
238 {src
/adm
/method
/viewer.i
}
239 {inc
/method
/m-mntvwr.i
}
241 /* _UIB-CODE-BLOCK-END
*/
247 /* ************************ Control Triggers
************************ */
249 &Scoped-define SELF-NAME btn_print
250 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn_print V-table-Win
251 ON CHOOSE OF btn_print
IN FRAME F-Main
/* OK */
255 SELF:SENSITIVE = Yes.
258 /* _UIB-CODE-BLOCK-END
*/
262 &Scoped-define SELF-NAME RP.Char1
263 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Char1 V-table-Win
264 ON VALUE-CHANGED
OF RP.Char1
IN FRAME F-Main
/* Char1
*/
266 RUN select-options-changed.
269 /* _UIB-CODE-BLOCK-END
*/
273 &Scoped-define SELF-NAME cmb_MonthFrom
274 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_MonthFrom V-table-Win
275 ON U1
OF cmb_MonthFrom
IN FRAME F-Main
/* From month
*/
277 {inc
/selcmb
/scmths1.i
"RP" "Int3"}
280 /* _UIB-CODE-BLOCK-END
*/
284 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_MonthFrom V-table-Win
285 ON U2
OF cmb_MonthFrom
IN FRAME F-Main
/* From month
*/
287 {inc
/selcmb
/scmths2.i
"RP" "Int3"}
290 /* _UIB-CODE-BLOCK-END
*/
294 &Scoped-define SELF-NAME cmb_MonthTo
295 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_MonthTo V-table-Win
296 ON U1
OF cmb_MonthTo
IN FRAME F-Main
/* To
*/
298 {inc
/selcmb
/scmthe1.i
"RP" "Int4"}
301 /* _UIB-CODE-BLOCK-END
*/
305 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_MonthTo V-table-Win
306 ON U2
OF cmb_MonthTo
IN FRAME F-Main
/* To
*/
308 {inc
/selcmb
/scmthe2.i
"RP" "Int4"}
311 /* _UIB-CODE-BLOCK-END
*/
315 &Scoped-define SELF-NAME fil_Property
316 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Property V-table-Win
317 ON U1
OF fil_Property
IN FRAME F-Main
319 {inc
/selfil
/sfpro1.i
"RP" "Int1"}
322 /* _UIB-CODE-BLOCK-END
*/
326 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Property V-table-Win
327 ON U2
OF fil_Property
IN FRAME F-Main
329 {inc
/selfil
/sfpro2.i
"RP" "Int1"}
332 /* _UIB-CODE-BLOCK-END
*/
336 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Property V-table-Win
337 ON U3
OF fil_Property
IN FRAME F-Main
339 {inc
/selfil
/sfpro3.i
"RP" "Int1"}
342 /* _UIB-CODE-BLOCK-END
*/
346 &Scoped-define SELF-NAME RP.Int1
347 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Int1 V-table-Win
348 ON LEAVE OF RP.Int1
IN FRAME F-Main
/* Int1
*/
350 {inc
/selcde
/cdpro.i
"fil_Property"}
353 /* _UIB-CODE-BLOCK-END
*/
357 &Scoped-define SELF-NAME RP.Log2
358 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Log2 V-table-Win
359 ON VALUE-CHANGED
OF RP.Log2
IN FRAME F-Main
/* Log2
*/
361 RUN enable-appropriate-fields.
364 /* _UIB-CODE-BLOCK-END
*/
368 &Scoped-define SELF-NAME RP.Log5
369 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Log5 V-table-Win
370 ON VALUE-CHANGED
OF RP.Log5
IN FRAME F-Main
/* Rental report
*/
372 RUN enable-appropriate-fields.
375 /* _UIB-CODE-BLOCK-END
*/
381 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK V-table-Win
384 /* *************************** Main Block
*************************** */
386 /* _UIB-CODE-BLOCK-END
*/
390 /* ********************** Internal Procedures
*********************** */
392 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available V-table-Win
393 PROCEDURE adm-row-available
:
394 /*------------------------------------------------------------------------------
395 Purpose
: Override
(thoroughly
!) the Progress adm-row-available
396 ------------------------------------------------------------------------------*/
398 /* Define variables needed by this internal procedure.
*/
399 {src
/adm
/template
/row-head.i
}
401 /* Create a list of all the tables that we need to get.
*/
402 {src
/adm
/template
/row-list.i
"Creditor"}
404 /* Get the record
ROWID's from the RECORD-SOURCE.
*/
405 {src
/adm
/template
/row-get.i
}
407 /* FIND each record specified by the RECORD-SOURCE.
*/
408 {src
/adm
/template
/row-find.i
"Creditor"}
410 /* Process the newly available records
(i.e. display fields
,
411 open queries
, and
/or pass records on to any RECORD-TARGETS
).
*/
412 {src
/adm
/template
/row-end.i
}
416 /* _UIB-CODE-BLOCK-END
*/
420 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI V-table-Win _DEFAULT-DISABLE
421 PROCEDURE disable_UI
:
422 /*------------------------------------------------------------------------------
423 Purpose
: DISABLE the User Interface
425 Notes
: Here we clean-up the user-interface by deleting
426 dynamic widgets we have created and
/or hide
427 frames. This procedure is usually called when
428 we are ready to
"clean-up" after running.
429 ------------------------------------------------------------------------------*/
430 /* Hide all frames.
*/
432 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
435 /* _UIB-CODE-BLOCK-END
*/
439 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE enable-appropriate-fields V-table-Win
440 PROCEDURE enable-appropriate-fields
:
441 /*------------------------------------------------------------------------------
443 ------------------------------------------------------------------------------*/
444 DO WITH FRAME {&FRAME-NAME}:
446 RUN select-options-changed.
448 IF INPUT RP.Log2
THEN DO:
450 ENABLE cmb_MonthFrom cmb_MonthTo RP.Log3 RP.Log4 RP.Char3.
452 ELSE IF NOT INPUT RP.Log2
THEN
453 DISABLE cmb_MonthFrom cmb_MonthTo RP.Log3 RP.Log4 RP.Char3.
455 DISABLE cmb_MonthFrom cmb_MonthTo RP.Log3 .
456 ENABLE RP.Log4 RP.Char3.
459 IF INPUT RP.Log5
THEN
466 /* _UIB-CODE-BLOCK-END
*/
470 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-enable-fields V-table-Win
471 PROCEDURE inst-enable-fields
:
472 /*------------------------------------------------------------------------------
474 ------------------------------------------------------------------------------*/
476 RUN enable-appropriate-fields.
480 /* _UIB-CODE-BLOCK-END
*/
484 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-initialize V-table-Win
485 PROCEDURE inst-initialize
:
486 /*------------------------------------------------------------------------------
488 ------------------------------------------------------------------------------*/
489 FIND RP
WHERE RP.UserName
= "Amtrust-Forecast"
490 AND RP.ReportID
= {&REPORT-ID} NO-ERROR.
492 IF NOT AVAILABLE RP
THEN DO WITH FRAME {&FRAME-NAME}:
494 ASSIGN RP.ReportID
= {&REPORT-ID}
495 RP.UserName
= "Amtrust-Forecast"
501 RUN dispatch
( 'display-fields'
:U
).
502 RUN dispatch
( 'enable-fields'
:U
).
506 /* _UIB-CODE-BLOCK-END
*/
510 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-destroy V-table-Win
511 PROCEDURE pre-destroy
:
512 /*------------------------------------------------------------------------------
516 ------------------------------------------------------------------------------*/
518 RUN check-modified
( "CLEAR" ).
522 /* _UIB-CODE-BLOCK-END
*/
526 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE run-report V-table-Win
527 PROCEDURE run-report
:
528 /*------------------------------------------------------------------------------
529 Purpose
: Actually run the report through RB engine.
530 ------------------------------------------------------------------------------*/
531 DEF VAR report-options
AS CHAR NO-UNDO.
534 IF RETURN-VALUE = "FAIL" THEN RETURN.
536 RUN dispatch
( 'update-record'
:U
).
538 report-options
= RP.Char1
539 + (IF RP.Char1
= "OneProperty" THEN
540 "~nProperties," + STRING(RP.Int1
) + "," + STRING(RP.Int1
)
542 + (IF RP.Log2
= ?
THEN "~nRegenerate," + RP.Char3
ELSE "")
543 + (IF RP.Log1
THEN "~nPreview" ELSE "")
544 + (IF RP.Log2
THEN "~nClearAll" ELSE "")
545 + (IF NOT RP.Log2
THEN "~nReportOnly" ELSE "")
546 + (IF RP.Log3
THEN "~nAllRatchets" ELSE "")
547 + (IF RP.Log4
THEN "~nAuditReport" ELSE "")
548 + (IF RP.Log5
THEN "~nRentReport" ELSE "")
549 + (IF RP.Log5
AND RP.Log6
THEN "~nSkipAgentsFees" ELSE "")
550 + "~nMonths," + STRING( RP.Int3
) + "," + STRING( RP.Int4
) .
552 IF RP.Log2
THEN DO TRANSACTION:
553 /* save the options for future runs
*/
554 FIND CURRENT RP
EXCLUSIVE-LOCK.
555 RP.Char6
= report-options.
556 FIND CURRENT RP
EXCLUSIVE-LOCK.
559 {inc
/bq-do.i
"forecast/amtrust-forecast.p" "report-options" "NOT RP.Log1"}
563 /* _UIB-CODE-BLOCK-END
*/
567 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE select-options-changed V-table-Win
568 PROCEDURE select-options-changed
:
569 /*------------------------------------------------------------------------------
571 ------------------------------------------------------------------------------*/
572 DEF VAR options
AS CHAR NO-UNDO.
574 options
= INPUT FRAME {&FRAME-NAME} RP.Char1.
578 DO WITH FRAME {&FRAME-NAME}:
579 HIDE RP.Int1 fil_Property.
580 RUN set-link-attributes
IN sys-mgr
( THIS-PROCEDURE, STRING( fil_Property
:HANDLE ), "HIDDEN = Yes":U
).
583 WHEN "OneProperty" THEN
584 DO WITH FRAME {&FRAME-NAME}:
585 VIEW RP.Int1 fil_Property.
586 RUN set-link-attributes
IN sys-mgr
( THIS-PROCEDURE, STRING( fil_Property
:HANDLE ), "HIDDEN = No":U
).
593 /* _UIB-CODE-BLOCK-END
*/
597 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records V-table-Win
598 PROCEDURE send-records
:
599 /*------------------------------------------------------------------------------
601 ------------------------------------------------------------------------------*/
603 /* Define variables needed by this internal procedure.
*/
604 {src
/adm
/template
/snd-head.i
}
606 /* For each requested table
, put it's
ROWID in the output list.
*/
607 {src
/adm
/template
/snd-list.i
"Creditor"}
609 /* Deal with any unexpected table requests before closing.
*/
610 {src
/adm
/template
/snd-end.i
}
614 /* _UIB-CODE-BLOCK-END
*/
618 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed V-table-Win
619 PROCEDURE state-changed
:
620 /* -----------------------------------------------------------
624 -------------------------------------------------------------*/
625 DEFINE INPUT PARAMETER p-issuer-hdl
AS HANDLE NO-UNDO.
626 DEFINE INPUT PARAMETER p-state
AS CHARACTER NO-UNDO.
629 /* Object instance CASEs can go here to replace standard behavior
631 {src
/adm
/template
/vstates.i
}
635 /* _UIB-CODE-BLOCK-END
*/
639 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE verify-report V-table-Win
640 PROCEDURE verify-report
:
641 /*------------------------------------------------------------------------------
643 ------------------------------------------------------------------------------*/
645 CASE INPUT FRAME {&FRAME-NAME} RP.Char1:
647 WHEN 'OneProperty'
THEN
648 IF NOT CAN-FIND( FIRST Property
WHERE Property.PropertyCode
=
649 INPUT FRAME {&FRAME-NAME} RP.Int1 ) THEN
651 MESSAGE "You must select a property" VIEW-AS ALERT-BOX ERROR.
652 APPLY '
ENTRY'
:U
TO RP.Int1
IN FRAME {&FRAME-NAME}.
659 /* _UIB-CODE-BLOCK-END
*/