source: WorldVistAEHR/trunk/r/ENGINEERING-EN/ENTIRT.m@ 1766

Last change on this file since 1766 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.7 KB
Line 
1ENTIRT ;WOIFO/LKG - TERMINATE RESPONSIBILITY ;2/4/08 12:32
2 ;;7.0;ENGINEERING;**87**;Aug 17, 1993;Build 16
3TERMLST ;Entry for list termination processing
4 N DA,DIR,DIROUT,DIRUT,DTOUT,DUOUT,DIC,D,ENACL,ENCNT,ENDA,ENMETHOD,ENERR,ENX,ENI,ENJ,X,Y
5LSTSTART S DIR(0)="S^E:EQUIPMENT;P:PERSON",DIR("A")="Specify method for selecting IT assignments"
6 D ^DIR K DIR G:$D(DIRUT) LSTEXIT
7 S ENMETHOD=Y
8 I ENMETHOD="E" D G:$D(ENERR) LSTEXIT
9 . N D,DIC S DIC("S")="I $D(^ENG(6916.3,""AEA"",Y))" D GETEQ^ENUTL
10 . I $D(DTOUT)!$D(DUOUT)!(Y<1) S ENERR=1 Q
11 . S ENDA=+Y
12 . K DIC,D,^TMP($J,"ENITTR"),ENERR
13 . D FIND^DIC(6916.3,"","@;.01;1;20","PQ",ENDA,"","AEA","I $P(^(0),U,8)=""""","","^TMP($J,""ENITTR"")","ENERR")
14 I ENMETHOD="P" D G:$D(ENERR) LSTEXIT
15 . N D,DIC S DIC=200,DIC(0)="AEMQ",DIC("S")="I $D(^ENG(6916.3,""AOA"",Y))"
16 . D ^DIC I $D(DTOUT)!$D(DUOUT)!(Y<1) S ENERR=1 Q
17 . S ENDA=+Y
18 . K DIC,D,^TMP($J,"ENITTR"),ENERR
19 . D FIND^DIC(6916.3,"","@;.01;1;20","PQ",ENDA,"","AOA","I $P(^(0),U,8)=""""","","^TMP($J,""ENITTR"")","ENERR")
20 I $P($G(^TMP($J,"ENITTR","DILIST",0)),U)'>0 W !!,"There are no active responsibilities for this "_$S(ENMETHOD="E":"equipment",ENMETHOD="P":"person",1:"")_"." K DIR S DIR(0)="E" D ^DIR K DIR K ^TMP($J,"ENITTR") G LSTEXIT:'Y,LSTSTART
21 K ^TMP($J,"SCR"),^TMP($J,"INDX"),ENACL
22 S ^TMP($J,"SCR")=$P(^TMP($J,"ENITTR","DILIST",0),U)_"^ACTIVE IT RESPONSIBILITIES"
23 S ^TMP($J,"SCR",0)="5;9;ENTRY #^15;20;MFG EQUIP NAME^37;30;OWNER^69;10;STATUS"
24 S ENI=0
25 F S ENI=$O(^TMP($J,"ENITTR","DILIST",ENI)) Q:+ENI'>0 D
26 . N ENX S ENX=$G(^TMP($J,"ENITTR","DILIST",ENI,0))
27 . S ^TMP($J,"SCR",ENI)=$P(ENX,U,2)_U_$E($$GET1^DIQ(6914,$P(ENX,U,2)_",",3),1,20)_U_$P(ENX,U,3,4)
28 . S ^TMP($J,"INDX",ENI)=$P(ENX,U)
29 K ^TMP($J,"ENITTR")
30 D EN2^ENPLS2(1)
31 G:'$D(ENACL)!$D(DIRUT) LSTEXIT
32 S DIR(0)="Y",DIR("A")="OK to terminate assignments",DIR("B")="NO" D ^DIR K DIR
33 G:'Y!$D(DIRUT) LSTEXIT
34 S ENCNT=0,ENX=""
35 F S ENX=$O(ENACL(ENX)) Q:ENX="" D
36 . N ENXSTR
37 . S ENXSTR=$G(ENACL(ENX)) Q:ENXSTR=""
38 . I $L(ENXSTR,",")>0 D
39 . . F ENJ=1:1 S ENI=$P(ENXSTR,",",ENJ) Q:+ENI'>0 D
40 . . . S DA=^TMP($J,"INDX",ENI) L +^ENG(6916.3,DA):$S($G(DILOCKTM)>5:DILOCKTM,1:5) E D MSG(DA,"Termination") Q
41 . . . S X=$$TERM^ENTIUTL1(DA)
42 . . . L -^ENG(6916.3,DA) K DA
43 . . . S ENCNT=ENCNT+1
44 W !!,ENCNT," IT responsibilities were terminated." K DIR S DIR(0)="E" D ^DIR K DIR
45 K ^TMP($J,"SCR"),^TMP($J,"INDX")
46 G LSTEXIT:'Y,LSTSTART
47LSTEXIT ;
48 K ^TMP($J,"SCR"),^TMP($J,"INDX")
49 Q
50MSG(ENDA,ENMSG) ;Write Error Message
51 N END,ENERR,ENDAC S ENDAC=ENDA_"," D GETS^DIQ(6916.3,ENDAC,".01;1","E","END","ENERR")
52 W !,"Assignment Equip Entry# ",$G(END(6916.3,ENDAC,.01,"E"))," for ",$G(END(6916.3,ENDAC,1,"E"))," is locked by another process.",!?10,ENMSG," was bypassed."
53 Q
54 ;
55 ;ENTIRT
Note: See TracBrowser for help on using the repository browser.