ENTIRA ;WOIFO/SAB - IT EQUIPMENT RESPONSIBILITY ASSIGN ;2/4/2008
;;7.0;ENGINEERING;**87**;Aug 17, 1993;Build 16
;
N ENC,ENDA,ENIA,ENPER,ENSM,ENSMV,ENSRT,ENX,ENY
N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
;
GETEQ ; get equipment
W !!,"Selecting accountable IT equipment to be assigned..."
; ask method of selection
S ENX=$$ASKEQSM^ENTIUTL2("ECULS","E")
S ENSM=$P(ENX,U),ENSMV=$P(ENX,U,2)
G:"^E^C^U^L^S^"'[(U_ENSM_U) EXIT
;
; ask if already assigned equipment should be included
I ENSM="E" S ENIA="1"
E S ENIA=$$ASKIAEQ^ENTIUTL2()
G:ENIA="" EXIT
;
; select equipment using method
S ENSRT="E" ; set sort method = E
D GETEQ^ENTIUTL2(ENSM,ENSMV,ENSRT,ENIA)
;
; display count of selected equipment
S ENY=$G(^TMP($J,"ENITEQ",0))
W !!,+ENY," equipment item(s) selected."
;
I ENY'>0 D G:Y GETEQ G EXIT
. W !!
. S DIR(0)="Y"
. S DIR("A")="No equipment was selected. Do you want to try again"
. S DIR("B")="YES"
. D ^DIR K DIR
;
; ask if detailed report desired
S DIR(0)="Y"
S DIR("A")="Do you want to print a list of the equipment"
S DIR("B")="YES"
D ^DIR K DIR G:$D(DIRUT) EXIT
I Y D AEN^ENTIRRE
;
GETPE ; get people that will be assigned the equipment
W !!,"Selecting person(s) to be assigned responsibility..."
D SELPER
;
; display count of selected persons
S ENY=$G(^TMP($J,"ENITPE",0))
W !!,+ENY," person(s) selected."
I ENY'>0 D G:Y GETPE G EXIT
. W !!
. S DIR(0)="Y"
. S DIR("A")="No responsible person selected. Do you want to try again"
. S DIR("B")="YES"
. D ^DIR K DIR
;
; confirm
S DIR(0)="Y"
S DIR("A")="OK to create assignments"
S DIR("B")="YES"
D ^DIR K DIR G:'Y EXIT
;
; make assignments
K ENC
; loop thru equipment list
S ENDA=0 F S ENDA=$O(^TMP($J,"ENITEQ","NA",ENDA)) Q:'ENDA D
. ; loop thru person list
. S ENPER=0 F S ENPER=$O(^TMP($J,"ENITPE",ENPER)) Q:'ENPER D
. . ; create assignment
. . S ENX=$$ASGN^ENTIUTL1(ENDA,ENPER)
. . I ENX S ENC(1)=$G(ENC(1))+1
. . I ENX=0 W !," Equipment # ",ENDA," is already assigned to ",$$GET1^DIQ(200,ENPER,.01) S ENC(0)=$G(ENC(0))+1
. . I ENX="E" W !," ERROR. Equipment ",ENDA," was not assigned to ",$$GET1^DIQ(200,ENPER,.01) S ENC("E")=$G(ENC("E"))+1
;
; display totals
W !!,+$G(ENC(1))," equipment assignment(s) created."
W:$G(ENC(0)) !,ENC(0)," equipment assignment(s) already in place."
W:$G(ENC("E")) !,ENC("E")," assignment(s) not created due to an error."
;
EXIT ;
K ^TMP($J,"ENITEQ"),^TMP($J,"ENITPE")
Q
;
SELPER ; Select Person(s)
; output
; ^TMP($J,"ENITPE",0)=count
; ^TMP($J,"ENITPE",ien)="" list of persons by internal entry number
;
N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
N ENCNT,END,ENDA,ENNAME
S ENCNT=0,END=0
K ^TMP($J,"ENITPE")
;
; ask person in loop
F D Q:END
. S DIC="^VA(200,"
. S DIC(0)="AQEM"
. I ENCNT>0 S DIC("A")="Select Another NEW PERSON NAME: "
. W !
. D ^DIC K DIC I Y<1 S END=1 Q
. S ENDA=+Y
. S ENNAME=$P(Y,U,2)
. S DIR(0)="Y",DIR("A")="Assign responsibility to "_ENNAME
. D ^DIR I $D(DIRUT) S END=1 Q
. I 'Y Q
. ; user confirmed
. S ENCNT=ENCNT+1
. S ^TMP($J,"ENITPE",ENDA)=""
;
; set output header node
S ^TMP($J,"ENITPE",0)=ENCNT
;
;ENTIRA
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HENTIRA 3251 printed Sep 15, 2024@21:20 Page 2
ENTIRA ;WOIFO/SAB - IT EQUIPMENT RESPONSIBILITY ASSIGN ;2/4/2008
+1 ;;7.0;ENGINEERING;**87**;Aug 17, 1993;Build 16
+2 ;
+3 NEW ENC,ENDA,ENIA,ENPER,ENSM,ENSMV,ENSRT,ENX,ENY
+4 NEW DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
+5 ;
GETEQ ; get equipment
+1 WRITE !!,"Selecting accountable IT equipment to be assigned..."
+2 ; ask method of selection
+3 SET ENX=$$ASKEQSM^ENTIUTL2("ECULS","E")
+4 SET ENSM=$PIECE(ENX,U)
SET ENSMV=$PIECE(ENX,U,2)
+5 if "^E^C^U^L^S^"'[(U_ENSM_U)
GOTO EXIT
+6 ;
+7 ; ask if already assigned equipment should be included
+8 IF ENSM="E"
SET ENIA="1"
+9 IF '$TEST
SET ENIA=$$ASKIAEQ^ENTIUTL2()
+10 if ENIA=""
GOTO EXIT
+11 ;
+12 ; select equipment using method
+13 ; set sort method = E
SET ENSRT="E"
+14 DO GETEQ^ENTIUTL2(ENSM,ENSMV,ENSRT,ENIA)
+15 ;
+16 ; display count of selected equipment
+17 SET ENY=$GET(^TMP($JOB,"ENITEQ",0))
+18 WRITE !!,+ENY," equipment item(s) selected."
+19 ;
+20 IF ENY'>0
Begin DoDot:1
+21 WRITE !!
+22 SET DIR(0)="Y"
+23 SET DIR("A")="No equipment was selected. Do you want to try again"
+24 SET DIR("B")="YES"
+25 DO ^DIR
KILL DIR
End DoDot:1
if Y
GOTO GETEQ
GOTO EXIT
+26 ;
+27 ; ask if detailed report desired
+28 SET DIR(0)="Y"
+29 SET DIR("A")="Do you want to print a list of the equipment"
+30 SET DIR("B")="YES"
+31 DO ^DIR
KILL DIR
if $DATA(DIRUT)
GOTO EXIT
+32 IF Y
DO AEN^ENTIRRE
+33 ;
GETPE ; get people that will be assigned the equipment
+1 WRITE !!,"Selecting person(s) to be assigned responsibility..."
+2 DO SELPER
+3 ;
+4 ; display count of selected persons
+5 SET ENY=$GET(^TMP($JOB,"ENITPE",0))
+6 WRITE !!,+ENY," person(s) selected."
+7 IF ENY'>0
Begin DoDot:1
+8 WRITE !!
+9 SET DIR(0)="Y"
+10 SET DIR("A")="No responsible person selected. Do you want to try again"
+11 SET DIR("B")="YES"
+12 DO ^DIR
KILL DIR
End DoDot:1
if Y
GOTO GETPE
GOTO EXIT
+13 ;
+14 ; confirm
+15 SET DIR(0)="Y"
+16 SET DIR("A")="OK to create assignments"
+17 SET DIR("B")="YES"
+18 DO ^DIR
KILL DIR
if 'Y
GOTO EXIT
+19 ;
+20 ; make assignments
+21 KILL ENC
+22 ; loop thru equipment list
+23 SET ENDA=0
FOR
SET ENDA=$ORDER(^TMP($JOB,"ENITEQ","NA",ENDA))
if 'ENDA
QUIT
Begin DoDot:1
+24 ; loop thru person list
+25 SET ENPER=0
FOR
SET ENPER=$ORDER(^TMP($JOB,"ENITPE",ENPER))
if 'ENPER
QUIT
Begin DoDot:2
+26 ; create assignment
+27 SET ENX=$$ASGN^ENTIUTL1(ENDA,ENPER)
+28 IF ENX
SET ENC(1)=$GET(ENC(1))+1
+29 IF ENX=0
WRITE !," Equipment # ",ENDA," is already assigned to ",$$GET1^DIQ(200,ENPER,.01)
SET ENC(0)=$GET(ENC(0))+1
+30 IF ENX="E"
WRITE !," ERROR. Equipment ",ENDA," was not assigned to ",$$GET1^DIQ(200,ENPER,.01)
SET ENC("E")=$GET(ENC("E"))+1
End DoDot:2
End DoDot:1
+31 ;
+32 ; display totals
+33 WRITE !!,+$GET(ENC(1))," equipment assignment(s) created."
+34 if $GET(ENC(0))
WRITE !,ENC(0)," equipment assignment(s) already in place."
+35 if $GET(ENC("E"))
WRITE !,ENC("E")," assignment(s) not created due to an error."
+36 ;
EXIT ;
+1 KILL ^TMP($JOB,"ENITEQ"),^TMP($JOB,"ENITPE")
+2 QUIT
+3 ;
SELPER ; Select Person(s)
+1 ; output
+2 ; ^TMP($J,"ENITPE",0)=count
+3 ; ^TMP($J,"ENITPE",ien)="" list of persons by internal entry number
+4 ;
+5 NEW DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
+6 NEW ENCNT,END,ENDA,ENNAME
+7 SET ENCNT=0
SET END=0
+8 KILL ^TMP($JOB,"ENITPE")
+9 ;
+10 ; ask person in loop
+11 FOR
Begin DoDot:1
+12 SET DIC="^VA(200,"
+13 SET DIC(0)="AQEM"
+14 IF ENCNT>0
SET DIC("A")="Select Another NEW PERSON NAME: "
+15 WRITE !
+16 DO ^DIC
KILL DIC
IF Y<1
SET END=1
QUIT
+17 SET ENDA=+Y
+18 SET ENNAME=$PIECE(Y,U,2)
+19 SET DIR(0)="Y"
SET DIR("A")="Assign responsibility to "_ENNAME
+20 DO ^DIR
IF $DATA(DIRUT)
SET END=1
QUIT
+21 IF 'Y
QUIT
+22 ; user confirmed
+23 SET ENCNT=ENCNT+1
+24 SET ^TMP($JOB,"ENITPE",ENDA)=""
End DoDot:1
if END
QUIT
+25 ;
+26 ; set output header node
+27 SET ^TMP($JOB,"ENITPE",0)=ENCNT
+28 ;
+29 ;ENTIRA