source: FOIAVistA/trunk/r/SCHEDULING-SD-SC/SCCVE.m@ 1780

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

initial load of FOIAVistA 6/30/08 version

File size: 5.2 KB
Line 
1SCCVE ;ALB/RMO,TMP - Encounter Conversion Driver; [ 04/05/95 8:19 AM ]
2 ;;5.3;Scheduling;**211**;Aug 13, 1993
3 ;
4QUE(SCLOG,SCREQ) ;Schedule encounter conversion via task manager
5 ; Input -- SCLOG CST log IEN
6 ; SCREQ CST request IEN
7 ; Output -- None
8 N I,SCERRMSG,SCREQ0,SCREQD,Y,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTSK
9 S SCREQ0=$G(^SD(404.98,SCLOG,"R",SCREQ,0))
10 ;
11 ; -- quit if convert or reconvert & conversion disabled
12 IF $P(SCREQ0,U,3)=1!($P(SCREQ0,U,3)=2),'$$OK^SCCVU(1) G QUEQ
13 ;
14 I SCREQ0="" D G QUEQ
15 . N SCERRIP
16 . S SCERRIP(1)=SCLOG
17 . S SCERRIP(2)=SCREQ
18 . S SCERRIP(3)="Conversion"
19 . D GETERR^SCCVLOG1(4049004.001,"",.SCERRIP,SCLOG,0,.SCERRMSG)
20 S SCREQD=$$LOW^XLFSTR($$EXPAND^SCCVDSP2(404.9825,.02,$P(SCREQ0,U,2)))
21 S ZTDESC="CST Log #"_SCLOG_" - "_SCREQD_" ("_$$LOW^XLFSTR($$EXPAND^SCCVDSP2(404.9825,.03,$P(SCREQ0,U,3)))_")"
22 S ZTRTN="EN^SCCVE"
23 F I="SCLOG","SCREQ" S ZTSAVE(I)=""
24 S ZTIO="SCCV RESOURCE"
25 S ZTDTH=$S($P(SCREQ0,U,4):$P(SCREQ0,U,4),1:$$NOW^XLFDT)
26 D ^%ZTLOAD
27 I $D(ZTSK) D
28 . W " (Task: #",ZTSK,")"
29 . D UPD^SCCVLOG("CST",SCLOG,"","","",ZTSK,$G(^%ZOSF("VOL")),6)
30QUEQ Q
31 ;
32EN ;Entry point to run encounter estimate/conversion
33 ; Input -- SCLOG CST log IEN
34 ; SCREQ CST request IEN
35 ; Output -- None
36 N SCACT,SCCVEVT,SCEND,SCERRMSG,SCRSTDT,SCRSTPT,SCSTDT,SCSTOPF,SCBULL,SCTOT,SCRSTDFN,SCCVERRH,SCCVERRT,SCCVDIS,SCCVACRP,SCCV900,ZZLOG,SCCVMAXE
37 I '$G(SCLOG)!('$G(SCREQ))!('$G(DUZ)) D G ENQ ;req vars missing
38 . N SCERRIP
39 . S SCERRIP(1)=$S('$G(SCLOG):"SCLOG",'$G(SCREQ):"SCREQ",1:"DUZ")
40 . S SCERRIP(2)="EN^SCCVE"
41 . D GETERR^SCCVLOG1(4040001.001,"",.SCERRIP,$G(SCLOG),0,.SCERRMSG)
42 . I $G(SCLOG),$G(SCREQ) D STOP^SCCVLOG(SCLOG,SCREQ,1)
43 ;
44 ; -- set overall variables
45 S SCCVACRP=$$ENDDATE^SCCVU()
46 S SCCV900=+$O(^DIC(40.7,"C",900,0))
47 S SCCVMAXE=$S($P($G(^SD(404.91,1,"CNV")),U,7):$P(^("CNV"),U,7),1:1000)-1
48 ;
49 D SET(SCLOG,SCREQ,.SCACT,.SCCVEVT,.SCSTDT,.SCENDT,.SCRSTPT,.SCRSTDT,.SCBULL,.SCRSTDFN)
50 ;
51 ; -- quit if convert or reconvert & conversion disabled
52 IF SCCVEVT=1!(SCCVEVT=2),'$$OK^SCCVU(0) G ENQ
53 ;
54 ;Log event
55 D UPD^SCCVLOG("CST",SCLOG,"","","","","",SCACT)
56 ;
57 I $G(SCCVEVT)=1,$$CHKACT^SCCVLOG(SCLOG,SCCVEVT,5,"CST") D G ENQ ;converted
58 . D GETERR^SCCVLOG1(4049001.008,"","",SCLOG,0,.SCERRMSG)
59 ;
60 I "^2^4^"'[(U_SCACT_U) D G ENQ ;start or re-start
61 . D GETERR^SCCVLOG1(4049006.001,"","",SCLOG,0,.SCERRMSG)
62 . D STOP^SCCVLOG(SCLOG,SCREQ,1)
63 ;
64 I '$G(SCSTDT)!('$G(SCENDT)) D G ENQ ;start date or end date undefined
65 . D GETERR^SCCVLOG1(4049001.003,"","",SCLOG,0,.SCERRMSG)
66 . D STOP^SCCVLOG(SCLOG,SCREQ,1)
67 ;
68 I $G(SCCVEVT)="" D G ENQ ;event undefined
69 . D GETERR^SCCVLOG1(4049001.009,"","",SCLOG,0,.SCERRMSG)
70 . D STOP^SCCVLOG(SCLOG,SCREQ,1)
71 ;
72 I $$VERDT^SCCVU2(SCSTDT,SCENDT,SCLOG) D G ENQ ;invalid date range
73 . D STOP^SCCVLOG(SCLOG,SCREQ,1)
74 ;
75 S (SCCVERRH,SCCVERRT)=+$P($G(^SD(404.98,SCLOG,1)),U,5)
76 I SCCVEVT S SCTOT(1.02)=$P($G(^SD(404.98,SCLOG,1)),U,2),SCTOT(2.06)=$P($G(^(2)),U,6)
77 I 'SCCVEVT K ^XTMP("SCCV-VIS-"_SCLOG),^XTMP("SCCV-BOTH-"_SCLOG)
78 ;
79 ;Convert appointments
80 I $G(SCRSTPT)<2 D EN^SCCVEAP(SCCVEVT,SCSTDT,SCENDT,SCLOG,SCREQ,+$G(SCRSTDFN),.SCSTOPF) G ENQ:$G(SCSTOPF) I $G(SCRSTPT) S (SCRSTDT,SCRSTDFN)=""
81 ;
82 ;Convert disposition
83 I $S('$G(SCRSTPT):1,1:SCRSTPT'=2) D EN^SCCVEDI(SCCVEVT,$S($G(SCRSTDT):SCRSTDT,1:SCSTDT),SCENDT,SCLOG,SCREQ,.SCSTOPF) G ENQ:$G(SCSTOPF) I $G(SCRSTPT) S (SCRSTDT,SCRSTDFN)=""
84 ;
85 ;Convert add/edits
86 D EN^SCCVEAE(SCCVEVT,$S($G(SCRSTDT):SCRSTDT,1:SCSTDT),SCENDT,SCLOG,SCREQ,.SCSTOPF) G ENQ:$G(SCSTOPF)
87 ;
88 ;Log completion
89 D UPD^SCCVLOG("CST",SCLOG,"","","","@","@",5)
90 ;
91ENQ Q
92 ;
93SET(SCLOG,SCREQ,SCACT,SCCVEVT,SCSTDT,SCENDT,SCRSTPT,SCRSTDT,SCBULL,SCRSTDFN) ;
94 ; Set variables
95 ; Input -- SCLOG CST log IEN
96 ; SCREQ CST request IEN
97 ; Output -- SCACT Action
98 ; SCCVEVT Conversion event
99 ; SCSTDT Start date
100 ; SCENDT End date
101 ; SCRSTPT Conversion re-start point (1=appt, 2=a/e, 3=disp)
102 ; SCRSTDT Re-start date
103 ; SCBULL Send bulletin flag
104 ; SCRSTDFN Re-start dfn
105 N SCLOG0,SCLOG1,SCOE,SCOE0,SCREQACT
106 S SCLOG0=$G(^SD(404.98,SCLOG,0)),SCLOG1=$G(^(1))
107 S SCREQACT=$P($G(^SD(404.98,SCLOG,"R",SCREQ,0)),U,2)
108 S SCACT=$S(SCREQACT=1:2,SCREQACT=3:4,1:"") ;action based on request
109 S SCCVEVT=$P(SCLOG0,U,5)
110 S SCSTDT=$P(SCLOG0,U,3)
111 S SCENDT=$P(SCLOG0,U,4)
112 S SCBULL=$P(SCLOG0,U,6)
113 ;
114 I +SCLOG1,SCCVEVT,SCACT=4 D ;Only for re-start of conversion
115 . S SCOE=+SCLOG1 ;last entry
116 . I $P($G(^SCE(SCOE,0)),U,6) S SCOE=+$P(^(0),U,6) ;re-start at parent
117 . S SCOE0=$G(^SCE(SCOE,0))
118 . S SCRSTPT=+$P(SCOE0,U,8),SCRSTDT=$P(+SCOE0,"."),SCRSTDFN=$P(SCOE0,U,2) ;set re-start point
119 ;
120 I 'SCCVEVT D ;Estimate must start counting over from beginning
121 .N Z,SC2,SCDATA,SCF
122 .S SC2=$G(^SD(404.98,SCLOG,2))
123 .F Z=1:1:11 I $P(SC2,U,Z) S SCF="2."_$S(Z<10:"0",1:"")_Z,SCDATA(+SCF)=0
124 .I $D(SCDATA) D UPD^SCCVDBU(404.98,SCLOG,.SCDATA) ;Re-set totals to 0
125 ;
126 I SCCVEVT=2,SCACT'=4 D ;'Start' of re-convert deletes errors and resets counts to 0
127 . N SCDATA
128 . S SCDATA(1.05)=0,SCDATA(50)="@",SCDATA(2.06)=0,SCDATA(1.02)=0
129 . D UPD^SCCVDBU(404.98,SCLOG,.SCDATA)
130 Q
131 ;
132STOP(SCLOG,SCREQ) ;User request to stop conversion
133 ; Input -- SCLOG CST log IEN
134 ; SCREQ CST request IEN
135 ; Output -- None
136 N SCSTOPF
137 D STOP^SCCVLOG(SCLOG,SCREQ,.SCSTOPF)
138 Q
139 ;
Note: See TracBrowser for help on using the repository browser.