Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ENEQPMR4

ENEQPMR4.m

Go to the documentation of this file.
  1. ENEQPMR4 ;WIRMFO/DH,SAB-Single PMI's ;1/11/2001
  1. ;;7.0;ENGINEERING;**14,35,43,48,68**;Aug 17, 1993
  1. ;
  1. SDPM ;Post PMI for one device
  1. N PMTOT
  1. 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)
  1. 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
  1. SDPM0 W !,"Are you recording a WEEKLY PMI" S %=2 D YN^DICN I %=2 S ENPM="M" G SDPM1
  1. G:%<0 OUT I %'=1 G SDPM0
  1. W !,"Recording weekly PMI's in this manner is a little unusual. Are you sure" S %=2 D YN^DICN G:%'=1 SDPM0
  1. SDPM01 R !,"Which week? ",X:DTIME G:X="^" OUT I X?1N,X>0,X<6 S ENPM="W"_X
  1. E W !,"Enter a number, 1 to 5." G SDPM01
  1. SDPM1 I $G(ENDEL)]"" G SDPM2
  1. I $P($G(^DIC(6910,1,0)),U,5)]"" S ENDEL=$P(^(0),U,5) G SDPM2
  1. SDPM10 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
  1. G:%<0 OUT S ENDEL=$S(%=1:"N",%=2:"Y",1:"")
  1. SDPM2 ;
  1. 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_") **"
  1. W !,?15,"** (or press <RETURN> to exit this option) **"
  1. D GETEQ^ENUTL G:Y'>0 OUT S ENDA=+Y
  1. N DA S ENPMWO="PM-"_ENSHABR_ENPMDT_ENPM,(ENKILL,ENCLOSE)=0
  1. 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
  1. . I $P($G(^ENG(6920,DA,5)),U,2)]"" D Q
  1. .. W !,"Work Order "_ENPMWOX_" has already been posted. If you wish to"
  1. .. W !,"edit it, please use the 'EDIT WORK ORDER' option.",*7
  1. .. S ENCLOSE=$P(^ENG(6920,DA,5),U,2)
  1. . S DIE="^ENG(6920,",DR=$S($D(^DIE("B","ENZPMCLOSE")):"[ENZPMCLOSE]",1:"[ENPMCLOSE]") D ^DIE
  1. . I '$D(DA) S ENKILL=1 Q ;pm work order deleted within ^DIE
  1. . I $P($G(^ENG(6920,DA,5)),U,2)]"",$E(^ENG(6920,DA,0),1,3)="PM-" D
  1. .. D PMHRS,PMINV S ENCLOSE=$P(^ENG(6920,DA,5),U,2)
  1. .. I ENDEL="Y" S DIK="^ENG(6920," D ^DIK K DIK
  1. I $G(ENKILL)!($G(ENCLOSE)) G SDPM2
  1. 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
  1. I ENPMWOX]"" W !,"Work order "_ENPMWOX_" has already been posted.",*7 G SDPM2
  1. D:'$D(DA) SDPM4^ENEQPMR5
  1. G SDPM2
  1. ;
  1. OUT I $D(PMTOT) D COUNT^ENBCPM8
  1. K EN,ENI,ENX,ENPMWO,ENK,ENDATE,ENDEL,ENPM,ENPMDT,ENPMMN,ENPMWK,ENPMYR
  1. K ENSHABR,ENSHKEY,ENSHOP,ENY,ENDA,ENFNO,ENPMWOX,ENNXL,ENNXT,ENRS,ENNXMN
  1. K ENHZ,ENPMN,ENSTMN,ENKILL,ENCLOSE,ENA
  1. K B,C,%DT,DA,DR,D0,DIE,DIC,DIK,I,J,Y
  1. Q
  1. HLD R !,"Press <RETURN> to continue...",X:DTIME S ENY=1 W @IOF
  1. Q
  1. ;
  1. COH2 ; Called by ENEQPMR1
  1. 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."
  1. Q
  1. ;
  1. COBH1 ; Called by ENEQPMR1, ENEQPMR2, or ENEQPMR6
  1. 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"
  1. 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"
  1. W !,"in accordance with your established archive criteria. In this way, the Work",!,"Order # File will reflect scheduled as well as unscheduled work load."
  1. W !," For estimating purposes, each PM work order will consume about 300 bytes",!,"of disk space (or about 3 such work orders per block)."
  1. Q
  1. ;
  1. PMHRS ;Extract hours from PM work order and add to PMTOT array
  1. ;Called by options that have closed PM work orders
  1. ;
  1. ; Input
  1. ; DA - ien of work order
  1. ; PMTOT( - (optional) array of already accumulated PM hours
  1. ; PMTOT(shop ien , tech ien) = hours
  1. ; Output
  1. ; PMTOT( - input array + hours from this work order
  1. ;
  1. N ENHRS,ENI,ENSHKEY,ENTEC,ENY0,ENDA
  1. ; loop thru assigned tech multiple
  1. S ENI=0 F S ENI=$O(^ENG(6920,DA,7,ENI)) Q:'ENI D
  1. . S ENY0=$G(^ENG(6920,DA,7,ENI,0))
  1. . S ENTEC=$P(ENY0,U),ENHRS=$P(ENY0,U,2),ENSHKEY=$P(ENY0,U,3)
  1. . I ENSHKEY="" S ENSHKEY=$P($G(^ENG(6920,DA,2)),U)
  1. . I ENSHKEY>0,ENTEC>0,ENHRS>0 S PMTOT(ENSHKEY,ENTEC)=$G(PMTOT(ENSHKEY,ENTEC))+ENHRS
  1. Q
  1. ;
  1. PMINV ; Updates PHYSICAL INVENTORY DATE in File 6914
  1. ; via call to ^ENEQNX5
  1. ; Called after PM work order close-out
  1. ;
  1. ; DA => IEN to Work Order File (returned)
  1. ;
  1. Q:$P($G(^ENG(6920,DA,5)),U,8)["D" ;don't update on deferred work order
  1. N ENEQ,ENDT,ENLOC
  1. S ENEQ=$P($G(^ENG(6920,DA,3)),U,8),ENDT=$P($P($G(^(5)),U,2),"."),ENLOC=$P(^(0),U,4)
  1. N DA
  1. I ENEQ>0,$D(^ENG(6914,ENEQ,0)),ENDT?7N D UPDT^ENEQNX5(ENEQ,ENDT,ENLOC)
  1. Q
  1. ;ENEQPMR4