source: WorldVistAEHR/trunk/r/ENGINEERING-EN/ENWO2.m@ 1800

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

initial load of WorldVistAEHR

File size: 4.1 KB
RevLine 
[613]1ENWO2 ;WIRMFO/DH,SAB-Disapprove Work Order ;2/3/97
2 ;;7.0;ENGINEERING;**35**;Aug 17, 1993
3DISAP ;Disapprove work order
4EN S DIC("S")="I $P($G(^(5)),U,2)=""""" D WO^ENWOUTL K DIC
5 G:Y'>0 EXIT S DA=+Y
6 S DIE="^ENG(6920,"
7EN1 ;
8 I $D(^ENG(6920,DA,5)),$P(^(5),U,2)]"" W !,*7,"NOTE: This Work Order has already been closed out." W:$D(^XUSEC("ENEDCLWO",DUZ)) !,"Use the Work Order EDIT or DISPLAY option if you need to edit." G EXIT
9 S ENDA(0)=DA,DR=$S($D(^DIE("B","ENZWODISAP")):"[ENZWODISAP]",1:"[ENWODISAP]") D ^DIE W !!
10 S DA=ENDA(0)
11 K ENDA(0) G EXIT
12EXIT Q
13 ;
14MSG ; Notify Requestor of W.O. Status Change
15 ; File 6920 Field 32 "AH" mumps x-ref
16 ; Expects DA (ien of w.o.)
17 N ENABBR,ENDAS,ENELWO,ENI,ENQ,ENSEND,ENSO,ENX,ENY
18 S ENSEND="" ; flag: =1 send msg, =0 no msg, =NULL don't know yet
19 S ENDAS=DA_","
20 D GETS^DIQ(6920,ENDAS,".01;.05;2;32","E","ENQ")
21 D GETS^DIQ(6920,ENDAS,"7.5;32;32.1","I","ENQ")
22 S:$E(ENQ(6920,ENDAS,.01,"E"),1,3)="PM-" ENSEND=0 ; ignore PM W.O.s
23 S:ENQ(6920,ENDAS,7.5,"I")'?1.N ENSEND=0 ; no requestor
24 S:ENQ(6920,ENDAS,7.5,"I")=DUZ ENSEND=0 ; don't send msg to self
25 ; if disapproved
26 I ENSEND="",ENQ(6920,ENDAS,32,"E")="DISAPPROVED" D S:ENSEND="" ENSEND=0
27 . I ENQ(6920,ENDAS,2,"E")["COMPUTER" S ENSEND=1
28 ; else if existing notification preference
29 I ENSEND="",ENQ(6920,ENDAS,32.1,"I")]"" D S:ENSEND="" ENSEND=0
30 . I ENQ(6920,ENDAS,32.1,"I")="S" S ENSEND=1
31 . I ENQ(6920,ENDAS,32.1,"I")="C",ENQ(6920,ENDAS,32,"E")="COMPLETED" S ENSEND=1
32 ; else if existing software option
33 I ENSEND="" D S:ENSEND="" ENSEND=0
34 . S ENI=$O(^ENG(6910.2,"B","NOTIFY W.O. REQUESTOR",0))
35 . S ENSO=$S(ENI?1.N:$P($G(^ENG(6910.2,ENI,0)),U,2),1:"")
36 . I ENSO]"" D
37 . . ; check if electronic w.o.
38 . . S ENELWO=0
39 . . F ENI=1:1 Q:$E(ENQ(6920,ENDAS,.05,"E"),ENI)'?1U
40 . . S ENABBR=$E(ENQ(6920,ENDAS,.05,"E"),1,ENI-1)
41 . . Q:ENABBR=""
42 . . S ENI=89
43 . . F S ENI=$O(^DIC(6922,ENI)) Q:'ENI D:ENI#100>89 Q:ENELWO
44 . . . I $P($G(^(ENI,0)),U,2)=ENABBR S ENELWO=1
45 . . Q:'ENELWO
46 . . I ENSO="S" S ENSEND=1
47 . . I ENSO="C",ENQ(6920,ENDAS,32,"E")="COMPLETED" S ENSEND=1
48 D:ENSEND=1
49 . ; send mail message to requestor
50 . N ENL,ENTEXT,XMCHAN,XMDUZ,XMSUB,XMTEXT,XMY
51 . S ENTEXT(1)="A work request which you entered on "_$$GET1^DIQ(6920,ENDAS,1)
52 . S ENTEXT(2)=" Original Work Order #: "_ENQ(6920,ENDAS,.05,"E")
53 . S ENTEXT(3)=" Task Description: "_$$GET1^DIQ(6920,ENDAS,6)
54 . S ENTEXT(4)=" Contact Person: "_$$GET1^DIQ(6920,ENDAS,7)
55 . S ENTEXT(4)=ENTEXT(4)_" Phone: "_$$GET1^DIQ(6920,ENDAS,8)
56 . S ENTEXT(5)=$S(ENQ(6920,ENDAS,32,"I")<5:"is ",1:"has been ")
57 . S ENTEXT(5)=ENTEXT(5)_ENQ(6920,ENDAS,32,"E")
58 . S:ENQ(6920,ENDAS,32,"I")>4 ENTEXT(5)=ENTEXT(5)_" on "_$$GET1^DIQ(6920,ENDAS,36)
59 . S ENTEXT(5)=ENTEXT(5)_"."
60 . S ENL=5
61 . I ENQ(6920,ENDAS,32,"E")="COMPLETED" D
62 . . S ENL=ENL+1,ENTEXT(ENL)=" "
63 . . ;
64 . . S ENX("DIMSG",1)="Work Perf: "_$P($G(^ENG(6920,DA,5)),U,7)
65 . . K ENY D MSG^DIALOG("AM",.ENY,70,"","ENX")
66 . . F ENI=1:1 Q:'$D(ENY(ENI)) S ENL=ENL+1,ENTEXT(ENL)=ENY(ENI)
67 . . ;
68 . I $O(^ENG(6920,DA,6,0)) D
69 . . S ENL=ENL+1,ENTEXT(ENL)=" "
70 . . S ENL=ENL+1,ENTEXT(ENL)="COMMENTS:"
71 . . S ENI=0
72 . . F S ENI=$O(^ENG(6920,DA,6,ENI)) Q:'ENI S ENL=ENL+1,ENTEXT(ENL)=$G(^(ENI,0))
73 . I $O(^DIC(6910,1,5,0)) D
74 . . ; add WORK ORDER MESSAGE TEXT if any
75 . . S ENL=ENL+1,ENTEXT(ENL)=" "
76 . . S ENI=0
77 . . F S ENI=$O(^DIC(6910,1,5,ENI)) Q:'ENI S ENL=ENL+1,ENTEXT(ENL)=$G(^(ENI,0))
78 . S XMSUB="Work Order "_ENQ(6920,ENDAS,.01,"E")_" STATUS"
79 . ;_" "_ENQ(6920,ENDAS,32,"E")
80 . S XMCHAN=1,XMTEXT="ENTEXT(",XMDUZ="AEMS/MERS"
81 . S XMZ=$P($G(^ENG(6920,DA,4)),U,6)
82 . I XMZ,$$SUBGET^XMGAPI0(XMZ)]"" D I ENI>0 Q
83 . . ; send message as response
84 . . S ENI=$$ENT^XMA2R(XMZ,XMSUB,.ENTEXT,"",DUZ)
85 . ; create new message
86 . K XMZ D XMZ^XMA2 I XMZ'>0 Q ; could not create new message
87 . ; save message number in w.o.
88 . S $P(^ENG(6920,DA,4),U,6)=XMZ
89 . ; add text to message
90 . S (ENI,ENL)=0 F S ENI=$O(ENTEXT(ENI)) Q:'ENI D
91 . . S ^XMB(3.9,XMZ,2,ENI,0)=ENTEXT(ENI),ENL=ENL+1
92 . I ENL S ^XMB(3.9,XMZ,2,0)="^3.92^"_ENL_U_ENL_U_DT
93 . ; make information only
94 . K ENL
95 . S ENL(3.9,XMZ_",",1.97)="Y"
96 . D FILE^DIE("E","ENL")
97 . ; forward to user
98 . S XMY(ENQ(6920,ENDAS,7.5,"I"))=""
99 . D ENT1^XMD
100 Q
101 ;ENWO2
Note: See TracBrowser for help on using the repository browser.