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