source: WorldVistAEHR/trunk/r/VA_FILEMAN-ARJT-DI-DD-DM-DT-%DT-%RCR/DDSM1.m@ 623

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

initial load of WorldVistAEHR

File size: 3.4 KB
RevLine 
[613]1DDSM1 ;SFISC/MKO-MULTILINE, LOAD AND DELETE ;9:49 AM 20 Apr 1999
2 ;;22.0;VA FileMan;**8**;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5LOAD(DDSIEN) ;Load subentries
6MLOAD ;Entry point from MLOAD^DDSUTL
7 ;@DDSIEN is an array of record numbers
8 ;
9 Q:$D(DDSIEN)[0
10 Q:$D(@DDSIEN)<9
11 ;
12 N DDSI,DDSPDA,DDSRN,DDSSN
13 S DDSPDA=$P(DDSREP,U)
14 S DDSSN=$O(@DDSREFT@(DDSPG,DDSBK,DDSPDA," "),-1)
15 ;
16 ;Add records to internal ^TMP array
17 ;Load data for each record
18 S DDSI="" F S DDSI=$O(@DDSIEN@(DDSI)) Q:DDSI="" D
19 . S DDSRN=@DDSIEN@(DDSI) Q:'DDSRN
20 . S DA=+DDSRN,$P(DDSDA,",")=DA,@("D"_DDSDL)=DA
21 . I $D(@DDSREFT@(DDSPG,DDSBK,DDSPDA,"B",DDSDA))[0 D
22 .. S DDSSN=DDSSN+1
23 .. S @DDSREFT@(DDSPG,DDSBK,DDSPDA,"B",DDSDA)=DDSSN
24 .. S @DDSREFT@(DDSPG,DDSBK,DDSPDA,DDSSN)=DDSDA
25 .. S ^("ADD")=$G(@DDSREFT@("ADD"))+1,^("ADD",^("ADD"))=DDSDA_DIE
26 . D ^DDS11(DDSBK)
27 . S DDSCHG=1
28 ;
29 ;Position the cursor on blank (Select) line
30 ;Repaint all lines in the repeating block
31 D POSSN^DDSM(999999999999)
32 D DMULTN^DDSR(DDSPG,DDSBK,DDSPDA,$P(DDSREP,U,5),1)
33 ;
34 ;Update DIR0
35 S DIR0=$P(@DDSREFS@(DDSPG,DDSBK,DDO,"D"),U,1,3)
36 S:$P($G(DDSREP),U,3)>1 $P(DIR0,U)=$P(DIR0,U)+$P(DDSREP,U,3)-1
37 Q
38 ;
39DEL(DDSIEN) ;Delete subentries
40MDEL ;Entry point from MDEL^DDSUTL
41 ;In:
42 ; If DDSIEN contains a record number, delete that one (G MDELONE)
43 ; If DDSIEN contains a closed root, @DDSIEN is an array
44 ; of record numbers to delete
45 ; DIE = global root
46 ; DDSDA = current IENS
47 ;
48 Q:$D(DDSIEN)[0
49 G:+$P(DDSIEN,"E") MDELONE
50 Q:$D(@DDSIEN)<9
51 ;
52 N DDSI,DDSPDA,DDSRN,DDSSN
53 S DDSPDA=$P(DDSREP,U)
54 ;
55 ;Loop through passed array and delete subentries
56 S DDSI="" F S DDSI=$O(@DDSIEN@(DDSI)) Q:DDSI="" D
57 . ;S DDSRN=@DDSIEN@(DDSI) Q:'DDSRN
58 . ;S DDSIENS=DDSDA,$P(DDSIENS,",")=+DDSRN
59 . ;D K^DDS6(DDSIENS,DIE)
60 . ;Q
61 . ;
62 . S DDSRN=@DDSIEN@(DDSI) Q:'DDSRN
63 . S DA=+DDSRN,$P(DDSDA,",")=DA
64 . S DDSSN=$G(@DDSREFT@(DDSPG,DDSBK,DDSPDA,"B",DDSDA)) Q:'DDSSN
65 . K @DDSREFT@(DDSPG,DDSBK,DDSPDA,"B",DDSDA)
66 . K @DDSREFT@(DDSPG,DDSBK,DDSPDA,DDSSN)
67 . K @DDSREFT@("F"_DDP,DDSDA)
68 . K @DDSREFT@("F0",DDSDA)
69 ;
70 ;Close up gaps in ^TMP array
71 S (DDSI,DDSSN)=0
72 F S DDSI=$O(@DDSREFT@(DDSPG,DDSBK,DDSPDA,DDSI)) Q:'DDSI D
73 . S DDSSN=DDSSN+1 Q:DDSI=DDSSN
74 . S DDSRN=@DDSREFT@(DDSPG,DDSBK,DDSPDA,DDSI)
75 . S @DDSREFT@(DDSPG,DDSBK,DDSPDA,DDSSN)=DDSRN
76 . S @DDSREFT@(DDSPG,DDSBK,DDSPDA,"B",DDSRN)=DDSSN
77 ;
78 F S DDSSN=$O(@DDSREFT@(DDSPG,DDSBK,DDSPDA,DDSSN)) Q:'DDSSN D
79 . K @DDSREFT@(DDSPG,DDSBK,DDSPDA,DDSSN)
80 ;
81 ;Position cursor on "Select" line
82 ;Repaint all lines in repeating block
83 D POSSN^DDSM(999999999999,1)
84 ;
85 ;Update DIR0
86 S DIR0=$P(@DDSREFS@(DDSPG,DDSBK,DDO,"D"),U,1,3)
87 S:$P($G(DDSREP),U,3)>1 $P(DIR0,U)=$P(DIR0,U)+$P(DDSREP,U,3)-1
88 Q
89 ;
90MDELONE ;Delete one subentry in the current repeating block
91 ;In: DDSIEN = IENS of record to be deleted
92 ; DDSREP = data for repeating blocks
93 ; DDSDA = current IENS
94 ; DIE = current global root
95 ;
96 N DDSPDA,DDSRN,DDSSN
97 ;
98 ;Get parent IENS
99 S DDSPDA=$P(DDSREP,U)
100 ;
101 ;Kill all data pertaining to current (sub)record
102 D K^DDS6(DDSIEN,DIE)
103 ;
104 ;Repaint lines and reposition cursor
105 I DDSDA=DDSIEN D
106 . D DMULTN^DDSR(DDSPG,DDSBK,DDSPDA,$P(DDSREP,U,5),$P(DDSREP,U,3))
107 . S DDSSN=$P(DDSREP,U,4)
108 . I $D(@DDSREFT@(DDSPG,DDSBK,DDSPDA,DDSSN))[0 D
109 .. S DDSSN=$O(@DDSREFT@(DDSPG,DDSBK,DDSPDA,DDSSN),-1)
110 . D POSSN^DDSM(DDSSN)
111 ;
112 E D POSSN^DDSM(999999999999,1)
113 ;
114 ;Update DIR0
115 S DIR0=$P(@DDSREFS@(DDSPG,DDSBK,DDO,"D"),U,1,3)
116 S:$P($G(DDSREP),U,3)>1 $P(DIR0,U)=$P(DIR0,U)+$P(DDSREP,U,3)-1
117 Q
Note: See TracBrowser for help on using the repository browser.