- ENTIUTL2 ;WOIFO/SAB - Find and Sort Equipment Utilities ;2/14/2008
- ;;7.0;ENGINEERING;**87**;Aug 17, 1993;Build 16
- ;
- ASKEQSM(ENAML,ENDM) ; Ask Equipment Selection Method
- ; input
- ; ENAML = allowed method list, may contain the following characters
- ; A = all equipment
- ; E = by Entry #
- ; C = by CMR
- ; U = by using service
- ; L = by location
- ; S = by service of location
- ; example "ECULS"
- ; ENDM = (optional) default method
- ; returns null if no method selected or
- ; piece 1 = A, E, C, U, L, or S if a method was selected
- ; piece 2 = specified value when method is C, U, L, or S
- ; e.g. "C^12" for CMR with internal entry number = 12
- ;
- N DIC,DIR,DIROUT,DIRUT,DTOUT,DUOUT,ENRET,ENVAL,X,Y
- S ENRET="",ENVAL=""
- ;
- ; ask method
- S DIR(0)="S^"
- I ENAML["A" S DIR(0)=DIR(0)_"A:ALL TRACKED IT EQUIPMENT;"
- I ENAML["E" S DIR(0)=DIR(0)_"E:ENTRY #;"
- I ENAML["C" S DIR(0)=DIR(0)_"C:CMR;"
- I ENAML["U" S DIR(0)=DIR(0)_"U:USING SERVICE;"
- I ENAML["L" S DIR(0)=DIR(0)_"L:LOCATION;"
- I ENAML["S" S DIR(0)=DIR(0)_"S:SERVICE OF LOCATION;"
- Q:DIR(0)="S^" ENRET
- ; remove trailing ;
- I $E(DIR(0),$L(DIR(0)))=";" S DIR(0)=$E(DIR(0),1,$L(DIR(0))-1)
- S DIR("A")="Specify method to select equipment by"
- I $G(ENDM)]"" S DIR("B")=ENDM
- S DIR("?")="Enter a code from the list."
- S DIR("?",1)="The system considers tracked IT equipment to be"
- S DIR("?",2)="equipment that is on a CMR with IT TRACKING = YES."
- S DIR("?",3)=" "
- D ^DIR
- I '$D(DIRUT) S ENRET=Y
- ;
- ; ask a value for applicable methods
- ;
- ; method C - by CMR
- I ENRET="C" D
- . ; ask CMR
- . S DIC("S")="I $P($G(^(0)),U,9)=1" ; screen IT TRACKING = YES
- . S DIC="^ENG(6914.1,"
- . S DIC(0)="AQEM"
- . D ^DIC K DIC I Y<1 S ENRET="" Q
- . S ENVAL=+Y
- ;
- ; method U - by using service
- I ENRET="U" D
- . ; ask USING SERVICE
- . S DIC("S")="I $D(^ENG(6914,""AC"",+Y))" ; screen services with equip
- . S DIC="^DIC(49,"
- . S DIC(0)="AQEM"
- . D ^DIC K DIC I Y<1 S ENRET="" Q
- . S ENVAL=+Y
- ;
- ; method L - by location
- I ENRET="L" D
- . ; ask LOCATION
- . S DIC("S")="I $D(^ENG(6914,""D"",+Y))" ; screen locations with equip
- . S DIC="^ENG(""SP"","
- . S DIC(0)="AQEM"
- . D ^DIC K DIC I Y<1 S ENRET="" Q
- . S ENVAL=+Y
- ;
- ; method S - by service of location
- I ENRET="S" D
- . ; ask SERVICE
- . S DIC("S")="I $D(^ENG(""SP"",""D"",+Y))" ; screen services with space
- . S DIC="^DIC(49,"
- . S DIC(0)="AQEM"
- . D ^DIC K DIC I Y<1 S ENRET="" Q
- . S ENVAL=+Y
- ;
- I ENVAL]"" S ENRET=ENRET_"^"_ENVAL
- Q ENRET
- ;
- ASKIAEQ() ; Ask Include Assigned Equipment
- ;
- ; returns null if time-out or uparrorw
- ; 1 if assigned equipment should be included
- ; 0 if not
- ;
- N DIR,DIROUT,DIRUT,DTOUT,DUOUT,ENRET,X,Y
- S ENRET=""
- S DIR(0)="Y"
- S DIR("A")="Include equipment with an existing active assignment"
- S DIR("B")="NO"
- D ^DIR
- I '$D(DIRUT) S ENRET=Y
- Q ENRET
- ;
- ASKEQSRT(ENSM,ENDM) ; Ask Equipment Sort
- ; input ENSM = (optional) selection method
- ; if method is E then sort is set to E
- ; ENDM = (optional) default sort method
- ;
- ; returns null if no sort selected
- ; E, C, U, L, or S if a sort was selected
- ;
- N DIR,DIROUT,DIRUT,DTOUT,DUOUT,ENRET,X,Y
- S ENRET=""
- I $G(ENSM)="E" S ENRET="E"
- E D
- . S DIR(0)="S^E:ENTRY #;C:CMR;U:USING SERVICE;L:LOCATION;S:SERVICE OF LOCATION"
- . S DIR("A")="Sort equipment by"
- . I $G(ENDM)]"" S DIR("B")=ENDM
- . D ^DIR K DIR
- . I '$D(DIRUT) S ENRET=Y
- Q ENRET
- ;
- GETEQ(ENSM,ENVAL,ENSRT,ENIA) ; Get Equipment
- ; input ENSM = selection method (A, E, C, U, L, or S)
- ; NOTE: E method is interactive, while the others are not
- ; ENVAL = value when method is C, U, L, or S (e.g. ien of CMR)
- ; ENSRT = sort by (E, C, U, L, or S) - must be E for method E
- ; ENIA = 1 (include) or 0 (don't include) equip w/active assign
- ; this does not apply to method E
- ; optional, default = 1
- ; output
- ; ^TMP($J,"ENITEQ",0)=count^method^specified value^sort
- ; ^TMP($J,"ENITEQ",sort value,equip ien)="" list of equipment
- ;
- N ENCMR,ENCNT,END,ENDA
- K ^TMP($J,"ENITEQ")
- S ENVAL=$G(ENVAL)
- S ENSRT=$G(ENSRT,"E")
- S ENIA=$G(ENIA,1)
- S ENCNT=0,END=0
- ;
- ; method A - all tracked equipment
- I ENSM="A" D
- . ; loop thru CMRs with IT TRACKING = YES
- . S ENCMR=0 F S ENCMR=$O(^ENG(6914.1,"AIT",1,ENCMR)) Q:'ENCMR D
- . . ; loop thru equipment on CMR
- . . S ENDA=0 F S ENDA=$O(^ENG(6914,"AD",ENCMR,ENDA)) Q:'ENDA D
- . . . I 'ENIA,$D(^ENG(6916.3,"AEA",ENDA)) Q ; chose to excl. assigned
- . . . D SETTMP
- ;
- ; method E - by individual equipment (interactive)
- I ENSM="E" D
- . N DA,DIC,DIR,DIROUT,DIRUT,DTOUT,DUOUT,ENSCR,X,Y
- . ; screen by CMR:IT TRACKING
- . S ENSCR="N ENCMR S ENCMR=$P($G(^(2)),U,9) I ENCMR,$D(^ENG(6914.1,""AIT"",1,ENCMR))"
- . ; ask equipment in loop
- . F S DIC("S")=ENSCR D GETEQ^ENUTL Q:Y<1 D Q:END
- . . S ENDA=+Y
- . . ; display equip
- . . W @(IOF)
- . . D DISEQ^ENTIUTL(ENDA)
- . . W !
- . . D DISASGN^ENTIUTL(ENDA)
- . . ;
- . . ; check if already selected (sort is always "E" for this method)
- . . I $D(^TMP($J,"ENITEQ","NA",ENDA)) D Q
- . . . W !!,"This equipment item has already been selected."
- . . . W !,"If all desired equipment has been selected then press RETURN"
- . . . W !,"at the equipment selection prompt."
- . . ;
- . . ; ask confirmation
- . . W !
- . . S DIR(0)="Y",DIR("A")="Do you want to select this item"
- . . D ^DIR I $D(DIRUT) S END=1 Q
- . . I 'Y Q
- . . ;
- . . ; user confirmed
- . . D SETTMP
- ;
- ; method C - by CMR
- I ENSM="C" D
- . ; loop thru equipment on the CMR
- . S ENDA=0 F S ENDA=$O(^ENG(6914,"AD",ENVAL,ENDA)) Q:'ENDA D
- . . I 'ENIA,$D(^ENG(6916.3,"AEA",ENDA)) Q ; chose to exclude assigned
- . . D SETTMP
- ;
- ; method U - by using service
- I ENSM="U" D
- . ; loop thru equipment with this using service
- . S ENDA=0 F S ENDA=$O(^ENG(6914,"AC",ENVAL,ENDA)) Q:'ENDA D
- . . S ENCMR=$P($G(^ENG(6914,ENDA,2)),U,9)
- . . Q:'ENCMR ; not on a cmr
- . . Q:$P($G(^ENG(6914.1,ENCMR,0)),U,9)'=1 ; IT tracking not yes
- . . I 'ENIA,$D(^ENG(6916.3,"AEA",ENDA)) Q ; chose to exclude assigned
- . . D SETTMP
- ;
- ; method L - by location
- I ENSM="L" D
- . ; loop thru equipment in this location
- . S ENDA=0 F S ENDA=$O(^ENG(6914,"D",ENVAL,ENDA)) Q:'ENDA D
- . . S ENCMR=$P($G(^ENG(6914,ENDA,2)),U,9)
- . . Q:'ENCMR ; not on a cmr
- . . Q:$P($G(^ENG(6914.1,ENCMR,0)),U,9)'=1 ; IT tracking not yes
- . . I 'ENIA,$D(^ENG(6916.3,"AEA",ENDA)) Q ; chose to exclude assigned
- . . D SETTMP
- ;
- ; method S - by service of location
- I ENSM="S" D
- . N ENSP
- . ; loop thru locations with this service
- . S ENSP=0 F S ENSP=$O(^ENG("SP","D",ENVAL,ENSP)) Q:'ENSP D
- . . ; loop thru equipment with this location
- . . S ENDA=0 F S ENDA=$O(^ENG(6914,"D",ENSP,ENDA)) Q:'ENDA D
- . . . S ENCMR=$P($G(^ENG(6914,ENDA,2)),U,9)
- . . . Q:'ENCMR ; not on a cmr
- . . . Q:$P($G(^ENG(6914.1,ENCMR,0)),U,9)'=1 ; IT tracking not yes
- . . . I 'ENIA,$D(^ENG(6916.3,"AEA",ENDA)) Q ; chose to exclude assigned
- . . . D SETTMP
- ;
- ; set output header node
- S ^TMP($J,"ENITEQ",0)=ENCNT_U_ENSM_U_ENVAL_ENSRT
- ;
- Q
- ;
- SETTMP ; save equipment in sorted TMP global
- N ENSRTV
- S ENSRTV=""
- I ENSRT="E" S ENSRTV="NA"
- I ENSRT="C" S ENSRTV=$$GET1^DIQ(6914,ENDA,19) ; cmr
- I ENSRT="U" S ENSRTV=$$GET1^DIQ(6914,ENDA,21) ; service
- I ENSRT="L" S ENSRTV=$$GET1^DIQ(6914,ENDA,24) ; location
- I ENSRT="S" S ENSRTV=$$GET1^DIQ(6914,ENDA,"24:1.5") ; svc of loc
- I ENSRTV="" S ENSRTV=" <null>"
- S ^TMP($J,"ENITEQ",ENSRTV,ENDA)=""
- S ENCNT=ENCNT+1
- Q
- ;
- ;ENTIUTL2
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HENTIUTL2 7725 printed Feb 18, 2025@23:22:28 Page 2
- ENTIUTL2 ;WOIFO/SAB - Find and Sort Equipment Utilities ;2/14/2008
- +1 ;;7.0;ENGINEERING;**87**;Aug 17, 1993;Build 16
- +2 ;
- ASKEQSM(ENAML,ENDM) ; Ask Equipment Selection Method
- +1 ; input
- +2 ; ENAML = allowed method list, may contain the following characters
- +3 ; A = all equipment
- +4 ; E = by Entry #
- +5 ; C = by CMR
- +6 ; U = by using service
- +7 ; L = by location
- +8 ; S = by service of location
- +9 ; example "ECULS"
- +10 ; ENDM = (optional) default method
- +11 ; returns null if no method selected or
- +12 ; piece 1 = A, E, C, U, L, or S if a method was selected
- +13 ; piece 2 = specified value when method is C, U, L, or S
- +14 ; e.g. "C^12" for CMR with internal entry number = 12
- +15 ;
- +16 NEW DIC,DIR,DIROUT,DIRUT,DTOUT,DUOUT,ENRET,ENVAL,X,Y
- +17 SET ENRET=""
- SET ENVAL=""
- +18 ;
- +19 ; ask method
- +20 SET DIR(0)="S^"
- +21 IF ENAML["A"
- SET DIR(0)=DIR(0)_"A:ALL TRACKED IT EQUIPMENT;"
- +22 IF ENAML["E"
- SET DIR(0)=DIR(0)_"E:ENTRY #;"
- +23 IF ENAML["C"
- SET DIR(0)=DIR(0)_"C:CMR;"
- +24 IF ENAML["U"
- SET DIR(0)=DIR(0)_"U:USING SERVICE;"
- +25 IF ENAML["L"
- SET DIR(0)=DIR(0)_"L:LOCATION;"
- +26 IF ENAML["S"
- SET DIR(0)=DIR(0)_"S:SERVICE OF LOCATION;"
- +27 if DIR(0)="S^"
- QUIT ENRET
- +28 ; remove trailing ;
- +29 IF $EXTRACT(DIR(0),$LENGTH(DIR(0)))=";"
- SET DIR(0)=$EXTRACT(DIR(0),1,$LENGTH(DIR(0))-1)
- +30 SET DIR("A")="Specify method to select equipment by"
- +31 IF $GET(ENDM)]""
- SET DIR("B")=ENDM
- +32 SET DIR("?")="Enter a code from the list."
- +33 SET DIR("?",1)="The system considers tracked IT equipment to be"
- +34 SET DIR("?",2)="equipment that is on a CMR with IT TRACKING = YES."
- +35 SET DIR("?",3)=" "
- +36 DO ^DIR
- +37 IF '$DATA(DIRUT)
- SET ENRET=Y
- +38 ;
- +39 ; ask a value for applicable methods
- +40 ;
- +41 ; method C - by CMR
- +42 IF ENRET="C"
- Begin DoDot:1
- +43 ; ask CMR
- +44 ; screen IT TRACKING = YES
- SET DIC("S")="I $P($G(^(0)),U,9)=1"
- +45 SET DIC="^ENG(6914.1,"
- +46 SET DIC(0)="AQEM"
- +47 DO ^DIC
- KILL DIC
- IF Y<1
- SET ENRET=""
- QUIT
- +48 SET ENVAL=+Y
- End DoDot:1
- +49 ;
- +50 ; method U - by using service
- +51 IF ENRET="U"
- Begin DoDot:1
- +52 ; ask USING SERVICE
- +53 ; screen services with equip
- SET DIC("S")="I $D(^ENG(6914,""AC"",+Y))"
- +54 SET DIC="^DIC(49,"
- +55 SET DIC(0)="AQEM"
- +56 DO ^DIC
- KILL DIC
- IF Y<1
- SET ENRET=""
- QUIT
- +57 SET ENVAL=+Y
- End DoDot:1
- +58 ;
- +59 ; method L - by location
- +60 IF ENRET="L"
- Begin DoDot:1
- +61 ; ask LOCATION
- +62 ; screen locations with equip
- SET DIC("S")="I $D(^ENG(6914,""D"",+Y))"
- +63 SET DIC="^ENG(""SP"","
- +64 SET DIC(0)="AQEM"
- +65 DO ^DIC
- KILL DIC
- IF Y<1
- SET ENRET=""
- QUIT
- +66 SET ENVAL=+Y
- End DoDot:1
- +67 ;
- +68 ; method S - by service of location
- +69 IF ENRET="S"
- Begin DoDot:1
- +70 ; ask SERVICE
- +71 ; screen services with space
- SET DIC("S")="I $D(^ENG(""SP"",""D"",+Y))"
- +72 SET DIC="^DIC(49,"
- +73 SET DIC(0)="AQEM"
- +74 DO ^DIC
- KILL DIC
- IF Y<1
- SET ENRET=""
- QUIT
- +75 SET ENVAL=+Y
- End DoDot:1
- +76 ;
- +77 IF ENVAL]""
- SET ENRET=ENRET_"^"_ENVAL
- +78 QUIT ENRET
- +79 ;
- ASKIAEQ() ; Ask Include Assigned Equipment
- +1 ;
- +2 ; returns null if time-out or uparrorw
- +3 ; 1 if assigned equipment should be included
- +4 ; 0 if not
- +5 ;
- +6 NEW DIR,DIROUT,DIRUT,DTOUT,DUOUT,ENRET,X,Y
- +7 SET ENRET=""
- +8 SET DIR(0)="Y"
- +9 SET DIR("A")="Include equipment with an existing active assignment"
- +10 SET DIR("B")="NO"
- +11 DO ^DIR
- +12 IF '$DATA(DIRUT)
- SET ENRET=Y
- +13 QUIT ENRET
- +14 ;
- ASKEQSRT(ENSM,ENDM) ; Ask Equipment Sort
- +1 ; input ENSM = (optional) selection method
- +2 ; if method is E then sort is set to E
- +3 ; ENDM = (optional) default sort method
- +4 ;
- +5 ; returns null if no sort selected
- +6 ; E, C, U, L, or S if a sort was selected
- +7 ;
- +8 NEW DIR,DIROUT,DIRUT,DTOUT,DUOUT,ENRET,X,Y
- +9 SET ENRET=""
- +10 IF $GET(ENSM)="E"
- SET ENRET="E"
- +11 IF '$TEST
- Begin DoDot:1
- +12 SET DIR(0)="S^E:ENTRY #;C:CMR;U:USING SERVICE;L:LOCATION;S:SERVICE OF LOCATION"
- +13 SET DIR("A")="Sort equipment by"
- +14 IF $GET(ENDM)]""
- SET DIR("B")=ENDM
- +15 DO ^DIR
- KILL DIR
- +16 IF '$DATA(DIRUT)
- SET ENRET=Y
- End DoDot:1
- +17 QUIT ENRET
- +18 ;
- GETEQ(ENSM,ENVAL,ENSRT,ENIA) ; Get Equipment
- +1 ; input ENSM = selection method (A, E, C, U, L, or S)
- +2 ; NOTE: E method is interactive, while the others are not
- +3 ; ENVAL = value when method is C, U, L, or S (e.g. ien of CMR)
- +4 ; ENSRT = sort by (E, C, U, L, or S) - must be E for method E
- +5 ; ENIA = 1 (include) or 0 (don't include) equip w/active assign
- +6 ; this does not apply to method E
- +7 ; optional, default = 1
- +8 ; output
- +9 ; ^TMP($J,"ENITEQ",0)=count^method^specified value^sort
- +10 ; ^TMP($J,"ENITEQ",sort value,equip ien)="" list of equipment
- +11 ;
- +12 NEW ENCMR,ENCNT,END,ENDA
- +13 KILL ^TMP($JOB,"ENITEQ")
- +14 SET ENVAL=$GET(ENVAL)
- +15 SET ENSRT=$GET(ENSRT,"E")
- +16 SET ENIA=$GET(ENIA,1)
- +17 SET ENCNT=0
- SET END=0
- +18 ;
- +19 ; method A - all tracked equipment
- +20 IF ENSM="A"
- Begin DoDot:1
- +21 ; loop thru CMRs with IT TRACKING = YES
- +22 SET ENCMR=0
- FOR
- SET ENCMR=$ORDER(^ENG(6914.1,"AIT",1,ENCMR))
- if 'ENCMR
- QUIT
- Begin DoDot:2
- +23 ; loop thru equipment on CMR
- +24 SET ENDA=0
- FOR
- SET ENDA=$ORDER(^ENG(6914,"AD",ENCMR,ENDA))
- if 'ENDA
- QUIT
- Begin DoDot:3
- +25 ; chose to excl. assigned
- IF 'ENIA
- IF $DATA(^ENG(6916.3,"AEA",ENDA))
- QUIT
- +26 DO SETTMP
- End DoDot:3
- End DoDot:2
- End DoDot:1
- +27 ;
- +28 ; method E - by individual equipment (interactive)
- +29 IF ENSM="E"
- Begin DoDot:1
- +30 NEW DA,DIC,DIR,DIROUT,DIRUT,DTOUT,DUOUT,ENSCR,X,Y
- +31 ; screen by CMR:IT TRACKING
- +32 SET ENSCR="N ENCMR S ENCMR=$P($G(^(2)),U,9) I ENCMR,$D(^ENG(6914.1,""AIT"",1,ENCMR))"
- +33 ; ask equipment in loop
- +34 FOR
- SET DIC("S")=ENSCR
- DO GETEQ^ENUTL
- if Y<1
- QUIT
- Begin DoDot:2
- +35 SET ENDA=+Y
- +36 ; display equip
- +37 WRITE @(IOF)
- +38 DO DISEQ^ENTIUTL(ENDA)
- +39 WRITE !
- +40 DO DISASGN^ENTIUTL(ENDA)
- +41 ;
- +42 ; check if already selected (sort is always "E" for this method)
- +43 IF $DATA(^TMP($JOB,"ENITEQ","NA",ENDA))
- Begin DoDot:3
- +44 WRITE !!,"This equipment item has already been selected."
- +45 WRITE !,"If all desired equipment has been selected then press RETURN"
- +46 WRITE !,"at the equipment selection prompt."
- End DoDot:3
- QUIT
- +47 ;
- +48 ; ask confirmation
- +49 WRITE !
- +50 SET DIR(0)="Y"
- SET DIR("A")="Do you want to select this item"
- +51 DO ^DIR
- IF $DATA(DIRUT)
- SET END=1
- QUIT
- +52 IF 'Y
- QUIT
- +53 ;
- +54 ; user confirmed
- +55 DO SETTMP
- End DoDot:2
- if END
- QUIT
- End DoDot:1
- +56 ;
- +57 ; method C - by CMR
- +58 IF ENSM="C"
- Begin DoDot:1
- +59 ; loop thru equipment on the CMR
- +60 SET ENDA=0
- FOR
- SET ENDA=$ORDER(^ENG(6914,"AD",ENVAL,ENDA))
- if 'ENDA
- QUIT
- Begin DoDot:2
- +61 ; chose to exclude assigned
- IF 'ENIA
- IF $DATA(^ENG(6916.3,"AEA",ENDA))
- QUIT
- +62 DO SETTMP
- End DoDot:2
- End DoDot:1
- +63 ;
- +64 ; method U - by using service
- +65 IF ENSM="U"
- Begin DoDot:1
- +66 ; loop thru equipment with this using service
- +67 SET ENDA=0
- FOR
- SET ENDA=$ORDER(^ENG(6914,"AC",ENVAL,ENDA))
- if 'ENDA
- QUIT
- Begin DoDot:2
- +68 SET ENCMR=$PIECE($GET(^ENG(6914,ENDA,2)),U,9)
- +69 ; not on a cmr
- if 'ENCMR
- QUIT
- +70 ; IT tracking not yes
- if $PIECE($GET(^ENG(6914.1,ENCMR,0)),U,9)'=1
- QUIT
- +71 ; chose to exclude assigned
- IF 'ENIA
- IF $DATA(^ENG(6916.3,"AEA",ENDA))
- QUIT
- +72 DO SETTMP
- End DoDot:2
- End DoDot:1
- +73 ;
- +74 ; method L - by location
- +75 IF ENSM="L"
- Begin DoDot:1
- +76 ; loop thru equipment in this location
- +77 SET ENDA=0
- FOR
- SET ENDA=$ORDER(^ENG(6914,"D",ENVAL,ENDA))
- if 'ENDA
- QUIT
- Begin DoDot:2
- +78 SET ENCMR=$PIECE($GET(^ENG(6914,ENDA,2)),U,9)
- +79 ; not on a cmr
- if 'ENCMR
- QUIT
- +80 ; IT tracking not yes
- if $PIECE($GET(^ENG(6914.1,ENCMR,0)),U,9)'=1
- QUIT
- +81 ; chose to exclude assigned
- IF 'ENIA
- IF $DATA(^ENG(6916.3,"AEA",ENDA))
- QUIT
- +82 DO SETTMP
- End DoDot:2
- End DoDot:1
- +83 ;
- +84 ; method S - by service of location
- +85 IF ENSM="S"
- Begin DoDot:1
- +86 NEW ENSP
- +87 ; loop thru locations with this service
- +88 SET ENSP=0
- FOR
- SET ENSP=$ORDER(^ENG("SP","D",ENVAL,ENSP))
- if 'ENSP
- QUIT
- Begin DoDot:2
- +89 ; loop thru equipment with this location
- +90 SET ENDA=0
- FOR
- SET ENDA=$ORDER(^ENG(6914,"D",ENSP,ENDA))
- if 'ENDA
- QUIT
- Begin DoDot:3
- +91 SET ENCMR=$PIECE($GET(^ENG(6914,ENDA,2)),U,9)
- +92 ; not on a cmr
- if 'ENCMR
- QUIT
- +93 ; IT tracking not yes
- if $PIECE($GET(^ENG(6914.1,ENCMR,0)),U,9)'=1
- QUIT
- +94 ; chose to exclude assigned
- IF 'ENIA
- IF $DATA(^ENG(6916.3,"AEA",ENDA))
- QUIT
- +95 DO SETTMP
- End DoDot:3
- End DoDot:2
- End DoDot:1
- +96 ;
- +97 ; set output header node
- +98 SET ^TMP($JOB,"ENITEQ",0)=ENCNT_U_ENSM_U_ENVAL_ENSRT
- +99 ;
- +100 QUIT
- +101 ;
- SETTMP ; save equipment in sorted TMP global
- +1 NEW ENSRTV
- +2 SET ENSRTV=""
- +3 IF ENSRT="E"
- SET ENSRTV="NA"
- +4 ; cmr
- IF ENSRT="C"
- SET ENSRTV=$$GET1^DIQ(6914,ENDA,19)
- +5 ; service
- IF ENSRT="U"
- SET ENSRTV=$$GET1^DIQ(6914,ENDA,21)
- +6 ; location
- IF ENSRT="L"
- SET ENSRTV=$$GET1^DIQ(6914,ENDA,24)
- +7 ; svc of loc
- IF ENSRT="S"
- SET ENSRTV=$$GET1^DIQ(6914,ENDA,"24:1.5")
- +8 IF ENSRTV=""
- SET ENSRTV=" <null>"
- +9 SET ^TMP($JOB,"ENITEQ",ENSRTV,ENDA)=""
- +10 SET ENCNT=ENCNT+1
- +11 QUIT
- +12 ;
- +13 ;ENTIUTL2