1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
5 Report
: Creditor List printout
6 Author
: Andrew McMillan
8 ------------------------------------------------------------------------*/
10 DEF INPUT PARAMETER report-options
AS CHAR NO-UNDO.
12 DEF VAR last-used
AS DATE NO-UNDO.
13 DEF VAR active-only
AS LOGI
NO-UNDO INITIAL No.
16 DEF VAR user-name
AS CHAR NO-UNDO.
17 {inc
/username.i
"user-name"}
18 DEF VAR timeStamp
AS CHAR FORMAT "X(44)" NO-UNDO.
19 timeStamp
= STRING( TODAY, "99/99/9999") + ", " + STRING( TIME, "HH:MM:SS") + " for " + user-name.
21 DEF VAR pr-line
AS CHAR INIT "" NO-UNDO.
/* used everywhere to hold print line
*/
22 DEF VAR rowcounter
AS INT INIT 0.
24 DEF VAR title-font
AS CHAR NO-UNDO INITIAL "font-family: sans-serif; font-weight: 700; font-size: 14pt".
25 DEF VAR time-font
AS CHAR NO-UNDO INITIAL "font-family: tahoma,sans-serif; font-size: 8pt;".
26 DEF VAR break1-font
AS CHAR NO-UNDO INITIAL "font-family: serif; font-size: 14pt; font-weight: 700;".
27 DEF VAR break2-font
AS CHAR NO-UNDO INITIAL "font-family: serif; font-size: 11pt; font-weight: 700;".
28 DEF VAR base-font
AS CHAR NO-UNDO INITIAL "font-family: serif; font-size: 10pt;".
32 /* _UIB-CODE-BLOCK-END
*/
36 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
38 /* ******************** Preprocessor Definitions
******************** */
40 &Scoped-define PROCEDURE-TYPE Procedure
41 &Scoped-define DB-AWARE no
45 /* _UIB-PREPROCESSOR-BLOCK-END
*/
50 /* *********************** Procedure Settings
************************ */
52 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
53 /* Settings for
THIS-PROCEDURE
57 Add Fields to
: Neither
58 Other Settings
: CODE-ONLY
COMPILE
60 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
62 /* ************************* Create Window
************************** */
64 &ANALYZE-SUSPEND _CREATE-WINDOW
65 /* DESIGN Window definition
(used by the UIB
)
66 CREATE WINDOW Procedure
ASSIGN
69 /* END WINDOW DEFINITION
*/
73 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
74 /* ************************* Included-Libraries
*********************** */
76 {inc
/method
/m-txtrep.i
}
80 /* _UIB-CODE-BLOCK-END
*/
87 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
90 /* *************************** Main Block
*************************** */
92 /* Re-initialise with a more appropriate suffix for HTML files
*/
93 txtrep-file-suffix
= ".html".
94 RUN txtrep-initialise.
96 OUTPUT TO VALUE(txtrep-print-file
) KEEP-MESSAGES PAGE-SIZE 0.
98 RUN htmlrep-start
('Creditors List'
).
102 FOR EACH Creditor
NO-LOCK,
103 LAST AcctTran
WHERE EntityType
= 'C'
AND EntityCode
= CreditorCode
NO-LOCK
113 /* _UIB-CODE-BLOCK-END
*/
117 /* ********************** Internal Procedures
*********************** */
119 &IF DEFINED(EXCLUDE-each-creditor) = 0 &THEN
121 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-creditor Procedure
122 PROCEDURE each-creditor
:
123 /*------------------------------------------------------------------------------
125 ------------------------------------------------------------------------------*/
126 IF AcctTran.Date
< last-used
THEN RETURN.
127 IF NOT(Creditor.Active
) AND active-only
THEN RETURN.
129 PUT UNFORMATTED '
<tr class
=row'
(rowcounter
MODULO 2) '
>~n'.
130 PUT UNFORMATTED "<td align=right>" STRING(Creditor.CreditorCode
) "</td>~n".
131 PUT UNFORMATTED "<td>" Creditor.Name
"</td>~n".
132 PUT UNFORMATTED "<td>" STRING( AcctTran.Date
, '
99/99/9999'
) "</td>~n".
133 PUT CONTROL "</tr>~n".
134 rowcounter
= rowcounter
+ 1.
137 /* _UIB-CODE-BLOCK-END
*/
142 &IF DEFINED(EXCLUDE-parse-parameters) = 0 &THEN
144 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
145 PROCEDURE parse-parameters
:
146 /*------------------------------------------------------------------------------
148 ------------------------------------------------------------------------------*/
149 DEF VAR token
AS CHAR NO-UNDO.
150 DEF VAR i
AS INT NO-UNDO.
152 {inc
/showopts.i
"report-options"}
153 last-used
= TODAY - 800.
155 DO i
= 1 TO NUM-ENTRIES( report-options
, "~n" ):
156 token
= ENTRY( i
, report-options
, "~n" ).
158 CASE ENTRY( 1, token
):
159 WHEN "Selection" THEN ASSIGN
160 active-only
= ENTRY(2,token
) = "Active".
161 WHEN "LastUsed" THEN ASSIGN
162 last-used
= DATE( ENTRY(2,token
) ).
169 /* _UIB-CODE-BLOCK-END
*/
174 &IF DEFINED(EXCLUDE-report-footers) = 0 &THEN
176 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE report-footers Procedure
177 PROCEDURE report-footers
:
178 /*------------------------------------------------------------------------------
180 ------------------------------------------------------------------------------*/
181 PUT UNFORMATTED "</table>~n".
183 PUT UNFORMATTED '
<p
><p style
="' time-font '">Report prepared at ' timeStamp .
186 /* _UIB-CODE-BLOCK-END
*/
191 &IF DEFINED(EXCLUDE-report-headers) = 0 &THEN
193 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE report-headers Procedure
194 PROCEDURE report-headers
:
195 /*------------------------------------------------------------------------------
197 ------------------------------------------------------------------------------*/
199 PUT UNFORMATTED '
<style type
="text/css"><!--~n'.
200 PUT UNFORMATTED '.base
, p
, td ~
{' base-font '
}~n'.
201 PUT UNFORMATTED '.title ~
{' title-font '
}~n'.
202 PUT UNFORMATTED '.row0 ~
{ background
: #f0f0c0
; }~n'.
203 PUT UNFORMATTED '.row1 ~
{ background
: #fafbe8
; }~n'.
204 PUT UNFORMATTED '.break1 ~
{' break1-font '
}~n'.
205 PUT UNFORMATTED '.break2 ~
{' break2-font '
}~n'.
206 PUT UNFORMATTED '
--></style
>~n'.
209 PUT UNFORMATTED '
<h2 style
="' + title-font + '">Creditor Listing
</h2
>~n'.
212 PUT UNFORMATTED "<table>~n".
214 PUT UNFORMATTED "<tr>~n".
215 PUT UNFORMATTED "<th>#</th>~n".
216 PUT UNFORMATTED "<th>Name</th>~n".
217 PUT UNFORMATTED "<th>Last Used</th>~n".
218 PUT CONTROL "</tr>~n".
222 /* _UIB-CODE-BLOCK-END
*/