source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SCCVPAR.m@ 1270

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

initial load of WorldVistAEHR

File size: 5.4 KB
Line 
1SCCVPAR ;ALB/TMP - SCHED VISITS CONVERSION PARAMETERS; [ 03/02/98 10:47 AM ]
2 ;;5.3;Scheduling;**211**;Aug 13, 1993
3 ;
4PARAM ; Main entry point - display scheduling conversion parameters
5 D EN^VALM("SCCV CONV PARAM MENU")
6 D REFRESH^SCCVCDSP
7 Q
8 ;
9INIT ; -- set up initial variables
10 D FNL
11 S U="^",VALMCNT=0,VALMBG=1
12 D BLD
13 Q
14 ;
15HDR ;
16 S VALMHDR(1)=""
17 Q
18 ;
19FNL ; Clean up
20 K ^TMP("SCCV.PARAM",$J),^TMP("SCCV.PARAM.DX",$J)
21 Q
22 ;
23BLD ;Build parameter display
24 N SCCVCNV
25 S VALMBG=1
26 K ^TMP("SCCV.PARAM",$J)
27 S VALMCNT=0
28 S SCCVCNV=$G(^SD(404.91,1,"CNV"))
29 S VALMCNT=VALMCNT+1
30 D SET^VALM10(VALMCNT," ")
31 S VALMCNT=VALMCNT+1
32 D SET^VALM10(VALMCNT,"Earliest encounter date to be converted: "_$S(+SCCVCNV:$$FMTE^XLFDT(+SCCVCNV,"1D"),1:"<Not Specified>"))
33 S VALMCNT=VALMCNT+1
34 D SET^VALM10(VALMCNT,"Limit CST date range to 1 year or less?: "_$$EXPAND^SCCVDSP2(404.91,905,+$P(SCCVCNV,U,5)))
35 S VALMCNT=VALMCNT+1
36 D SET^VALM10(VALMCNT," Default Disposition Clinic: "_$$NONE^SCCVDSP2(404.91,902,$P(SCCVCNV,U,2),"<Not Specified>"))
37 S VALMCNT=VALMCNT+1
38 D SET^VALM10(VALMCNT," Maximum Errors Allowed: "_$$EXPAND^SCCVDSP2(404.91,907,$S($P(SCCVCNV,U,7):$P(SCCVCNV,U,7),1:1000)))
39 S VALMCNT=VALMCNT+1
40 D SET^VALM10(VALMCNT," Display Cancelled Templates: "_$$EXPAND^SCCVDSP2(404.91,909,+$P(SCCVCNV,U,9)))
41 S VALMCNT=VALMCNT+1
42 D SET^VALM10(VALMCNT," ")
43 S VALMCNT=VALMCNT+1
44 D SET^VALM10(VALMCNT,"Date Conversion Completed: "_$S('$$COMPL():"* UNEDITABLE - CST entry(s) missing or incomplete *",1:$$FMTE^XLFDT($P(SCCVCNV,U,4),"1D")))
45 S VALMCNT=VALMCNT+1
46 D SET^VALM10(VALMCNT,"Date Deletion Completed: "_$S('$$COMPL():"* UNEDITABLE - CST entry(s) missing or incomplete *",1:$$FMTE^XLFDT($P(SCCVCNV,U,3),"1D")))
47 Q
48 ;
49EDIT ; Edit scheduling conversion parameters
50 N SCDT1
51 S SCDT1=$P($G(^SD(404.91,1,"CNV")),U,4)
52 D FULL^VALM1
53 S DIE="^SD(404.91,",DA=1,DR="[SCCV CONV EDIT SITE PARAMS]"
54 D ^DIE
55 I 'SCDT1,$P($G(^SD(404.91,1,"CNV")),U,4) D
56 . S DIR(0)="YA",DIR("A")="Do you want to delete the old scheduling files now? ",DIR("B")="NO" D ^DIR K DIR
57 . I Y=1 D
58 .. D EN^SCCVDEL
59 D BLD
60 S VALMBCK="R"
61 Q
62 ;
63903(SKIPTO) ;
64 N DIR,Y
65 ;
66 Q:'$P($G(^SD(404.91,1,"CNV")),U,3)!($G(SCCVX(903)))
67 ;
68 I '$P($G(^SD(404.91,1,"CNV")),U,4) D G Q903
69 .S DIR(0)="EA"
70 .S DIR("A",1)="DATE CONVERSION COMPLETED must be entered before you can enter this date",DIR("A")="Press RETURN to continue"
71 .D ^DIR K DIR
72 .S SKIPTO="@30"
73 ;
74 S DIR(0)="YA",DIR("B")="NO"
75 S DIR("A",1)="Entering this date indicates that your site is finished",DIR("A",2)="deleting any old encounter files that can be deleted.",DIR("A",3)=" ",DIR("A")="Are you sure you want to do this?: "
76 D ^DIR K DIR
77 I Y'=1 S SKIPTO="@30"
78 ;
79Q903 Q
80 ;
81904(SKIPTO) ;
82 N DIR,SC0,SCLACT,SCLEVT,SCOK,Y,Z
83 ;
84 G:'$P($G(^SD(404.91,1,"CNV")),U,4)!($G(SCCVX(904))) Q904
85 ;
86 ; All CST's must be canceled or completed before date can be entered
87 I '$$COMPL() D S SKIPTO="@20" G Q904
88 . W !
89 . S DIR(0)="EA"
90 .S DIR("A",1)="You must complete or cancel each CST before you may enter this date",DIR("A",2)="At least one CST was found to be missing or incomplete",DIR("A")="Press RETURN to continue "
91 . D ^DIR K DIR
92 . W !
93 ;
94 I $$SEQGAP() D S SKIPTO="@20" G Q904 ; Check for gaps in the dt range
95 . N DIR,Y,SCDT1
96 . S SCDT1=$P($G(^SD(404.91,1,"CNV")),U)
97 . S:SCDT1 SCDT1=$$FMTE^XLFDT(SCDT1,2)
98 . W !
99 . S DIR(0)="EA"
100 . S DIR("A",1)="You have one or more gaps in conversion dates from your earliest date to",DIR("A",2)=" convert ("_$S(SCDT1'="":SCDT1,1:"NOT ENTERED")_") to 9-30-96"
101 . S DIR("A",3)="You must finish converting before you can enter the conversion completed date",DIR("A")="Press RETURN to continue "
102 . D ^DIR K DIR
103 . W !
104 ;
105 S DIR(0)="YA",DIR("B")="NO"
106 S DIR("A",1)="Entering this date prevents you from converting any more data from the old",DIR("A",2)=" Scheduling files to the PCE V-files",DIR("A",3)=" ",DIR("A")="Are you sure you want to do this?: "
107 D ^DIR K DIR
108 I Y'=1 S SKIPTO="@20"
109 ;
110Q904 Q
111 ;
112COMPL(ANY) ; Check if all/any CST's are complete or canceled
113 ; Returns 0 if function fails, 1 if function succeeds
114 ; ANY = 1: just check for ANY completed
115 ;
116 N Z,SC0,SCOK,SCLACT,SCLEVT,SCANY
117 ;
118 I '$G(ANY) S SCOK='$$SEQGAP() G COMPLQ ;Check all for full range
119 ;
120 S Z=0,SCANY=0
121 F S Z=$O(^SD(404.98,Z)) Q:'Z S SC0=$G(^(Z,0)) D Q:SCANY
122 . Q:$P(SC0,U,9) ; CST canceled
123 . S SCLACT=+$$LSTACT^SCCVLOG(Z),SCLEVT=+$$LSTEVT^SCCVLOG(Z)
124 . I $S(SCLACT'=5:0,1:"12"[SCLEVT) S SCANY=1 Q ; Last actn (cnvrt/recnvrt) completed
125 ;
126COMPLQ Q $S($G(ANY):SCANY,1:SCOK)
127 ;
128SEQGAP() ; Checks entire date range from start to 9-30-96 has been converted
129 ; Returns 0 if no gap found from earliest date to convert to 09/30/96
130 ; 1 if gap found
131 N Z,Z0,SC0,SCLACT,SCLEVT,SCGAP,SCDT1,SCDT2
132 ;
133 S Z=0,SCGAP=0
134 F S Z=$O(^SD(404.98,Z)) Q:'Z S SC0=$G(^(Z,0)) D
135 . Q:$P(SC0,U,9) ; CST canceled
136 . S SCLACT=+$$LSTACT^SCCVLOG(Z),SCLEVT=+$$LSTEVT^SCCVLOG(Z)
137 . I $S(SCLACT'=5:0,1:"12"[SCLEVT) D ; Last actn (cnvrt/recnvrt) completed
138 .. S SCGAP(+$$FMTH^XLFDT($P(SC0,U,3),1))=+$$FMTH^XLFDT($P(SC0,U,4),1)
139 ;
140 S SCDT1=+$$FMTH^XLFDT(+$G(^SD(404.91,1,"CNV"),2801001),1) ; start date
141 S SCDT2=+$$FMTH^XLFDT($$ENDDATE^SCCVU(),1) ; end date
142 S SCGAP=0,Z=SCDT1
143 F S Z0=$G(SCGAP(Z)) D Q:SCGAP!(Z0=SCDT2) ;Check ranges for gaps
144 . I Z0=SCDT2 Q ; No gaps found
145 . I Z0="" S SCGAP=1 Q ; Gap found...S/B an entry at Z
146 . I Z=SCDT1 S Z=Z0+1 Q ; First date range
147 . S Z=Z0+1
148 ;
149 Q SCGAP
150 ;
Note: See TracBrowser for help on using the repository browser.