source: WorldVistAEHR/trunk/r/ENGINEERING-EN/ENLIB1.m@ 1361

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

initial load of WorldVistAEHR

File size: 5.1 KB
Line 
1ENLIB1 ;(WASH ISC)/DH-Package Utilities ;8/5/1998
2 ;;7.0;ENGINEERING;**35,53**;Aug 17, 1993
3MNTH S:'$D(ENMN) ENMN="" I ENMN']"" S ENMNTH="" Q
4 S ENMNTH=$P("JAN^FEB^MAR^APR^MAY^JUN^JUL^AUG^SEP^OCT^NOV^DEC","^",ENMN)
5 Q
6RVMNTH I $D(ENMNTH),$L(ENMNTH)=3 S A=ENMNTH,ENMN=$S(A="JAN":1,A="FEB":2,A="MAR":3,A="APR":4,A="MAY":5,A="JUN":6,A="JUL":7,A="AUG":8,A="SEP":9,A="OCT":10,A="NOV":11,A="DEC":12,1:-1) K A Q
7 S ENMN=-1
8 Q
9RDMNTH S ENMN="" R !,"Select MONTH: ",X:DTIME I X?1.2N,X>0,X<13 S ENMN=+X
10 I X="^" S ENMN=-1 Q
11 I ENMN="",X?.U S X=$E(X,1,3),ENMN=$S(X="JAN":1,X="FEB":2,X="MAR":3,X="APR":4,X="MAY":5,X="JUN":6,X="JUL":7,X="AUG":8,X="SEP":9,X="OCT":10,X="NOV":11,X="DEC":12,1:"")
12 I X?3U,ENMN]"" W " "_ENMN
13 I ENMN="" W !,*7,"Enter month as an integer from 1 to 12." G RDMNTH
14 Q
15WOCMP S E(1)=$S($D(^ENG(6920,DA,2)):^(2),1:""),E(2)=$P(E(1),U,1) K:E(2)'=35 E Q:$D(E(2))=0 S E=$S($D(^(3)):^(3),1:"") F E(3)=3,6,7,9 K:$P(E,U,E(3))="" X I E(3)=9 K E
16 Q
17 ;
18TECH ;Set ASSIGNED TECH from PRIMARY TECH
19 ; called by File 6920 Field 16 "AG" cross-reference set logic
20 ; Input DA = work order ien
21 ; X = entered primary technican (pointer to file 6929)
22 ; This code puts a newly entered primary techinician into the
23 ; TECHNICIANS ASSIGNED multiple if not already there.
24 N EN1,ENR,ENFNO,ENNXL,ENNXT
25 Q:'$D(^ENG(6920,DA,2))
26 S EN1=$P(^ENG(6920,DA,2),U,2) Q:EN1=""
27 I '$D(^ENG("EMP",EN1,0)) Q
28 I '$D(^ENG(6920,DA,7,0)) S ^ENG(6920,DA,7,0)="^6920.02PA^1^1",^ENG(6920,DA,7,1,0)=EN1_"^^"_$P(^ENG("EMP",EN1,0),U,10) Q
29 F ENR=0:0 S ENR=$O(^ENG(6920,DA,7,ENR)) Q:ENR="" I $D(^(ENR,0)),$P(^(0),U)=EN1 Q
30 G:ENR]"" DNTECH
31 S ENFNO=$P(^ENG(6920,DA,7,0),U,1,2),ENNXL=$P(^(0),U,3),ENNXT=$P(^(0),U,4)
32TECH1 S ENNXL=ENNXL+1 I $D(^ENG(6920,DA,7,ENNXL)) G TECH1
33 S ^ENG(6920,DA,7,ENNXL,0)=EN1_"^^"_$P(^ENG("EMP",EN1,0),U,10),ENNXT=ENNXT+1,^ENG(6920,DA,7,0)=ENFNO_U_ENNXL_U_ENNXT
34DNTECH ;
35 Q
36 ;
37INTECH ;Set PRIMARY TECH from ASSIGNED TECH
38 ; called by File 6920.02 Field .01 "AE" cross-reference set logic
39 ; Input DA(1) = work order ien (file 6920)
40 ; X = entered technican (pointer to file 6929)
41 ; If PRIMARY TECH ASSIGNED (#16) field in the Work Order (#6920) file
42 ; is blank then this code will set it equal to the technician just
43 ; entered in the 6920.02 subfile (TECHNICIANS ASSIGNED multiple).
44 Q:'$D(DA(1))
45 Q:$P($G(^ENG(6920,DA(1),2)),U,2)]"" ; primary tech not blank
46 S $P(^ENG(6920,DA(1),2),U,2)=X
47 Q
48 ;
49OUTECH ;Update PRIMARY TECH if same as deleted ASSIGNED TECH
50 ; called by File 6920.02 Field .01 "AE" cross-reference kill logic
51 ; Input DA(1) = work order ien (file 6920)
52 ; X = deleted technician (pointer to file 6929)
53 ; If technician just deleted from the 6920.02 subfile (TECHNICIANS
54 ; ASSIGNED) is the primary tech of the work order then this code will
55 ; update the PRIMARY TECH ASSIGNED (#16) field of the Work Order (#6920)
56 N ENI,ENTECH,ENX
57 Q:'$D(DA(1))
58 Q:$P($G(^ENG(6920,DA(1),2)),U,2)'=X ; not primary tech
59 ; see if there is another assigned technician to use as primary tech
60 S ENTECH=""
61 S ENI=0 F S ENI=$O(^ENG(6920,DA(1),7,ENI)) Q:'ENI D Q:ENTECH'=""
62 . S ENX=$P($G(^ENG(6920,DA(1),7,ENI,0)),U)
63 . I ENX'=X,ENX?1.N S ENTECH=ENX
64 ; update primary tech
65 S $P(^ENG(6920,DA(1),2),U,2)=ENTECH
66 Q
67 ;
68CMR S IOP="HOME" D ^%ZIS W !,"This CMR is not currently in use. Enter 'A' to add it to the file, 'L' to",!,"see a list of active CMR's, or '^' to abort. L// "
69 S R="" R R:DTIME I R'="","Ll"'[$E(R) G CMROUT
70CMR1 S ENY=1,I=0 F J=0:0 S I=$O(^ENG(6914,"AD",I)) Q:I="" W !,I S ENY=ENY+1 I (IOSL-ENY)<6 D CONT Q:R="^"
71CMROUT Q:R="A" W ! K ENY,I S X="" I $D(^ENG(6914,DA,2)) S X=$P(^(2),U,9)
72 Q
73 ;
74IX ;Look-up X-ref ;Expects DIC,ENDX,X
75 K EN N S,S1,I,X2,R S I=1,S=X,X2=$L(X),S1="",ENY=1
76IX1 S S=$O(@(DIC_""""_ENDX_""",S)")) G:S="" IX2
77 I $E(S,1,X2)=X W !,?5,I,?10,S S EN(I)=S,I=I+1,ENY=ENY+1 I (IOSL-ENY)<5 D CONT G:$E(R)="^" IX2
78 I S?.N D IXNUM
79 I $E(S,1,X2)=X!($E(S1,1,X2)=X) G IX1
80 I X?.N S S=X_" ",S1=$O(@(DIC_""""_ENDX_""",S)")) I $E(S1,1,X2)=X G IX1
81IX2 S X="" I I>1 S:$D(ENIX) ENIX=1 W !,"Select (1 to ",I-1,"): " R X:DTIME I X]"",X'="^" S X=$S($D(EN(X)):EN(X),1:"")
82IXOUT K EN,ENY
83 Q
84IXNUM S S1=$O(@(DIC_""""_ENDX_""",S)"))
85 I S1=+S1,$E(S1,1,X2)'=X S S=S1 G IXNUM
86 Q
87 ;
88SWOPT ;Validate software option selection
89 N Y S Y=$P($G(^ENG(6910.2,DA,0)),U) Q:Y=""
90 I Y="ASK INCOMING INSPECTION W.O." K:"012"'[X X Q
91 I Y="AUTO PRINT NEW W.O." K:"SLN"'[X X Q
92 I Y="EQUIPMENT REPLACEMENT TEMPLATE" K:"SL"'[X X Q
93 I Y="EXPANDED PM WORK ORDERS" K:X'="Y" X Q
94 I Y="INVENTORY TEMPLATE" K:"SL"'[X X Q
95 I Y="NOTIFY W.O. REQUESTOR" K:"CSA"'[X X Q
96 I Y="PM DEVICE TYPE IDENTIFIER" K:"EM"'[X X Q
97 I Y="PM SORT" K:"ECILPS"'[X X Q
98 I Y="PRINT BAR CODES ON W.O." K:"NY"'[X X Q
99 I Y="SAFETY PRINTOUT" K:"SL"'[X X Q
100 I Y="SPACE SURVEY PRINTOUT" K:"SL"'[X X Q
101 I Y="WARRANTY EXPIRATION TEMPLATE" K:"SL"'[X X Q
102 Q
103 ;
104BLDG ;Called for Building File
105 N X1,I1,X2
106 S X2=$P(X,"-",2,3) I X2["-" W !,?7,"BUILDINGS may not contain more than one hyphen." K X Q
107 I $D(X),X2'?.NU W " Incorrect DIVISION format." K X Q
108 S X1=$P(X,"-") Q:X1?.NU F I1=1:1:$L(X1) I $E(X1,I1)'?1NU,"e. "'[$E(X1,I1) K X Q
109 I '$D(X) W !,?7,"BUILDING not in proper format."
110 Q
111 ;
112CONT S:$D(ENY) ENY=1 R !!,"<cr> to continue, '^' to stop...",R:DTIME
113 Q
114 ;ENLIB1
Note: See TracBrowser for help on using the repository browser.