ENBCPM8 ;(WASH ISC)/DH/SAB-Bar Coded PMI, Accum Hours ;1.13.98
;;7.0;ENGINEERING;**14,15,35,48**;Aug 17, 1993
COUNT ;Post PM hours to file 6922
;Called by options that close PM work orders
; Input
; ENPMDT - PM month YYMM
; PMTOT( - array of PM hours by shop and tech
; PMTOT(shop ien , tech ien) = hours
; Computed
; ENDT - Date (YYYMMDD) for work order posting
;
N ENDT,ENI,ENFDA,ENSHKEY,ENTEC,DELYR
S DELYR=$E(DT,2,3)-$E(ENPMDT,1,2),ENDT=$E(DT)+$S(DELYR>79:1,DELYR<-20:-1,1:0)_ENPMDT_"00"
; loop thru shops in array
S ENSHKEY=0 F S ENSHKEY=$O(PMTOT(ENSHKEY)) Q:ENSHKEY="" D
. L +^DIC(6922,ENSHKEY):300
. ; loop thru techs within shop in array
. S ENTEC=0 F S ENTEC=$O(PMTOT(ENSHKEY,ENTEC)) Q:ENTEC="" D
. . ; find/add entry in 6922
. . K ENFDA,ENI
. . S ENFDA(6922.03,"?+2,"_ENSHKEY_",",.01)=ENDT
. . S ENFDA(6922.31,"?+3,?+2,"_ENSHKEY_",",.01)=ENTEC
. . D UPDATE^DIE("","ENFDA","ENI") D MSG^DIALOG()
. . ; add hours to entry
. . 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)
. L -^DIC(6922,ENSHKEY)
Q
UNPOST ;UnPost/Remove PM hours from file 6922
;Called by options that reopen closed PM work orders (e.g. Edit W.O.)
; Input
; ENPMDT - PM month YYMM
; PMTOT( - array of PM hours by shop and tech
; PMTOT(shop ien , tech ien) = hours
; Computed
; ENDT - Date (YYYMMDD) for work order un-posting
;
N ENDT,ENI,ENSHKEY,ENTEC,DELYR
S DELYR=$E(DT,2,3)-$E(ENPMDT,1,2),ENDT=$E(DT)+$S(DELYR>79:1,DELYR<-20:-1,1:0)_ENPMDT_"00"
; loop thru shops in array
S ENSHKEY=0 F S ENSHKEY=$O(PMTOT(ENSHKEY)) Q:ENSHKEY="" D
. L +^DIC(6922,ENSHKEY):300
. ; loop thru techs within shop in array
. S ENTEC=0 F S ENTEC=$O(PMTOT(ENSHKEY,ENTEC)) Q:ENTEC="" D
. . ; find entry in 6922
. . S ENI(2)=$O(^DIC(6922,ENSHKEY,1,"B",ENDT,0)) Q:ENI(2)'>0
. . S ENI(3)=$O(^DIC(6922,ENSHKEY,1,ENI(2),1,"B",ENTEC,0)) Q:ENI(3)'>0
. . ; delete hours from entry
. . 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)
. L -^DIC(6922,ENSHKEY)
Q
;ENBCPM8
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HENBCPM8 2217 printed Oct 16, 2024@17:52:56 Page 2
ENBCPM8 ;(WASH ISC)/DH/SAB-Bar Coded PMI, Accum Hours ;1.13.98
+1 ;;7.0;ENGINEERING;**14,15,35,48**;Aug 17, 1993
COUNT ;Post PM hours to file 6922
+1 ;Called by options that close PM work orders
+2 ; Input
+3 ; ENPMDT - PM month YYMM
+4 ; PMTOT( - array of PM hours by shop and tech
+5 ; PMTOT(shop ien , tech ien) = hours
+6 ; Computed
+7 ; ENDT - Date (YYYMMDD) for work order posting
+8 ;
+9 NEW ENDT,ENI,ENFDA,ENSHKEY,ENTEC,DELYR
+10 SET DELYR=$EXTRACT(DT,2,3)-$EXTRACT(ENPMDT,1,2)
SET ENDT=$EXTRACT(DT)+$SELECT(DELYR>79:1,DELYR<-20:-1,1:0)_ENPMDT_"00"
+11 ; loop thru shops in array
+12 SET ENSHKEY=0
FOR
SET ENSHKEY=$ORDER(PMTOT(ENSHKEY))
if ENSHKEY=""
QUIT
Begin DoDot:1
+13 LOCK +^DIC(6922,ENSHKEY):300
+14 ; loop thru techs within shop in array
+15 SET ENTEC=0
FOR
SET ENTEC=$ORDER(PMTOT(ENSHKEY,ENTEC))
if ENTEC=""
QUIT
Begin DoDot:2
+16 ; find/add entry in 6922
+17 KILL ENFDA,ENI
+18 SET ENFDA(6922.03,"?+2,"_ENSHKEY_",",.01)=ENDT
+19 SET ENFDA(6922.31,"?+3,?+2,"_ENSHKEY_",",.01)=ENTEC
+20 DO UPDATE^DIE("","ENFDA","ENI")
DO MSG^DIALOG()
+21 ; add hours to entry
+22 IF ENI(2)>0
IF ENI(3)>0
SET $PIECE(^DIC(6922,ENSHKEY,1,ENI(2),1,ENI(3),0),U,2)=$PIECE(^DIC(6922,ENSHKEY,1,ENI(2),1,ENI(3),0),U,2)+PMTOT(ENSHKEY,ENTEC)
End DoDot:2
+23 LOCK -^DIC(6922,ENSHKEY)
End DoDot:1
+24 QUIT
UNPOST ;UnPost/Remove PM hours from file 6922
+1 ;Called by options that reopen closed PM work orders (e.g. Edit W.O.)
+2 ; Input
+3 ; ENPMDT - PM month YYMM
+4 ; PMTOT( - array of PM hours by shop and tech
+5 ; PMTOT(shop ien , tech ien) = hours
+6 ; Computed
+7 ; ENDT - Date (YYYMMDD) for work order un-posting
+8 ;
+9 NEW ENDT,ENI,ENSHKEY,ENTEC,DELYR
+10 SET DELYR=$EXTRACT(DT,2,3)-$EXTRACT(ENPMDT,1,2)
SET ENDT=$EXTRACT(DT)+$SELECT(DELYR>79:1,DELYR<-20:-1,1:0)_ENPMDT_"00"
+11 ; loop thru shops in array
+12 SET ENSHKEY=0
FOR
SET ENSHKEY=$ORDER(PMTOT(ENSHKEY))
if ENSHKEY=""
QUIT
Begin DoDot:1
+13 LOCK +^DIC(6922,ENSHKEY):300
+14 ; loop thru techs within shop in array
+15 SET ENTEC=0
FOR
SET ENTEC=$ORDER(PMTOT(ENSHKEY,ENTEC))
if ENTEC=""
QUIT
Begin DoDot:2
+16 ; find entry in 6922
+17 SET ENI(2)=$ORDER(^DIC(6922,ENSHKEY,1,"B",ENDT,0))
if ENI(2)'>0
QUIT
+18 SET ENI(3)=$ORDER(^DIC(6922,ENSHKEY,1,ENI(2),1,"B",ENTEC,0))
if ENI(3)'>0
QUIT
+19 ; delete hours from entry
+20 SET $PIECE(^DIC(6922,ENSHKEY,1,ENI(2),1,ENI(3),0),U,2)=$PIECE(^DIC(6922,ENSHKEY,1,ENI(2),1,ENI(3),0),U,2)-PMTOT(ENSHKEY,ENTEC)
End DoDot:2
+21 LOCK -^DIC(6922,ENSHKEY)
End DoDot:1
+22 QUIT
+23 ;ENBCPM8