| 1 | TIUALFUN ;SLC/AJB - TIU Alert Functions; Mar 17, 2003 | 
|---|
| 2 | ;;1.0;TEXT INTEGRATION UTILITIES;**158**;Jun 20, 1997 | 
|---|
| 3 | ; | 
|---|
| 4 | Q | 
|---|
| 5 | ALRTDEL ; | 
|---|
| 6 | S TIU("DELETE")=1 | 
|---|
| 7 | S TIU("MSG")="     Delete Alerts for the following documents:" | 
|---|
| 8 | D RESEND | 
|---|
| 9 | K TIU("DELETE"),TIU("MSG") | 
|---|
| 10 | Q | 
|---|
| 11 | ASKUSR ; | 
|---|
| 12 | N TIUTMP | 
|---|
| 13 | D   I TIUTMP("ASK")=-1 S TIU("QUIT")=1 Q | 
|---|
| 14 | . N DIR,POP,TIUCONT,X,Y | 
|---|
| 15 | . S DIR(0)="SA^1:Browse Document;2:Combination Alerts;3:Delete Alerts;4:Detailed Display;5:Edit a Document;6:Identify Signers;7:Resend Alerts;8:Third Party Alerts" | 
|---|
| 16 | . S DIR("A")="Select ACTION: " | 
|---|
| 17 | . S DIR("B")="RESEND ALERTS" | 
|---|
| 18 | . S DIR("L",1)="1.  Browse a Document   4.  Detailed Display    7.  Resend Alerts" | 
|---|
| 19 | . S DIR("L",2)="2.  Combination Alerts  5.  Edit a Document     8.  Third Party Alerts" | 
|---|
| 20 | . S DIR("L",3)="3.  Delete Alerts       6.  Identify Signers" | 
|---|
| 21 | . S DIR("L",4)="" | 
|---|
| 22 | . S DIR("L")="Enter selection by typing the name, number, or abbreviation" | 
|---|
| 23 | . S DIR("?",1)="The following actions are available:" | 
|---|
| 24 | . S DIR("?",2)="Browse a Document  - View a selected document (if authorized)" | 
|---|
| 25 | . S DIR("?",3)="Combination Alerts - Send alerts to expected signers and 3rd parties" | 
|---|
| 26 | . S DIR("?",4)="Delete Alerts      - Delete a document's alerts" | 
|---|
| 27 | . S DIR("?",5)="Detailed Display   - View detailed display of a document (if authorized)" | 
|---|
| 28 | . S DIR("?",6)="Edit a Document    - Edit a selected document (if authorized)" | 
|---|
| 29 | . S DIR("?",7)="Identify Signers   - Identify/Change Signers of a document (if authorized)" | 
|---|
| 30 | . S DIR("?",8)="Resend Alerts      - Resend alerts to expected signers" | 
|---|
| 31 | . S DIR("?")="Third Party Alerts - Send alerts to one or more 3rd parties" | 
|---|
| 32 | . F  D ^DIR D  Q:$G(TIUCONT)!$D(DIRUT) | 
|---|
| 33 | . . I $D(TIUC(2)),+Y=1 W !,"You can only browse one document at a time.  Select another action." Q | 
|---|
| 34 | . . I $D(TIUC(2)),+Y=4 W !,"You can only view the detailed display of one document at a time.",!,"Select another action." Q | 
|---|
| 35 | . . I $D(TIUC(2)),+Y=5 W !,"You can only edit one document at a time.  Select another action." Q | 
|---|
| 36 | . . I $D(TIUC(2)),+Y=6 W !,"You can only identify signers one document at a time.  Select another action." Q | 
|---|
| 37 | . . S TIUCONT=1 | 
|---|
| 38 | . S TIUTMP("ASK")=$S(+Y=1:"BROWSE",+Y=2:"COMBO",+Y=3:"ALRTDEL",+Y=4:"DETDISP^TIUALSET",+Y=5:"EDIT^TIUAL1",+Y=6:"IDSIGNER",+Y=7:"RESEND",+Y=8:"THIRD",Y=U:-1,1:-1) | 
|---|
| 39 | D @TIUTMP("ASK") | 
|---|
| 40 | Q | 
|---|
| 41 | BROWSE ; | 
|---|
| 42 | N TEMP,TIUCNT,TIUSEL,TIUQUIK,TIUDA,TIUPRM0,TIUPRM1,TIUPRM3,RSTOK S TIUQUIK=1 | 
|---|
| 43 | K TIUC | 
|---|
| 44 | D FULL^VALM1 | 
|---|
| 45 | I TIU("CNT")=0 W !,"No documents to select." H 3 Q | 
|---|
| 46 | S TIUSEL=$P(XQORNOD(0),"=",2) | 
|---|
| 47 | I TIUSEL="" D  Q:TIUSEL=U!($D(DIRUT)) | 
|---|
| 48 | . N DIR,X,Y | 
|---|
| 49 | . S DIR("A")="Select Document: (1-"_VALMLST_") " | 
|---|
| 50 | . S DIR(0)="NA^1:"_VALMLST | 
|---|
| 51 | . D ^DIR S TIUSEL=Y | 
|---|
| 52 | I $A($E(TIUSEL,$L(TIUSEL)))<48!($A($E(TIUSEL,$L(TIUSEL)))>57) S TIUSEL=$E(TIUSEL,1,$L(TIUSEL)-1) | 
|---|
| 53 | F X=1:1  Q:$P(TIUSEL,",",X)=""  S TIUC($P(TIUSEL,",",X))=$O(@VALMAR@("IDX",$P(TIUSEL,",",X),"")) | 
|---|
| 54 | S TIUDA=TIUC(TIUSEL) | 
|---|
| 55 | S RSTOK=$$DOCCHK^TIULRR(TIUDA) | 
|---|
| 56 | I RSTOK'>0 D  Q | 
|---|
| 57 | . W !!,$C(7),"Ok, no harm done...",! ; Echo denial message | 
|---|
| 58 | . I $$READ^TIUU("EA","RETURN to continue...") ; pause | 
|---|
| 59 | I $P(^TIU(8925,+TIUDA,0),U,5)'<7,'+$$ISSIGNR^TIUALRT(TIUDA,DUZ) | 
|---|
| 60 | D:'$D(TIUPRM0)!'$D(TIUPRM1) SETPARM^TIULE | 
|---|
| 61 | S TEMP("CNT")=TIU("CNT"),TEMP("P")=TIU("P"),TEMP("S")=TIU("S") | 
|---|
| 62 | S TEMP("D",1)=TIU("D",1),TEMP("D",2)=TIU("D",2) | 
|---|
| 63 | S TEMP="" | 
|---|
| 64 | F  S TEMP=$O(TIU("C",TEMP)) Q:TEMP=""  S TEMP("C",TEMP)=TIU("C",TEMP) | 
|---|
| 65 | F TIUCNT=1:1:TIU("S") S TEMP("S",TIUCNT)=TIU("S",TIUCNT) S $P(TEMP("S",TIUCNT),U)=$S(+TEMP("S",TIUCNT)=10:14,+TEMP("S",TIUCNT)=11:15,1:+TEMP("S",TIUCNT)) | 
|---|
| 66 | K TIU D EN^VALM("TIU BROWSE FOR READ ONLY") | 
|---|
| 67 | S TIU("CNT")=TEMP("CNT"),TIU("P")=TEMP("P"),TIU("S")=TEMP("S") | 
|---|
| 68 | S TEMP="" | 
|---|
| 69 | F  S TEMP=$O(TEMP("C",TEMP)) Q:TEMP=""  S TIU("C",TEMP)=TEMP("C",TEMP) | 
|---|
| 70 | S TIU("D",1)=TEMP("D",1),TIU("D",2)=TEMP("D",2) | 
|---|
| 71 | F TIUCNT=1:1:TEMP("S") S TIU("S",TIUCNT)=TEMP("S",TIUCNT) S $P(TIU("S",TIUCNT),U)=$S(+TIU("S",TIUCNT)=10:14,+TIU("S",TIUCNT)=11:15,1:+TIU("S",TIUCNT)) | 
|---|
| 72 | Q | 
|---|
| 73 | COMBO ; | 
|---|
| 74 | I TIU("CNT")=0 W !,"No documents to select." H 3 Q | 
|---|
| 75 | S TIUTMP("CMSG")=1,TIU("MSG")="     Send COMBINATION Alerts for the following documents:" | 
|---|
| 76 | S TIUTMP("THIRD PARTY ALERTS")="",TIUTMP("NODEL")="" | 
|---|
| 77 | D USERS | 
|---|
| 78 | K TIUTMP("CMSG"),TIU("MSG") | 
|---|
| 79 | Q | 
|---|
| 80 | RESEND ; | 
|---|
| 81 | I TIU("CNT")=0 W !,"No documents to select." H 3 Q | 
|---|
| 82 | N DIR,TIUCNT,TIUDA,TIUDIV1,TIUOD,TIUPRM0,TIUPRM1,TIUQUIT,X,Y | 
|---|
| 83 | ; | 
|---|
| 84 | I '$D(TIU("MSG")) S TIU("MSG")="     Resend Alerts for the following documents:" | 
|---|
| 85 | W @IOF,!,TIU("MSG"),!! | 
|---|
| 86 | S TIUCNT="",TIUCNT(1)=0,TIUCNT(2)=19 | 
|---|
| 87 | F  S TIUCNT(1)=TIUCNT(1)+1,TIUCNT=$O(TIUC(TIUCNT)) W:TIUCNT=""&($G(Y)'=0) ! Q:TIUCNT=""  W $E(@VALMAR@(TIUCNT,0),1,80) D:TIUCNT(1)#TIUCNT(2)=0 | 
|---|
| 88 | . S TIUCNT(2)=TIUCNT(2)+21 | 
|---|
| 89 | . N DIR S DIR(0)="E" W ! D ^DIR W !! I Y=0 S TIUCNT="",TIUCNT=$O(TIUC(TIUCNT),-1) | 
|---|
| 90 | S DIR(0)="Y",DIR("A")="     Send these alerts as OVERDUE",DIR("B")="NO" | 
|---|
| 91 | I '$D(TIU("DELETE")) D ^DIR S TIUOD=+Y Q:TIUOD=U!($D(DIRUT))  W ! | 
|---|
| 92 | S DIR(0)="Y",DIR("A")="     Is this correct",DIR("B")="YES" | 
|---|
| 93 | D ^DIR I +Y'=1 S TIUQUIT=1 Q | 
|---|
| 94 | I $G(TIUTMP("CMSG"))=1 F  S TIUCNT=$O(TIUC(TIUCNT)) Q:TIUCNT=""  D ALERTDEL^TIUALRT(TIUC(TIUCNT)) | 
|---|
| 95 | I '$D(TIU("DELETE")) W !!,"     Sending Alerts..." | 
|---|
| 96 | I $D(TIU("DELETE")) W !!,"     Deleting Alerts..." | 
|---|
| 97 | S TIUCNT="" | 
|---|
| 98 | I '$D(TIU("DELETE")) D | 
|---|
| 99 | . F  S TIUCNT=$O(TIUC(TIUCNT)) Q:TIUCNT=""  W "." D SEND^TIUALRT(TIUC(TIUCNT),TIUOD) | 
|---|
| 100 | . K TIUTMP("THIRD PARTY ALERTS") | 
|---|
| 101 | . I $G(TIUTMP("CMSG"))=1 S TIUCNT="" F  S TIUCNT=$O(TIUC(TIUCNT)) Q:TIUCNT=""  W "." D SEND^TIUALRT(TIUC(TIUCNT),TIUOD) | 
|---|
| 102 | I $D(TIU("DELETE")) F  S TIUCNT=$O(TIUC(TIUCNT)) Q:TIUCNT=""  W "." D ALERTDEL^TIUALRT(TIUC(TIUCNT)) | 
|---|
| 103 | W !!,"     Finished.",! | 
|---|
| 104 | K DIR S DIR("A")="     Enter RETURN to continue or '^' to exit",DIR(0)="E" D ^DIR | 
|---|
| 105 | K TIUTMP("NODEL") | 
|---|
| 106 | Q | 
|---|
| 107 | SELECT(TIUACT) ; | 
|---|
| 108 | N TIUSEL,X,Y | 
|---|
| 109 | K TIUC | 
|---|
| 110 | D FULL^VALM1 | 
|---|
| 111 | I TIU("CNT")=0 W !,"No documents to select." H 3 Q | 
|---|
| 112 | S TIUSEL=$P(XQORNOD(0),"=",2) | 
|---|
| 113 | I TIUSEL="" D  Q:Y=U | 
|---|
| 114 | . N DIR | 
|---|
| 115 | . S DIR("A")="Select Document(s): (1-"_VALMLST_") " | 
|---|
| 116 | . S DIR(0)="LAC^1:"_VALMLST | 
|---|
| 117 | . D ^DIR I $D(DIRUT)!(Y=U) S Y=U Q | 
|---|
| 118 | . S TIUSEL=Y(0) | 
|---|
| 119 | I $A($E(TIUSEL,$L(TIUSEL)))<48!($A($E(TIUSEL,$L(TIUSEL)))>57) S TIUSEL=$E(TIUSEL,1,$L(TIUSEL)-1) | 
|---|
| 120 | F X=1:1  Q:$P(TIUSEL,",",X)=""  D | 
|---|
| 121 | . N TIUCNT | 
|---|
| 122 | . I $P(TIUSEL,",",X)["-" F TIUCNT=+$P(TIUSEL,",",X):1:$P($P(TIUSEL,",",X),"-",2) S TIUC(TIUCNT)=$O(@VALMAR@("IDX",TIUCNT,"")) | 
|---|
| 123 | . E  S TIUC($P(TIUSEL,",",X))=$O(@VALMAR@("IDX",$P(TIUSEL,",",X),"")) | 
|---|
| 124 | D @TIUACT | 
|---|
| 125 | Q | 
|---|
| 126 | THIRD ; | 
|---|
| 127 | I TIU("CNT")=0 W !,"No documents to select." H 3 Q | 
|---|
| 128 | S TIU("MSG")="     Send 3rd Party Alerts for the following documents:" | 
|---|
| 129 | S TIUTMP("THIRD PARTY ALERTS")="",TIUTMP("NODEL")="" | 
|---|
| 130 | D USERS | 
|---|
| 131 | K TIU("MSG") | 
|---|
| 132 | Q | 
|---|
| 133 | USERS ; | 
|---|
| 134 | N TIUQUIT,TIUREM,TIUXQA | 
|---|
| 135 | K TIU("3RD"),TIU("CONTINUE") | 
|---|
| 136 | F  D  Q:$G(TIUQUIT)=1!($G(TIU("CONTINUE"))=1) | 
|---|
| 137 | . N DIC,DIR,POP,TIUCNT,X,Y | 
|---|
| 138 | . W @IOF,! | 
|---|
| 139 | . W "     Enter the name(s) of individuals to receive an alert for the selected",! | 
|---|
| 140 | . W "     document(s).",!! | 
|---|
| 141 | . W "     Kernel will not send alerts to Inactive users; they cannot be",! | 
|---|
| 142 | . W "     selected.",!! | 
|---|
| 143 | . W "     Enter RETURN or '^' to finish selections.",! | 
|---|
| 144 | . S TIUCNT=0,DIC="^VA(200,",DIC("S")="I '$P(^(0),U,7)" | 
|---|
| 145 | . S DIC(0)="AEMQ",DIC("A")="     Enter 3RD PARTY RECIPIENT(S): " | 
|---|
| 146 | . F  D ^DIC Q:Y=-1  D  Q:$G(TIUQUIT)=1  K TIUREM | 
|---|
| 147 | . . N TIUDA,TIUASK S TIUDA="" F  S TIUDA=$O(TIUC(TIUDA)) Q:TIUDA=""  I '$G(TIUASK),'$$CANDO(TIUC(TIUDA),+Y) D | 
|---|
| 148 | . . . S TIUASK=1 | 
|---|
| 149 | . . . W !!?5,"Because ",$E($$GET1^DIQ(200,+Y,.01),1,15)," may not be able to SIGN/COSIGN some or all of the" | 
|---|
| 150 | . . . W !?5,"selected documents, they may be unable to resolve the resulting alerts.",! | 
|---|
| 151 | . . . N DIR,X,Y S DIR(0)="Y",DIR("A")="     Remove",DIR("B")="YES" | 
|---|
| 152 | . . . D ^DIR I Y=U!($D(DIRUT)) S TIUQUIT=1 Q | 
|---|
| 153 | . . . I +Y S TIUREM=1 W ! | 
|---|
| 154 | . . S:'$G(TIUREM) TIUCNT=TIUCNT+1,TIU("3RD",+Y)="" S:TIUCNT=1 DIC("A")="                              and  " | 
|---|
| 155 | . Q:$G(TIUQUIT)=1 | 
|---|
| 156 | . I TIUCNT=0 W !!,"     No selections made.",! S DIR("A")="     Enter RETURN to continue or '^' to exit",DIR(0)="E" D ^DIR S TIUQUIT=1 Q | 
|---|
| 157 | . W !!,$S(TIUCNT>1:"     Send 3rd Party Alerts to the following individuals: ",1:"     Send 3rd Party Alerts to the following individual: "),!! | 
|---|
| 158 | . S X="" F  S X=$O(TIU("3RD",X)) Q:X=""  S TIUXQA(X)="" W ?5,$$GET1^DIQ(200,X_",",.01),! | 
|---|
| 159 | . S DIR(0)="Y",DIR("A")="     Is this correct",DIR("B")="YES" | 
|---|
| 160 | . D ^DIR I +Y'=1 W !! K TIU("3RD"),TIUXQA S:Y=U TIUQUIT=1 Q | 
|---|
| 161 | . S TIU("CONTINUE")=1 | 
|---|
| 162 | Q:$G(TIUQUIT)=1 | 
|---|
| 163 | D RESEND | 
|---|
| 164 | Q | 
|---|
| 165 | ; | 
|---|
| 166 | CANDO(TIUDA,PERSON) ; | 
|---|
| 167 | N TIUACT | 
|---|
| 168 | S TIUACT="SIGNATURE" I $$CANDO^TIULP(TIUDA,TIUACT,PERSON) Q 1 | 
|---|
| 169 | S TIUACT="COSIGNATURE" I $$CANDO^TIULP(TIUDA,TIUACT,PERSON) Q 1 | 
|---|
| 170 | Q 0 | 
|---|
| 171 | IDSIGNER ; | 
|---|
| 172 | N D,DIC,TIUCHNG,TIUDA,TIUDCSNR,TIUDIV1,TIUFPRIV,TIUPRM0,TIUPRM1,TIUSEL,X,Y | 
|---|
| 173 | D FULL^VALM1 | 
|---|
| 174 | I TIU("CNT")=0 W !,"No documents to select." H 3 Q | 
|---|
| 175 | S TIUSEL=$P(XQORNOD(0),"=",2) | 
|---|
| 176 | I TIUSEL="" D  Q:TIUSEL=U!($D(DIRUT)) | 
|---|
| 177 | . N DIR,X,Y | 
|---|
| 178 | . S DIR("A")="Select Document: (1-"_VALMLST_") " | 
|---|
| 179 | . S DIR(0)="NA^1:"_VALMLST | 
|---|
| 180 | . D ^DIR S TIUSEL=Y | 
|---|
| 181 | I $A($E(TIUSEL,$L(TIUSEL)))<48!($A($E(TIUSEL,$L(TIUSEL)))>57) S TIUSEL=$E(TIUSEL,1,$L(TIUSEL)-1) | 
|---|
| 182 | F X=1:1  Q:$P(TIUSEL,",",X)=""  S TIUC($P(TIUSEL,",",X))=$O(@VALMAR@("IDX",$P(TIUSEL,",",X),"")) | 
|---|
| 183 | S TIUDA=TIUC(TIUSEL) | 
|---|
| 184 | D SIGNER^TIURA1 | 
|---|
| 185 | D UPDATE^TIUALSET | 
|---|
| 186 | Q | 
|---|