source: WorldVistAEHR/trunk/r/KERNEL-XU-A4A7-USC-XG-XLF-XNOA-XPD-XQ-XVIR-ZI-ZOSF-ZOSV-ZT-ZU-%Z-XIP--XQAB--XUC--XUR--ZIN--ZTED/ZISPL.m@ 1240

Last change on this file since 1240 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 5.6 KB
Line 
1ZISPL ;SF/RWF - UTILITIES FOR SPOOLING ;03/31/2003 08:53
2 ;;8.0;KERNEL;**23,69,291**;Jul 10, 1995
3 ;This is the general code for managment of the spooler file.
4DELETE ;delete a document from the file.
5A S DIC("A")="Delete which SPOOL DOCUMENT: " D GETDOC G:Y<0 EXIT
6 I '$P(ZISPL0,U,7) W !,$C(13),"This Document hasn't been printed. Are you sure??"
7 S DIR(0)="S^n:NO;y:YES;c:CLEAR",DIR("A")="...OK TO DELETE",DIR("B")="NO" D ^DIR K DIR G:$D(DIRUT)!("yc"'[Y) EXIT
8 S ZISY=Y D DSD($P(ZISPL0,U,10)) ;delete data
9 I ZISY["c" S X=^XMB(3.51,ZISDA,0),^(0)=$P(X,"^",1)_"^^^^"_DUZ_"^^^"_$P(X,"^",8) K ^XMB(3.51,ZISDA,2) W " ... DOCUMENT CLEARED!!" G EXIT
10 ;
11 D DSDOC(ZISDA) ;Delete entry
12 W " ...DOCUMENT DELETED!!",$C(13),!
13 G EXIT
14DEL ;Called from mailman to delete the document.
15 Q ;Obsolete
16GETDOC ;Get a spool document to work on.
17 S Y=-1 Q:$D(DUZ)[0 S ZISPLU=$S($D(^VA(200,DUZ,"SPL")):^("SPL"),1:"") I $P(ZISPLU,"^",1)'["y" W !,?5,$C(13),"You must be authorized by IRM to use spooling" Q
18 S DIC=3.51,DIC(0)="AEMQZ" D ^DIC Q:Y<0 I $P(Y(0),U,2)]"" W !,?5,$C(13),"This spool is still active and can't be worked on." G GETDOC
19 S ZISDA=+Y,ZISPL0=Y(0) K DIC Q
20 ;
21PRINT ;
22 N %,DIC,DIE,DR,DA,X,Y,ZISPL0,ZISPG,ZISDA,ZISDA2,ZISPLC,ZISFDA,ZISIEN,ZISIOP,ZISMSG
23P S DIC("A")="Print which SPOOL DOCUMENT: " D GETDOC K IOP,%ZIS,%IS Q:Y<0
24 S ZISPG=$P(ZISPL0,U,8) I $P(ZISPL0,U,3)="m" W !,"Sorry, this spool document has been converted into a mail message",!,"and you are unable to print it" G EXIT
25 I $P(ZISPL0,U,10)'>0 W !,"Sorry there isn't anything to print." G EXIT
26 I $P(ZISPL0,U,11) D MSG2 S %=2 D YN^DICN G EXIT:%'=1
27IO ;
28 S DIR(0)="N^1:99",DIR("A")="Copies to Print" D ^DIR S ZISPLC=+$G(Y) I $D(DIRUT) G EXIT
29 U IO(0) S %IS="MQ" D ^%ZIS G:POP EXIT S ZISIOP=ION_";"_IOST_";"_IOM_";"_IOSL
30 U IO(0) S ZISDA2=$$FIND1^DIC(3.5121,","_ZISDA_",","O",ION)
31 I ZISDA2>0,$P(^XMB(3.51,ZISDA,2,ZISDA2,0),"^",3) S ZISMSG="This device is currently printing a copy of this document" G CIO
32 I +ZISPG>IOM!($P(ZISPG,";",2)>IOSL) S ZISMSG="Current page is "_IOM_" by "_IOSL_$C(13,10)_" Page must be at least "_(+ZISPG)_" by "_$P(ZISPG,";",2) G CIO
33 S %=$S(ZISDA2>0:ZISDA2_",",1:"?+1,")_ZISDA_","
34 S ZISFDA(3.5121,%,.01)=ION,ZISFDA(3.5121,%,1)=ZISPLC D UPDATE^DIE("","ZISFDA","ZISIEN")
35 S:ZISDA2'>0 ZISDA2=ZISIEN(1)
36 W ! I '$D(IO("Q")) S %ZIS="",IOP=ZISIOP D ^%ZIS G:'POP DQP^ZISPL2
37 S ZTRTN="DQP^ZISPL2",ZTDESC="Print spool document",ZTIO=ZISIOP,ZTSAVE("ZISDA")="",ZTSAVE("ZISDA2")="",ZTSAVE("ZISPLC")=""
38 K IO("Q") D ^%ZTLOAD,^%ZISC K ZTSK G EXIT:$P(ZISPLU,"^",2)'["y" W !!,"Also send to" G IO
39 ;
40CIO ;Close device and go to IO
41 D ^%ZISC U IO D:$D(ZISMSG) G IO
42 . W !,ZISMSG K ZISMSG
43CEXIT ;Close device and Exit
44 D ^%ZISC
45EXIT D KILL^XUSCLEAN S ZTREQ="@" Q
46 ;
47KERMIT ;Use Kermit to send a spooler file
48 D GETDOC Q:Y'>0 S ZISDA=$P(ZISPL0,U,10) G EXIT:ZISDA'>0 S XTKDIC="^XMBS(3.519,"_ZISDA_",2,",XTKFILE=$P(ZISPL0,U)
49 D MODE^XTKERMIT G EXIT:$D(DIRUT) D SEND^XTKERMIT G EXIT
50 ;
51BROWSE ;Use FM Browser to look at document
52 D GETDOC Q:Y'>0 S ZISDA=$P(ZISPL0,U,10) G EXIT:ZISDA'>0
53 D BROWSE^DDBR($NA(^XMBS(3.519,ZISDA,2)),"NR",$P(ZISPL0,U)) G EXIT
54 ;
55MAIL ;Make into a mail message (move text from file #3.519 to file #3.9)
56 N ZISPLU,ZISDA,ZISPL0,XS,ZISLINES,DIR,X,Y
57 S ZISPLU=$G(^VA(200,DUZ,"SPL")) I $P(ZISPLU,U,3)["n" W !,"You are not authorized to convert Spool Documents into MailMan Messages." G EXIT
58 D GETDOC G:'$D(ZISPL0) EXIT
59 S XS=$P(ZISPL0,"^",10) I 'XS D MSG1 G EXIT
60 S ZISLINES=$P(ZISPL0,U,9) I '+ZISLINES D MSG1 G EXIT
61 K DIR,X,Y
62 S DIR(0)="Y"
63 S DIR("A")="Convert spool doc: "_$P(ZISPL0,U)_" into a MailMan message"
64 S DIR("B")=$$EZBLD^DIALOG(39054) ; Yes
65 D ^DIR G:'Y EXIT
66 N XMDUZ,ZISSUBJ,ZISINSTR,ZISABORT,XMV
67 S ZISABORT=0
68 D INITAPI^XMVVITAE
69 D ASK(.ZISSUBJ,.ZISINSTR,.ZISABORT) I ZISABORT G CLEAN
70 G:ZISLINES<500 MAILIT
71 W !
72 K DIR,X,Y
73 S DIR(0)="Y"
74 S DIR("A",1)="You have "_ZISLINES_" lines of text to convert into a MailMan message."
75 S DIR("A")="Do you wish to queue this conversion process"
76 S DIR("B")=$$EZBLD^DIALOG(39054) ; Yes
77 D ^DIR I $D(DIRUT) G CLEAN
78 G:'Y MAILIT
79 N ZTIO,ZTRTN,ZTDESC,ZTDTH,ZTSAVE,I
80 S ZTIO="",ZTRTN="MAILTASK^ZISPL",ZTDESC="Convert spool document into MailMan message"
81 F I="ZISDA","XMDUZ","ZISSUBJ","ZISINSTR(","XMV(","^TMP(""XMY"",$J,","^TMP(""XMY0"",$J," S ZTSAVE(I)=""
82 D ^%ZTLOAD
83 I '$G(ZTSK) W !,"Queueing failed."
84 E W !,$$EZBLD^DIALOG(34501.1,ZTSK) ; Request queued. Task number: |1|
85 G CLEAN
86MAILTASK ;
87 N XS
88 S XS=$P($G(^XMB(3.51,ZISDA,0)),"^",10)
89 I 'XS D DSDOC(ZISDA) Q
90MAILIT ;
91 W:'$D(ZTQUEUED) !!,$$EZBLD^DIALOG(34234) ; Moving to a MailMan message...
92 N XMZ
93 D CRE8XMZ^XMXAPI(ZISSUBJ,.XMZ) I $D(XMERR) G CLEAN
94 D MOVEBODY^XMXAPI(XMZ,"^XMBS(3.519,"_XS_",2)") I $D(XMERR) G CLEAN
95 W:'$D(ZTQUEUED) !,$$EZBLD^DIALOG(34236) ; Finished moving.
96 D SENDMSG^XMAPHOST(DUZ,XMZ,.ZISINSTR)
97 D DSDOC(ZISDA),DSD(XS)
98CLEAN ;
99 I $D(XMERR) D
100 . I '$D(ZTQUEUED) D SHOWERR^XMXAPIU Q
101 . K XMERR,^TMP("XMERR",$J)
102 D CLEANUP^XMXADDR
103 G EXIT
104ASK(ZISSUBJ,ZISINSTR,ZISABORT) ;
105 S ZISSUBJ=$E("Spool document: "_$P(ZISPL0,"^"),1,65)
106 D SUBJ^XMXAPIU(.ZISSUBJ) I $D(XMERR) S ZISABORT=1 Q
107 D FROMWHOM^XMAPHOST(DUZ,.ZISINSTR,.ZISABORT) Q:ZISABORT
108 S ZISINSTR("ADDR FLAGS")="R"
109 D TOWHOM^XMXAPIU(DUZ,"","S",.ZISINSTR)
110 I $D(XMERR) S ZISABORT=1
111 Q
112DSD(DA) ; Delete an entry in the spool data file.
113 Q:DA'>0 N DIK K ^XMB(3.51,"AM",DA) S DIK="^XMBS(3.519," D ^DIK
114 Q
115DSDOC(DA) ; Delete an entry in the spool doc file.
116 Q:DA'>0 N DIK S DIK="^XMB(3.51," D ^DIK
117 Q
118MSG1 W !,"This spool document doesn't have any text."
119 Q
120MSG2 W !,"You have exceeded the total spool document line limit allowed."
121 W !,"Therefore, this spool document is incomplete."
122 W !!,"Do you still wish to print this document"
123 Q
Note: See TracBrowser for help on using the repository browser.