source: WorldVistAEHR/trunk/r/ENGINEERING-EN/ENBCPM8.m@ 1800

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

initial load of WorldVistAEHR

File size: 2.1 KB
Line 
1ENBCPM8 ;(WASH ISC)/DH/SAB-Bar Coded PMI, Accum Hours ;1.13.98
2 ;;7.0;ENGINEERING;**14,15,35,48**;Aug 17, 1993
3COUNT ;Post PM hours to file 6922
4 ;Called by options that close PM work orders
5 ; Input
6 ; ENPMDT - PM month YYMM
7 ; PMTOT( - array of PM hours by shop and tech
8 ; PMTOT(shop ien , tech ien) = hours
9 ; Computed
10 ; ENDT - Date (YYYMMDD) for work order posting
11 ;
12 N ENDT,ENI,ENFDA,ENSHKEY,ENTEC,DELYR
13 S DELYR=$E(DT,2,3)-$E(ENPMDT,1,2),ENDT=$E(DT)+$S(DELYR>79:1,DELYR<-20:-1,1:0)_ENPMDT_"00"
14 ; loop thru shops in array
15 S ENSHKEY=0 F S ENSHKEY=$O(PMTOT(ENSHKEY)) Q:ENSHKEY="" D
16 . L +^DIC(6922,ENSHKEY):300
17 . ; loop thru techs within shop in array
18 . S ENTEC=0 F S ENTEC=$O(PMTOT(ENSHKEY,ENTEC)) Q:ENTEC="" D
19 . . ; find/add entry in 6922
20 . . K ENFDA,ENI
21 . . S ENFDA(6922.03,"?+2,"_ENSHKEY_",",.01)=ENDT
22 . . S ENFDA(6922.31,"?+3,?+2,"_ENSHKEY_",",.01)=ENTEC
23 . . D UPDATE^DIE("","ENFDA","ENI") D MSG^DIALOG()
24 . . ; add hours to entry
25 . . I ENI(2)>0,ENI(3)>0 S $P(^DIC(6922,ENSHKEY,1,ENI(2),1,ENI(3),0),U,2)=$P(^DIC(6922,ENSHKEY,1,ENI(2),1,ENI(3),0),U,2)+PMTOT(ENSHKEY,ENTEC)
26 . L -^DIC(6922,ENSHKEY)
27 Q
28UNPOST ;UnPost/Remove PM hours from file 6922
29 ;Called by options that reopen closed PM work orders (e.g. Edit W.O.)
30 ; Input
31 ; ENPMDT - PM month YYMM
32 ; PMTOT( - array of PM hours by shop and tech
33 ; PMTOT(shop ien , tech ien) = hours
34 ; Computed
35 ; ENDT - Date (YYYMMDD) for work order un-posting
36 ;
37 N ENDT,ENI,ENSHKEY,ENTEC,DELYR
38 S DELYR=$E(DT,2,3)-$E(ENPMDT,1,2),ENDT=$E(DT)+$S(DELYR>79:1,DELYR<-20:-1,1:0)_ENPMDT_"00"
39 ; loop thru shops in array
40 S ENSHKEY=0 F S ENSHKEY=$O(PMTOT(ENSHKEY)) Q:ENSHKEY="" D
41 . L +^DIC(6922,ENSHKEY):300
42 . ; loop thru techs within shop in array
43 . S ENTEC=0 F S ENTEC=$O(PMTOT(ENSHKEY,ENTEC)) Q:ENTEC="" D
44 . . ; find entry in 6922
45 . . S ENI(2)=$O(^DIC(6922,ENSHKEY,1,"B",ENDT,0)) Q:ENI(2)'>0
46 . . S ENI(3)=$O(^DIC(6922,ENSHKEY,1,ENI(2),1,"B",ENTEC,0)) Q:ENI(3)'>0
47 . . ; delete hours from entry
48 . . S $P(^DIC(6922,ENSHKEY,1,ENI(2),1,ENI(3),0),U,2)=$P(^DIC(6922,ENSHKEY,1,ENI(2),1,ENI(3),0),U,2)-PMTOT(ENSHKEY,ENTEC)
49 . L -^DIC(6922,ENSHKEY)
50 Q
51 ;ENBCPM8
Note: See TracBrowser for help on using the repository browser.