source: FOIAVistA/trunk/r/ENGINEERING-EN/ENEQPMR4.m@ 1582

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

initial load of FOIAVistA 6/30/08 version

File size: 4.6 KB
Line 
1ENEQPMR4 ;WIRMFO/DH,SAB-Single PMI's ;1/11/2001
2 ;;7.0;ENGINEERING;**14,35,43,48,68**;Aug 17, 1993
3 ;
4SDPM ;Post PMI for one device
5 N PMTOT
6 S DIC="^DIC(6922,",DIC(0)="AEMQ" D ^DIC G:Y'>0 OUT S ENSHKEY=+Y,ENSHOP=$P(^DIC(6922,ENSHKEY,0),U,1),ENSHABR=$P(^(0),U,2)
7 S ENDATE=$E(DT,4,5)_"/"_$E(DT,6,7)_"/"_$E(DT,2,3),Y=$E(DT,1,5)_"00" X ^DD("DD") S %DT("A")="Select Month: ",%DT("B")=Y,%DT="AEPMX" D ^%DT G:Y'>0 OUT S ENPMDT=$E(Y,2,5),ENPMMN=+$E(Y,4,5),ENPMYR=$E(Y,1,3)+1700
8SDPM0 W !,"Are you recording a WEEKLY PMI" S %=2 D YN^DICN I %=2 S ENPM="M" G SDPM1
9 G:%<0 OUT I %'=1 G SDPM0
10 W !,"Recording weekly PMI's in this manner is a little unusual. Are you sure" S %=2 D YN^DICN G:%'=1 SDPM0
11SDPM01 R !,"Which week? ",X:DTIME G:X="^" OUT I X?1N,X>0,X<6 S ENPM="W"_X
12 E W !,"Enter a number, 1 to 5." G SDPM01
13SDPM1 I $G(ENDEL)]"" G SDPM2
14 I $P($G(^DIC(6910,1,0)),U,5)]"" S ENDEL=$P(^(0),U,5) G SDPM2
15SDPM10 W !,"Do you want to retain PM work orders in your Work Order File after they have",!,"been posted to the Equipment History" S %=2 D YN^DICN I %=0 D COBH1 G SDPM10
16 G:%<0 OUT S ENDEL=$S(%=1:"N",%=2:"Y",1:"")
17SDPM2 ;
18 W !!,?10,"** Need an Equipment Record for PMI entry ("_$P("Jan^Feb^Mar^Apr^May^Jun^Jul^Aug^Sep^Oct^Nov^Dec",U,ENPMMN)_", "_ENPMYR_") **"
19 W !,?15,"** (or press <RETURN> to exit this option) **"
20 D GETEQ^ENUTL G:Y'>0 OUT S ENDA=+Y
21 N DA S ENPMWO="PM-"_ENSHABR_ENPMDT_ENPM,(ENKILL,ENCLOSE)=0
22 S ENI=0 F S ENI=$O(^ENG(6920,"G",ENDA,ENI)) Q:'ENI I $P($G(^ENG(6920,ENI,0)),U)[ENPMWO S DA=ENI,ENPMWOX=$P(^(0),U) D Q
23 . I $P($G(^ENG(6920,DA,5)),U,2)]"" D Q
24 .. W !,"Work Order "_ENPMWOX_" has already been posted. If you wish to"
25 .. W !,"edit it, please use the 'EDIT WORK ORDER' option.",*7
26 .. S ENCLOSE=$P(^ENG(6920,DA,5),U,2)
27 . S DIE="^ENG(6920,",DR=$S($D(^DIE("B","ENZPMCLOSE")):"[ENZPMCLOSE]",1:"[ENPMCLOSE]") D ^DIE
28 . I '$D(DA) S ENKILL=1 Q ;pm work order deleted within ^DIE
29 . I $P($G(^ENG(6920,DA,5)),U,2)]"",$E(^ENG(6920,DA,0),1,3)="PM-" D
30 .. D PMHRS,PMINV S ENCLOSE=$P(^ENG(6920,DA,5),U,2)
31 .. I ENDEL="Y" S DIK="^ENG(6920," D ^DIK K DIK
32 I $G(ENKILL)!($G(ENCLOSE)) G SDPM2
33 S ENI=0,ENPMWOX="" F S ENI=$O(^ENG(6914,ENDA,6,ENI)) Q:'ENI I $P(^(ENI,0),U,2)[ENPMWO S ENPMWOX=$P(^(0),U,2) Q
34 I ENPMWOX]"" W !,"Work order "_ENPMWOX_" has already been posted.",*7 G SDPM2
35 D:'$D(DA) SDPM4^ENEQPMR5
36 G SDPM2
37 ;
38OUT I $D(PMTOT) D COUNT^ENBCPM8
39 K EN,ENI,ENX,ENPMWO,ENK,ENDATE,ENDEL,ENPM,ENPMDT,ENPMMN,ENPMWK,ENPMYR
40 K ENSHABR,ENSHKEY,ENSHOP,ENY,ENDA,ENFNO,ENPMWOX,ENNXL,ENNXT,ENRS,ENNXMN
41 K ENHZ,ENPMN,ENSTMN,ENKILL,ENCLOSE,ENA
42 K B,C,%DT,DA,DR,D0,DIE,DIC,DIK,I,J,Y
43 Q
44HLD R !,"Press <RETURN> to continue...",X:DTIME S ENY=1 W @IOF
45 Q
46 ;
47COH2 ; Called by ENEQPMR1
48 W !,"Enter the next PM work order you wish to close out, or the numeric (sequential)",!,"portion thereof, or <RETURN> to accept the default (",ENPMWO(1),"),",!,"or ""^"" to EXIT."
49 Q
50 ;
51COBH1 ; Called by ENEQPMR1, ENEQPMR2, or ENEQPMR6
52 W !!," Deletion of PM work orders after they have been closed out is recommended",!,"for sites that are short on disk space. The results of the PMI will be posted"
53 W !,"to the equipment history file before the PM work order is deleted.",!," If disk space is not a problem, then you may wish to retain PM work orders"
54 W !,"in accordance with your established archive criteria. In this way, the Work",!,"Order # File will reflect scheduled as well as unscheduled work load."
55 W !," For estimating purposes, each PM work order will consume about 300 bytes",!,"of disk space (or about 3 such work orders per block)."
56 Q
57 ;
58PMHRS ;Extract hours from PM work order and add to PMTOT array
59 ;Called by options that have closed PM work orders
60 ;
61 ; Input
62 ; DA - ien of work order
63 ; PMTOT( - (optional) array of already accumulated PM hours
64 ; PMTOT(shop ien , tech ien) = hours
65 ; Output
66 ; PMTOT( - input array + hours from this work order
67 ;
68 N ENHRS,ENI,ENSHKEY,ENTEC,ENY0,ENDA
69 ; loop thru assigned tech multiple
70 S ENI=0 F S ENI=$O(^ENG(6920,DA,7,ENI)) Q:'ENI D
71 . S ENY0=$G(^ENG(6920,DA,7,ENI,0))
72 . S ENTEC=$P(ENY0,U),ENHRS=$P(ENY0,U,2),ENSHKEY=$P(ENY0,U,3)
73 . I ENSHKEY="" S ENSHKEY=$P($G(^ENG(6920,DA,2)),U)
74 . I ENSHKEY>0,ENTEC>0,ENHRS>0 S PMTOT(ENSHKEY,ENTEC)=$G(PMTOT(ENSHKEY,ENTEC))+ENHRS
75 Q
76 ;
77PMINV ; Updates PHYSICAL INVENTORY DATE in File 6914
78 ; via call to ^ENEQNX5
79 ; Called after PM work order close-out
80 ;
81 ; DA => IEN to Work Order File (returned)
82 ;
83 Q:$P($G(^ENG(6920,DA,5)),U,8)["D" ;don't update on deferred work order
84 N ENEQ,ENDT,ENLOC
85 S ENEQ=$P($G(^ENG(6920,DA,3)),U,8),ENDT=$P($P($G(^(5)),U,2),"."),ENLOC=$P(^(0),U,4)
86 N DA
87 I ENEQ>0,$D(^ENG(6914,ENEQ,0)),ENDT?7N D UPDT^ENEQNX5(ENEQ,ENDT,ENLOC)
88 Q
89 ;ENEQPMR4
Note: See TracBrowser for help on using the repository browser.