INHUT4 ;JAW,JPD; 13 Jan 93 14:16;HANDLE COPIES OF DOCUMENTS
;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
;COPYRIGHT 1991-2000 SAIC
;
COPIES(COPIES,PROMPT) ; ask # copies
; COPIES(op)=Default for number of copies; def=1
; PROMPT(op)=Alternate prompt; def="Number of Copes: "
S COPIES=$S($G(COPIES):+COPIES,1:1),PROMPT=$S($G(PROMPT)]"":PROMPT,1:"NUMBER OF COPIES: ")_COPIES_"//"
F D I %["^"!% Q
.W !,PROMPT R %:DTIME E S %="^" Q
.I %["^" S %="^" Q
.I %="" S %=COPIES
.I %<1!(%>10)!(%'?.N) W !,"Enter a number between 1 and 10" S %=0
Q %
PRINT(ROU,COPIES,DOC) ; Print multiple copies of a report to device 'IO'
;NOTE: DEVICE 'IO' MUST BE OPEN WHEN CALLING
; ROU(re) = Run routine to do printing
; COPIES(op) = # copies to print (def 1)
; DOC(op) = Name for document being printed. If passed doc is left
; with an expiration date of a week. Scratch name used &
; doc. deleted if not passed. DOC contains one copy of
; what is printed by 'ROU'.
N DA,DIE,DR,INZISDA,INZISDOC,ZISDA,ZISDOC
; ZISDOC by ref. - need to know the document name from RUN
S (ZISDOC,DOC)=$G(DOC) D RUN(ROU,.ZISDOC,IOM,IOSL)
S ZISCOPY=$S($G(COPIES):COPIES,1:1)
; Save values; Print multiple copies; SPOOLER closes device
S ZISDA=$O(^XUSPLDSM("B",ZISDOC,"")),ZISDOC=$G(^XUSPLDSM(ZISDA,1))
S INZISDA=ZISDA,INZISDOC=ZISDOC U IO D ENTSK^%ZISPL
; Delete spool document and VMS file
I DOC="" S DA=INZISDA,DIK="^XUSPLDSM(" D ^DIK
Q
RUN(ROU,DOC,IOM,IOSL) ; Print to spool file 'DOC' once
; ROU(re)=Routine that does printing
; DOC(op)=Document name (def bogus doc)
; IOM(op)=Margin for out (def 80)
; IOSL(op)=Pg length for out (def 60)
N IO,IOP,IOST
S DOC=$S($G(DOC)="":"INSPOOL"_$TR($H,",")_$J,1:DOC)
S IOP="SPOOL;"_DOC_";"_$S($G(IOM):IOM,1:80)_";"_$S($G(IOSL):IOSL,1:60)
D ^%ZIS D
.; New DOC in case DOC was by ref. and 'ROU' kills it
.N DOC U IO D @ROU,^%ZISC
Q
INHUT4 ;JAW,JPD; 13 Jan 93 14:16;HANDLE COPIES OF DOCUMENTS
+1 ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
+2 ;COPYRIGHT 1991-2000 SAIC
+3 ;
COPIES(COPIES,PROMPT) ; ask # copies
+1 ; COPIES(op)=Default for number of copies; def=1
+2 ; PROMPT(op)=Alternate prompt; def="Number of Copes: "
+3 SET COPIES=$SELECT($GET(COPIES):+COPIES,1:1)
SET PROMPT=$SELECT($GET(PROMPT)]"":PROMPT,1:"NUMBER OF COPIES: ")_COPIES_"//"
+4 FOR
Begin DoDot:1
+5 WRITE !,PROMPT
READ %:DTIME
IF '$TEST
SET %="^"
QUIT
+6 IF %["^"
SET %="^"
QUIT
+7 IF %=""
SET %=COPIES
+8 IF %<1!(%>10)!(%'?.N)
WRITE !,"Enter a number between 1 and 10"
SET %=0
End DoDot:1
IF %["^"!%
QUIT
+9 QUIT %
PRINT(ROU,COPIES,DOC) ; Print multiple copies of a report to device 'IO'
+1 ;NOTE: DEVICE 'IO' MUST BE OPEN WHEN CALLING
+2 ; ROU(re) = Run routine to do printing
+3 ; COPIES(op) = # copies to print (def 1)
+4 ; DOC(op) = Name for document being printed. If passed doc is left
+5 ; with an expiration date of a week. Scratch name used &
+6 ; doc. deleted if not passed. DOC contains one copy of
+7 ; what is printed by 'ROU'.
+8 NEW DA,DIE,DR,INZISDA,INZISDOC,ZISDA,ZISDOC
+9 ; ZISDOC by ref. - need to know the document name from RUN
+10 SET (ZISDOC,DOC)=$GET(DOC)
DO RUN(ROU,.ZISDOC,IOM,IOSL)
+11 SET ZISCOPY=$SELECT($GET(COPIES):COPIES,1:1)
+12 ; Save values; Print multiple copies; SPOOLER closes device
+13 SET ZISDA=$ORDER(^XUSPLDSM("B",ZISDOC,""))
SET ZISDOC=$GET(^XUSPLDSM(ZISDA,1))
+14 SET INZISDA=ZISDA
SET INZISDOC=ZISDOC
USE IO
DO ENTSK^%ZISPL
+15 ; Delete spool document and VMS file
+16 IF DOC=""
SET DA=INZISDA
SET DIK="^XUSPLDSM("
DO ^DIK
+17 QUIT
RUN(ROU,DOC,IOM,IOSL) ; Print to spool file 'DOC' once
+1 ; ROU(re)=Routine that does printing
+2 ; DOC(op)=Document name (def bogus doc)
+3 ; IOM(op)=Margin for out (def 80)
+4 ; IOSL(op)=Pg length for out (def 60)
+5 NEW IO,IOP,IOST
+6 SET DOC=$SELECT($GET(DOC)="":"INSPOOL"_$TRANSLATE($HOROLOG,",")_$JOB,1:DOC)
+7 SET IOP="SPOOL;"_DOC_";"_$SELECT($GET(IOM):IOM,1:80)_";"_$SELECT($GET(IOSL):IOSL,1:60)
+8 DO ^%ZIS
Begin DoDot:1
+9 ; New DOC in case DOC was by ref. and 'ROU' kills it
+10 NEW DOC
USE IO
DO @ROU
DO ^%ZISC
End DoDot:1
+11 QUIT