1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
15 ------------------------------------------------------------------------*/
17 DEF INPUT PARAMETER voucher-start
LIKE Voucher.VoucherSeq
NO-UNDO.
18 DEF INPUT PARAMETER voucher-end
LIKE Voucher.VoucherSeq
NO-UNDO.
19 DEF INPUT PARAMETER voucher-list
AS CHAR NO-UNDO.
21 DEF VAR fixed-codes
AS CHAR NO-UNDO.
22 DEF VAR variable-codes
AS CHAR NO-UNDO.
23 DEF VAR transaction-codes
AS CHAR NO-UNDO.
24 DEF VAR preview
AS LOGICAL INITIAL No
NO-UNDO.
25 DEF VAR prt-ctrl
AS CHAR NO-UNDO.
26 DEF VAR rows
AS INT NO-UNDO.
27 DEF VAR cols
AS INT NO-UNDO.
29 DEF VAR gst-applies
AS LOGI
NO-UNDO.
30 DEF VAR continued-on-attached
AS LOGICAL NO-UNDO INITIAL No.
32 {inc
/ofc-set.i
"AcctGroup-Ownex" "AcctGroup-Ownex"}
37 /* _UIB-CODE-BLOCK-END
*/
41 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
43 /* ******************** Preprocessor Definitions
******************** */
45 &Scoped-define PROCEDURE-TYPE Procedure
46 &Scoped-define DB-AWARE no
50 /* _UIB-PREPROCESSOR-BLOCK-END
*/
55 /* *********************** Procedure Settings
************************ */
57 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
58 /* Settings for
THIS-PROCEDURE
62 Add Fields to
: Neither
63 Other Settings
: CODE-ONLY
COMPILE
65 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
67 /* ************************* Create Window
************************** */
69 &ANALYZE-SUSPEND _CREATE-WINDOW
70 /* DESIGN Window definition
(used by the UIB
)
71 CREATE WINDOW Procedure
ASSIGN
74 /* END WINDOW DEFINITION
*/
78 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
79 /* ************************* Included-Libraries
*********************** */
81 {inc
/method
/m-txtrep.i
}
85 /* _UIB-CODE-BLOCK-END
*/
92 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
95 /* *************************** Main Block
*************************** */
97 FIND Office
WHERE Office.ThisOffice
NO-LOCK.
98 gst-applies
= Office.GST
<> ?.
100 RUN make-control-string
( "PCL", "reset,simplex,portrait,tm,0,a4,lm,0,courier,cpi,18,lpi,9",
101 OUTPUT prt-ctrl
, OUTPUT rows
, OUTPUT cols
).
102 RUN output-control-file
( prt-ctrl
).
103 OUTPUT TO VALUE(txtrep-print-file
) KEEP-MESSAGES PAGE-SIZE 0.
105 RUN voucher-approval-forms.
108 RUN view-output-file
( no
).
110 /* _UIB-CODE-BLOCK-END
*/
114 /* ********************** Internal Procedures
*********************** */
116 &IF DEFINED(EXCLUDE-approval-prompts) = 0 &THEN
118 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE approval-prompts Procedure
119 PROCEDURE approval-prompts
:
120 /*------------------------------------------------------------------------------
124 ------------------------------------------------------------------------------*/
126 /* Approval Prompts
*/
127 RUN hpgl-moveto
( 23, 39 ).
128 RUN hpgl-text
( "Helvetica,Point,12,Proportional", "Certified Correct:" ).
129 RUN hpgl-move-relative
( 50, 0 ).
130 RUN hpgl-line-relative
( 77, 0 ).
131 RUN hpgl-move-relative
( 4, 0 ).
132 RUN hpgl-text
( hpgl-last-font
, "Date:" ).
133 RUN hpgl-move-relative
( 14, 0 ).
134 RUN hpgl-line-relative
( 32, 0 ).
135 RUN hpgl-move-relative
( -177, -9 ).
136 RUN hpgl-text
( "Helvetica,Point,12,Proportional", "Approved for Payment:" ).
137 RUN hpgl-move-relative
( 50, 0 ).
138 RUN hpgl-line-relative
( 77, 0 ).
139 RUN hpgl-move-relative
( 4, 0 ).
140 RUN hpgl-text
( hpgl-last-font
, "Date:" ).
141 RUN hpgl-move-relative
( 14, 0 ).
142 RUN hpgl-line-relative
( 32, 0 ).
146 /* _UIB-CODE-BLOCK-END
*/
151 &IF DEFINED(EXCLUDE-approval-variables) = 0 &THEN
153 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE approval-variables Procedure
154 PROCEDURE approval-variables
:
155 /*------------------------------------------------------------------------------
159 ------------------------------------------------------------------------------*/
161 RUN hpgl-moveto
( 23, 39 ).
162 RUN hpgl-move-relative
( 50, -2.2 ).
163 RUN hpgl-text
( "Helvetica,Point,6,Proportional", "@Certified Correct@" ).
164 RUN hpgl-move-relative
( 0, -9 ).
165 RUN hpgl-text
( "Helvetica,Point,6,Proportional", "@Payment Approval@" ).
169 /* _UIB-CODE-BLOCK-END
*/
174 &IF DEFINED(EXCLUDE-budget-prompts) = 0 &THEN
176 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE budget-prompts Procedure
177 PROCEDURE budget-prompts
:
178 /*------------------------------------------------------------------------------
182 ------------------------------------------------------------------------------*/
185 RUN hpgl-moveto
( 23, 162.2 ).
186 RUN hpgl-text
( "Helvetica,Point,10,Proportional", "YTD Actual:" ).
187 RUN hpgl-move-relative
( 60, 0 ).
188 RUN hpgl-text
( hpgl-last-font
, "YTD Budget:" ).
189 RUN hpgl-move-relative
( 58, 0 ).
190 RUN hpgl-text
( hpgl-last-font
, "Full Year Budget:" ).
194 /* _UIB-CODE-BLOCK-END
*/
199 &IF DEFINED(EXCLUDE-budget-variables) = 0 &THEN
201 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE budget-variables Procedure
202 PROCEDURE budget-variables
:
203 /*------------------------------------------------------------------------------
207 ------------------------------------------------------------------------------*/
209 RUN hpgl-moveto
( 23, 162.2 ).
210 RUN hpgl-move-relative
( 21, 0 ).
211 RUN hpgl-text
( "Times,Point,12,Proportional,Bold", "@YTD Actual@" ).
212 RUN hpgl-move-relative
( 62, 0 ).
213 RUN hpgl-text
( hpgl-last-font
, "@YTD Budget@" ).
214 RUN hpgl-move-relative
( 64, 0 ).
215 RUN hpgl-text
( hpgl-last-font
, "@FY Budget@" ).
219 /* _UIB-CODE-BLOCK-END
*/
224 &IF DEFINED(EXCLUDE-each-voucher) = 0 &THEN
226 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-voucher Procedure
227 PROCEDURE each-voucher
:
228 /*------------------------------------------------------------------------------
232 ------------------------------------------------------------------------------*/
233 DEF VAR printer-codes
AS CHAR NO-UNDO.
235 PUT CONTROL fixed-codes.
236 RUN variable-replacements.
237 PUT CONTROL hpgl-codes.
243 get-entity-client
( Voucher.EntityType
, Voucher.EntityCode
)
245 RUN hpgl-get-codes
( no
, yes
, OUTPUT printer-codes
).
246 PUT CONTROL printer-codes.
248 RUN print-transactions.
249 PUT CONTROL transaction-codes.
251 RUN make-control-string
( "PCL", "eject",
252 OUTPUT prt-ctrl
, OUTPUT rows
, OUTPUT cols
).
253 PUT CONTROL prt-ctrl.
255 IF continued-on-attached
THEN DO:
256 RUN print-continuation.
257 continued-on-attached
= No.
262 /* _UIB-CODE-BLOCK-END
*/
267 &IF DEFINED(EXCLUDE-each-voucherline) = 0 &THEN
269 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE each-voucherline Procedure
270 PROCEDURE each-voucherline
:
271 /*------------------------------------------------------------------------------
275 ------------------------------------------------------------------------------*/
277 DEF VAR entity-name
AS CHAR NO-UNDO.
278 DEF VAR account-desc
AS CHAR NO-UNDO.
280 RUN hpgl-text
( "Courier,Point,9,Proportional,Normal",
281 IF VoucherLine.EntityType
= ?
THEN "" ELSE VoucherLine.EntityType
).
282 RUN hpgl-move-relative
( 5.5, 1.5 ).
284 RUN hpgl-text
( hpgl-last-font
,
285 IF VoucherLine.EntityCode
= ?
OR VoucherLine.EntityCode
= 0 THEN "" ELSE
286 STRING( VoucherLine.EntityCode
, "99999" ) ).
287 RUN hpgl-move-relative
( -1, -2 ).
289 RUN voucher-entity-name
( OUTPUT entity-name
).
290 RUN hpgl-text
( "Point,4", entity-name
).
291 RUN hpgl-move-relative
( 14, IF LOOKUP( VoucherLine.EntityType
, "C,T" ) <> 0
295 RUN hpgl-text
( "Point,9",
296 IF VoucherLine.AccountCode
= ?
OR VoucherLine.AccountCode
= 0 THEN "" ELSE
297 STRING( VoucherLine.AccountCode
, "9999.99" ) ).
298 RUN hpgl-move-relative
( -2, IF LOOKUP( VoucherLine.EntityType
, "C,T" ) <> 0
301 RUN get-account-desc
( OUTPUT account-desc
).
302 RUN hpgl-text
( "Point,4", account-desc
).
303 RUN hpgl-move-relative
( 21, 0.5 ).
305 RUN hpgl-text
( "Point,9", VoucherLine.Description
).
306 RUN hpgl-move-relative
( 104, 0 ).
308 RUN hpgl-text
( "Courier,Fixed,cpi,12",
309 STRING( TRUNCATE( VoucherLine.Amount
, 0 ), "->>,>>>,>>9" ) ).
310 RUN hpgl-move-relative
( 27, 0 ).
312 RUN hpgl-text
( hpgl-last-font
,
313 STRING( ABSOLUTE( ( VoucherLine.Amount
- TRUNCATE( VoucherLine.Amount
, 0 )) * 100 ), "99" ) ).
315 RUN hpgl-move-relative
( -168.5, -6 ).
319 /* _UIB-CODE-BLOCK-END
*/
324 &IF DEFINED(EXCLUDE-entity-variables) = 0 &THEN
326 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE entity-variables Procedure
327 PROCEDURE entity-variables
:
328 /*------------------------------------------------------------------------------
332 ------------------------------------------------------------------------------*/
334 RUN hpgl-moveto
( 23, 153 ).
335 RUN hpgl-text
( "Helvetica,Point,10,Proportional,Normal", "@Entity@" ).
339 /* _UIB-CODE-BLOCK-END
*/
344 &IF DEFINED(EXCLUDE-get-account-desc) = 0 &THEN
346 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-account-desc Procedure
347 PROCEDURE get-account-desc
:
348 /*------------------------------------------------------------------------------
352 ------------------------------------------------------------------------------*/
354 DEF OUTPUT PARAMETER account-desc
AS CHAR NO-UNDO.
356 FIND ChartOfAccount
WHERE ChartOfAccount.AccountCode
= VoucherLine.AccountCode
359 IF AVAILABLE ChartOfAccount
THEN
360 account-desc
= SUBSTR( ChartOfAccount.Name
, 1, 18 ).
364 /* _UIB-CODE-BLOCK-END
*/
369 &IF DEFINED(EXCLUDE-get-fixed-codes) = 0 &THEN
371 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-fixed-codes Procedure
372 PROCEDURE get-fixed-codes
:
373 /*------------------------------------------------------------------------------
377 ------------------------------------------------------------------------------*/
379 /* The constant parts of the page
*/
381 RUN hpgl-set-line-width
( 0.25 ).
382 RUN hpgl-moveto
( 55, 256 ).
383 RUN hpgl-text
( 'helvetica
,point
,20,proportional
,bold'
, "INVOICE APPROVAL VOUCHER" ).
386 RUN hpgl-get-codes
( no
, yes
, OUTPUT fixed-codes
).
390 /* _UIB-CODE-BLOCK-END
*/
395 &IF DEFINED(EXCLUDE-get-variables) = 0 &THEN
397 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE get-variables Procedure
398 PROCEDURE get-variables
:
399 /*------------------------------------------------------------------------------
403 ------------------------------------------------------------------------------*/
405 RUN invoice-detail-variables.
406 RUN budget-variables.
407 RUN entity-variables.
408 RUN recoverable-variables.
409 RUN approval-variables.
410 RUN signatory-variables.
412 RUN hpgl-get-codes
( no
, yes
, OUTPUT variable-codes
).
416 /* _UIB-CODE-BLOCK-END
*/
421 &IF DEFINED(EXCLUDE-invoice-detail-prompts) = 0 &THEN
423 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE invoice-detail-prompts Procedure
424 PROCEDURE invoice-detail-prompts
:
425 /*------------------------------------------------------------------------------
429 ------------------------------------------------------------------------------*/
431 RUN hpgl-moveto
( 151, 271 ).
432 RUN hpgl-text
( "Helvetica,Point,13,Proportional,Normal", "Voucher No:" ).
434 /* Invoice Detail Prompts
*/
435 RUN hpgl-moveto
( 23, 246 ).
436 RUN hpgl-text
( "Helvetica,Point,10,Proportional", "Creditor Number:" ).
437 RUN hpgl-move-relative
( 51, 0 ).
438 RUN hpgl-text
( hpgl-last-font
, "Creditor Name:" ).
439 RUN hpgl-move-relative
( -51, -8.5 ).
440 RUN hpgl-text
( "Helvetica,Point,12,Proportional", "Invoice Details" ).
441 RUN hpgl-move-relative
( 0, -7.2 ).
442 RUN hpgl-text
( "Helvetica,Point,10,Proportional", "Invoice Number:" ).
443 RUN hpgl-move-relative
( 0, -6 ).
444 RUN hpgl-text
( hpgl-last-font
, "Order Number:" ).
445 RUN hpgl-move-relative
( 0, -6 ).
446 /* RUN hpgl-text
( hpgl-last-font
, "Capex Reference:" ).
*/
447 RUN hpgl-move-relative
( 0, -10 ).
448 RUN hpgl-text
( hpgl-last-font
, "Description:" ).
450 RUN hpgl-move-relative
( 68.5, 16 ).
451 RUN hpgl-text
( hpgl-last-font
, "Date:" ).
452 RUN hpgl-move-relative
( 0, -6 ).
453 RUN hpgl-text
( hpgl-last-font
, "Approval:" ).
455 RUN hpgl-move-relative
( 53.5, 12 ).
456 RUN hpgl-text
( "Helvetica,Point,13,Proportional", "Value" ).
457 RUN hpgl-move-relative
( 0, -6 ).
458 IF gst-applies
THEN RUN hpgl-text
( hpgl-last-font
, "GST" ).
459 RUN hpgl-move-relative
( 0, -6 ).
460 RUN hpgl-text
( hpgl-last-font
, "Total" ).
464 /* _UIB-CODE-BLOCK-END
*/
469 &IF DEFINED(EXCLUDE-invoice-detail-variables) = 0 &THEN
471 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE invoice-detail-variables Procedure
472 PROCEDURE invoice-detail-variables
:
473 /*------------------------------------------------------------------------------
477 ------------------------------------------------------------------------------*/
479 RUN hpgl-moveto
( 24, 289 ).
480 RUN hpgl-text
( "Times,Point,6,Normal", "@LastModified@" ).
482 RUN hpgl-moveto
( 181, 271 ).
483 RUN hpgl-text
( "Times,Point,16,Proportional,Bold", "@VoucherNo@" ).
485 /* Invoice Detail Variables
*/
486 RUN hpgl-moveto
( 53, 246 ).
487 RUN hpgl-text
( "Times,Point,12,Proportional", "@Creditor@" ).
488 RUN hpgl-move-relative
( 47, 0 ).
489 RUN hpgl-text
( hpgl-last-font
, "@CreditorName@" ).
490 RUN hpgl-move-relative
( -43, -15 ).
491 RUN hpgl-text
( hpgl-last-font
, "@InvoiceNo@" ).
492 RUN hpgl-move-relative
( 0, -6 ).
493 RUN hpgl-text
( hpgl-last-font
, "@OrderNo@" ).
494 RUN hpgl-move-relative
( 0, -17 ).
495 RUN hpgl-text
( hpgl-last-font
, "@VoucherDescription@" ).
497 RUN hpgl-move-relative
( 53, 16 ).
498 RUN hpgl-text
( hpgl-last-font
, "@Date@" ).
499 RUN hpgl-move-relative
( 0, -6 ).
500 RUN hpgl-text
( hpgl-last-font
, "@Approval@" ).
502 RUN hpgl-move-relative
( 54, 13 ).
503 RUN hpgl-text
( "Courier,Fixed,cpi,12", "@Value@" ).
504 RUN hpgl-move-relative
( 0, -6 ).
505 IF gst-applies
THEN RUN hpgl-text
( hpgl-last-font
, "@GST@" ).
506 RUN hpgl-move-relative
( 0, -6 ).
507 RUN hpgl-text
( hpgl-last-font
, "@Total@" ).
511 /* _UIB-CODE-BLOCK-END
*/
516 &IF DEFINED(EXCLUDE-notes-prompts) = 0 &THEN
518 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE notes-prompts Procedure
519 PROCEDURE notes-prompts
:
520 /*------------------------------------------------------------------------------
524 ------------------------------------------------------------------------------*/
527 DEF VAR i
AS INT INIT 0 NO-UNDO.
528 RUN hpgl-moveto
( 23, 198 ).
529 RUN hpgl-text
( "Helvetica,Point,12,Proportional", "Notes:" ).
530 RUN hpgl-move-relative
( 14, 0 ).
531 RUN hpgl-set-line-type
( -2, 1, 1 ).
532 RUN hpgl-line-relative
( 163, 0 ).
534 RUN hpgl-move-relative
( -177, -6 ).
535 RUN hpgl-line-relative
( 177, 0 ).
540 /* _UIB-CODE-BLOCK-END
*/
545 &IF DEFINED(EXCLUDE-print-boxes) = 0 &THEN
547 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-boxes Procedure
548 PROCEDURE print-boxes
:
549 /*------------------------------------------------------------------------------
550 Purpose
: Print the voucher approval boxes.
551 ------------------------------------------------------------------------------*/
553 RUN hpgl-moveto
( 20, 205).
556 RUN hpgl-box-relative
( 180, 38 ).
557 RUN hpgl-move-relative
( 37, 19 ).
558 RUN hpgl-line-relative
( 27, 0).
559 RUN hpgl-move-relative
( -27, 6 ).
560 RUN hpgl-line-relative
( 27, 0).
561 RUN hpgl-move-relative
( -61, 6.5 ).
562 RUN hpgl-line-relative
( 30, 0).
563 RUN hpgl-move-relative
( 105.5, -12.5 ).
564 RUN hpgl-line-relative
( 33, 0).
565 RUN hpgl-move-relative
( 0, -8).
566 RUN hpgl-set-line-width
( 0.5 ).
567 RUN hpgl-line-relative
( -33, 0).
568 RUN hpgl-set-line-width
( 0.25 ).
571 RUN hpgl-move-relative
( -138.5, -56.5).
572 RUN hpgl-box-relative
( 180, 7).
575 RUN hpgl-move-relative
( 0, -41).
576 RUN hpgl-box-relative
( 93, 31).
577 RUN hpgl-move-relative
( 0, 6).
578 RUN hpgl-line-relative
( 93, 0).
579 RUN hpgl-move-relative
( -53, 0).
580 RUN hpgl-line-relative
( 0, 25).
581 RUN hpgl-move-relative
( 16.5, 0).
582 RUN hpgl-box-relative
( 21.5, -25).
585 RUN hpgl-move-relative
( -56, -54 ).
586 RUN hpgl-box-relative
( 180, -45 ).
587 RUN hpgl-move-relative
( 5, 0).
588 RUN hpgl-box-relative
( 12, -45 ).
589 RUN hpgl-move-relative
( 30, 0).
590 RUN hpgl-box-relative
( 108, -45 ).
591 RUN hpgl-move-relative
( 132, 0 ).
592 RUN hpgl-line-relative
( 0, -45 ).
593 RUN hpgl-move-relative
( 13, 41 ).
594 RUN hpgl-line-relative
( -180, 0 ).
596 RUN hpgl-set-line-type
( 2, 1, 1).
597 RUN hpgl-move-relative
( 0, -5 ).
598 RUN hpgl-box-relative
( 180, -6 ).
599 RUN hpgl-move-relative
( 0, -12 ).
600 RUN hpgl-box-relative
( 180, -6 ).
601 RUN hpgl-move-relative
( 0, -12 ).
602 RUN hpgl-box-relative
( 180, -6 ).
606 /* _UIB-CODE-BLOCK-END
*/
611 &IF DEFINED(EXCLUDE-print-continuation) = 0 &THEN
613 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-continuation Procedure
614 PROCEDURE print-continuation
:
615 /*------------------------------------------------------------------------------
617 ------------------------------------------------------------------------------*/
618 DEF VAR i
AS INT NO-UNDO INITIAL 0.
619 DEF VAR continuation-codes
AS CHAR NO-UNDO.
623 RUN hpgl-set-line-width
( 0.25 ).
624 RUN hpgl-moveto
( 70, 256 ).
625 RUN hpgl-text
( 'helvetica
,point
,20,proportional
,bold'
, "Voucher Continuation" ).
626 RUN hpgl-moveto
( 151, 271 ).
627 RUN hpgl-text
( "Helvetica,Point,13,Proportional,Normal", "Voucher No:" ).
628 RUN hpgl-moveto
( 181, 271 ).
629 RUN hpgl-text
( "Times,Point,16,Proportional,Bold", STRING( Voucher.VoucherSeq
, ">>>>>>>9" ) ).
631 RUN hpgl-moveto
( 22, 240 ).
632 RUN hpgl-text
( "Helvetica,Point,9,Proportional", "T" ).
633 RUN hpgl-move-relative
( 6, 0 ).
634 RUN hpgl-text
( hpgl-last-font
, "Code" ).
635 RUN hpgl-move-relative
( 12, 0 ).
636 RUN hpgl-text
( hpgl-last-font
, "Account" ).
637 RUN hpgl-move-relative
( 19, 0 ).
638 RUN hpgl-text
( hpgl-last-font
, "Narrative" ).
639 RUN hpgl-move-relative
( 116.5, 0 ).
640 RUN hpgl-text
( hpgl-last-font
, "$" ).
641 RUN hpgl-move-relative
( 17.5, 0 ).
642 RUN hpgl-text
( hpgl-last-font
, "c" ).
644 RUN hpgl-moveto
( 21.5, 230 ).
645 FOR EACH VoucherLine
OF Voucher
NO-LOCK:
647 IF i
<= {&MAX-P1-ALLOC} THEN NEXT.
648 RUN each-voucherline.
651 RUN hpgl-get-codes
( no
, yes
, OUTPUT continuation-codes
).
652 PUT CONTROL continuation-codes.
654 RUN make-control-string
( "PCL", "eject",
655 OUTPUT prt-ctrl
, OUTPUT rows
, OUTPUT cols
).
656 PUT CONTROL prt-ctrl.
660 /* _UIB-CODE-BLOCK-END
*/
665 &IF DEFINED(EXCLUDE-print-prompts) = 0 &THEN
667 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-prompts Procedure
668 PROCEDURE print-prompts
:
669 /*------------------------------------------------------------------------------
673 ------------------------------------------------------------------------------*/
675 RUN invoice-detail-prompts.
678 RUN recoverable-prompts.
679 RUN verification-prompts.
680 RUN transaction-prompts.
681 RUN approval-prompts.
685 /* _UIB-CODE-BLOCK-END
*/
690 &IF DEFINED(EXCLUDE-print-transactions) = 0 &THEN
692 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE print-transactions Procedure
693 PROCEDURE print-transactions
:
694 /*------------------------------------------------------------------------------
698 ------------------------------------------------------------------------------*/
699 DEF VAR i
AS INT NO-UNDO INITIAL 0.
702 RUN hpgl-moveto
( 21.5, 87.5 ).
703 FOR EACH VoucherLine
OF Voucher
NO-LOCK:
705 IF i
> {&MAX-P1-ALLOC} THEN DO:
706 continued-on-attached
= Yes.
707 RUN hpgl-move-relative
( 48, 0 ).
708 RUN hpgl-text
( "Helvetica,Point,12,Proportional,Bold",
709 "Continued On Attached Sheet" ).
712 RUN each-voucherline.
715 RUN hpgl-get-codes
( no
, yes
, OUTPUT transaction-codes
).
719 /* _UIB-CODE-BLOCK-END
*/
724 &IF DEFINED(EXCLUDE-recoverable-prompts) = 0 &THEN
726 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE recoverable-prompts Procedure
727 PROCEDURE recoverable-prompts
:
728 /*------------------------------------------------------------------------------
732 ------------------------------------------------------------------------------*/
734 /* Recoverable Prompts
*/
735 RUN hpgl-moveto
( 23, 145 ).
736 RUN hpgl-text
( "Helvetica,Point,10,Proportional", "Recoverable:" ).
737 RUN hpgl-move-relative
( 135, 0 ).
738 RUN hpgl-text
( "Helvetica,Point,12,Proportional", "Due:" ).
739 RUN hpgl-move-relative
( -135, -6 ).
740 RUN hpgl-text
( "Helvetica,Point,10,Proportional", "Source:" ).
741 RUN hpgl-move-relative
( 0, -6 ).
742 RUN hpgl-text
( hpgl-last-font
, "By Annual Rec:" ).
743 RUN hpgl-move-relative
( 0, -6 ).
744 RUN hpgl-text
( hpgl-last-font
, "Outgoings Received:" ).
745 RUN hpgl-move-relative
( 0, -7 ).
746 RUN hpgl-text
( hpgl-last-font
, "Percentage Recoverable:" ).
748 RUN hpgl-move-relative
( 44, 25 ).
749 RUN hpgl-text
( hpgl-last-font
, "Y" ).
750 RUN hpgl-move-relative
( -4, -6 ).
751 RUN hpgl-text
( hpgl-last-font
, "Lessee" ).
752 RUN hpgl-move-relative
( 4, -6 ).
753 RUN hpgl-text
( hpgl-last-font
, "Y" ).
754 RUN hpgl-move-relative
( 0, -6 ).
755 RUN hpgl-text
( hpgl-last-font
, "Y" ).
757 RUN hpgl-move-relative
( 19, 18 ).
758 RUN hpgl-text
( hpgl-last-font
, "N" ).
759 RUN hpgl-move-relative
( -6.5, -6 ).
760 RUN hpgl-text
( hpgl-last-font
, "Insurance" ).
761 RUN hpgl-move-relative
( 6.5, -6 ).
762 RUN hpgl-text
( hpgl-last-font
, "N" ).
763 RUN hpgl-move-relative
( 0, -6 ).
764 RUN hpgl-text
( hpgl-last-font
, "N" ).
766 RUN hpgl-move-relative
( 16.5, 18 ).
767 RUN hpgl-text
( hpgl-last-font
, "Part" ).
768 RUN hpgl-move-relative
( -1, -6 ).
769 RUN hpgl-text
( hpgl-last-font
, "Other" ).
770 RUN hpgl-move-relative
( 1, -6 ).
771 RUN hpgl-text
( hpgl-last-font
, "N/A" ).
772 RUN hpgl-move-relative
( 0, -6 ).
773 RUN hpgl-text
( hpgl-last-font
, "N/A" ).
777 /* _UIB-CODE-BLOCK-END
*/
782 &IF DEFINED(EXCLUDE-recoverable-variables) = 0 &THEN
784 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE recoverable-variables Procedure
785 PROCEDURE recoverable-variables
:
786 /*------------------------------------------------------------------------------
790 ------------------------------------------------------------------------------*/
792 RUN hpgl-moveto
( 170, 145 ).
793 RUN hpgl-text
( "Times,Point,16,Proportional,Bold", "@DueDate@" ).
794 RUN hpgl-text
( "Normal", "" ).
796 RUN hpgl-moveto
( 65, 120 ).
797 RUN hpgl-text
( "Times,Point,12,Proportional,Bold", "@Percentage@" ).
801 /* _UIB-CODE-BLOCK-END
*/
806 &IF DEFINED(EXCLUDE-replace-approvers) = 0 &THEN
808 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE replace-approvers Procedure
809 PROCEDURE replace-approvers
:
810 /*------------------------------------------------------------------------------
814 ------------------------------------------------------------------------------*/
816 DEF VAR approver-1
AS CHAR NO-UNDO.
817 DEF VAR approver-2
AS CHAR NO-UNDO.
819 FIND FIRST Approver
WHERE
820 Approver.ApproverCode
= Voucher.ApproverCode
AND
824 IF AVAILABLE Approver
THEN
826 FIND Person
OF Approver
NO-LOCK NO-ERROR.
827 IF AVAILABLE Person
THEN approver-1
= Person.FirstName
+ " " + Person.LastName.
830 FIND FIRST Approver
WHERE
831 Approver.ApproverCode
= Voucher.SecondApprover
AND
835 IF AVAILABLE Approver
THEN DO:
836 FIND Person
OF Approver
NO-LOCK NO-ERROR.
837 IF AVAILABLE Person
THEN approver-2
= Person.FirstName
+ " " + Person.LastName.
840 RUN hpgl-replace
( "@Certified Correct@", IF Voucher.SecondApprover
= "" THEN "" ELSE approver-1
).
841 RUN hpgl-replace
( "@Payment Approval@", IF Voucher.SecondApprover
= "" THEN approver-1
ELSE approver-2
).
845 /* _UIB-CODE-BLOCK-END
*/
850 &IF DEFINED(EXCLUDE-replace-budgets) = 0 &THEN
852 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE replace-budgets Procedure
853 PROCEDURE replace-budgets
:
854 /*------------------------------------------------------------------------------
858 ------------------------------------------------------------------------------*/
860 DEF VAR ytd-actual
AS DEC NO-UNDO.
861 DEF VAR ytd-budget
AS DEC NO-UNDO.
862 DEF VAR fy-budget
AS DEC NO-UNDO.
864 DEF VAR first-month
LIKE Month.MonthCode
NO-UNDO.
865 DEF VAR last-month
LIKE Month.MonthCode
NO-UNDO.
866 DEF VAR this-month
LIKE Month.MonthCode
NO-UNDO.
868 IF LOOKUP( Voucher.EntityType
, "P,L" ) = 0 THEN
870 RUN hpgl-replace
( "@YTD Actual@", "" ).
871 RUN hpgl-replace
( "@YTD Budget@", "" ).
872 RUN hpgl-replace
( "@FY Budget@", "" ).
876 FIND FIRST Month
WHERE Month.StartDate
<= Voucher.Date
AND Month.EndDate
>= Voucher.Date
878 FIND FinancialYear
OF Month
NO-LOCK NO-ERROR.
880 IF AVAILABLE FinancialYear
THEN
882 this-month
= Month.MonthCode.
883 FIND FIRST Month
OF FinancialYear
NO-LOCK. first-month
= Month.MonthCode.
884 FIND LAST Month
OF FinancialYear
NO-LOCK. last-month
= Month.MonthCode.
886 FOR EACH AccountBalance
NO-LOCK WHERE
887 AccountBalance.EntityType
= Voucher.EntityType
AND
888 AccountBalance.EntityCode
= Voucher.EntityCode
AND
889 AccountBalance.AccountCode
= Voucher.AccountCode
AND
890 AccountBalance.MonthCode
>= first-month
AND
891 AccountBalance.MonthCode
<= last-month
:
892 IF AccountBalance.MonthCode
<= this-month
THEN
894 ytd-actual
= ytd-actual
+ AccountBalance.Balance
895 ytd-budget
= ytd-budget
+ AccountBalance.Budget.
896 fy-budget
= fy-budget
+ AccountBalance.Budget.
901 RUN hpgl-replace
( "@YTD Actual@", TRIM( STRING( ytd-actual
, "$>>>,>>>,>>9.99CR" ) ) ).
902 RUN hpgl-replace
( "@YTD Budget@", TRIM( STRING( ytd-budget
, "$>>>,>>>,>>9.99CR" ) ) ).
903 RUN hpgl-replace
( "@FY Budget@", TRIM( STRING( fy-budget
, "$>>>,>>>,>>9.99CR" ) ) ).
907 /* _UIB-CODE-BLOCK-END
*/
912 &IF DEFINED(EXCLUDE-replace-entity) = 0 &THEN
914 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE replace-entity Procedure
915 PROCEDURE replace-entity
:
916 /*------------------------------------------------------------------------------
920 ------------------------------------------------------------------------------*/
922 DEF VAR entity-name
AS CHAR NO-UNDO.
923 DEF VAR entity-type
AS CHAR NO-UNDO.
925 CASE Voucher.EntityType
:
928 FIND Company
WHERE Company.CompanyCode
= Voucher.EntityCode
NO-LOCK NO-ERROR.
929 IF AVAILABLE Company
THEN entity-name
= Company.LegalName.
930 entity-type
= "Company".
934 FIND Property
WHERE Property.PropertyCode
= Voucher.EntityCode
NO-LOCK NO-ERROR.
935 IF AVAILABLE Property
THEN entity-name
= Property.Name.
936 entity-type
= "Property".
940 FIND Tenant
WHERE Tenant.TenantCode
= Voucher.EntityCode
NO-LOCK NO-ERROR.
941 IF AVAILABLE Tenant
THEN entity-name
= Tenant.Name.
942 entity-type
= "Tenant".
946 FIND Project
WHERE Project.ProjectCode
= Voucher.EntityCode
NO-LOCK NO-ERROR.
947 IF AVAILABLE Project
THEN entity-name
= Project.Name.
948 entity-type
= "Project".
953 FIND ChartOfAccount
WHERE ChartOfAccount.AccountCode
= Voucher.AccountCode
956 IF AVAILABLE ChartOfAccount
AND entity-name
<> "" THEN
957 entity-name
= entity-name
+ ", " + ChartOfAccount.Name.
959 DEF VAR normal
AS CHAR NO-UNDO.
960 RUN make-control-string
( "PCL", "Courier,Point,12,Proportional,Bold", OUTPUT prt-ctrl
, OUTPUT rows
, OUTPUT cols
).
961 RUN make-control-string
( "PCL", "Courier,Point,12,Proportional,Normal", OUTPUT normal
, OUTPUT rows
, OUTPUT cols
).
962 RUN hpgl-replace
( "@Entity@", entity-type
+ ": " + prt-ctrl
+ entity-name
+ normal
).
966 /* _UIB-CODE-BLOCK-END
*/
971 &IF DEFINED(EXCLUDE-replace-percentage-recoverable) = 0 &THEN
973 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE replace-percentage-recoverable Procedure
974 PROCEDURE replace-percentage-recoverable
:
975 /*------------------------------------------------------------------------------
979 ------------------------------------------------------------------------------*/
981 DEF VAR percent-recoverable
AS DEC NO-UNDO.
983 FIND ChartOfAccount
WHERE ChartOfAccount.AccountCode
= Voucher.AccountCode
985 FIND AccountGroup
OF ChartOfAccount
NO-LOCK NO-ERROR.
987 /* 0% recoverable expense if balance sheet account or non recoverable account
*/
988 IF AVAILABLE(AccountGroup
) AND
989 ( AccountGroup.GroupType
= "B" OR
990 AccountGroup.AccountGroupCode
= AcctGroup-ownex
)
991 THEN percent-recoverable
= 0.
993 IF AVAILABLE AccountGroup
AND AccountGroup.AccountGroupCode
= "TENEX" THEN
994 percent-recoverable
= 100.00.
995 ELSE IF Voucher.EntityType
= "P" THEN DO:
996 FIND Property
WHERE Property.PropertyCode
= Voucher.EntityCode
998 FOR EACH TenancyLease
OF Property
NO-LOCK WHERE TenancyLease.LeaseStatus
<> "PAST" AND NOT TenancyLease.GrossLease
:
999 FIND FIRST TenancyOutgoing
OF TenancyLease
WHERE TenancyOutgoing.AccountCode
= Voucher.AccountCode
NO-LOCK NO-ERROR.
1000 percent-recoverable
= percent-recoverable
+ (IF AVAILABLE(TenancyOutgoing
) THEN TenancyOutgoing.Percentage
ELSE TenancyLease.OutgoingsRate
).
1002 END.
/* EntityType
= "P" */
1006 RUN hpgl-replace
( "@Percentage@", TRIM( STRING( percent-recoverable
, ">>9.99%" ) ) ).
1009 RUN hpgl-replace
( "@Percentage@", "" ).
1014 /* _UIB-CODE-BLOCK-END
*/
1019 &IF DEFINED(EXCLUDE-signatory-variables) = 0 &THEN
1021 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE signatory-variables Procedure
1022 PROCEDURE signatory-variables
:
1023 /*------------------------------------------------------------------------------
1025 ------------------------------------------------------------------------------*/
1027 DEF VAR approver-list
AS CHAR NO-UNDO.
1029 FIND Office
WHERE Office.ThisOffice
NO-LOCK.
1030 FIND OfficeSettings
OF Office
WHERE
1031 OfficeSettings.SetName
= "VOUCHER-SIGN" NO-LOCK.
1033 approver-list
= OfficeSettings.SetValue.
1035 DEF VAR n
AS DEC NO-UNDO.
1036 DEF VAR box-width
AS DEC NO-UNDO.
1037 DEF VAR box-height
AS DEC NO-UNDO.
1038 DEF VAR gap-width
AS DEC NO-UNDO.
1040 n
= NUM-ENTRIES( approver-list
).
1041 box-width
= ( 3 / ( 4 * n
- 1 ) ) * 180.
1042 gap-width
= box-width
/ 3.
1045 DEF VAR i
AS INT NO-UNDO.
1046 RUN hpgl-moveto
( 21, 13 ).
1047 RUN hpgl-append
( "LT" ).
/* Solid Line
*/
1049 RUN hpgl-box-relative
( box-width
, box-height
).
1050 RUN hpgl-move-relative
( 1, 1 ).
1051 RUN hpgl-text
( "Helvetica,Point,10,Proportional", ENTRY( i
, approver-list
) ).
1052 RUN hpgl-move-relative
( box-width
+ gap-width
- 1 , -1 ).
1057 /* _UIB-CODE-BLOCK-END
*/
1062 &IF DEFINED(EXCLUDE-transaction-prompts) = 0 &THEN
1064 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE transaction-prompts Procedure
1065 PROCEDURE transaction-prompts
:
1066 /*------------------------------------------------------------------------------
1070 ------------------------------------------------------------------------------*/
1072 /* Transaction Prompts
*/
1073 RUN hpgl-moveto
( 22, 92.3 ).
1074 RUN hpgl-text
( "Helvetica,Point,9,Proportional", "T" ).
1075 RUN hpgl-move-relative
( 6, 0 ).
1076 RUN hpgl-text
( hpgl-last-font
, "Code" ).
1077 RUN hpgl-move-relative
( 12, 0 ).
1078 RUN hpgl-text
( hpgl-last-font
, "Account" ).
1079 RUN hpgl-move-relative
( 19, 0 ).
1080 RUN hpgl-text
( hpgl-last-font
, "Narrative" ).
1081 RUN hpgl-move-relative
( 116.5, 0 ).
1082 RUN hpgl-text
( hpgl-last-font
, "$" ).
1083 RUN hpgl-move-relative
( 17.5, 0 ).
1084 RUN hpgl-text
( hpgl-last-font
, "c" ).
1088 /* _UIB-CODE-BLOCK-END
*/
1093 &IF DEFINED(EXCLUDE-variable-replacements) = 0 &THEN
1095 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE variable-replacements Procedure
1096 PROCEDURE variable-replacements
:
1097 /*------------------------------------------------------------------------------
1101 ------------------------------------------------------------------------------*/
1103 hpgl-codes
= variable-codes.
1105 RUN hpgl-replace
( "@LastModified@",
1106 IF Voucher.LastModifiedUser
= ?
THEN "Unknown" ELSE Voucher.LastModifiedUser
+ '
- '
+
1107 STRING( Voucher.LastModifiedDate
, "99/99/9999" ) + ' '
+
1108 STRING( Voucher.LastModifiedTime
, "HH:MM:SS" ) ).
1109 RUN hpgl-replace
( "@VoucherNo@", STRING( Voucher.VoucherSeq
, ">>>>>>>9" ) ).
1111 FIND Creditor
OF Voucher
NO-LOCK NO-ERROR.
1112 RUN hpgl-replace
( "@Creditor@", IF AVAILABLE Creditor
THEN
1113 STRING( Creditor.CreditorCode
, "99999" ) ELSE "" ).
1114 RUN hpgl-replace
( "@CreditorName@", IF AVAILABLE Creditor
THEN
1115 Creditor.Name
ELSE "" ).
1117 RUN hpgl-replace
( "@InvoiceNo@", Voucher.InvoiceReference
).
1118 RUN hpgl-replace
( "@OrderNo@", IF Voucher.OurOrderNo
= ?
THEN "" ELSE Voucher.OurOrderNo
).
1119 RUN hpgl-replace
( "@CapexRef@", STRING( Voucher.CapexCode
, "99999" ) ).
1120 RUN hpgl-replace
( "@VoucherDescription@", Voucher.Description
).
1121 RUN hpgl-replace
( "@Date@", IF Voucher.Date
= ?
THEN "" ELSE
1122 STRING( Voucher.Date
, "99/99/9999" ) ).
1123 RUN hpgl-replace
( "@Approval@", Voucher.ApproverCode
).
1124 RUN hpgl-replace
( "@Value@", STRING( Voucher.GoodsValue
, ">>,>>>,>>9.99CR" ) ).
1126 RUN hpgl-replace
( "@GST@", STRING( Voucher.TaxValue
, ">>,>>>,>>9.99CR" ) ).
1127 RUN hpgl-replace
( "@Total@", STRING( Voucher.GoodsValue
+ Voucher.TaxValue
, ">>,>>>,>>9.99CR" ) ).
1129 RUN replace-budgets.
1131 RUN replace-percentage-recoverable.
1133 RUN hpgl-replace
( "@DueDate@", IF Voucher.DateDue
= ?
THEN "" ELSE
1134 STRING( Voucher.DateDue
, "99/99/9999" ) ).
1136 RUN replace-approvers.
1140 /* _UIB-CODE-BLOCK-END
*/
1145 &IF DEFINED(EXCLUDE-verification-prompts) = 0 &THEN
1147 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE verification-prompts Procedure
1148 PROCEDURE verification-prompts
:
1149 /*------------------------------------------------------------------------------
1153 ------------------------------------------------------------------------------*/
1155 /* Verification Prompts
*/
1156 RUN hpgl-moveto
( 23, 110 ).
1157 RUN hpgl-text
( "Helvetica,Point,12,Proportional", "Invoice Numbers( office use only ):" ).
1158 RUN hpgl-move-relative
( 71, 0 ).
1159 RUN hpgl-line-relative
( 106, 0 ).
1160 RUN hpgl-move-relative
( -177, -9 ).
1161 RUN hpgl-text
( hpgl-last-font
, "Extensions Checked:" ).
1162 RUN hpgl-move-relative
( 44, 0 ).
1163 RUN hpgl-line-relative
( 43, 0 ).
1164 RUN hpgl-move-relative
( 4, 0 ).
1165 RUN hpgl-text
( hpgl-last-font
, "Coding Verified:" ).
1166 RUN hpgl-move-relative
( 34, 0 ).
1167 RUN hpgl-line-relative
( 52, 0 ).
1171 /* _UIB-CODE-BLOCK-END
*/
1176 &IF DEFINED(EXCLUDE-voucher-approval-forms) = 0 &THEN
1178 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE voucher-approval-forms Procedure
1179 PROCEDURE voucher-approval-forms
:
1180 /*------------------------------------------------------------------------------
1184 ------------------------------------------------------------------------------*/
1186 RUN get-fixed-codes.
1189 /* The voucher-dependent parts of the page
*/
1190 DEF VAR i
AS INT NO-UNDO.
1192 IF voucher-list
<> ?
THEN
1193 DO i
= 1 TO NUM-ENTRIES( voucher-list
):
1195 Voucher.VoucherSeq
= INT ( ENTRY( i
, voucher-list
) ) NO-LOCK NO-ERROR.
1196 IF AVAILABLE Voucher
THEN RUN each-voucher.
1199 IF voucher-start
<> ?
AND voucher-end
<> ?
THEN
1200 FOR EACH Voucher
NO-LOCK WHERE
1201 Voucher.VoucherSeq
>= voucher-start
AND
1202 Voucher.VoucherSeq
<= voucher-end
:
1208 /* _UIB-CODE-BLOCK-END
*/
1213 &IF DEFINED(EXCLUDE-voucher-entity-name) = 0 &THEN
1215 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE voucher-entity-name Procedure
1216 PROCEDURE voucher-entity-name
:
1217 /*------------------------------------------------------------------------------
1219 ------------------------------------------------------------------------------*/
1221 DEF OUTPUT PARAMETER entity-name
AS CHAR NO-UNDO INITIAL "Unknown".
1223 IF VoucherLine.EntityType
= "L" THEN DO:
1224 FIND Company
WHERE Company.CompanyCode
= VoucherLine.EntityCode
NO-LOCK NO-ERROR.
1225 IF AVAILABLE Company
THEN entity-name
= SUBSTR( Company.ShortName
, 1, 12 ).
1228 entity-name
= get-entity-name
( VoucherLine.EntityType
, VoucherLine.EntityCode
).
1230 entity-name
= SUBSTR( entity-name
, 1, 12 ).
1234 /* _UIB-CODE-BLOCK-END
*/