source: WorldVistAEHR/trunk/r/TEXT_INTEGRATION_UTILITIES-GMRP-TIU/TIURT.m@ 1154

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

initial load of WorldVistAEHR

File size: 6.7 KB
Line 
1TIURT ; SLC/JER,MAM - Sign On Chart, etc. ;14-MAR-2001 09:52:41 [1/5/04 11:30am]
2 ;;1.0;TEXT INTEGRATION UTILITIES;**71,58,100,176**;Jun 20, 1997
3SIGNCHRT ; Mark signed on chart
4 N TIUCHNG,TIUI,TIUY,Y,DIROUT
5 I '$D(VALMY) D EN^VALM2(XQORNOD(0))
6 S TIUI=0
7 F S TIUI=$O(VALMY(TIUI)) Q:+TIUI'>0 D Q:$D(DIROUT)
8 . N TIU,DFN,TIUDA,TIUDATA,RSTRCTD
9 . S TIUDATA=$G(^TMP("TIURIDX",$J,TIUI))
10 . S TIUDA=+$P(TIUDATA,U,2) S RSTRCTD=$$DOCRES^TIULRR(TIUDA)
11 . I RSTRCTD D Q
12 . . W !!,$C(7),"Ok, no harm done...",!
13 . . I $$READ^TIUU("EA","RETURN to continue...") ; pause
14 . D EN^VALM("TIU SIGN ON CHART")
15 ; -- Update or Rebuild list: --
16 S TIUCHNG("UPDATE")=1
17 D UPRBLD^TIURL(.TIUCHNG,.VALMY) K VALMY
18 S VALMBCK="R"
19 Q
20SIGCHRT1(TIUDA) ; Single record sign on chart
21 N SIGMSG D FULL^VALM1
22 D OC(TIUDA,.SIGMSG)
23 W !,$G(SIGMSG(1)),!,$G(SIGMSG(2)),! H $S($D(SIGMSG(0)):+SIGMSG(0),1:3)
24 Q
25OC(DA,MSG) ; Mark signed on chart. Edit on-chart signatures.
26 N SIGNER,DIE,DR,Y,TIUSTAT,COSIGNER,TIUDA,COSMODE,SIGMODE
27 N SIGNAME,COSNAME,SIGTITL,COSTITL,TIU0,TIU12,TIU15,TIU16
28 N TIUSFLDS,TIUCFLDS,TIUPSIG,NTIU15
29 S MSG=$$READ^TIUU("YO","Mark this Document 'Signed on chart'/Edit Marked Signature(s)","NO","^D OCSIG^TIUDIRH") ; P71 wording
30 I 'MSG S TIUCHNG=0 G OCX
31 S TIUCHNG=1
32 S TIU0=$G(^TIU(8925,+DA,0)),TIU12=$G(^(12)),TIU15=$G(^(15))
33 S SIGNER=$$PERSNAME^TIULC1(+$P(TIU12,U,4))
34 S COSIGNER=$$PERSNAME^TIULC1(+$P(TIU12,U,8))
35 S SIGMODE=$P(TIU15,U,5),COSMODE=$P(TIU15,U,11)
36 S TIUSTAT=$$STATUS^TIULC(DA)
37 ; P71. Input transform kills null Sig Blk Title but accepts @
38 S TIUSFLDS="1501//NOW;1502//"_SIGNER_";S SIGNAME=$$SIGNAME^TIULS(X),SIGTITL=$$SIGTITL^TIULS(X) S:SIGTITL="""" SIGTITL=""@"";1503///^S X=SIGNAME;1504///^S X=SIGTITL;1505////C" ; user edit Signature flds
39 S TIUCFLDS="1507//NOW;1508//"_COSIGNER_";S COSNAME=$$SIGNAME^TIULS(X),COSTITL=$$SIGTITL^TIULS(X) S:COSTITL="""" COSTITL=""@"";1509///^S X=COSNAME;1510///^S X=COSTITL;1511////C" ; user edit Co-signature flds
40 I TIUSTAT="completed",(SIGMODE="C") S DR=TIUSFLDS ; user edit sig
41 I TIUSTAT="completed"&(COSMODE="C") S DR=TIUCFLDS ; user edit co-sig
42 I TIUSTAT="uncosigned"&(SIGMODE'="C") S DR=TIUCFLDS ; new co-signature
43 I $S(TIUSTAT="unsigned":1,COSMODE="C"&(SIGMODE="C"):1,SIGMODE="C"&(TIUSTAT="uncosigned"):1,1:0) D
44 . N TIUWHO
45 . I (COSIGNER]""),(SIGNER'=COSIGNER) S TIUWHO=$P($$READ^TIUU("SO^S:signer;C:cosigner;B:both","Which signatures are on chart?","both"),U)
46 . E S TIUWHO="S"
47 . ; TIUWHO=S if expsigner=expcosigner or if there is no expcosigner,
48 . ; or if user answered S.
49 . I $S('$L(TIUWHO):1,"SCB"'[$P(TIUWHO,U):1,1:0) Q
50 . I TIUWHO="S" S DR=TIUSFLDS
51 . I TIUWHO="C" S DR=TIUCFLDS_";1513////"_DUZ
52 . I TIUWHO="B" S DR=TIUSFLDS_";"_TIUCFLDS_";1513////"_DUZ
53 I TIUSTAT="uncosigned" S DR=DR_";1513////"_DUZ
54 I $D(DR) S DR=DR_";1512////"_DUZ
55 I '$D(DR) D G OCX
56 . S MSG(1)=" No signatures available to mark 'Signed on chart' or edit"
57 . S TIU16=$G(^TIU(8925,DA,16))
58 . I (TIUSTAT="amended"),'$P(TIU16,U,3) S MSG(1)=" 'Chart' amendment signatures are automatic; can't edit",MSG(0)="5HANG"
59 S DIE=8925 D ^DIE S NTIU15=$G(^TIU(8925,+DA,15))
60 D OCDELETE(DA,TIU15,.NTIU15,.MSG)
61 ; If user left docmt co-signed but not signed, then stuff signer
62 ; with cosigner data (and P71 - avoid ^(15)):
63 I $P(NTIU15,U,7),'$P(NTIU15,U) D STUFFSIG(DA,.NTIU15)
64 ; P71 If user left docmt signed but uncosigned, and entered expected
65 ; cosigner for signer, then stuff cosigner with signer data:
66 I $P(NTIU15,U),'$P(NTIU15,U,7),$P(NTIU15,U,2)=$P(TIU12,U,8) D STUFFCOS(DA,.NTIU15)
67 S TIUDA=DA D UPDATE^TIUU
68 ; P71 Do alert AFTER status update so alert to cosigner=signer is
69 ; deleted if complete:
70 S DR=".05///"_$$STATUS^TIULC(+DA),DIE=8925 D ^DIE
71 S TIU0=$G(^TIU(8925,DA,0))
72 D SEND^TIUALRT(+DA)
73 D SIGNIRT^TIUDIRT(+DA)
74 ; post-signature action
75 S TIUPSIG=$$POSTSIGN^TIULC1(+TIU0)
76 I +$L(TIUPSIG),(+$P(TIU0,U,5)>6) X TIUPSIG
77OCX I $D(MSG)<10 S MSG(1)=" On chart signature data NOT changed."
78 Q
79 ;
80OCDELETE(DA,TIU15,NTIU15,MSG) ; Clean up data if signers/dates deleted or
81 ; partially deleted
82 N TIUSFLDS,TIUCFLDS,DR,DIE,X,Y
83 S TIUSFLDS="1501///@;1502///@;1503///@;1504///@;1505///@"
84 S TIUCFLDS="1507///@;1508///@;1509///@;1510///@;1511///@"
85 D ; If user altered sign flds and they are deleted or partially
86 . ; deleted, then delete sign flds:
87 . I $P(NTIU15,U)=$P(TIU15,U),$P(NTIU15,U,2)=$P(TIU15,U,2) Q
88 . S MSG(1)=$S($P(NTIU15,U)&'$P(TIU15,U):" Marked 'Signed on chart'",1:" On chart signature edited")
89 . I $P(NTIU15,U)=""!($P(NTIU15,U,2)="") D
90 . . S DR=TIUSFLDS,DIE=8925 D ^DIE S NTIU15=$G(^TIU(8925,+DA,15))
91 . . S MSG(1)=$S('(($P(NTIU15,U)="")&($P(NTIU15,U,2)="")):" Incomplete on chart signature. Deleted.",1:" On chart signature deleted.")
92 D ; If user altered co-sign flds and they are deleted or partially
93 . ; deleted, then delete co-sign flds:
94 . I $P(NTIU15,U,7)=$P(TIU15,U,7),$P(NTIU15,U,8)=$P(TIU15,U,8) Q
95 . S MSG(2)=$S($P(NTIU15,U,7)&'$P(TIU15,U,8):" Marked 'Cosigned on chart'",1:" On chart co-signature edited")
96 . I $P(NTIU15,U,7)=""!($P(NTIU15,U,8)="") D
97 . . S DR=TIUCFLDS,DIE=8925 D ^DIE S NTIU15=$G(^TIU(8925,+DA,15))
98 . . S MSG(2)=$S('(($P(NTIU15,U,7)="")&($P(NTIU15,U,8)="")):" Incomplete on chart co-signature. Deleted.",1:" On chart co-signature deleted.")
99 D ; If user deleted sign flds, but docmt is cosigned, then
100 . ; stuff sign data with co-sign data:
101 . I $P(NTIU15,U)=$P(TIU15,U),$P(NTIU15,U,2)=$P(TIU15,U,2) Q
102 . I $P(NTIU15,U)="",$P(NTIU15,U,7)'="" D STUFFSIG(DA,.NTIU15) S MSG(1)=" On chart signer deleted, auto-replaced with cosigner.",MSG(0)="4HANG"
103 D ; If user deleted co-sign flds, and docmt is signed, and
104 . ; signer = deleted cosigner, then delete sign flds:
105 . I $P(NTIU15,U,7)=$P(TIU15,U,7),$P(NTIU15,U,8)=$P(TIU15,U,8) Q
106 . I $P(NTIU15,U,7)="",$P(NTIU15,U),$P(NTIU15,U,2)=$P(TIU15,U,8) S DR=TIUSFLDS,DIE=8925 D ^DIE S NTIU15=$G(^TIU(8925,+DA,15)) S MSG(2)=" On chart signatures deleted."
107 Q
108 ;
109STUFFSIG(DA,TIU15) ; Stuff sig flds w/ TIU15 co-sig flds
110 ; TIU15 must be current when received, is returned updated.
111 N TIUSTUFF,DR,DIE,X,Y
112 S TIUSTUFF="1501////"_$$NOW^TIULC_";1502////^S X=$P(TIU15,U,8);1503////^S X=$P(TIU15,U,9);1504////^S X=$P(TIU15,U,10);1505////C" ; stuff Signer data w/ Cosigner data
113 S DR=TIUSTUFF,DIE=8925 D ^DIE S TIU15=$G(^TIU(8925,+DA,15))
114 ; Editing 1501 resets ACLEC xref even tho' it's cosigned, so until that can be fixed, rekill ACLEC by resetting 1507:
115 S DR="1507////"_$$NOW^TIULC,DIE=8925 D ^DIE S TIU15=$G(^TIU(8925,+DA,15))
116 Q
117 ;
118STUFFCOS(DA,TIU15) ; Stuff co-sig flds w/ TIU15 sig flds
119 ; TIU15 must be current when received, is returned updated.
120 N TIUCTUFF,DR,DIE,X,Y
121 S TIUCTUFF="1507////"_$$NOW^TIULC_";1508////^S X=$P(TIU15,U,2);1509////^S X=$P(TIU15,U,3);1510////^S X=$P(TIU15,U,4);1511////C"
122 S DR=TIUCTUFF,DIE=8925 D ^DIE S TIU15=$G(^TIU(8925,+DA,15))
123 Q
124 ;
Note: See TracBrowser for help on using the repository browser.