Add blank column, rename column.
[capital-apms-progress.git] / process / report / creditor-list.p
blob1ffb256edb305563a90d29e170efebc2de82c6e5
1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
2 &ANALYZE-RESUME
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
5 Report: Creditor List printout
6 Author: Andrew McMillan
7 Date: 16/7/2001
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.
14 RUN parse-parameters.
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;".
30 {inc/ofc-this.i}
32 /* _UIB-CODE-BLOCK-END */
33 &ANALYZE-RESUME
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 */
46 &ANALYZE-RESUME
50 /* *********************** Procedure Settings ************************ */
52 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
53 /* Settings for THIS-PROCEDURE
54 Type: Procedure
55 Allow:
56 Frames: 0
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
67 HEIGHT = 28.25
68 WIDTH = 36.29.
69 /* END WINDOW DEFINITION */
71 &ANALYZE-RESUME
73 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
74 /* ************************* Included-Libraries *********************** */
76 {inc/method/m-txtrep.i}
77 {inc/null.i}
78 {inc/entity.i}
80 /* _UIB-CODE-BLOCK-END */
81 &ANALYZE-RESUME
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').
100 RUN report-headers.
102 FOR EACH Creditor NO-LOCK,
103 LAST AcctTran WHERE EntityType = 'C' AND EntityCode = CreditorCode NO-LOCK
104 BY Creditor.Name:
105 RUN each-creditor.
106 END.
107 RUN report-footers.
109 OUTPUT CLOSE.
111 RUN htmlrep-finish.
113 /* _UIB-CODE-BLOCK-END */
114 &ANALYZE-RESUME
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 /*------------------------------------------------------------------------------
124 Purpose:
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.
135 END PROCEDURE.
137 /* _UIB-CODE-BLOCK-END */
138 &ANALYZE-RESUME
140 &ENDIF
142 &IF DEFINED(EXCLUDE-parse-parameters) = 0 &THEN
144 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
145 PROCEDURE parse-parameters :
146 /*------------------------------------------------------------------------------
147 Purpose:
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) ).
163 END CASE.
165 END.
167 END PROCEDURE.
169 /* _UIB-CODE-BLOCK-END */
170 &ANALYZE-RESUME
172 &ENDIF
174 &IF DEFINED(EXCLUDE-report-footers) = 0 &THEN
176 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE report-footers Procedure
177 PROCEDURE report-footers :
178 /*------------------------------------------------------------------------------
179 Purpose:
180 ------------------------------------------------------------------------------*/
181 PUT UNFORMATTED "</table>~n".
183 PUT UNFORMATTED '<p><p style="' time-font '">Report prepared at ' timeStamp .
184 END PROCEDURE.
186 /* _UIB-CODE-BLOCK-END */
187 &ANALYZE-RESUME
189 &ENDIF
191 &IF DEFINED(EXCLUDE-report-headers) = 0 &THEN
193 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE report-headers Procedure
194 PROCEDURE report-headers :
195 /*------------------------------------------------------------------------------
196 Purpose:
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'.
208 RUN htmlrep-body.
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".
220 END PROCEDURE.
222 /* _UIB-CODE-BLOCK-END */
223 &ANALYZE-RESUME
225 &ENDIF