source: WorldVistAEHR/trunk/r/ENGINEERING-EN/ENBCPM4.m@ 1806

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

initial load of WorldVistAEHR

File size: 3.5 KB
Line 
1ENBCPM4 ;(WASH ISC)/DH-Bar Coded PMI ;4.9.97
2 ;;7.0;ENGINEERING;**9,35**;Aug 17, 1993
3POST ;Post PMI to Equip Hist
4 Q:'$D(^ENG(6914,ENEQ)) ;Could be foreign equipment
5 S ENWOX=0 D WOCHK^ENBCPM6 ;Maybe work already posted
6 Q:ENWOX ;WO has been closed
7 S ENWP=""
8 F DA=0:0 S DA=$O(^ENG(6920,"G",ENEQ,DA)) Q:DA'>0 I $P(^ENG(6920,DA,0),U,1)[ENPMWO D POST1 Q
9 D:DA'>0 POST2^ENBCPM5
10 Q
11 ;
12POST1 ;PM work order to be closed
13 S ENLKAHD="",ENX1=$O(^PRCT(446.4,ENCTID,2,ENCTTI,1,ENX)) S:ENX1]"" ENLKAHD=^(ENX1,0)
14 G:ENLKAHD=""!($E(ENLKAHD)="*") POST11 I $E(ENLKAHD,3,8)[" EE" G POST11
15 I $E(ENLKAHD,1,2)="SP"!($E(ENLKAHD,1,4)="MOD:")!($E(ENLKAHD,1,4)="PM#:") G POST11
16 I $E(ENLKAHD,1,4)="TIME" G POST12
17 I ENLKAHD="FAILED" G POST13^ENBCPM7
18 S ENMSG="UNEXPECTED DATA UPLOADED FROM BAR CODE READER.",ENMSG(0,1)="Please check entry following "_ENLBL_".",ENMSG(0,2)="Attempting to process: "_ENLKAHD D XCPTN^ENBCPM2
19 Q
20 ;
21POST11 ;Device passed, no t&m
22 S ENTIME=$P($G(^ENG(6920,DA,5)),U,3),ENPMTEC=$P($G(^(2)),U,2)
23 L +^ENG(6920,DA):10 I '$T S ENMSG="Work order "_$P(^ENG(6920,DA,0),U,1)_" being edited by another user.",ENMSG(0,1)="Can't process." D XCPTN^ENBCPM2 Q
24 I ENTEC'=ENPMTEC S:'$D(^ENG(6920,DA,7)) ^ENG(6920,DA,7,0)="^6920.02PA^1^1^" S ^ENG(6920,DA,7,1,0)=ENTEC_U_ENTIME_U_ENSHKEY,$P(^ENG(6920,DA,2),U,2)=ENTEC
25 I ENTEC'=ENPMTEC,ENTIME]"" S ENW=$S($D(^ENG("EMP",ENTEC,0)):$P(^(0),U,3),1:"") S:ENW="" ENW=$S($D(^DIC(6910.1,1,0)):$P(^(0),U,4),1:"") I ENW]"" S $P(^ENG(6920,DA,5),U,6)=(ENW*ENTIME)
26 G RECRD1
27 ;
28POST12 ;Device passed, t&m recorded
29 S ENTIME=+$E(ENLKAHD,6,30) I ENTIME]"" S X=ENTIME,X(0)=2 D ROUND^ENLIB S ENTIME=+Y S:ENTIME<0 ENTIME="" S:ENTIME>0 $P(^ENG(6920,DA,5),U,3)=ENTIME
30 S ENX=ENX1,^PRCT(446.4,ENCTID,2,ENCTTI,1,ENX,0)="*"_ENLKAHD,ENX1=$O(^PRCT(446.4,ENCTID,2,ENCTTI,1,ENX)) S ENLKAHD=$S(ENX1]"":^(ENX1,0),1:"")
31 S ENMATRL="" I $E(ENLKAHD,1,5)="MATRL" D
32 . S ENX=ENX1,^PRCT(446.4,ENCTID,2,ENCTTI,1,ENX,0)="*"_ENLKAHD,ENMATRL=+$E(ENLKAHD,7,30) S:ENMATRL<0 ENMATRL=""
33 . S ENX1=$O(^PRCT(446.4,ENCTID,2,ENCTTI,1,ENX)),ENLKAHD=$S(ENX1]"":^(ENX1,0),1:"")
34 . I $E(ENLKAHD,1,5)="CODE:" D
35 .. S ENX=ENX1,^PRCT(446.4,ENCTID,2,ENCTTI,1,ENX,0)="*"_ENLKAHD
36 .. I $P(ENLKAHD,":",2)?1N N DIE,DA D
37 ... S DA=ENEQ,DIE="^ENG(6914,",DR="53///"_$P(ENLKAHD,":",2) D ^DIE
38 ... Q
39 I $P($G(^ENG(6920,DA,2)),U,2)'=ENTEC S $P(^(2),U,2)=ENTEC D
40 . S:'$D(^ENG(6920,DA,7)) ^ENG(6920,DA,7,0)="^6920.02PA^1^1"
41 . S ^ENG(6920,DA,7,1,0)=ENTEC_U_ENTIME_U_ENSHKEY
42 S X=ENX
43 F S X=$O(^PRCT(446.4,ENCTID,2,ENCTTI,1,X)) Q:X="" S X1=^(X,0) Q:X1=""!($E(X1)="*")!($E(X1,1,2)="SP")!($E(X1,1,4)="MOD:")!($E(X1,1,4)="PM#:")!($E(X1,3,8)[" EE") S ENX=X,ENWP=ENWP_X1,^(0)="*"_X1
44 L +^ENG(6920,DA):5 I '$T S ENMSG="Work order "_$P(^ENG(6920,DA,0),U,1)_" being edited by another user.",ENMSG(0,1)="Can't process." D XCPTN^ENBCPM2 Q
45 I ENMATRL=+ENMATRL S X=ENMATRL,X(0)=2 D ROUND^ENLIB S ENMATRL=+Y,$P(^ENG(6920,DA,5),U,4)=ENMATRL
46 G:ENTIME="" RECRD1 S ENW="" S ENW=$P($G(^ENG("EMP",ENTEC,0)),U,3) I ENW="",$D(^DIC(6910,1,0)) S ENW=$P(^(0),U,4)
47 S:ENW<0 ENW=0 S Y=$S(ENW]"":(ENW*ENTIME),1:""),$P(^ENG(6920,DA,5),U,6)=Y
48 ;
49RECRD1 ;
50 I ENWP="",$D(^ENG(6920,DA,5)) S ENWP=$P(^(5),U,7)
51 I $L(ENWP)<130 S ENWP=ENWP_" (Bar Code)"
52 S ENPMTEC=ENTEC,ENPMEMP=ENEMP,DIE="^ENG(6920,",DR="35.2///^S X=""P"";39///^S X=ENWP;36///^S X=DT;32///^S X=""COMPLETED"""
53 I $$GET1^DIQ(6920,DA,3)'=ENLOC S DR=DR_";3///^S X=ENLOC"
54 D ^DIE
55 L -^ENG(6920,DA)
56 I ENDEL="Y",$E(^ENG(6920,DA,0),1,3)="PM-" S DIK="^ENG(6920," D ^DIK
57 S ENTEC=ENPMTEC,ENEMP=ENPMEMP K EN
58 I $G(ENTIME)>0 S PMTOT(ENSHKEY,ENTEC)=$G(PMTOT(ENSHKEY,ENTEC))+ENTIME
59 Q
60 ;ENBCPM4
Note: See TracBrowser for help on using the repository browser.