source: FOIAVistA/tag/r/ENGINEERING-EN/ENEQMED.m@ 1694

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

initial load of FOIAVistA 6/30/08 version

File size: 3.7 KB
Line 
1ENEQMED ;WISC/SAB-Multiple Equipment Edit ;9/24/97
2 ;;7.0;ENGINEERING**35,45**;;Aug 17, 1993
3 W !,"Multiple Equipment Edit",!
4 I $G(IO)="" D HOME^%ZIS
5 S ENEDNX=$D(^XUSEC("ENEDNX",DUZ))
6 K ^TMP($J)
7PO ; get purchase order #
8 K ENPO,ENA,ENX
9 S DIR(0)="6914,11" D ^DIR K DIR G:Y']""!$D(DIRUT) EXIT S ENX=Y
10 I $D(^ENG(6914,"M",ENX)) S ENPO=ENX G POEND
11 ; try an alternate format (add/remove station)
12 S ENA=$S(ENX["-":$P(ENX,"-",2),1:$P($G(^DIC(6910,1,0)),U,2)_"-"_ENX)
13 I ENA]"",$D(^ENG(6914,"M",ENA)) S ENPO=ENA G POEND
14 ; show partial matches
15 S DIC="^ENG(6914,",ENDX="M",X=ENX D IX^ENLIB1 I X]"" S ENPO=X G POEND
16 I ENA]"" S X=ENA D IX^ENLIB1 I X]"" S ENPO=X G POEND
17 W $C(7),!,"No equipment with purchase order # '",ENX,"' found in"
18 W !,"the Equipment Inventory file."
19 G PO
20POEND ; have purchase order #
21 ; store and sort equip in tmp
22 K ^TMP($J,"ENPO")
23 S ENDA=0 F S ENDA=$O(^ENG(6914,"M",ENPO,ENDA)) Q:'ENDA D
24 . S DIC=6914,DR="6;1;4",DA=ENDA,DIQ="ENQ",DIQ(0)="I" D EN^DIQ1 K DIQ
25 . F Y=6,1,4 I ENQ(6914,DA,Y,"I")']"" S ENQ(6914,DA,Y,"I")="?"
26 . S ^TMP($J,"ENPO",ENQ(6914,DA,6,"I"),ENQ(6914,DA,1,"I"),ENQ(6914,DA,4,"I"),DA)=""
27 . K ENQ
28 ; build array ENL() of category-manufacturer-model combinations
29 K ENL S (ENL,ENC("PO"))=0
30 S ENCATI=""
31 F S ENCATI=$O(^TMP($J,"ENPO",ENCATI)) Q:ENCATI']"" D
32 . I ENCATI S DIC=6911,DR=".01",DA=ENCATI,DIQ="ENQ" D EN^DIQ1 K DIQ
33 . S ENCAT=$S(ENCATI:$E(ENQ(6911,ENCATI,.01),1,24),1:"unspecified") K ENQ
34 . S ENMANI=""
35 . F S ENMANI=$O(^TMP($J,"ENPO",ENCATI,ENMANI)) Q:ENMANI']"" D
36 . . I ENMANI S DIC=6912,DR=".01",DA=ENMANI,DIQ="ENQ" D EN^DIQ1 K DIQ
37 . . S ENMAN=$S(ENMANI:$E(ENQ(6912,ENMANI,.01),1,24),1:"unspecified") K ENQ
38 . . S ENMOD=""
39 . . F S ENMOD=$O(^TMP($J,"ENPO",ENCATI,ENMANI,ENMOD)) Q:ENMOD']"" D
40 . . . S ENDA=0,ENC("LINE")=0
41 . . . F S ENDA=$O(^TMP($J,"ENPO",ENCATI,ENMANI,ENMOD,ENDA)) Q:'ENDA D
42 . . . . S ENC("LINE")=ENC("LINE")+1
43 . . . S ENL=ENL+1
44 . . . S ENL(ENL)=ENCATI_U_ENCAT
45 . . . S ENL(ENL)=ENL(ENL)_U_ENMANI_U_ENMAN_U_ENMOD_U
46 . . . S ENL(ENL)=ENL(ENL)_$S(ENMOD="?":"unspecified",1:$E(ENMOD,1,14))
47 . . . S ENL(ENL)=ENL(ENL)_U_ENC("LINE")
48 . . . S ENC("PO")=ENC("PO")+ENC("LINE")
49 S ENL("MAX")=ENL
50 ; display array
51 W @IOF
52 W ENC("PO")," Equipment Items found with Purchase Order # = ",ENPO
53 W !,"Line",?6,"Equipment Category",?32,"Manufacturer"
54 W ?58,"Model",?74,"Count",!
55 F ENL=1:1:ENL("MAX") D
56 . W !,ENL,?6,$P(ENL(ENL),U,2),?32,$P(ENL(ENL),U,4)
57 . W ?58,$P(ENL(ENL),U,6),?74,$P(ENL(ENL),U,7)
58 ; get lines to edit
59 S DIR(0)="L^1:"_ENL("MAX")
60 S DIR("A")="Select line(s) to edit"
61 D ^DIR K DIR G:$D(DIRUT) EXIT S ENL("SEL")=Y
62 S ENC("SEL")=0
63 F ENI=1:1 S ENL=$P(ENL("SEL"),",",ENI) Q:'ENL S ENC("SEL")=ENC("SEL")+$P(ENL(ENL),U,7)
64 W !,ENC("SEL")," Equipment Items will be edited",!
65 ; save/lock selected equipment
66 K ^TMP($J,"ENSEL")
67 S ENLOCK("BATCH")=$S(ENC("SEL")>50:0,1:1) ;lock batch (all) or as-edited
68 S ENNX=0,ENFA=0,ENLOCK=1
69 F ENI=1:1 S ENL=$P(ENL("SEL"),",",ENI) Q:'ENL D
70 . S ENCATI=$P(ENL(ENL),U,1)
71 . S ENMANI=$P(ENL(ENL),U,3)
72 . S ENMOD=$P(ENL(ENL),U,5)
73 . S ENDA=0
74 . F S ENDA=$O(^TMP($J,"ENPO",ENCATI,ENMANI,ENMOD,ENDA)) Q:'ENDA!'ENLOCK D
75 . . I ENLOCK("BATCH") L +^ENG(6914,ENDA):10 I '$T S ENLOCK=0 Q
76 . . S ^TMP($J,"ENSEL",ENDA)=""
77 . . I 'ENNX,$P($G(^ENG(6914,ENDA,0)),U,4)="NX" S ENNX=1
78 . . I 'ENFA,+$$CHKFA^ENFAUTL(ENDA) S ENFA=1
79 I 'ENLOCK D G EXIT
80 . W $C(7),!,"Some of the selected equipment is currently being edited"
81 . W !,"by another process. Please try later."
82 K ^TMP($J,"ENFLD")
83 ; reserve pseudo entry for edit session
84 S ENDAT=0
85 F ENI=90000000001:1:90000000100 L +^ENG(6914,ENI):0 I $T S ENDAT=ENI Q
86 I 'ENDAT W $C(7),!,"Sorry, unable to reserve space for PM schedule." G EXIT
87 K ^ENG(6914,ENDAT)
88 S ^ENG(6914,ENDAT,0)=ENDAT
89 G FLD^ENEQMED1
90EXIT ;
91 G EXIT^ENEQMED2
92 ;ENEQMED
Note: See TracBrowser for help on using the repository browser.