source: FOIAVistA/trunk/r/SCHEDULING-SD-SC/SCCVU2.m@ 1379

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

initial load of FOIAVistA 6/30/08 version

File size: 3.9 KB
Line 
1SCCVU2 ;ALB/RMO,TMP - SCHED VISITS CONVERT/ARCHIVE UTILITIES; [ 10/10/95 2:39 PM ]
2 ;;5.3;Scheduling;**211**;Aug 13, 1993
3 ;
4VERDT(SCSTDT,SCENDT,SCLOG,SCERRMSG) ;Verify date range is valid
5 ; Input -- SCSTDT Start date
6 ; SCENDT End date
7 ; SCLOG CST log IEN [optional]
8 ; Output -- #=Error number and 0=No Error
9 ; SCERRMSG Error message
10 N SCERRNB,SCNVPAR
11 S SCERRNB=0
12 S SCNVPAR=$G(^SD(404.91,1,"CNV"))
13 ;
14 ;Check start date
15 I SCSTDT D
16 . I SCSTDT<+SCNVPAR D ;start dt cannot be before earliest encounter dt
17 . . N SCERRIP,Y
18 . . S SCERRNB=4049001.001
19 . . S Y=+SCNVPAR D D^DIQ S SCERRIP(1)=Y
20 . . D GETERR^SCCVLOG1(SCERRNB,"",.SCERRIP,$G(SCLOG),1,.SCERRMSG)
21 ;
22 ;Check end date
23 I 'SCERRNB,SCENDT D
24 . I SCENDT<+SCNVPAR D ;end dt cannot be before earliest encounter dt
25 . . N SCERRIP,Y
26 . . S SCERRNB=4049001.004
27 . . S Y=+SCNVPAR D D^DIQ S SCERRIP(1)=Y
28 . . D GETERR^SCCVLOG1(SCERRNB,"",.SCERRIP,$G(SCLOG),1,.SCERRMSG)
29 ;
30 ;Check date range
31 I 'SCERRNB,SCSTDT,SCENDT D
32 . I SCSTDT>SCENDT D ;start date cannot be after end date
33 . . S SCERRNB=4049001.005
34 . . D GETERR^SCCVLOG1(SCERRNB,"","",$G(SCLOG),1,.SCERRMSG)
35 . I 'SCERRNB,SCENDT<SCSTDT D ;end date cannot be before start date
36 . . S SCERRNB=4049001.006
37 . . D GETERR^SCCVLOG1(SCERRNB,"","",$G(SCLOG),1,.SCERRMSG)
38 ;
39 ;Check for 1 year limit if parameter set
40 I 'SCERRNB,$P(SCNVPAR,U,5),$$FMADD^XLFDT(SCSTDT,365)<SCENDT D
41 . S SCERRNB=4049001.007
42 . D GETERR^SCCVLOG1(SCERRNB,"","",$G(SCLOG),1,.SCERRMSG)
43 Q SCERRNB
44 ;
45CHKDUP(SCCVTYP,SCSTDT,SCENDT,SCLOG,SCERRMSG) ;Check for duplicate type and date range for conversion entry
46 ; Input -- SCCVTYP Conversion type
47 ; SCSTDT Start date
48 ; SCENDT End date
49 ; SCLOG CST log IEN
50 ; Output -- #=Error number and 0=No Error
51 ; SCERRMSG Error message
52 N SCERRNB,SCLOGX,SCCV0,SCDTS,SCDTE
53 S (SCERRNB,SCLOGX)=0
54 F S SCLOGX=$O(^SD(404.98,"TYP",SCCVTYP,SCLOGX)) Q:'SCLOGX!(SCERRNB) I SCLOG'=SCLOGX D
55 . S SCCV0=$G(^SD(404.98,SCLOGX,0)),SCDTS=$P(SCCV0,U,3),SCDTE=$P(SCCV0,U,4)
56 . Q:$P(SCCV0,U,9) ;Template canceled
57 . ;
58 . ; -- 'IF SCDTE<SCSTDT!(SCDTS>SCENDT) Q'
59 . ; If (end < new start) or (start > new end) then ok and quit
60 . ; Next line is boolean negative of above 'If'
61 . ;
62 . I SCDTE'<SCSTDT,SCDTS'>SCENDT D ;date range overlap
63 . . N SCERRIP
64 . . S SCERRNB=4049001.01
65 . . S SCERRIP(1)=SCLOGX
66 . . D GETERR^SCCVLOG1(SCERRNB,"",.SCERRIP,$G(SCLOG),1,.SCERRMSG)
67 ;
68 Q SCERRNB
69 ;
70PROCSEL(SCRESULT,SC) ; -- Process Archive SELECT request - not used
71 ; Input -- SC Array:
72 ; SC("TEMPLNO") Template number ien
73 ; ("REQNUM") Request number ien
74 ; Output -- SCRESULT (#=Error number | 0=No Error)^Message
75 ;
76 Q
77 N SCERRMSG,SCERRNB,SCLOG,SCREQ,SCREQACT
78 S SCERRNB=0
79 ;
80 S SCLOG=$G(SC("TEMPLNO"))
81 S SCREQ=$G(SC("REQNUM"))
82 ;
83 ;Quit if Template number ien or request ien are not defined
84 I 'SCLOG!('SCREQ) D
85 . S SCERRNB=4049007.003
86 . D GETERR^SCCVLOG1(SCERRNB,"","","",1,.SCERRMSG)
87 ;
88 S SCRESULT=$S('SCERRNB:0,1:SCERRNB_U_$$BLDSTR^SCCVU1(.SCERRMSG))
89 ;
90 G:SCERRNB PROCSELQ
91 ;
92 ; Set request action
93 S SCREQACT=$P($G(^SD(404.99,SCLOG,"R",SCREQ,0)),U,2)
94 ;
95 ; Queue archive select request
96 ;D QSEL^SCCVAST1(SCLOG,SCREQ)
97 ;
98PROCSELQ Q
99 ;
100OTHERR(ERRNO) ; Returns text of specific errors for error log
101 N X
102 S ERRNO=ERRNO+1
103 S X=$P($T(ERRLIST+ERRNO),";;",3,99)
104 Q X
105 ;
106ERRLIST ; List of 'OTHER' specific errors ;;ERROR # (OFFSET-1);;ERROR TEXT
107 ;;0;;Unknown
108 ;;1;;Appointment does not exist in clinic file
109 ;;2;;Encounter was not created for appointment
110 ;;3;;Visit was not created for appointment
111 ;;4;;Add/edit's top level 0-node does not exist
112 ;;5;;Add/edit does not have a valid patient DFN
113 ;;6;;Add/edit does not have a valid division
114 ;;7;;Add/edit does not have a valid clinic stop
115 ;;8;;Disposition does not have a valid hospital location
116 ;;9;;Add/edit's "CS" level 0-node does not exist
117 ;
Note: See TracBrowser for help on using the repository browser.