source: WorldVistAEHR/trunk/r/ENGINEERING-EN/ENTIRX.m@ 862

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

initial load of WorldVistAEHR

File size: 4.4 KB
RevLine 
[613]1ENTIRX ;WOIFO/LKG - TRANSFER RESPONSIBILITY ;2/5/08 14:58
2 ;;7.0;ENGINEERING;**87**;Aug 17, 1993;Build 16
3TERMLST ;Entry for transfer processing
4 N DA,DIR,DIROUT,DIRUT,DTOUT,DUOUT,DIC,D,ENA,ENACL,ENCNT,ENCNT2,ENDA,ENMETHOD,ENNAME,ENNBR,ENPER,ENRES,ENERR,ENX,ENI,ENJ,X,X1,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)!$D(DIROUT)!$D(DTOUT)!$D(DUOUT) 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 I '$D(ENACL)!$D(DIRUT)!$D(DIROUT) K ^TMP($J,"SCR"),^TMP($J,"INDX") G LSTEXIT
32ASKNAME K DIC S DIC=200,DIC(0)="AEMQ",DIC("A")="Select person for new assignment: "
33 D ^DIC I +Y<1!$D(DTOUT)!$D(DUOUT) G LSTEXIT
34 S ENPER=+Y,ENNAME=$P(Y,U,2) K DIR S DIR(0)="Y",DIR("A")="Assign responsibility to "_ENNAME,DIR("B")="NO"
35 D ^DIR G LSTEXIT:$D(DIRUT),ASKNAME:'Y
36 S DIR(0)="Y",DIR("A")="OK to transfer assignments",DIR("B")="NO" D ^DIR K DIR
37 G:'Y!$D(DIRUT) LSTEXIT W !
38 S ENCNT=0,ENCNT2=0,ENX="" K ENA K ^TMP($J,"ENSIGN")
39 F S ENX=$O(ENACL(ENX)) Q:ENX="" D
40 . N ENXSTR
41 . S ENXSTR=$G(ENACL(ENX)) Q:ENXSTR=""
42 . I $L(ENXSTR,",")>0 D
43 . . F ENJ=1:1 S ENI=$P(ENXSTR,",",ENJ) Q:+ENI'>0 D
44 . . . S DA=^TMP($J,"INDX",ENI) L +^ENG(6916.3,DA):$S($G(DILOCKTM)>5:DILOCKTM,1:5) E D MSG^ENTIRT(DA,"Transfer") Q
45 . . . S X=$$TERM^ENTIUTL1(DA)
46 . . . L -^ENG(6916.3,DA)
47 . . . S ENCNT=ENCNT+1
48 . . . S ENNBR=$P($G(^ENG(6916.3,DA,0)),U) Q:'ENNBR
49 . . . I '$D(ENA(ENNBR)) S ENRES=$$ASGN^ENTIUTL1(ENNBR,ENPER),ENA(ENNBR)=ENRES S:ENRES ENCNT2=ENCNT2+1 W:ENRES=0 !,ENNBR," is already assigned to ",ENNAME,"." S:(ENPER=DUZ)&ENRES ^TMP($J,"ENSIGN",ENRES)=""
50 W !!,ENCNT," IT responsibilities were terminated.",!,ENCNT2," assignments were created." K DIR S DIR(0)="E" D ^DIR K DIR K ^TMP($J,"SCR"),^TMP($J,"INDX") G:'Y LSTEXIT
51 I ENPER=DUZ,$$SIGNOK() D
52 . N L,DIC,FLDS,FR,TO,BY,IOP,DHD,ENMSG
53 . S DA=$O(^ENG(6916.2,"@"),-1)
54 . I '$$CMP^XUSESIG1($P($G(^ENG(6916.2,DA,0)),U,3),$NAME(^ENG(6916.2,DA,1))) W !!,"Hand receipt text is corrupted - Please contact EPS AEMS/MERS support." Q
55 . S L=0,DIC=6916.2,FLDS=1,FR=DA,TO=DA,BY="@NUMBER",IOP="HOME",DHD="@"
56 . D EN1^DIP
57 . K DIR S DIR(0)="Y",DIR("A")="OK to sign",DIR("B")="NO" D ^DIR K DIR
58 . Q:'Y!$D(DIRUT)
59 . D SIG^XUSESIG I X1="" W !,"<Invalid Electronic Signature> Signing Aborted." Q
60 . S ENDA="",ENCNT=0
61 . F S ENDA=$O(^TMP($J,"ENSIGN",ENDA)) Q:ENDA="" D
62 . . L +^ENG(6916.3,ENDA):$S($G(DILOCKTM)>5:DILOCKTM,1:5) E D MSG^ENTIRT(ENDA,"Signature") Q
63 . . I $$SIGN^ENTIUTL1(ENDA) S ENCNT=ENCNT+1 K ^TMP($J,"ENSIGN",ENDA)
64 . . L -^ENG(6916.3,ENDA)
65 . W !!,ENCNT," assignment records were signed."
66 . S ENDA=""
67 . F S ENDA=$O(^TMP($J,"ENSIGN",ENDA)) Q:ENDA="" D
68 . . N END,ENERR,ENDAC S ENDAC=ENDA_"," D GETS^DIQ(6916.3,ENDAC,".01;1","E","END","ENERR")
69 . . W !,"Assignment Equip Entry# ",$G(END(6916.3,ENDAC,.01,"E"))," for ",$G(END(6916.3,ENDAC,1,"E"))," was not signed."
70 . . K ^TMP($J,"ENSIGN",ENDA)
71 G LSTSTART:'$D(DIRUT)
72LSTEXIT ;
73 K ^TMP($J,"ENSIGN"),^TMP($J,"ENITTR"),^TMP($J,"INDX"),^TMP($J,"SCR")
74 Q
75SIGNOK() ;Ask if want to sign for equipment
76 K DIR S DIR(0)="Y",DIR("A")="Do you want to sign to accept responsibility now",DIR("B")="NO"
77 D ^DIR K DIR
78 Q Y
79 ;
80 ;ENTIRX
Note: See TracBrowser for help on using the repository browser.