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

ENXIP65.m

Go to the documentation of this file.
  1. ENXIP65 ;WCIOFO/SAB-PATCH INSTALL ROUTINE ;5/18/2000
  1. ;;7.0;ENGINEERING;**65**;Aug 17, 1993
  1. Q
  1. ;
  1. PS ;Post Install Entry Point
  1. ;
  1. ; only perform during 1st install
  1. I $$PATCH^XPDUTL("EN*7.0*65") D BMES^XPDUTL(" Skipping post install since patch was previously installed.") Q
  1. ;
  1. N ENX,Y
  1. ; create KIDS checkpoints with call backs
  1. F ENX="XTIME","EQHIST" D
  1. . S Y=$$NEWCP^XPDUTL(ENX,ENX_"^ENXIP65")
  1. . I 'Y D BMES^XPDUTL("ERROR Creating "_ENX_" Checkpoint.")
  1. Q
  1. ;
  1. XTIME ; Remove time from equipment history entries
  1. ; Previous patch EN*7*48 resulted in work orders with a time being
  1. ; incorrectly posted to the equipment history
  1. N ENACTN,ENC,ENDTCP,ENH,ENHDA,ENHR,ENINV
  1. N XPDIDTOT
  1. ;
  1. D BMES^XPDUTL(" Removing time from equipment histories...")
  1. ;
  1. ; estimate count of equipment to examine
  1. S ENC("TOT")=$P($G(^ENG(6914,0)),U,4)
  1. I ENC("TOT")<1 S ENC("TOT")=1
  1. S ENC("EQ")=0 ; count of evaluated equipment
  1. S ENC("FIX")=0 ; count of modified histories
  1. S XPDIDTOT=ENC("TOT") ; set total for status bar
  1. S ENC("UPD")=5 ; initial % required to update status bar
  1. ;
  1. ; loop thru equipment
  1. S ENINV=0 F S ENINV=$O(^ENG(6914,ENINV)) Q:'ENINV D
  1. . S ENC("EQ")=ENC("EQ")+1
  1. . S ENC("%")=ENC("EQ")*100/ENC("TOT") ; calculate % complete
  1. . ;
  1. . ; check if status bar should be updated
  1. . I ENC("%")>ENC("UPD"),ENC("%")<100 D
  1. . . D UPDATE^XPDID(ENC("EQ")) ; update status bar
  1. . . S ENC("UPD")=ENC("UPD")+5 ; increase update criteria by 5%
  1. . ;
  1. . ; loop thru history multiple
  1. . S ENHDA=0
  1. . F S ENHDA=$O(^ENG(6914,ENINV,6,ENHDA)) Q:'ENHDA I ENHDA["." D
  1. . . ; contains a time
  1. . . ;
  1. . . ; get current data
  1. . . S ENH=$G(^ENG(6914,ENINV,6,ENHDA,0))
  1. . . Q:ENH=""
  1. . . S ENHR=$P(ENH,U)
  1. . . S ENDTCP=$P(ENHR,"-") ; date complete
  1. . . S ENACTN=$P(ENHR,"-",2) ; work action(s)
  1. . . ;W !!,ENINV,?10,ENHDA,?25,ENDTCP,!," ",ENH
  1. . . ;
  1. . . ; remove time from the date in the history reference field
  1. . . S ENDTCP=$P(ENDTCP,".")
  1. . . S $P(ENH,U)=ENDTCP_"-"_ENACTN
  1. . . ;
  1. . . ;W !,ENINV,?25,ENDTCP,!," ",ENH
  1. . . ; post to history as a new entry (uses ENINV, ENDTCP, and ENH)
  1. . . D EXT^ENEQHS
  1. . . ;
  1. . . ; delete original entry from history
  1. . . K ^ENG(6914,ENINV,6,ENHDA,0)
  1. . . S $P(^ENG(6914,ENINV,6,0),U,4)=$P(^ENG(6914,ENINV,6,0),U,4)-1
  1. . . ;
  1. . . S ENC("FIX")=ENC("FIX")+1
  1. ;
  1. D MES^XPDUTL(" "_ENC("FIX")_" equipment histories were modified.")
  1. Q
  1. ;
  1. EQHIST ; update equipment history data based on completed work orders
  1. ;
  1. N ENC,ENEQDA,ENEQHDA,ENEQHX,ENH,ENI,ENINV,ENTEC,ENWODA,ENWODC,ENWOX
  1. N XPDIDTOT
  1. ;
  1. D BMES^XPDUTL(" Using completed work order data to correct equipment histories...")
  1. ;
  1. ; estimate count of work orders to examine
  1. S ENC("TOT")=$P($G(^ENG(6920,0)),U,4)
  1. I ENC("TOT")<1 S ENC("TOT")=1
  1. S ENC("WO")=0 ; count of evaluated work orders
  1. S XPDIDTOT=ENC("TOT") ; set total for status bar
  1. S ENC("UPD")=5 ; initial % required to update status bar
  1. ;
  1. S ENC("WOC")=0 ; count of work orders with status = complete
  1. S ENC("EHM")=0 ; count of missing equipment histories
  1. S ENC("DIF")=0 ; count of different equip hist vs w.o.
  1. ;
  1. K ^XTMP("EN7P65")
  1. S ^XTMP("EN7P65",0)=$$FMADD^XLFDT(DT,90)_U_DT
  1. ;
  1. ; loop thru work orders
  1. S ENWODA=0 F S ENWODA=$O(^ENG(6920,ENWODA)) Q:'ENWODA D
  1. . S ENC("WO")=ENC("WO")+1
  1. . S ENC("%")=ENC("WO")*100/ENC("TOT") ; calculate % complete
  1. . ;
  1. . ; check if status bar should be updated
  1. . I ENC("%")>ENC("UPD"),ENC("%")<100 D
  1. . . D UPDATE^XPDID(ENC("WO")) ; update status bar
  1. . . S ENC("UPD")=ENC("UPD")+5 ; increase update criteria by 5%
  1. . ;
  1. . S ENEQDA=$P($G(^ENG(6920,ENWODA,3)),U,8) ; equip entry #
  1. . Q:ENEQDA'>0 ; not linked with equipment entry
  1. . S ENWODC=$P($G(^ENG(6920,ENWODA,5)),U,2) ; date complete
  1. . Q:ENWODC="" ; not completed
  1. . Q:$P($G(^ENG(6920,ENWODA,4)),U,3)=5 ; disapproved
  1. . ; have found a completed work order for an equipment record
  1. . S ENC("WOC")=ENC("WOC")+1 ; count it
  1. . S ENWOX=$P($G(^ENG(6920,ENWODA,0)),U)
  1. . ;
  1. . ; check if equipment record exists
  1. . Q:'$D(^ENG(6914,ENEQDA,0)) ; equip must have been deleted or archived
  1. . ;
  1. . ; determine expected history value based on work order
  1. . S ENH=$$HIST(ENWODA)
  1. . ;
  1. . ; look for work order in the equipment history
  1. . S ENEQHDA=0
  1. . S ENI=0 F S ENI=$O(^ENG(6914,ENEQDA,6,ENI)) Q:'ENI D Q:ENEQHDA
  1. . . S ENEQHX=$G(^ENG(6914,ENEQDA,6,ENI,0))
  1. . . I $P(ENEQHX,U,2)=ENWOX S ENEQHDA=ENI ; found it
  1. . I ENEQHDA'>0 D Q ; equipment hist missing
  1. . . ; add to equip hist
  1. . . S DA=ENWODA,ENINV=ENEQDA
  1. . . S ENTEC=$P($G(^ENG(6920,DA,2)),U,2)
  1. . . D W^ENEQHS
  1. . . ;
  1. . . S ENC("EHM")=ENC("EHM")+1
  1. . . S ^XTMP("EN7P65","ADD",ENWODA,ENEQDA)=ENH
  1. . ;
  1. . ; compare history with expected history and update if necessary
  1. . I $P(ENEQHX,U,3,7)'=$P(ENH,U,3,7) D ; values differ
  1. . . ;
  1. . . S ^XTMP("EN7P65","UPD",ENEQDA,ENEQHDA)=ENWODA
  1. . . S ^XTMP("EN7P65","UPD",ENEQDA,ENEQHDA,"OLD")=ENEQHX
  1. . . F I=3:1:7 S $P(ENEQHX,U,I)=$P(ENH,U,I)
  1. . . S ^ENG(6914,ENEQDA,6,ENEQHDA,0)=ENEQHX
  1. . . ;
  1. . . S ENC("DIF")=ENC("DIF")+1
  1. . . S ^XTMP("EN7P65","UPD",ENEQDA,ENEQHDA,"NEW")=ENEQHX
  1. ;
  1. ; save counts
  1. S ^XTMP("EN7P65","UPD",0)=ENC("DIF")
  1. S ^XTMP("EN7P65","ADD",0)=ENC("EHM")
  1. ;
  1. D MES^XPDUTL(" Processed "_ENC("WOC")_" completed work orders.")
  1. D MES^XPDUTL(" "_ENC("EHM")_" missing equipment histories were added.")
  1. D MES^XPDUTL(" "_ENC("DIF")_" inaccurate equipment histories were fixed.")
  1. Q
  1. ;
  1. HIST(DA) ; determine equipment hist value based on work order data
  1. ; input DA - work order internal entry #
  1. N ENACTN,ENDTCP,ENEMPL,ENH,ENHRS,ENINV,ENLABOR,ENMTL
  1. N ENODE,ENRET,ENSTAT,ENTEC,ENVEND,ENWORK,ENWOX,I,J,J1,K
  1. S ENRET=""
  1. ;
  1. I $D(^ENG(6920,DA,4)),$P(^(4),U,3)=5 Q ENRET ; disapproved work order
  1. S ENWOX=$P($G(^ENG(6920,DA,0)),U)
  1. S ENINV=$P($G(^ENG(6920,DA,3)),U,8)
  1. S ENTEC=$P($G(^ENG(6920,DA,2)),U,2)
  1. ;
  1. I ENTEC="" S ENEMPL=$S($E(ENWOX,1,3)="PM-":"STAFF",1:"NO ENTRY")
  1. E S ENEMPL=$E($P($G(^ENG("EMP",ENTEC,0)),U),1,15)
  1. ;
  1. S ENODE=$G(^ENG(6920,DA,5))
  1. S ENDTCP=$P($P(ENODE,U,2),"."),ENHRS=$P(ENODE,U,3),ENMTL=$P(ENODE,U,4)
  1. S ENLABOR=$P(ENODE,U,6),ENSTAT=$P(ENODE,U,8),ENWORK=$P(ENODE,U,7)
  1. S ENACTN="XX"
  1. I $D(^ENG(6920,DA,8)) D
  1. . F I=0:0 S I=$O(^ENG(6920,DA,8,I)) Q:I'>0!($L(ENACTN)=8) D
  1. .. S J=$P(^ENG(6920,DA,8,I,0),U)
  1. .. Q:'$D(^ENG(6920.1,J,0)) S J1=$P(^(0),U,2)
  1. .. I ENACTN="XX" S ENACTN=""
  1. .. S ENACTN=ENACTN_J1
  1. S ENVEND=$P($P($G(^ENG(6920,DA,4)),U,4),".")
  1. S ENRET=ENDTCP_"-"_ENACTN_U_ENWOX_U_ENSTAT_U_ENHRS_U_ENLABOR_U_ENMTL_U_ENVEND_U_ENEMPL_U_ENWORK
  1. Q ENRET
  1. ;
  1. ;ENXIP65