source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SCCVPOST.m@ 1147

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

initial load of WorldVistAEHR

File size: 4.1 KB
Line 
1SCCVPOST ;ALB/MJK - Patch SD*5.3*201 Post-Install Routine ; 11/5/97
2 ;;5.3;Scheduling;**211**,Aug 13, 1993
3 ;
4EN ; --- main entry point
5 S U="^"
6 D BMES^XPDUTL("Post-Install Started...")
7 ;
8 ; -- main driver calls
9 D RES,LOGDATA
10 ;
11 D BMES^XPDUTL("Post-Install Finished.")
12 Q
13 ;
14RES ; -- set up resource device
15 N NAME,SLOTS,DESC
16 D BMES^XPDUTL(" >>> SCCV RESOURCE device setup...")
17 S NAME="SCCV RESOURCE"
18 S SLOTS=1
19 S DESC="Scheduling Conversion Resource Device"
20 ;
21 ; -- check to see if device already exists
22 IF $D(^%ZIS(1,"B",NAME)) D G RESQ
23 . D MES^XPDUTL(" ...Device already exists.")
24 ;
25 ; -- create device
26 IF $$RES^XUDHSET(NAME,,SLOTS,DESC)>0 D G RESQ
27 . D MES^XPDUTL(" ...Resource device successfully created.")
28 ;
29 ; -- indicate device creation failed
30 D MES^XPDUTL(" ...Unable to create resource device!")
31RESQ Q
32 ;
33LOGDATA ; -- queue job to transfer 'edited by' & 'date entry made' data
34 N SDUZ,ZTRTN,ZTIO,ZTDESC,ZTDTH,ZTSAVE,ZTSK
35 ;
36 ; -- quit if pre-test
37 IF '$$OK^SCCVU(0) Q
38 ;
39 S SDUZ=$G(DUZ)
40 D BMES^XPDUTL(" >>> Queuing task to transfer log data from Scheduling Visits file")
41 ;
42 ; -- following line in for interactive testing
43 ;D LOGQUE Q
44 ;
45 ; -- has data already been xfer'd
46 IF $P($G(^SD(404.91,1,"CNV")),U,8) D G LOGDATAQ
47 . D MES^XPDUTL(" o Data already has been transferred.")
48 . D MES^XPDUTL(" (No task queued.)")
49 . D MES^XPDUTL(" >>> Done.")
50 ;
51 ; -- queue task
52 S ZTIO=""
53 S ZTRTN="LOGQUE^SCCVPOST"
54 S ZTDESC="Transferring log data from Scheduling Visits file"
55 S ZTDTH=$$NOW^XLFDT()
56 F X="SDUZ" S ZTSAVE(X)=""
57 D ^%ZTLOAD
58 D:$D(ZTSK) MES^XPDUTL(" -> Task: #"_ZTSK)
59 D MES^XPDUTL(" >>> Done.")
60LOGDATAQ Q
61 ;
62LOGQUE ; -- TaskMan entry point to queue log data transfer
63 ;
64 N SDATE,SDOE,DR,DA,DIE,SDSTOP,SDTOT,SDBEG,SDEND,SDDR,SDFIN
65 ;
66 ; -- quit if pre-test
67 IF '$$OK^SCCVU(0) Q
68 ;
69 S SDTOT=0
70 S SDBEG=$$NOW^XLFDT()
71 ;
72 ; -- get date ACRP started on target system ; use as loop start date
73 S SDATE=$P($G(^SD(404.91,1,"AMB")),U,2)
74 ;
75 ; -- get date of last a/e ; use as finish date
76 S SDFIN=$P($O(^SDV("A"),-1),".")_".24"
77 ;
78 ; -- scan ^SCE records
79 F S SDATE=$O(^SCE("B",SDATE)) Q:'SDATE!(SDATE>SDFIN) D S SDSTOP=$$S^%ZTLOAD Q:SDSTOP
80 . S SDOE=0 F S SDOE=$O(^SCE("B",SDATE,SDOE)) Q:'SDOE D
81 . . S SDDR=$$BUILDR(.SDOE)
82 . . IF SDDR]"" D
83 . . . S DIE="^SCE(",DA=SDOE,DR=SDDR D ^DIE
84 . . . S SDTOT=SDTOT+1
85 ;
86 S SDEND=$$NOW^XLFDT()
87 ;
88 ; -- send bulletin
89 D BULL
90 ;
91 ; -- set completion flag
92 S DA=1,DR="908////"_SDEND,DIE="^SD(404.91," D ^DIE
93 ;
94 Q
95 ;
96BUILDR(SDOE) ; -- build DR string
97 ;
98 N SDDR
99 N SDOE0,SDOECNV,SDOEUSER,SDORG,SCEUSR,SCECRE,DFN
100 N SDT,SDCS,SDCS0,SDVUSR,SDVCRE,SDVOE
101 S SDDR=""
102 ;
103 ; -- get sce data
104 S SDOE0=$G(^SCE(SDOE,0))
105 S SDOECNV=$G(^SCE(SDOE,"CNV"))
106 S SDOEUSER=$G(^SCE(SDOE,"USER"))
107 S SDORG=+$P(SDOE0,U,8)
108 S SCEUSR=+SDOEUSER
109 S SCECRE=+$P(SDOECNV,U,2)
110 ;
111 ; -- quit if not an add/edit
112 IF SDORG'=2 G BUILDRQ
113 ;
114 ; -- get sdv data
115 S DFN=+$P(SDOE0,U,2)
116 S SDT=$$SDVIEN^SCCVU(DFN,+SDOE0)
117 S SDCS=$P(SDOE0,U,9)
118 S SDCS0=$G(^SDV(+SDT,"CS",+SDCS,0))
119 S SDVUSR=$P(SDCS0,U,2)
120 S SDVCRE=$P(SDCS0,U,7)
121 S SDVOE=+$P(SDCS0,U,8)
122 ;
123 ; -- quit if cs node not found
124 IF SDCS0="" G BUILDRQ
125 ;
126 ; -- quit if ien numbers don't match
127 IF SDOE'=SDVOE G BUILDRQ
128 ;
129 ; -- compare sce and sdv data and set DR string accordingly
130 IF 'SCEUSR,SDVUSR S SDDR="101////"_SDVUSR
131 IF 'SCECRE,SDVCRE S SDDR=SDDR_$S(SDDR]"":";",1:"")_"902////"_SDVCRE
132 ;
133BUILDRQ Q SDDR
134 ;
135BULL ; -- send message indicating transfer of log data complete or stopped
136 N SDTEXT,SDCNT,XMSUB,XMN,XMTEXT,XMDUZ,XMY
137 S SDCNT=0
138 ;
139 D LINE("")
140 D LINE(" >>> Task Started: "_$$FMTE^XLFDT(SDBEG))
141 D LINE(" Finished: "_$$FMTE^XLFDT(SDEND))
142 D LINE("")
143 ;
144 ; -- build text
145 IF SDSTOP D
146 . D LINE(" >>> Task stopped by user. <<<")
147 ELSE D
148 . ; -- build text
149 . D LINE(" >>> Task Completed.")
150 ;
151 D LINE("")
152 D LINE(" >>> "_SDTOT_" Records processed.")
153 ;
154 ; -- set xm vars and send message
155 S XMSUB="Transfer of Scheduling Visits Log Data - Task Information"
156 S XMN=0
157 S XMTEXT="SDTEXT("
158 S XMDUZ=.5
159 S XMY(SDUZ)=""
160 D ^XMD
161 Q
162 ;
163LINE(TEXT) ; -- add line of text
164 S SDCNT=SDCNT+1
165 S SDTEXT(SDCNT)=TEXT
166 Q
167 ;
Note: See TracBrowser for help on using the repository browser.