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

ENTIRA.m

Go to the documentation of this file.
  1. ENTIRA ;WOIFO/SAB - IT EQUIPMENT RESPONSIBILITY ASSIGN ;2/4/2008
  1. ;;7.0;ENGINEERING;**87**;Aug 17, 1993;Build 16
  1. ;
  1. N ENC,ENDA,ENIA,ENPER,ENSM,ENSMV,ENSRT,ENX,ENY
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. ;
  1. GETEQ ; get equipment
  1. W !!,"Selecting accountable IT equipment to be assigned..."
  1. ; ask method of selection
  1. S ENX=$$ASKEQSM^ENTIUTL2("ECULS","E")
  1. S ENSM=$P(ENX,U),ENSMV=$P(ENX,U,2)
  1. G:"^E^C^U^L^S^"'[(U_ENSM_U) EXIT
  1. ;
  1. ; ask if already assigned equipment should be included
  1. I ENSM="E" S ENIA="1"
  1. E S ENIA=$$ASKIAEQ^ENTIUTL2()
  1. G:ENIA="" EXIT
  1. ;
  1. ; select equipment using method
  1. S ENSRT="E" ; set sort method = E
  1. D GETEQ^ENTIUTL2(ENSM,ENSMV,ENSRT,ENIA)
  1. ;
  1. ; display count of selected equipment
  1. S ENY=$G(^TMP($J,"ENITEQ",0))
  1. W !!,+ENY," equipment item(s) selected."
  1. ;
  1. I ENY'>0 D G:Y GETEQ G EXIT
  1. . W !!
  1. . S DIR(0)="Y"
  1. . S DIR("A")="No equipment was selected. Do you want to try again"
  1. . S DIR("B")="YES"
  1. . D ^DIR K DIR
  1. ;
  1. ; ask if detailed report desired
  1. S DIR(0)="Y"
  1. S DIR("A")="Do you want to print a list of the equipment"
  1. S DIR("B")="YES"
  1. D ^DIR K DIR G:$D(DIRUT) EXIT
  1. I Y D AEN^ENTIRRE
  1. ;
  1. GETPE ; get people that will be assigned the equipment
  1. W !!,"Selecting person(s) to be assigned responsibility..."
  1. D SELPER
  1. ;
  1. ; display count of selected persons
  1. S ENY=$G(^TMP($J,"ENITPE",0))
  1. W !!,+ENY," person(s) selected."
  1. I ENY'>0 D G:Y GETPE G EXIT
  1. . W !!
  1. . S DIR(0)="Y"
  1. . S DIR("A")="No responsible person selected. Do you want to try again"
  1. . S DIR("B")="YES"
  1. . D ^DIR K DIR
  1. ;
  1. ; confirm
  1. S DIR(0)="Y"
  1. S DIR("A")="OK to create assignments"
  1. S DIR("B")="YES"
  1. D ^DIR K DIR G:'Y EXIT
  1. ;
  1. ; make assignments
  1. K ENC
  1. ; loop thru equipment list
  1. S ENDA=0 F S ENDA=$O(^TMP($J,"ENITEQ","NA",ENDA)) Q:'ENDA D
  1. . ; loop thru person list
  1. . S ENPER=0 F S ENPER=$O(^TMP($J,"ENITPE",ENPER)) Q:'ENPER D
  1. . . ; create assignment
  1. . . S ENX=$$ASGN^ENTIUTL1(ENDA,ENPER)
  1. . . I ENX S ENC(1)=$G(ENC(1))+1
  1. . . I ENX=0 W !," Equipment # ",ENDA," is already assigned to ",$$GET1^DIQ(200,ENPER,.01) S ENC(0)=$G(ENC(0))+1
  1. . . I ENX="E" W !," ERROR. Equipment ",ENDA," was not assigned to ",$$GET1^DIQ(200,ENPER,.01) S ENC("E")=$G(ENC("E"))+1
  1. ;
  1. ; display totals
  1. W !!,+$G(ENC(1))," equipment assignment(s) created."
  1. W:$G(ENC(0)) !,ENC(0)," equipment assignment(s) already in place."
  1. W:$G(ENC("E")) !,ENC("E")," assignment(s) not created due to an error."
  1. ;
  1. EXIT ;
  1. K ^TMP($J,"ENITEQ"),^TMP($J,"ENITPE")
  1. Q
  1. ;
  1. SELPER ; Select Person(s)
  1. ; output
  1. ; ^TMP($J,"ENITPE",0)=count
  1. ; ^TMP($J,"ENITPE",ien)="" list of persons by internal entry number
  1. ;
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. N ENCNT,END,ENDA,ENNAME
  1. S ENCNT=0,END=0
  1. K ^TMP($J,"ENITPE")
  1. ;
  1. ; ask person in loop
  1. F D Q:END
  1. . S DIC="^VA(200,"
  1. . S DIC(0)="AQEM"
  1. . I ENCNT>0 S DIC("A")="Select Another NEW PERSON NAME: "
  1. . W !
  1. . D ^DIC K DIC I Y<1 S END=1 Q
  1. . S ENDA=+Y
  1. . S ENNAME=$P(Y,U,2)
  1. . S DIR(0)="Y",DIR("A")="Assign responsibility to "_ENNAME
  1. . D ^DIR I $D(DIRUT) S END=1 Q
  1. . I 'Y Q
  1. . ; user confirmed
  1. . S ENCNT=ENCNT+1
  1. . S ^TMP($J,"ENITPE",ENDA)=""
  1. ;
  1. ; set output header node
  1. S ^TMP($J,"ENITPE",0)=ENCNT
  1. ;
  1. ;ENTIRA