1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
15 ------------------------------------------------------------------------*/
17 /* *************************** Definitions
************************** */
19 DEF INPUT PARAMETER report-options
AS CHAR NO-UNDO.
21 DEF VAR pty-list
AS CHAR NO-UNDO.
22 DEF VAR file-name
AS CHAR NO-UNDO.
23 DEF VAR vouchers-after
AS DATE NO-UNDO.
24 DEF VAR cheques-after
AS DATE NO-UNDO.
25 DEF VAR list-file
AS CHAR NO-UNDO.
26 DEF VAR active-only
AS LOGI
NO-UNDO.
28 DEF VAR prp-selection
AS CHAR NO-UNDO.
29 DEF VAR srv-selection
AS CHAR NO-UNDO.
30 DEF VAR service-types
AS CHAR NO-UNDO.
31 DEF VAR prp-sel-id
AS CHAR NO-UNDO.
34 Creditor.CreditorCode ~
36 Property.PropertyCode ~
38 ( IF AVAILABLE ServiceType
THEN ServiceType.Description
ELSE "" ) ~
39 ( IF AVAILABLE FrequencyType
THEN FrequencyType.Description
ELSE "" ) ~
40 Contract.FixedAmount ~
41 Contract.ContractReference
53 /* _UIB-CODE-BLOCK-END
*/
57 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
59 /* ******************** Preprocessor Definitions
******************** */
61 &Scoped-define PROCEDURE-TYPE Procedure
65 /* _UIB-PREPROCESSOR-BLOCK-END
*/
70 /* *********************** Procedure Settings
************************ */
72 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
73 /* Settings for
THIS-PROCEDURE
77 Add Fields to
: Neither
78 Other Settings
: CODE-ONLY
COMPILE
80 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
82 /* ************************* Create Window
************************** */
84 &ANALYZE-SUSPEND _CREATE-WINDOW
85 /* DESIGN Window definition
(used by the UIB
)
86 CREATE WINDOW Procedure
ASSIGN
89 /* END WINDOW DEFINITION
*/
95 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
96 /* ************************* Included-Libraries
*********************** */
98 {inc
/method
/m-expctc.i
}
100 /* _UIB-CODE-BLOCK-END
*/
105 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
108 /* *************************** Main Block
*************************** */
110 DEF VAR i
AS INT NO-UNDO.
112 RUN parse-parameters.
114 OUTPUT TO VALUE( file-name
).
116 RUN export-contact-header.
117 this-contact-type
= "Contractor".
121 WHEN "CONTRACTOR" THEN DO:
122 IF prp-selection
= "ALL" THEN
123 FOR EACH Property
NO-LOCK:
126 ELSE IF prp-selection
= "MANAGER" THEN
127 FOR EACH Property
NO-LOCK WHERE Property.Administrator
= INT( prp-sel-id
):
130 ELSE IF prp-selection
= "REGION" THEN
131 FOR EACH Property
NO-LOCK WHERE Property.Region
= prp-sel-id
:
140 /* _UIB-CODE-BLOCK-END
*/
144 /* ********************** Internal Procedures
*********************** */
146 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-property Procedure
147 PROCEDURE each-property
:
148 /*------------------------------------------------------------------------------
150 ------------------------------------------------------------------------------*/
152 FOR EACH Contract
OF Property
NO-LOCK WHERE
153 ( IF srv-selection
= "ALL" THEN True
ELSE LOOKUP( Contract.ServiceType
, service-types
) <> 0 ),
155 FIRST Creditor
NO-LOCK WHERE
156 ( Creditor.CreditorCode
= Contract.CreditorCode
) AND
157 ( Creditor.Active
OR (NOT active-only
) ) AND
158 ( IF vouchers-after
= ?
THEN True
ELSE CAN-FIND( FIRST Voucher
OF Creditor
WHERE
159 Voucher.CreatedDate
>= vouchers-after
)
162 ( IF cheques-after
= ?
THEN True
ELSE CAN-FIND( FIRST Cheque
OF Creditor
WHERE
163 Cheque.Date
>= cheques-after
)
166 FIND Person
WHERE Person.PersonCode
= Creditor.PaymentContact
NO-LOCK NO-ERROR.
174 /* _UIB-CODE-BLOCK-END
*/
178 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
179 PROCEDURE parse-parameters
:
180 /*------------------------------------------------------------------------------
184 ------------------------------------------------------------------------------*/
186 DEF VAR i
AS INT NO-UNDO.
187 DEF VAR token
AS CHAR NO-UNDO.
189 DO i
= 1 TO NUM-ENTRIES( report-options
, "~n" ):
190 token
= ENTRY( i
, report-options
, "~n" ).
191 CASE ENTRY( 1, token
):
192 WHEN "FileName" THEN file-name
= ENTRY( 2, token
).
193 WHEN "Address" THEN pty-list
= SUBSTR( token
, INDEX( token
, "," ) + 1 ).
194 WHEN "Type" THEN list-file
= ENTRY( 2, token
).
195 WHEN "VouchersAfter" THEN vouchers-after
= DATE( ENTRY( 2, token
) ).
196 WHEN "ChequesAfter" THEN cheques-after
= DATE( ENTRY( 2, token
) ).
197 WHEN "ActiveOnly" THEN active-only
= ENTRY( 2, token
) = "Yes".
200 prp-selection
= ENTRY( 2, token
).
201 IF prp-selection
<> "ALL" THEN prp-sel-id
= ENTRY( 3, token
).
203 WHEN "ServiceType" THEN
205 srv-selection
= ENTRY( 2, token
).
206 IF srv-selection
<> "ALL" THEN service-types
= SUBSTR( token
, INDEX( token
, "," ) + 1 ).
209 WHEN "SplitAddress" THEN split-addresses
= Yes.
210 WHEN "MakeUnique" THEN make-unique
= Yes.
211 WHEN "CleanAddresses" THEN clean-addresses
= Yes.
212 WHEN "IncludeNoMailout" THEN include-no-mailout
= Yes.
218 /* _UIB-CODE-BLOCK-END
*/
222 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE x-export-contact Procedure
223 PROCEDURE x-export-contact
:
224 /*------------------------------------------------------------------------------
228 ------------------------------------------------------------------------------*/
230 DEF INPUT PARAMETER contact-type
AS CHAR NO-UNDO.
232 DEF VAR person-address
AS CHAR NO-UNDO.
233 DEF VAR phone-no
AS CHAR EXTENT 4 NO-UNDO.
234 DEF VAR phone-list
AS CHAR NO-UNDO INIT "HOME,BUS,MOB,FAX".
235 DEF VAR i
AS INT NO-UNDO.
237 IF NOT AVAILABLE(Person
) THEN RETURN.
238 RUN process
/getaddr.p
( "PERSON", Person.PersonCode
, pty-list
, OUTPUT person-address
).
240 DO i
= 1 TO NUM-ENTRIES( phone-list
):
242 FIND PhoneDetail
WHERE PhoneDetail.PersonCode
= Person.PersonCode
243 AND PhoneDetail.PhoneType
= ENTRY( i
, phone-list
)
245 IF AVAILABLE( PhoneDetail
) THEN
246 phone-no
[i
] = get-phone-no
( Person.PersonCode
, ENTRY( i
, phone-list
) ).
249 DO i
= 1 TO NUM-ENTRIES( pty-list
):
250 FIND PostalDetail
WHERE
251 PostalDetail.PersonCode
= Person.PersonCode
AND
252 PostalDetail.PostalType
= ENTRY( i
, pty-list
)
254 IF AVAILABLE(PostalDetail
) THEN LEAVE.
257 FIND FrequencyType
OF Contract
NO-LOCK NO-ERROR.
258 FIND ServiceType
OF Contract
NO-LOCK NO-ERROR.
267 TRIM(REPLACE(person-address
, "~r", ""))
268 (IF AVAILABLE(PostalDetail
) THEN PostalDetail.City
ELSE "")
277 /* _UIB-CODE-BLOCK-END
*/
281 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE x-export-contact-header Procedure
282 PROCEDURE x-export-contact-header
:
283 /*------------------------------------------------------------------------------
287 ------------------------------------------------------------------------------*/
306 /* _UIB-CODE-BLOCK-END
*/