Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ENWONEW2

ENWONEW2.m

Go to the documentation of this file.
  1. ENWONEW2 ;(WASH ISC)/DH-Work Order Entry ;5.29.97
  1. ;;7.0;ENGINEERING;**1,25,35,42**;Aug 17, 1993
  1. ;
  1. TRNIN ; Entry point to get work order for de-installation of equipment
  1. ; Expects DUZ
  1. ; Expects EQUIPMENT ID in piece 1 of WODATA, LOCATION in piece 2
  1. ; Expects that SERVICE POINTER may be in local variable PRCNSRV
  1. ; Returns work order number as ENWO and internal entry number as ENDA
  1. I $G(DUZ),+$G(WODATA)
  1. E Q ;Insufficient information to proceed
  1. N SHOPKEY,NUMBER,NAME,PHONE,ITEM,LOC,SERVICE,WARD
  1. N DIC,DIE,DIQ,DA,DR
  1. S SHOPKEY=$P($G(^DIC(6910,1,20)),U) D:'SHOPKEY Q:'SHOPKEY
  1. . S SHOPKEY=$P($G(^DIC(6910,1,0)),U,6) D:'SHOPKEY
  1. .. S DIC="^DIC(6922,",DIC(0)="AEQM",DIC("S")="I Y#100>89" D ^DIC K DIC("S") S:Y>0 SHOPKEY=+Y
  1. Q:'$D(^DIC(6922,SHOPKEY,0))
  1. D WONUM^ENWONEW ;create work order
  1. I NUMBER="" W !!,"Can't seem to add a new work order at this time. Suggest that you",!,"contact IRM.",*7 Q
  1. W !,"Work Order #: ",NUMBER S ENDA=DA,ENWO=NUMBER
  1. L +^ENG(6920,ENDA):0 I '$T W !!,"Bad news. Another user is already editing the work order that you just",!,"created. Please make a note of the work order number and advise Engineering",!,"Service of the problem."
  1. FILL ;Fill in the work order
  1. S DIC="^VA(200,",DR=".01;.131;.132;.133;.134;.135",DIQ="TMP",DIQ(0)="E",DA=DUZ
  1. D EN^DIQ1
  1. S NAME=$E(TMP(200,DA,.01,"E"),1,15)
  1. F X=".131",".132",".133",".134",".135" S PHONE=TMP(200,DA,X,"E") Q:PHONE]""
  1. K TMP
  1. LOAD S DIE="^ENG(6920,",DA=ENDA,DR="1///N;.05///^S X=NUMBER;7.5////"_DUZ_";9///"_SHOPKEY_";2///C"
  1. S DR=DR_";7///"_NAME_";17///A" S:PHONE]"" DR=DR_";8///^S X=PHONE"
  1. S ITEM=$P(WODATA,U),LOC=$P(WODATA,U,2)
  1. I LOC=+LOC S LOC=$P($G(^ENG("SP",LOC,0)),U)
  1. I LOC']"" S LOC=$P($G(^ENG(6914,ITEM,3)),U,5) S:LOC=+LOC LOC=$P(^ENG("SP",LOC,0),U)
  1. S DR=DR_";18///^S X=ITEM" I LOC]"" S DR=DR_";3///^S X=LOC"
  1. I $G(PRCNSRV) S SERVICE=$P($G(^DIC(49,+PRCNSRV,0)),U),DR=DR_";23///^S X=SERVICE"
  1. S DR=DR_";6///Prepare equipment for turn-in.;32///^S X=2;35///R2"
  1. D ^DIE
  1. S DR=$S($D(^DIE("B","ENZTIWO")):"[ENZTIWO]",$D(^DIE("B","ENTIWO")):"[ENTIWO]",1:"")
  1. D:DR]"" ^DIE
  1. L -^ENG(6920,ENDA)
  1. S WARD=1 D WOPRNT^ENWONEW
  1. Q
  1. ;
  1. AUTODEV ;Get device from ENG SECTION (null if unsuccessful)
  1. S DEVICE="",X=$P(^DIC(6922,SHOPKEY,0),U,3)
  1. I X]"",$D(^%ZIS(1,X,0)) S DEVICE=$P(^(0),U) S IOP=DEVICE,%ZIS="NQ" D ^%ZIS K IOP
  1. I WARD,DEVICE="" Q
  1. I DEVICE="" S %ZIS="NQ" D ^%ZIS S DEVICE=$S(POP:"",IO(0)=IO:"HOME",1:ION)
  1. I ION="NULL" D HOME^%ZIS S DEVICE=""
  1. Q
  1. ;
  1. ;ENWONEW2