source: WorldVistAEHR/trunk/r/MEDICINE-MC/MCESEDT.m@ 701

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

initial load of WorldVistAEHR

File size: 4.9 KB
Line 
1MCESEDT ;WISC/DCB-ELECTRONIC SIGNATURE PART 1 ; 2/6/03 9:15am
2 ;;2.3;Medicine;**18,37**;09/13/1996
3 ;
4 ;
5POST(MCFILE,MCREC) ;Get the info about screen and set-up for edit.
6 Q:'MCESON
7 D ENS^%ZISS
8 N ERROR,HDUZ,HOLD,LOOP,MDAT1,MDAT2,NAME,REC,NEWREC,NEWST,ORG,PROV,RNV,SCRAMBLE,SREC,STATUS,TDATE,TEMP,TEMP1,TY,X1,XDUZ,NCHANGE,LINE,XDATE,DIE,DA,DR,CREAT,SUP,DJDN,CODE,CDUZ,EE,DTOUT,DUOUT,DIRUT,DIROUT
9 S RNV=+$P($G(^MCAR(697.2,MCARGNUM,0)),U,17)
10 S ERROR=0,REC=MCREC,NCHANGE=0,(ORG,TEMP)=$G(^MCAR(MCFILE,REC,"ES")),EXIT=0,CODE=$P(TEMP,U,7),PROV=$$ESTONUM1^MCESSCR(CODE),$P(LINE,"_",80)="",MCESPED=TEMP,SUP="" K NEWST
11 S LOOP=PROV
12 I $P(TEMP,U,5)="" S XDUZ=1
13 ;I CODE<3,($P(ORG,U,1)="") S $P(TEMP,U,1)=DUZ,$P(ORG,U,1)=DUZ
14 I PROV<3,($P(ORG,U,1)="") S $P(TEMP,U,1)=DUZ,$P(ORG,U,1)=DUZ
15 E S XDUZ=4
16 S XDUZ=+$P(TEMP,U,XDUZ)
17 I 'MCESSEC D EDD^MCESEDT2 S ^MCAR(MCFILE,MCARGDA,"ES")=TEMP Q
18 S CREAT=$$GETDATE(15)
19 I PROV<1!(PROV>7) S PROV=1
20 I PROV=8 Q
21 S Y=$P(^MCAR(MCFILE,REC,0),U,1) D DD^%DT
22 S MDAT1=Y,MDAT2=$P($G(^MCAR(MCFILE,REC,0)),U,2),MDAT2=$P($G(^MCAR(690,+MDAT2,0)),U,1),MDAT2=$P($G(^DPT(+MDAT2,0)),U,1)
23 S STATUS=$$STATUS(MCFILE,CODE)
24 I PROV<3 S TDATE=$$GETDATE(3)
25 E I PROV=3!(PROV=4)!(PROV=6)!(PROV=7) S TDATE=$$GETDATE(9)
26 E I PROV=5 S TDATE=$$GETDATE(8)
27 D HEADER
28 I $P($G(^MCAR(MCFILE,REC,"ES")),U,7)="" D EDITD S ERROR=0 G SKIP
29 I $D(MCBACK) D EDITSS K MCBACK G SKIP
30 W !!!
31 S DIR(0)="Y",DIR("A")=IOINHI_"Do you want to change the release status"_IOINORM,DIR("B")="N" D ^DIR K DIR I $D(DIRUT)!(Y=0) W @IOF N DIE,DA,DR S DIE="^MCAR("_MCFILE_",",DA=REC,DR="1502///NOW" D ^DIE D EXIT Q
32SK ;
33 D HEADER,@("EDIT"_$$NUMTOES^MCESSCR(PROV))
34SKIP ;
35 I EXIT=0 S $P(TEMP,U,7)=SUP_$$NUMTOES^MCESSCR(LOOP) D:LOOP>2 HEADER
36 D:EXIT=0 @("ED"_$$NUMTOES^MCESSCR(LOOP)_"^MCESEDT2")
37 D UPDATE:EXIT=0,NOUPDATE:EXIT=1
38 I '$D(DTOUT) S DIR(0)="E" D ^DIR K DIR
39EXIT ;
40 D KILL^%ZISS W @IOF Q
41UPDATE ;
42 W !!,"Record has been updated with new release information",!!
43 S ORG=$P(ORG,U,7) K:ORG'="" ^MCAR(MCFILE,"ES",ORG,REC)
44 S ^MCAR(MCFILE,REC,"ES")=TEMP,^MCAR(MCFILE,"ES",$P(TEMP,U,7),REC)=""
45 Q
46NOUPDATE ;
47 W !!,"Record has not been updated with new release information",!!
48 ;; ***ORIGINAL*** ;; S ^MCAR(MCFILE,REC,"ES")=ORG
49 ; The 'IF $GET' was added to the set line to prevent dangling
50 ; 'ES' nodes when the user supersedes a record, but up-arrows
51 ; out of the edit and sign-off of the new record.
52 I $G(^MCAR(MCFILE,REC,0))]"" S ^MCAR(MCFILE,REC,"ES")=ORG
53 D DELSS ; NEW LINE
54 Q
55EDITD ;Draft
56EDITPD ;Problem Draft
57 S DIR("B")=PROV,DIR(0)="S^1:Draft;2:Problem Draft;3:Released On-Line Verified;4:Released Off-line Verified"
58 S:RNV'=0 DIR(0)=DIR(0)_";5:Released not Verified"
59 D ASK I EXIT=1,($P($G(^MCAR(MCFILE,REC,"ES")),U,7)="") S TY=1,EXIT=0
60 Q:EXIT=1
61 S LOOP=TY
62 Q
63EDITSRV ;
64 S SUP="S"
65EDITRV ;Released On-Line Verified
66 S DIR("B")=1,DIR(0)="S^1:Released On-Line Verified;2:Supersede" D ASK Q:EXIT=1
67 S:TY=2 SUP="" S LOOP=$S(TY=1:3,TY=2:8) Q
68EDITSROV ;
69 S SUP="S"
70EDITROV ;Released Off-Line Verified
71 S DIR("B")=2,DIR(0)="S^1:Released On-Line Verified;2:Released Off-Line Verified;3:Supersede" D ASK Q:EXIT=1
72 S:TY=3 SUP="" S LOOP=$S(TY=1:3,TY=2:4,TY=3:8) Q
73EDITRNV ;Released Not Verified
74 S DIR("B")=3,DIR(0)="S^1:Released On-Line Verified;2:Released Off-line Verified;3:Released not Verified;4:Supersede" D ASK Q:EXIT=1
75 S LOOP=$S(TY=1:3,TY=2:4,TY=3:5,TY=4:8) Q
76EDITSS ;Superseded Change
77EDITS S SUP="S",DIR("B")=PROV,DIR(0)="S^1:Released On-Line Verified;2:Released Off-line Verified" D ASK
78 I EXIT=1 D DELSS Q
79 S LOOP=$S(TY=1:3,TY=2:4) Q
80DELSS ;
81 Q:'$D(MCESPREV)
82 W !!,"Since you did not sign the procedure results this report will be"
83 W !,"deleted and the superseded report will be convert back the way it was."
84BACKSS ;
85 S ^MCAR(MCFILE,MCESPREV,"ES")=MCESTEMP K ^MCAR(MCFILE,"ES","S",MCESPREV)
86 S ^MCAR(MCFILE,"ES",$P(MCESTEMP,U,7),MCESPREV)="" S DIK="^MCAR("_MCFILE_",",DA=MCARGDA D ^DIK
87 Q
88ASK ;Ask for a status code
89 S DIR("A")=IOINHI_"Please Select a New Status"_IOINORM,DIR("?")="^D HELP^MCESHLP" D ^DIR S TY=Y I $D(DIRUT)!$D(DUOUT)!$D(DTOUT) S EXIT=1
90 I Y=DIR("B"),(PROV>2) S EXIT=1,NCHANGE=1
91 K DIR Q:EXIT=1
92 S NEWST=Y(0) Q
93HEADER ;
94 W @IOF,IODHLT," * * * Release Control * * *",!,IODHLB," * * * Release Control * * *"
95 W !,LINE
96 W:CREAT'[1700 !!,?4,IOINHI,"Created on: ",IOINORM,CREAT
97 W !!,IOINHI,?14,"DATE: ",IOINORM,MDAT1,!,?16,MDAT2,!!,IOINHI,"Current Status: ",IOINORM,IOBON,STATUS,IOBOFF
98 W:TDATE'="" IOINHI," as of ",IOINORM,TDATE
99 S NAME=$$DECODE^MCESPRT(ORG,CODE,MCFILE,MCARGDA)
100 W !,IOINHI,?16,"by: ",IOINORM,NAME
101 I PROV=4 D PROVID
102 I PROV=7!(PROV=8) S Y=$P(TEMP,U,14) D DD^%DT W !!,"This record supersedes record created on ",IOUON,Y,IOUOFF,"."
103 W:$D(NEWST) !!,IOINHI,?8,"New status: ",IOINORM,NEWST
104 W !,LINE Q
105PROVID ;
106 W !,IOINHI,?15,"for: ",IOINORM
107 S HDUZ=+$P(TEMP,U,4)
108 I '$D(^VA(200,HDUZ,0)) W "unknown"
109 E W $P(^VA(200,HDUZ,0),U,1)
110 K HDUZ Q
111GETDATE(EE) ;
112 N Y S Y=$P(TEMP,U,EE) D DD^%DT Q Y
113STATUS(FILE,PROV) ;
114 N Y,C S Y=PROV,C=$P(^DD(FILE,1506,0),U,2) D Y^DIQ
115 S:Y="" Y="DRAFT"
116 Q Y
Note: See TracBrowser for help on using the repository browser.