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 "Tenant Outgoing Budgets"
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.Int2 RP.Int1 RP.Log2 RP.Log3 ~
44 &Scoped-define FIELD-PAIRS~
45 ~
{&FP1}Int2 ~{&FP2}Int2 ~{&FP3}~
46 ~
{&FP1}Int1 ~{&FP2}Int1 ~{&FP3}
47 &Scoped-define ENABLED-TABLES RP
48 &Scoped-define FIRST-ENABLED-TABLE RP
49 &Scoped-Define ENABLED-OBJECTS RECT-23 cmb_MonthEnding btn_print
50 &Scoped-Define DISPLAYED-FIELDS RP.Char1 RP.Int2 RP.Int1 RP.Log2 RP.Log3 ~
52 &Scoped-Define DISPLAYED-OBJECTS fil_Tenant fil_Property cmb_MonthEnding
54 /* Custom List Definitions
*/
55 /* ADM-CREATE-FIELDS
,ADM-ASSIGN-FIELDS
,List-3
,List-4
,List-5
,List-6
*/
57 /* _UIB-PREPROCESSOR-BLOCK-END
*/
62 /* *********************** Control Definitions
********************** */
65 /* Definitions of the field level widgets
*/
66 DEFINE BUTTON btn_print
71 DEFINE VARIABLE cmb_MonthEnding
AS CHARACTER FORMAT "X(256)":U
73 VIEW-AS COMBO-BOX INNER-LINES 24
77 DEFINE VARIABLE fil_Property
AS CHARACTER FORMAT "X(256)":U
82 DEFINE VARIABLE fil_Tenant
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 "Single Tenant", "OneTenant":U
,
99 "Tenants of a particular property", "OneProperty":U
102 RP.Int2
AT ROW 3 COL 11 COLON-ALIGNED
103 LABEL "Tenant" FORMAT "99999"
107 RP.Int1
AT ROW 3 COL 11 COLON-ALIGNED
108 LABEL "Property" FORMAT "99999"
112 fil_Tenant
AT ROW 3 COL 20.72 COLON-ALIGNED NO-LABEL
113 fil_Property
AT ROW 3 COL 20.72 COLON-ALIGNED NO-LABEL
114 cmb_MonthEnding
AT ROW 4.4 COL 11 COLON-ALIGNED
115 RP.Log2
AT ROW 5.8 COL 6.14
116 LABEL "Expense Reconciliation"
120 RP.Log3
AT ROW 6.6 COL 6.14 HELP
122 LABEL "Generate transactions"
125 RP.Log4
AT ROW 7.4 COL 6.14 HELP
127 LABEL "Print letter to Tenant"
130 RP.Log1
AT ROW 9.2 COL 6.14
135 btn_print
AT ROW 9.2 COL 58.14
136 RECT-23
AT ROW 1 COL 1
137 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
138 SIDE-LABELS NO-UNDERLINE THREE-D
139 AT COL 1 ROW 1 SCROLLABLE
141 DEFAULT-BUTTON btn_print.
144 /* *********************** Procedure Settings
************************ */
146 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
147 /* Settings for
THIS-PROCEDURE
149 External Tables
: ttpl.RP
150 Allow
: Basic
,DB-Fields
152 Add Fields to
: EXTERNAL-TABLES
153 Other Settings
: PERSISTENT-ONLY
COMPILE
156 /* This procedure should always be
RUN PERSISTENT. Report the error
, */
157 /* then cleanup and return.
*/
158 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
159 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT."
160 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
164 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
166 /* ************************* Create Window
************************** */
168 &ANALYZE-SUSPEND _CREATE-WINDOW
169 /* DESIGN Window definition
(used by the UIB
)
170 CREATE WINDOW V-table-Win
ASSIGN
173 /* END WINDOW DEFINITION
*/
178 /* *************** Runtime Attributes and UIB Settings
************** */
180 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
181 /* SETTINGS
FOR WINDOW V-table-Win
182 VISIBLE,,RUN-PERSISTENT
*/
183 /* SETTINGS
FOR FRAME F-Main
184 NOT-VISIBLE Size-to-Fit
*/
186 FRAME F-Main
:SCROLLABLE = FALSE
187 FRAME F-Main
:HIDDEN = TRUE.
189 /* SETTINGS
FOR FILL-IN fil_Property
IN FRAME F-Main
191 /* SETTINGS
FOR FILL-IN fil_Tenant
IN FRAME F-Main
193 /* SETTINGS
FOR FILL-IN RP.Int1
IN FRAME F-Main
194 EXP-LABEL EXP-FORMAT
*/
195 /* SETTINGS
FOR FILL-IN RP.Int2
IN FRAME F-Main
196 EXP-LABEL EXP-FORMAT
*/
197 /* SETTINGS
FOR TOGGLE-BOX RP.Log1
IN FRAME F-Main
199 /* SETTINGS
FOR TOGGLE-BOX RP.Log2
IN FRAME F-Main
201 /* SETTINGS
FOR TOGGLE-BOX RP.Log3
IN FRAME F-Main
202 EXP-LABEL EXP-HELP
*/
203 /* SETTINGS
FOR TOGGLE-BOX RP.Log4
IN FRAME F-Main
204 EXP-LABEL EXP-HELP
*/
205 /* _RUN-TIME-ATTRIBUTES-END
*/
209 /* Setting information for Queries and Browse Widgets fields
*/
211 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
212 /* Query rebuild information for
FRAME F-Main
215 */ /* FRAME F-Main
*/
221 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB V-table-Win
222 /* ************************* Included-Libraries
*********************** */
224 {src
/adm
/method
/viewer.i
}
225 {inc
/method
/m-mntvwr.i
}
227 /* _UIB-CODE-BLOCK-END
*/
233 /* ************************ Control Triggers
************************ */
235 &Scoped-define SELF-NAME btn_print
236 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btn_print V-table-Win
237 ON CHOOSE OF btn_print
IN FRAME F-Main
/* OK */
241 SELF:SENSITIVE = Yes.
244 /* _UIB-CODE-BLOCK-END
*/
248 &Scoped-define SELF-NAME RP.Char1
249 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Char1 V-table-Win
250 ON VALUE-CHANGED
OF RP.Char1
IN FRAME F-Main
/* Char1
*/
252 RUN tenant-options-changed.
255 /* _UIB-CODE-BLOCK-END
*/
259 &Scoped-define SELF-NAME cmb_MonthEnding
260 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_MonthEnding V-table-Win
261 ON U1
OF cmb_MonthEnding
IN FRAME F-Main
/* Month ending
*/
263 {inc
/selcmb
/scmthe1.i
"RP" "Int3"}
266 /* _UIB-CODE-BLOCK-END
*/
270 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL cmb_MonthEnding V-table-Win
271 ON U2
OF cmb_MonthEnding
IN FRAME F-Main
/* Month ending
*/
273 {inc
/selcmb
/scmthe2.i
"RP" "Int3"}
276 /* _UIB-CODE-BLOCK-END
*/
280 &Scoped-define SELF-NAME fil_Property
281 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Property V-table-Win
282 ON U1
OF fil_Property
IN FRAME F-Main
284 {inc
/selfil
/sfpro1.i
"RP" "Int1"}
287 /* _UIB-CODE-BLOCK-END
*/
291 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Property V-table-Win
292 ON U2
OF fil_Property
IN FRAME F-Main
294 {inc
/selfil
/sfpro2.i
"RP" "Int1"}
297 /* _UIB-CODE-BLOCK-END
*/
301 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Property V-table-Win
302 ON U3
OF fil_Property
IN FRAME F-Main
304 {inc
/selfil
/sfpro3.i
"RP" "Int1"}
307 /* _UIB-CODE-BLOCK-END
*/
311 &Scoped-define SELF-NAME fil_Tenant
312 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Tenant V-table-Win
313 ON U1
OF fil_Tenant
IN FRAME F-Main
315 {inc
/selfil
/sftnt1.i
"RP" "Int2"}
318 /* _UIB-CODE-BLOCK-END
*/
322 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Tenant V-table-Win
323 ON U2
OF fil_Tenant
IN FRAME F-Main
325 {inc
/selfil
/sftnt2.i
"RP" "Int2"}
328 /* _UIB-CODE-BLOCK-END
*/
332 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fil_Tenant V-table-Win
333 ON U3
OF fil_Tenant
IN FRAME F-Main
335 {inc
/selfil
/sftnt3.i
"RP" "Int2"}
338 /* _UIB-CODE-BLOCK-END
*/
342 &Scoped-define SELF-NAME RP.Int1
343 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Int1 V-table-Win
344 ON LEAVE OF RP.Int1
IN FRAME F-Main
/* Property
*/
346 {inc
/selcde
/cdpro.i
"fil_Property"}
349 /* _UIB-CODE-BLOCK-END
*/
353 &Scoped-define SELF-NAME RP.Int2
354 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL RP.Int2 V-table-Win
355 ON LEAVE OF RP.Int2
IN FRAME F-Main
/* Tenant
*/
357 {inc
/selcde
/cdtnt.i
"fil_Tenant"}
360 /* _UIB-CODE-BLOCK-END
*/
366 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK V-table-Win
369 /* *************************** Main Block
*************************** */
371 &IF DEFINED(UIB_IS_RUNNING) <> 0 &THEN
372 RUN dispatch
IN THIS-PROCEDURE ('initialize'
:U
).
375 /************************ INTERNAL PROCEDURES
********************/
377 /* _UIB-CODE-BLOCK-END
*/
381 /* ********************** Internal Procedures
*********************** */
383 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available V-table-Win
384 PROCEDURE adm-row-available
:
385 /*------------------------------------------------------------------------------
386 Purpose
: Override
(thoroughly
!) the Progress adm-row-available
387 ------------------------------------------------------------------------------*/
389 /* Define variables needed by this internal procedure.
*/
390 {src
/adm
/template
/row-head.i
}
392 /* Create a list of all the tables that we need to get.
*/
393 {src
/adm
/template
/row-list.i
"Creditor"}
395 /* Get the record
ROWID's from the RECORD-SOURCE.
*/
396 {src
/adm
/template
/row-get.i
}
398 /* FIND each record specified by the RECORD-SOURCE.
*/
399 {src
/adm
/template
/row-find.i
"Creditor"}
401 /* Process the newly available records
(i.e. display fields
,
402 open queries
, and
/or pass records on to any RECORD-TARGETS
).
*/
403 {src
/adm
/template
/row-end.i
}
407 /* _UIB-CODE-BLOCK-END
*/
411 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI V-table-Win _DEFAULT-DISABLE
412 PROCEDURE disable_UI
:
413 /*------------------------------------------------------------------------------
414 Purpose
: DISABLE the User Interface
416 Notes
: Here we clean-up the user-interface by deleting
417 dynamic widgets we have created and
/or hide
418 frames. This procedure is usually called when
419 we are ready to
"clean-up" after running.
420 ------------------------------------------------------------------------------*/
421 /* Hide all frames.
*/
423 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
426 /* _UIB-CODE-BLOCK-END
*/
430 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-enable-fields V-table-Win
431 PROCEDURE inst-enable-fields
:
432 /*------------------------------------------------------------------------------
434 ------------------------------------------------------------------------------*/
436 RUN tenant-options-changed.
440 /* _UIB-CODE-BLOCK-END
*/
444 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-initialize V-table-Win
445 PROCEDURE inst-initialize
:
446 /*------------------------------------------------------------------------------
448 ------------------------------------------------------------------------------*/
449 DEF VAR user-name
AS CHAR NO-UNDO.
451 RUN get-username
IN sys-mgr
( OUTPUT user-name
).
453 FIND RP
WHERE RP.UserName
= user-name
AND RP.ReportID
= {&REPORT-ID} NO-ERROR.
455 IF NOT AVAILABLE RP
THEN DO WITH FRAME {&FRAME-NAME}:
457 ASSIGN RP.ReportID
= {&REPORT-ID}
458 RP.UserName
= user-name
459 RP.Char1
= "OneProperty"
464 IF RP.Date1
= ?
THEN RP.Date1
= TODAY .
465 RUN dispatch
( 'display-fields'
:U
).
466 RUN dispatch
( 'enable-fields'
:U
).
470 /* _UIB-CODE-BLOCK-END
*/
474 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE pre-destroy V-table-Win
475 PROCEDURE pre-destroy
:
476 /*------------------------------------------------------------------------------
480 ------------------------------------------------------------------------------*/
482 RUN check-modified
( "CLEAR" ).
486 /* _UIB-CODE-BLOCK-END
*/
490 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE run-report V-table-Win
491 PROCEDURE run-report
:
492 /*------------------------------------------------------------------------------
493 Purpose
: Actually run the report through RB engine.
494 ------------------------------------------------------------------------------*/
495 DEF VAR report-options
AS CHAR NO-UNDO.
496 DEF VAR open-only
AS LOGI
NO-UNDO INITIAL No.
499 IF RETURN-VALUE = "FAIL" THEN RETURN.
501 RUN dispatch
( 'update-record'
:U
).
504 IF RP.Log3
THEN open-only
= Yes.
506 report-options
= RP.Char1
507 + (IF RP.Char1
= "OneProperty" THEN
508 "~nProperty," + STRING( RP.Int1
) /* property code
*/
510 "~nTenant," + STRING( RP.Int2
)) /* tenant code
*/
511 + (IF RP.Log1
THEN "~nPreview" ELSE "")
512 + (IF RP.Log2
THEN "~nExpenseReconciliation" ELSE "")
513 + (IF RP.Log3
THEN "~nMakeTransactions" ELSE "")
514 + (IF RP.Log4
THEN "~nPrintLetter" ELSE "")
515 + "~nMonthEnding," + STRING( RP.Int3
)
518 RUN notify
( 'set-busy
, CONTAINER-SOURCE'
:U
).
519 RUN process
/report
/tenant-outgoing-budgets.p
( report-options
).
520 RUN notify
( 'set-idle
, CONTAINER-SOURCE'
:U
).
524 /* _UIB-CODE-BLOCK-END
*/
528 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records V-table-Win
529 PROCEDURE send-records
:
530 /*------------------------------------------------------------------------------
532 ------------------------------------------------------------------------------*/
534 /* Define variables needed by this internal procedure.
*/
535 {src
/adm
/template
/snd-head.i
}
537 /* For each requested table
, put it's
ROWID in the output list.
*/
538 {src
/adm
/template
/snd-list.i
"Creditor"}
540 /* Deal with any unexpected table requests before closing.
*/
541 {src
/adm
/template
/snd-end.i
}
545 /* _UIB-CODE-BLOCK-END
*/
549 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed V-table-Win
550 PROCEDURE state-changed
:
551 /* -----------------------------------------------------------
555 -------------------------------------------------------------*/
556 DEFINE INPUT PARAMETER p-issuer-hdl
AS HANDLE NO-UNDO.
557 DEFINE INPUT PARAMETER p-state
AS CHARACTER NO-UNDO.
560 /* Object instance CASEs can go here to replace standard behavior
562 {src
/adm
/template
/vstates.i
}
566 /* _UIB-CODE-BLOCK-END
*/
570 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE tenant-options-changed V-table-Win
571 PROCEDURE tenant-options-changed
:
572 /*------------------------------------------------------------------------------
574 ------------------------------------------------------------------------------*/
575 DEF VAR options
AS CHAR NO-UNDO.
577 options
= INPUT FRAME {&FRAME-NAME} RP.Char1.
580 WHEN "OneTenant" THEN
581 DO WITH FRAME {&FRAME-NAME}:
582 HIDE RP.Int1 fil_Property.
583 VIEW RP.Int2 fil_Tenant.
584 RUN set-link-attributes
IN sys-mgr
( THIS-PROCEDURE, STRING( fil_Property
:HANDLE ), "HIDDEN = Yes":U
).
585 RUN set-link-attributes
IN sys-mgr
( THIS-PROCEDURE, STRING( fil_Tenant
:HANDLE ), "HIDDEN = No":U
).
588 WHEN "OneProperty" THEN
589 DO WITH FRAME {&FRAME-NAME}:
590 HIDE RP.Int2 fil_Tenant.
591 VIEW RP.Int1 fil_Property.
592 RUN set-link-attributes
IN sys-mgr
( THIS-PROCEDURE, STRING( fil_Tenant
:HANDLE ), "HIDDEN = Yes":U
).
593 RUN set-link-attributes
IN sys-mgr
( THIS-PROCEDURE, STRING( fil_Property
:HANDLE ), "HIDDEN = No":U
).
600 /* _UIB-CODE-BLOCK-END
*/
604 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE verify-report V-table-Win
605 PROCEDURE verify-report
:
606 /*------------------------------------------------------------------------------
608 ------------------------------------------------------------------------------*/
610 CASE INPUT FRAME {&FRAME-NAME} RP.Char1:
612 WHEN 'OneTenant'
THEN
613 IF NOT CAN-FIND( FIRST Tenant
WHERE Tenant.TenantCode
=
614 INPUT FRAME {&FRAME-NAME} RP.Int2 ) THEN
616 MESSAGE "You must select a Tenant" VIEW-AS ALERT-BOX ERROR.
617 APPLY '
ENTRY'
:U
TO RP.Int2
IN FRAME {&FRAME-NAME}.
621 WHEN 'OneProperty'
THEN
622 IF NOT CAN-FIND( FIRST Property
WHERE Property.PropertyCode
=
623 INPUT FRAME {&FRAME-NAME} RP.Int1 ) THEN
625 MESSAGE "You must select a property" VIEW-AS ALERT-BOX ERROR.
626 APPLY '
ENTRY'
:U
TO RP.Int1
IN FRAME {&FRAME-NAME}.
633 /* _UIB-CODE-BLOCK-END
*/