1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
5 ------------------------------------------------------------------------*/
7 DEF INPUT PARAMETER report-options
AS CHAR NO-UNDO.
8 DEF VAR e1
AS INT NO-UNDO INITIAL 0.
9 DEF VAR e2
AS INT NO-UNDO INITIAL 99999.
10 DEF VAR preview
AS LOGICAL NO-UNDO INITIAL No.
11 DEF VAR contact-details
AS LOGICAL NO-UNDO INITIAL No.
12 DEF VAR all-contacts
AS LOGICAL NO-UNDO INITIAL No.
13 DEF VAR contract-types
AS CHAR NO-UNDO INITIAL "".
14 DEF VAR export-file
AS CHAR NO-UNDO INITIAL "".
15 DEF VAR page-breaks
AS LOGI
NO-UNDO INITIAL No.
16 DEF VAR service-column-first
AS LOGI
NO-UNDO INITIAL No.
17 DEF VAR sort-by
AS CHAR NO-UNDO.
20 &SCOPED-DEFINE lines-per-page 68
23 DEF VAR p-annual
AS DEC NO-UNDO.
24 DEF VAR g-annual
AS DEC NO-UNDO.
25 DEF VAR pr-annual
AS DEC NO-UNDO.
26 DEF VAR pnr-annual
AS DEC NO-UNDO.
27 DEF VAR gr-annual
AS DEC NO-UNDO.
28 DEF VAR gnr-annual
AS DEC NO-UNDO.
30 DEF VAR account-code
AS DEC NO-UNDO.
31 DEF VAR need-property-header
AS LOGI
INITIAL No
NO-UNDO.
34 DEF VAR ln
AS DEC INIT 0.00 NO-UNDO.
36 /* Line definitions
*/
38 DEF VAR page-no
AS INT INIT 1 NO-UNDO.
39 DEF VAR reset-page
AS CHAR NO-UNDO.
40 DEF VAR half-line
AS CHAR NO-UNDO. half-line
= CHR(27) + "=".
42 DEF VAR title-font
AS CHAR NO-UNDO.
43 DEF VAR time-font
AS CHAR NO-UNDO.
44 DEF VAR property-font
AS CHAR NO-UNDO.
45 DEF VAR body-font
AS CHAR NO-UNDO.
46 DEF VAR header-font
AS CHAR NO-UNDO.
47 DEF VAR line-font
AS CHAR NO-UNDO.
48 DEF VAR i
AS INT NO-UNDO.
50 DEF VAR user-name
AS CHAR NO-UNDO.
54 /* _UIB-CODE-BLOCK-END
*/
58 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
60 /* ******************** Preprocessor Definitions
******************** */
62 &Scoped-define PROCEDURE-TYPE Procedure
66 /* _UIB-PREPROCESSOR-BLOCK-END
*/
70 /* ************************ Function Prototypes
********************** */
72 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD include-contract Procedure
73 FUNCTION include-contract
RETURNS LOGICAL
74 ( INPUT test-contract
AS CHAR ) FORWARD.
76 /* _UIB-CODE-BLOCK-END
*/
80 /* *********************** Procedure Settings
************************ */
82 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
83 /* Settings for
THIS-PROCEDURE
87 Add Fields to
: Neither
88 Other Settings
: CODE-ONLY
COMPILE
90 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
92 /* ************************* Create Window
************************** */
94 &ANALYZE-SUSPEND _CREATE-WINDOW
95 /* DESIGN Window definition
(used by the UIB
)
96 CREATE WINDOW Procedure
ASSIGN
99 /* END WINDOW DEFINITION
*/
105 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
106 /* ************************* Included-Libraries
*********************** */
108 {inc
/method
/m-txtrep.i
}
111 /* _UIB-CODE-BLOCK-END
*/
116 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
119 /* *************************** Main Block
*************************** */
120 {inc
/username.i
"user-name"}
122 IF export-file
<> "" THEN
123 txtrep-print-file
= export-file.
125 RUN get-control-strings.
126 RUN output-control-file
( reset-page
+ line-font
).
129 OUTPUT TO VALUE(txtrep-print-file
) KEEP-MESSAGES PAGE-SIZE 0.
132 WHEN "Property" THEN RUN listing-by-property.
133 WHEN "AccountCode" THEN RUN listing-by-account.
137 IF export-file
= "" OR preview
THEN
138 RUN view-output-file
( preview
).
140 MESSAGE "Export of Contract details completed"
141 VIEW-AS ALERT-BOX INFORMATION
142 TITLE "Export Complete".
144 /* _UIB-CODE-BLOCK-END
*/
148 /* ********************** Internal Procedures
*********************** */
150 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE account-header Procedure
151 PROCEDURE account-header
:
152 /*------------------------------------------------------------------------------
154 ------------------------------------------------------------------------------*/
155 IF need-property-header
THEN
157 ELSE IF ln
+ 4 >= {&lines-per-page} THEN
160 IF NOT preview
THEN PUT CONTROL property-font.
161 IF export-file
<> "" THEN PUT UNFORMATTED '
"'.
163 IF AVAILABLE(ChartOfAccount) THEN
164 PUT UNFORMATTED STRING( ChartOfAccount.AccountCode, "9999.99" ) + ' - ' + ChartOfAccount.Name.
166 PUT UNFORMATTED STRING( account-code, "9999.99" ) + ' - ' + "not set up in chart of accounts
".
167 IF export-file <> "" THEN PUT UNFORMATTED '"'.
168 ELSE IF NOT preview
THEN PUT CONTROL line-font.
173 /* _UIB-CODE-BLOCK-END
*/
177 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE column-header Procedure
178 PROCEDURE column-header
:
179 /*------------------------------------------------------------------------------
181 ------------------------------------------------------------------------------*/
183 IF export-file
= "" THEN DO:
185 IF NOT( preview
OR contact-details
) THEN PUT CONTROL header-font.
186 IF contact-details
AND NOT(preview
) THEN PUT CONTROL line-font.
190 IF export-file
<> "" THEN DO:
191 IF contact-details
THEN
192 PUT UNFORMATTED '
,"Contractor","Type","Service","Reference"'
193 + (IF all-contacts
THEN '
,"Type"'
ELSE ''
)
194 + '
,"Contact","Phone Numbers","Notes"'.
196 PUT UNFORMATTED '
,"Creditor","Type","Service","Rnw","Rec","Start","Review","Period","Amount P.A","Per Period","Description / Reference","Notes"'.
198 ELSE IF contact-details
THEN
199 PUT UNFORMATTED "Type Service" SPACE(14)
200 "Contractor" SPACE(22)
201 "Reference" SPACE(13)
203 "Phone Numbers" SPACE(29)
206 PUT UNFORMATTED "Creditor" SPACE(24)
213 "Amount P.A" SPACE(2)
214 "Per Period" SPACE(2)
215 "Description / Reference" SPACE(9)
218 PUT UNFORMATTED "Creditor" SPACE(38)
225 "Amount P.A" SPACE(3)
226 "Per Period" SPACE(3)
227 "Description / Reference" SPACE(16)
230 IF export-file
= "" AND NOT(preview
) THEN PUT CONTROL line-font.
235 /* _UIB-CODE-BLOCK-END
*/
239 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-account-of-property Procedure
240 PROCEDURE each-account-of-property
:
241 /*------------------------------------------------------------------------------
243 ------------------------------------------------------------------------------*/
244 DEF INPUT PARAMETER recoverable-contracts
AS LOGI
NO-UNDO.
245 DEF VAR i
AS INT NO-UNDO.
247 FOR EACH ServiceType
NO-LOCK BREAK BY ServiceType.AccountCode
:
248 IF NOT include-contract
( ServiceType.ServiceType
) THEN NEXT.
249 IF FIRST-OF( ServiceType.AccountCode
) THEN DO:
256 account-code
= (IF recoverable-contracts
THEN ServiceType.AccountCode
ELSE ServiceType.NRAccount
).
257 FIND ChartOfAccount
WHERE ChartOfAccount.AccountCode
= account-code
NO-LOCK NO-ERROR.
258 FOR EACH Contract
NO-LOCK WHERE Contract.PropertyCode
= Property.PropertyCode
259 AND Contract.ServiceType
= ServiceType.ServiceType
260 AND Contract.Recoverable
= recoverable-contracts
,
261 FIRST Creditor
WHERE Creditor.CreditorCode
= Contract.CreditorCode
262 NO-LOCK BY Creditor.Name
:
263 FIND Property
OF Contract
NO-LOCK NO-ERROR.
264 IF NOT AVAILABLE(Property
) OR NOT Property.Active
THEN NEXT.
266 IF i
= 1 THEN RUN account-header.
270 IF export-file
= "" AND NOT(contact-details
) AND LAST-OF( ServiceType.AccountCode
) AND i
> 0 THEN DO:
271 g-annual
= g-annual
+ p-annual.
272 gr-annual
= gr-annual
+ pr-annual.
273 gnr-annual
= gnr-annual
+ pnr-annual.
274 PUT UNFORMATTED FILL(' '
, 98) FILL( '
='
, 13 ).
276 PUT UNFORMATTED FILL(' '
, 98) STRING( p-annual
, "->,>>>,>>9.99" ).
284 /* _UIB-CODE-BLOCK-END
*/
288 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-contract Procedure
289 PROCEDURE each-contract
:
290 /*------------------------------------------------------------------------------
292 ------------------------------------------------------------------------------*/
293 IF contact-details
THEN DO:
294 IF export-file
= "" THEN RUN each-contract-contact.
295 ELSE RUN export-contract-contact.
298 IF export-file
= "" THEN RUN each-contract-normal.
299 ELSE RUN export-contract-normal.
304 /* _UIB-CODE-BLOCK-END
*/
308 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-contract-contact Procedure
309 PROCEDURE each-contract-contact
:
310 /*------------------------------------------------------------------------------
312 ------------------------------------------------------------------------------*/
314 DEF VAR nl
AS INT NO-UNDO.
315 DEF VAR i
AS INT NO-UNDO.
316 DEF VAR c-name
AS CHAR NO-UNDO.
317 DEF VAR c-note
AS CHAR NO-UNDO INITIAL "".
318 DEF VAR c-desc
AS CHAR NO-UNDO.
319 DEF VAR p-name
AS CHAR NO-UNDO INITIAL "".
320 DEF VAR phones
AS CHAR NO-UNDO INITIAL "".
321 DEF VAR this-ph
AS CHAR NO-UNDO INITIAL "".
322 DEF VAR this-nm
AS CHAR NO-UNDO INITIAL "".
323 DEF VAR ph-lines
AS INT NO-UNDO.
324 DEF VAR nm-lines
AS INT NO-UNDO.
326 FIND ServiceType
OF Contract
NO-LOCK NO-ERROR.
327 FIND Note
OF Contract
NO-LOCK NO-ERROR.
329 IF all-contacts
THEN DO:
332 FOR EACH EntityContact
WHERE EntityContact.EntityType
= "C"
333 AND EntityContact.EntityCode
= Creditor.CreditorCode
NO-LOCK,
334 FIRST Person
OF EntityContact
NO-LOCK:
335 this-ph
= WRAP
( get-phone-nos
( Person.PersonCode
), 40).
336 this-nm
= WRAP
( combine-name
( "", Person.FirstName
, "", Person.LastName
, "")
337 + " (" + EntityContact.EntityContactType
+ ")", 30).
338 ph-lines
= NUM-ENTRIES( this-ph
, "~n").
339 nm-lines
= NUM-ENTRIES( this-nm
, "~n").
340 phones
= phones
+ (IF p-name
<> "" THEN "~n" ELSE "") /* note use of p-name
! */
341 + this-ph
+ FILL( "~n", MAX( 0, nm-lines
- ph-lines
)).
342 p-name
= p-name
+ (IF p-name
<> "" THEN "~n" ELSE "")
343 + this-nm
+ FILL( "~n", MAX( 0, ph-lines
- nm-lines
)).
347 FIND Person
WHERE Person.PersonCode
= Creditor.PaymentContact
NO-LOCK NO-ERROR.
348 IF AVAILABLE(Person
) THEN DO:
349 p-name
= WRAP
( combine-name
( "", Person.FirstName
, "", Person.LastName
, ""), 30).
350 phones
= WRAP
( get-phone-nos
( Person.PersonCode
), 40).
354 RUN word-wrap
( Creditor.Name
, 30, OUTPUT c-name
).
355 IF AVAILABLE Note
THEN RUN word-wrap
( Note.Details
, 40, OUTPUT c-note
).
356 RUN word-wrap
( Contract.ContractReference
, 20, OUTPUT c-desc
).
358 nl
= MAX( NUM-ENTRIES( c-name
, "~n" ), NUM-ENTRIES( c-note
, "~n" ), NUM-ENTRIES( c-desc
, "~n"),
359 NUM-ENTRIES( p-name
, "~n" ), NUM-ENTRIES( phones
, "~n" ) ).
360 c-name
= c-name
+ FILL( "~n", nl
- NUM-ENTRIES( c-name
, "~n" ) ).
361 c-note
= c-note
+ FILL( "~n", nl
- NUM-ENTRIES( c-note
, "~n" ) ).
362 c-desc
= c-desc
+ FILL( "~n", nl
- NUM-ENTRIES( c-desc
, "~n" ) ).
363 p-name
= p-name
+ FILL( "~n", nl
- NUM-ENTRIES( p-name
, "~n" ) ).
364 phones
= phones
+ FILL( "~n", nl
- NUM-ENTRIES( phones
, "~n" ) ).
366 RUN skip-line
( IF preview
THEN 1 ELSE 0.5 ).
370 STRING( IF i
= 1 THEN Contract.ServiceType
ELSE "", "X(4)" ) SPACE(1)
371 STRING( IF i
= 1 AND AVAILABLE ServiceType
372 THEN ServiceType.Description
373 ELSE "", "X(19)" ) SPACE(2)
374 STRING( ENTRY( i
, c-name
, "~n" ), "X(30)" ) SPACE(2)
375 STRING( ENTRY( i
, c-desc
, "~n" ), "X(20)" ) SPACE(2)
376 STRING( ENTRY( i
, p-name
, "~n" ), "X(30)" ) SPACE(2)
377 STRING( ENTRY( i
, phones
, "~n" ), "X(40)" ) SPACE(2)
378 STRING( ENTRY( i
, c-note
, "~n" ), "X(40)" ).
384 /* _UIB-CODE-BLOCK-END
*/
388 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-contract-normal Procedure
389 PROCEDURE each-contract-normal
:
390 /*------------------------------------------------------------------------------
392 ------------------------------------------------------------------------------*/
394 DEF VAR nl
AS INT NO-UNDO.
395 DEF VAR i
AS INT NO-UNDO.
396 DEF VAR c-name
AS CHAR NO-UNDO.
397 DEF VAR c-note
AS CHAR NO-UNDO.
398 DEF VAR c-desc
AS CHAR NO-UNDO.
399 DEF VAR c-start
AS CHAR NO-UNDO.
400 DEF VAR c-review
AS CHAR NO-UNDO.
401 DEF VAR period-cost
AS DEC NO-UNDO.
402 DEF VAR fraction
AS DEC NO-UNDO.
404 FIND ServiceType
OF Contract
NO-LOCK NO-ERROR.
405 FIND FrequencyType
OF Contract
NO-LOCK NO-ERROR.
406 FIND Note
OF Contract
NO-LOCK NO-ERROR.
408 RUN word-wrap
( Creditor.Name
, 30, OUTPUT c-name
).
409 IF AVAILABLE Note
THEN
410 RUN word-wrap
( Note.Details
, 30, OUTPUT c-note
).
411 RUN word-wrap
( Contract.ContractReference
, 30, OUTPUT c-desc
).
413 nl
= MAX( NUM-ENTRIES( c-name
, "~n" ), NUM-ENTRIES( c-note
, "~n" ), NUM-ENTRIES( c-desc
, "~n") ).
414 c-name
= c-name
+ FILL( "~n", nl
- NUM-ENTRIES( c-name
, "~n" ) ).
415 c-note
= c-note
+ FILL( "~n", nl
- NUM-ENTRIES( c-note
, "~n" ) ).
416 c-desc
= c-desc
+ FILL( "~n", nl
- NUM-ENTRIES( c-desc
, "~n" ) ).
418 /* Calculate the period cost
*/
419 RUN process
/calcfreq.p
( Contract.FrequencyCode
, OUTPUT fraction
).
420 period-cost
= Contract.AnnualEstimate
* fraction.
421 p-annual
= p-annual
+ Contract.AnnualEstimate.
422 IF ( Contract.Recoverable
) THEN
423 pr-annual
= pr-annual
+ Contract.AnnualEstimate.
425 pnr-annual
= pnr-annual
+ Contract.AnnualEstimate.
427 c-start
= STRING( Contract.StartDate
, "99/99/9999").
428 IF c-start
= ?
THEN c-start
= "".
429 c-review
= STRING( Contract.ReviewDate
, "99/99/9999").
430 IF c-review
= ?
THEN c-review
= "".
432 RUN skip-line
( IF preview
THEN 1 ELSE 0.5 ).
436 STRING( ENTRY( i
, c-name
, "~n" ), "X(30)" ) SPACE(2)
437 STRING( IF i
= 1 AND AVAILABLE ServiceType
438 THEN ServiceType.Description
439 ELSE "", "X(19)" ) SPACE(2)
440 STRING( IF i
<> 1 THEN "" ELSE
441 STRING( Contract.Renewing
, "Yes/No" ), "X(3)" ) SPACE(2)
442 STRING( IF i
<> 1 THEN "" ELSE
443 STRING( Contract.Recoverable
, "Yes/No" ), "X(3)" ) SPACE(2)
444 STRING( IF i
<> 1 THEN "" ELSE c-start
, "X(10)" ) SPACE(2)
445 STRING( IF i
<> 1 THEN "" ELSE c-review
, "X(10)" ) SPACE(2)
446 STRING( IF i
= 1 AND AVAILABLE FrequencyType
447 THEN FrequencyType.Description
448 ELSE "", "X(12)" ) SPACE(1)
449 STRING( IF i
<> 1 THEN "" ELSE
450 STRING( Contract.AnnualEstimate
, "->>>,>>9.99" ), "X(11)" ) SPACE(1)
451 STRING( IF i
<> 1 THEN "" ELSE
452 STRING( period-cost
, "->>>,>>9.99" ), "X(11)" ) SPACE(2)
453 STRING( ENTRY( i
, c-desc
, "~n" ), "X(30)" ) SPACE(2)
454 STRING( ENTRY( i
, c-note
, "~n" ), "X(30)" ).
460 /* _UIB-CODE-BLOCK-END
*/
464 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-property Procedure
465 PROCEDURE each-property
:
466 /*------------------------------------------------------------------------------
468 ------------------------------------------------------------------------------*/
469 DEF VAR i
AS INT NO-UNDO.
476 FOR EACH Contract
NO-LOCK WHERE Contract.PropertyCode
= Property.PropertyCode
477 AND Contract.ServiceType
<> "ESTM" ,
478 FIRST Creditor
NO-LOCK WHERE Creditor.CreditorCode
= Contract.CreditorCode
479 BY Property.PropertyCode
BY Contract.ServiceType
BY Creditor.Name
:
480 IF NOT include-contract
( Contract.ServiceType
) THEN NEXT.
482 IF i
= 1 THEN RUN property-header.
486 IF i
> 0 AND export-file
<> "" THEN RUN skip-line
(1).
487 IF contact-details
OR export-file
<> "" THEN RETURN.
489 g-annual
= g-annual
+ p-annual.
490 gr-annual
= gr-annual
+ pr-annual.
491 gnr-annual
= gnr-annual
+ pnr-annual.
494 PUT UNFORMATTED FILL(' '
, 100) FILL( '
='
, 11 ).
496 PUT UNFORMATTED FILL(' '
, 62)
497 STRING( pr-annual
, "->,>>>,>>9.99" ) "(Rec)"
498 STRING( pnr-annual
, "->,>>>,>>9.99" ) "(N/R)"
499 STRING( p-annual
, "->,>>>,>>9.99" ).
505 /* _UIB-CODE-BLOCK-END
*/
509 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE export-contract-contact Procedure
510 PROCEDURE export-contract-contact
:
511 /*------------------------------------------------------------------------------
513 ------------------------------------------------------------------------------*/
515 DEF VAR c-name
AS CHAR NO-UNDO.
516 DEF VAR c-note
AS CHAR NO-UNDO INITIAL "".
517 DEF VAR c-desc
AS CHAR NO-UNDO.
518 DEF VAR p-name
AS CHAR NO-UNDO INITIAL "".
519 DEF VAR phones
AS CHAR NO-UNDO INITIAL "".
522 FIND ServiceType
OF Contract
NO-LOCK NO-ERROR.
523 FIND Note
OF Contract
NO-LOCK NO-ERROR.
525 c-name
= Creditor.Name.
526 IF AVAILABLE Note
THEN c-note
= Note.Details.
527 c-desc
= Contract.ContractReference.
529 IF all-contacts
THEN DO:
532 FOR EACH EntityContact
WHERE EntityContact.EntityType
= "C"
533 AND EntityContact.EntityCode
= Creditor.CreditorCode
NO-LOCK,
534 FIRST Person
OF EntityContact
NO-LOCK:
535 p-name
= get-phone-nos
( Person.PersonCode
).
536 phones
= combine-name
( "", Person.FirstName
, "", Person.LastName
, "").
537 PUT UNFORMATTED '
,"' c-name '",'
538 '
"' Contract.ServiceType '",'
539 '
"' (IF AVAILABLE(ServiceType) THEN ServiceType.Description ELSE "") '",'
541 '
"' EntityContact.EntityContactType '",'
550 FIND Person
WHERE Person.PersonCode
= Creditor.PaymentContact
NO-LOCK NO-ERROR.
551 IF AVAILABLE(Person
) THEN DO:
552 p-name
= combine-name
( "", Person.FirstName
, "", Person.LastName
, "").
553 phones
= get-phone-nos
( Person.PersonCode
).
555 PUT UNFORMATTED '
,"' c-name '",'
556 '
"' Contract.ServiceType '",'
557 '
"' (IF AVAILABLE(ServiceType) THEN ServiceType.Description ELSE "") '",'
568 /* _UIB-CODE-BLOCK-END
*/
572 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE export-contract-normal Procedure
573 PROCEDURE export-contract-normal
:
574 /*------------------------------------------------------------------------------
576 ------------------------------------------------------------------------------*/
578 DEF VAR c-name
AS CHAR NO-UNDO.
579 DEF VAR c-note
AS CHAR NO-UNDO.
580 DEF VAR c-desc
AS CHAR NO-UNDO.
581 DEF VAR c-start
AS CHAR NO-UNDO.
582 DEF VAR c-review
AS CHAR NO-UNDO.
583 DEF VAR period-cost
AS DEC NO-UNDO.
584 DEF VAR fraction
AS DEC NO-UNDO.
586 FIND ServiceType
OF Contract
NO-LOCK NO-ERROR.
587 FIND FrequencyType
OF Contract
NO-LOCK NO-ERROR.
588 FIND Note
OF Contract
NO-LOCK NO-ERROR.
590 c-name
= Creditor.Name.
591 IF AVAILABLE Note
THEN c-note
= Note.Details.
592 c-desc
= Contract.ContractReference.
594 /* Calculate the period cost
*/
595 RUN process
/calcfreq.p
( Contract.FrequencyCode
, OUTPUT fraction
).
596 period-cost
= Contract.AnnualEstimate
* fraction.
597 p-annual
= p-annual
+ Contract.AnnualEstimate.
598 IF ( Contract.Recoverable
) THEN
599 pr-annual
= pr-annual
+ Contract.AnnualEstimate.
601 pnr-annual
= pnr-annual
+ Contract.AnnualEstimate.
603 c-start
= STRING( Contract.StartDate
, "99/99/9999").
604 IF c-start
= ?
THEN c-start
= "".
605 c-review
= STRING( Contract.ReviewDate
, "99/99/9999").
606 IF c-review
= ?
THEN c-review
= "".
608 PUT UNFORMATTED '
,"' c-name '",'
609 '
"' Contract.ServiceType '",'
610 '
"' (IF AVAILABLE(ServiceType) THEN ServiceType.Description ELSE "") '",'
611 '
"' STRING( Contract.Renewing, "Yes
/No
" ) '",'
612 '
"' STRING( Contract.Recoverable, "Yes
/No
" ) '",'
615 '
"' (IF AVAILABLE(FrequencyType) THEN FrequencyType.Description ELSE "") '",'
616 TRIM(STRING( Contract.AnnualEstimate
, "->>>>>>>>9.99" )) '
,'
617 TRIM(STRING( period-cost
, "->>>>>>>>9.99" )) '
,'
624 /* _UIB-CODE-BLOCK-END
*/
628 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-control-strings Procedure
629 PROCEDURE get-control-strings
:
630 /*------------------------------------------------------------------------------
631 Purpose
: Get all control strings for this report
632 ------------------------------------------------------------------------------*/
634 IF export-file
<> "" THEN RETURN.
636 DEF VAR rows
AS DEC NO-UNDO.
637 DEF VAR cols
AS DEC NO-UNDO.
639 RUN make-control-string
( "PCL", "reset,landscape,a4,tm,0,lm,4",
640 OUTPUT reset-page
, OUTPUT rows
, OUTPUT cols
).
642 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,12",
643 OUTPUT title-font
, OUTPUT rows
, OUTPUT cols
).
645 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,6",
646 OUTPUT time-font
, OUTPUT rows
, OUTPUT cols
).
648 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,8",
649 OUTPUT header-font
, OUTPUT rows
, OUTPUT cols
).
651 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,10",
652 OUTPUT property-font
, OUTPUT rows
, OUTPUT cols
).
654 RUN make-control-string
( "PCL", "Proportional,Helvetica,Bold,Point,8",
655 OUTPUT body-font
, OUTPUT rows
, OUTPUT cols
).
657 RUN make-control-string
( "PCL", "fixed,courier,cpi,18,lpi,10,normal",
658 OUTPUT line-font
, OUTPUT rows
, OUTPUT cols
).
662 /* _UIB-CODE-BLOCK-END
*/
666 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE listing-by-account Procedure
667 PROCEDURE listing-by-account
:
668 /*------------------------------------------------------------------------------
670 ------------------------------------------------------------------------------*/
671 FOR EACH Property
NO-LOCK WHERE Property.PropertyCode
>= e1
672 AND Property.PropertyCode
<= e2
674 AND NOT Property.ExternallyManaged
:
679 need-property-header
= Yes.
681 RUN each-account-of-property
(Yes
).
682 RUN each-account-of-property
(No
).
684 IF NOT need-property-header
THEN DO:
686 IF export-file
= "" AND NOT(contact-details
) THEN DO:
687 PUT UNFORMATTED FILL(' '
, 100) FILL( '
='
, 11 ).
689 PUT UNFORMATTED FILL(' '
, 64)
690 STRING( gr-annual
, "->>>,>>9.99" ) "(Rec)" FILL( ' '
, 2 )
691 STRING( gnr-annual
, "->>>,>>9.99" ) "(N/R)" FILL ( ' '
, 2 )
692 STRING( g-annual
, "->>>,>>9.99" ).
702 /* _UIB-CODE-BLOCK-END
*/
706 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE listing-by-property Procedure
707 PROCEDURE listing-by-property
:
708 /*------------------------------------------------------------------------------
710 ------------------------------------------------------------------------------*/
717 FOR EACH Property
NO-LOCK WHERE Property.PropertyCode
>= e1
718 AND Property.PropertyCode
<= e2
720 AND NOT Property.ExternallyManaged
:
724 IF NOT(contact-details
) AND g-annual
<> p-annual
THEN DO:
726 PUT UNFORMATTED FILL(' '
, 100) FILL( '
='
, 11 ).
728 PUT UNFORMATTED FILL(' '
, 62)
729 STRING( gr-annual
, "->,>>>,>>9.99" ) "(Rec)"
730 STRING( gnr-annual
, "->,>>>,>>9.99" ) "(N/R)"
731 STRING( g-annual
, "->,>>>,>>9.99" ).
739 /* _UIB-CODE-BLOCK-END
*/
743 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-feed Procedure
744 PROCEDURE page-feed
:
745 /*------------------------------------------------------------------------------
747 ------------------------------------------------------------------------------*/
749 IF export-file
<> "" THEN RETURN.
751 page-no
= page-no
+ 1.
757 /* _UIB-CODE-BLOCK-END
*/
761 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE page-header Procedure
762 PROCEDURE page-header
:
763 /*------------------------------------------------------------------------------
765 ------------------------------------------------------------------------------*/
772 /* _UIB-CODE-BLOCK-END
*/
776 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
777 PROCEDURE parse-parameters
:
778 /*------------------------------------------------------------------------------
779 Purpose
: Parse the command line
780 ------------------------------------------------------------------------------*/
781 DEF VAR report-style
AS CHAR NO-UNDO.
782 DEF VAR token
AS CHAR NO-UNDO.
783 DEF VAR i
AS INT NO-UNDO.
785 {inc
/showopts.i
"report-options"}
787 DO i
= 1 TO NUM-ENTRIES( report-options
, "~n" ):
788 token
= ENTRY( i
, report-options
, "~n" ).
790 CASE ENTRY( 1, token
):
791 WHEN "Preview" THEN preview
= Yes.
792 WHEN "ContactDetails" THEN contact-details
= Yes.
793 WHEN "AllContacts" THEN all-contacts
= Yes.
794 WHEN "PageBreaks" THEN page-breaks
= Yes.
795 WHEN "ServiceFirst" THEN service-column-first
= Yes.
796 WHEN "Style" THEN report-style
= ENTRY( 2, token
).
797 WHEN "Entity1" THEN e1
= INT(ENTRY( 2, token
)).
798 WHEN "Entity2" THEN e2
= INT(ENTRY( 2, token
)).
799 WHEN "Export" THEN export-file
= SUBSTRING( token
, INDEX( token
, ",") + 1).
800 WHEN "ContractTypes" THEN contract-types
= SUBSTRING( token
, INDEX( token
, ",") + 1).
801 WHEN "SortBy" THEN sort-by
= ENTRY( 2, token
).
805 IF report-style
= "A" THEN ASSIGN e1
= 0 e2
= 99999 .
/* all
*/
806 ELSE IF report-style
= "1" THEN ASSIGN e2
= e1 .
/* one
*/
810 /* _UIB-CODE-BLOCK-END
*/
814 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-title Procedure
815 PROCEDURE print-title
:
816 /*------------------------------------------------------------------------------
818 ------------------------------------------------------------------------------*/
819 IF export-file
<> "" THEN RETURN.
821 IF NOT preview
THEN PUT CONTROL line-font.
823 IF NOT preview
THEN PUT CONTROL time-font.
825 STRING( "Printed: " + STRING( TODAY, "99/99/9999" ) + " " +
826 STRING( TIME, "HH:MM:SS" ) + " for " + user-name
,
828 STRING( "Page: " + STRING( page-no
), "X(10)" ).
830 IF NOT preview
THEN PUT CONTROL title-font.
831 PUT UNFORMATTED SPACE(60) "Service Contracts Listing".
833 IF NOT preview
THEN PUT CONTROL line-font.
837 /* _UIB-CODE-BLOCK-END
*/
841 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE property-header Procedure
842 PROCEDURE property-header
:
843 /*------------------------------------------------------------------------------
845 ------------------------------------------------------------------------------*/
847 IF sort-by
= "AccountCode" THEN RUN page-header.
850 IF contact-details
AND page-breaks
THEN
851 RUN skip-line
( {&lines-per-page} - 2 ).
852 ELSE IF contact-details
THEN
855 IF ln
+ 4 >= {&lines-per-page} THEN
859 IF export-file
<> "" THEN PUT UNFORMATTED '
"'.
860 ELSE IF NOT preview THEN PUT CONTROL property-font.
861 PUT UNFORMATTED STRING( Property.PropertyCode, "9999" ) + ' - ' + Property.Name.
862 IF export-file <> "" THEN PUT UNFORMATTED '"'.
863 ELSE IF NOT preview
THEN PUT CONTROL line-font.
865 need-property-header
= No.
869 /* _UIB-CODE-BLOCK-END
*/
873 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE reset-page Procedure
874 PROCEDURE reset-page
:
875 /*------------------------------------------------------------------------------
879 ------------------------------------------------------------------------------*/
881 PUT CONTROL reset-page.
885 /* _UIB-CODE-BLOCK-END
*/
889 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE skip-line Procedure
890 PROCEDURE skip-line
:
891 /*------------------------------------------------------------------------------
895 ------------------------------------------------------------------------------*/
897 DEF INPUT PARAMETER n
AS DEC NO-UNDO.
899 IF ln
+ n
>= {&lines-per-page} THEN DO:
905 DEF VAR int-part
AS INT NO-UNDO.
906 DEF VAR dec-part
AS DEC NO-UNDO.
908 int-part
= TRUNCATE( n
, 0 ).
909 IF int-part
< 0 THEN RETURN.
910 dec-part
= n
- int-part.
911 IF int-part
= 0 AND dec-part
= 0 THEN RETURN.
913 /* Need to have this like the following
- do not touch
*/
916 ELSE IF int-part
> 1 THEN
919 IF export-file
<> "" THEN RETURN.
921 IF dec-part
<> 0 THEN PUT CONTROL half-line.
927 /* _UIB-CODE-BLOCK-END
*/
931 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE skip-to-line Procedure
932 PROCEDURE skip-to-line
:
933 /*------------------------------------------------------------------------------
937 ------------------------------------------------------------------------------*/
939 DEF INPUT PARAMETER line-no
AS DEC NO-UNDO.
941 DEF VAR int-part
AS INT NO-UNDO.
942 DEF VAR dec-part
AS DEC NO-UNDO.
944 int-part
= TRUNCATE( line-no
- ln
, 0 ).
945 IF int-part
< 0 THEN RETURN.
946 dec-part
= ( line-no
- ln
) - int-part.
947 IF int-part
= 0 AND dec-part
= 0 THEN RETURN.
949 IF int-part
<> 0 THEN PUT CONTROL FILL( CHR(10), int-part
).
950 IF dec-part
<> 0 THEN PUT CONTROL half-line.
958 /* _UIB-CODE-BLOCK-END
*/
962 /* ************************ Function Implementations
***************** */
964 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION include-contract Procedure
965 FUNCTION include-contract
RETURNS LOGICAL
966 ( INPUT test-contract
AS CHAR ) :
967 /*------------------------------------------------------------------------------
970 ------------------------------------------------------------------------------*/
971 IF contract-types
= "" THEN RETURN Yes.
973 RETURN LOOKUP( test-contract
, contract-types
) > 0 .
977 /* _UIB-CODE-BLOCK-END
*/