source: WorldVistAEHR/trunk/r/TEXT_INTEGRATION_UTILITIES-GMRP-TIU/TIURD4.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: 3.8 KB
RevLine 
[613]1TIURD4 ; SLC/JER - Reassign actions ;13-APR-2001 14:29:02
2 ;;1.0;TEXT INTEGRATION UTILITIES;**61,100**;Jun 20, 1997
3FROMTO(TIUDA,TIUDAT) ; Display the from/to information
4 N TIUF,TIUT,TIUDAD,TIUFEDT,TIUFLDT,TIUTEDT,TIUTLDT
5 S TIUDAD=$P($G(^TIU(8925,+TIUDA,0)),U,6)
6 D GETTIU^TIULD(.TIUF,+TIUDAD)
7 D GETTIU^TIULD(.TIUT,+TIUDAT)
8 S TIUFEDT=$$DATE^TIULS($P(TIUF("EDT"),U),"MM/DD/YY")
9 S TIUFLDT=$$DATE^TIULS($P(TIUF("LDT"),U),"MM/DD/YY")
10 S TIUTEDT=$$DATE^TIULS($P(TIUT("EDT"),U),"MM/DD/YY")
11 S TIUTLDT=$$DATE^TIULS($P(TIUT("LDT"),U),"MM/DD/YY")
12 W !!,"You are about to move the addendum as follows:",!
13 W !,?5,"From",?45,"To",!
14 W !,$P(TIUF("DOCTYP"),U,2),?35," --> ",?40,$P(TIUT("DOCTYP"),U,2)
15 W !,TIUF("PNM")," ",TIUF("PID"),?35," --> ",?40,TIUT("PNM")," ",TIUT("PID")
16 W !,TIUFEDT,$S($L(TIUFLDT):" - "_TIUFLDT,1:""),?35," --> "
17 W ?40,TIUTEDT,$S($L(TIUTLDT):" - "_TIUTLDT,1:""),!
18 Q
19UPDSTAT(DA) ; Update the status of the named record
20 N DIE,DR
21 S DIE=8925,DR=".05///^S X=$$STATUS^TIULC(DA)"
22 D ^DIE
23 Q
24LOADSB(TIUODA,TIUADA,TIUOS,TIUAS) ; Load arrays w/Sig Blocks
25 N TIUOD15,TIUAD15
26 S TIUOD15=$G(^TIU(8925,TIUODA,15))
27 S TIUOS("SBN")=$S($P(TIUOD15,U,3)]"":$$DECRYPT(TIUODA,$P(TIUOD15,U,3)),1:"@")
28 S TIUOS("SBT")=$S($P(TIUOD15,U,4)]"":$$DECRYPT(TIUODA,$P(TIUOD15,U,4)),1:"@")
29 S TIUOS("CSBN")=$S($P(TIUOD15,U,9)]"":$$DECRYPT(TIUODA,$P(TIUOD15,U,9)),1:"@")
30 S TIUOS("CSBT")=$S($P(TIUOD15,U,10)]"":$$DECRYPT(TIUODA,$P(TIUOD15,U,10)),1:"@")
31 S TIUAD15=$G(^TIU(8925,TIUADA,15))
32 S TIUAS("SBN")=$S($P(TIUAD15,U,3)]"":$$DECRYPT(TIUADA,$P(TIUAD15,U,3)),1:"@")
33 S TIUAS("SBT")=$S($P(TIUAD15,U,4)]"":$$DECRYPT(TIUADA,$P(TIUAD15,U,4)),1:"@")
34 S TIUAS("CSBN")=$S($P(TIUAD15,U,9)]"":$$DECRYPT(TIUADA,$P(TIUAD15,U,9)),1:"@")
35 S TIUAS("CSBT")=$S($P(TIUAD15,U,10)]"":$$DECRYPT(TIUADA,$P(TIUAD15,U,10)),1:"@")
36 Q
37SWAPSB(TIUODA,TIUADA,TIUOS,TIUAS) ; Swap Signature blocks
38 N DA,DIE,DR
39 S DR="1503///^S X=TIUAS(""SBN"");1504///^S X=TIUAS(""SBT"")"
40 S DR=DR_";1509///^S X=TIUAS(""CSBN"");1510///^S X=TIUAS(""CSBT"")"
41 S DA=TIUODA,DIE="^TIU(8925," D ^DIE K DR
42 S DR="1503///^S X=TIUOS(""SBN"");1504///^S X=TIUOS(""SBT"")"
43 S DR=DR_";1509///^S X=TIUOS(""CSBN"");1510///^S X=TIUOS(""CSBT"")"
44 S DA=TIUADA,DIE="^TIU(8925," D ^DIE K DR
45 Q
46DECRYPT(TIUDA,TIUX) ; Decrypt signature blocks
47 N TIUY
48 S TIUY=$$DECRYPT^TIULC1(TIUX,1,$$CHKSUM^TIULC("^TIU(8925,"_+TIUDA_",""TEXT"")"))
49 Q TIUY
50RECOVER(TIUODA,TIUDA,TIUD0) ; Restore original state on abort
51 N DIE,DR,DA,DIDEL,TIUI
52 W $C(7),$C(7),!!,"Transaction aborted. Restoring records to original state..."
53 ; Loop thru ^TMP("TIURTRCT",$J,DA) and restore prior state
54 I '$D(^TMP("TIURTRCT",$J,TIUODA)) D
55 . W !!,"** Can't Restore to Prior State...'$D(^TMP(""TIURTRCT"",$J,TIUODA)) **"
56 S TIUI=0 F S TIUI=$O(^TMP("TIURTRCT",$J,TIUI)) Q:+TIUI'>0 D
57 . N DIE,DR,X,Y,TIUD0,DA
58 . S DA=TIUI,TIUD0=^TMP("TIURTRCT",$J,DA,0)
59 . S DIE=8925
60 . S DR=".03////^S X=$P(TIUD0,U,3);.05////^S X=$P(TIUD0,U,5);.06////^S X=$P(TIUD0,U,6)"
61 . D ^DIE
62 ; Loop thru ^TMP("TIURTRCT",$J,"NEW",DA) and delete duplicate notes
63 I '$D(^TMP("TIURTRCT",$J,"NEW",TIUDA)) D
64 . W !!,"** Can't Restore to Prior State...'$D(^TMP(""TIURTRCT"",$J,""NEW"",TIUDA)) **"
65 S TIUI=0 F S TIUI=$O(^TMP("TIURTRCT",$J,"NEW",TIUI)) Q:+TIUI'>0 D
66 . D DELDOC(TIUI)
67 H 3
68 Q
69DELDOC(DA) ; Delete document and components--NOT its addenda
70 N DIE,DIDEL,DR,X,Y,TIUDA,TIUI
71 S TIUDA=DA
72 ; First, delete audit trail entries
73 D DELAUDIT^TIUEDI1(TIUDA)
74 D DELSGNRS(TIUDA)
75 ; Next, delete the document's components
76 S TIUI=0 F S TIUI=$O(^TIU(8925,"DAD",TIUDA,TIUI)) Q:+TIUI'>0 D
77 . I +$$ISADDNDM^TIULC1(TIUI) Q
78 . D DELDOC(TIUI)
79 S (DIDEL,DIE)=8925,DR=".01///@"
80 D ^DIE ; Delete duplicate note
81 Q
82DELSGNRS(TIUDA,UNSIGN) ; Remove Additional signers
83 N DA S DA=0
84 F S DA=$O(^TIU(8925.7,"B",TIUDA,DA)) Q:+DA'>0 D
85 . N DIK,DIDEL
86 . I +$G(UNSIGN),(+$P(^TIU(8925.7,DA,0),U,4)>0) Q
87 . S DIK="^TIU(8925.7,",DIDEL=8925.7 D ^DIK
88 Q
Note: See TracBrowser for help on using the repository browser.